Click in CheckBrowse to Select/Unselect
- Eugene Lutsenko
- Posts: 1649
- Joined: Sat Feb 04, 2012 2:23 am
- Location: Russia, Southern federal district, city of Krasnodar
- Contact:
Re: Click in CheckBrowse to Select/Unselect
Jimmy!
I am trying to do everything I need "simple". Maybe not as beautiful as could be. But everything well works
I am trying to do everything I need "simple". Maybe not as beautiful as could be. But everything well works
Re: Click in CheckBrowse to Select/Unselect
Here is a program that has a check column (using a database)
Code: Select all
#INCLUDE "dcdialog.CH"
#INCLUDE "dcbitmap.CH"
FUNCTION Main
LOCAL GetList[0], oBrowse, GetOptions
DC_LoadRdds()
USE CUSTOMER INDEX CUSTOMER VIA 'FOXCDX'
@ 0,0 DCBROWSE oBrowse ALIAS 'customer' SIZE 80,12 ;
PRESENTATION DC_BrowPres() FIT
DCBROWSECOL DATA {|x|x:=CUSTOMER->tag, ;
IIF(x,BITMAP_CHECKBOX_CHECKED_S,BITMAP_CHECKBOX_UNCHECKED_S)} ;
PARENT oBrowse HEADER 'Sel' WIDTH 1 ;
TYPE XBPCOL_TYPE_BITMAP ;
EVAL {|oB|oB:dataArea:lbClick := ;
{|a,b,o|IIF(oBrowse:colPos=1, ;
(CUSTOMER->(dbRLock()), ;
CUSTOMER->tag:=!CUSTOMER->tag, ;
CUSTOMER->(dbRUnlock()), ;
oBrowse:refreshCurrent()),nil)}}
DCBROWSECOL FIELD CUSTOMER->bill_name PARENT oBrowse HEADER 'Name' WIDTH 20
DCBROWSECOL FIELD CUSTOMER->bill_strt PARENT oBrowse HEADER 'Address' WIDTH 20
DCBROWSECOL FIELD CUSTOMER->bill_city PARENT oBrowse HEADER 'City' WIDTH 20
DCGETOPTIONS AUTORESIZE
DCREAD GUI FIT ADDBUTTONS MODAL ;
OPTIONS GetOptions ;
TITLE 'Click in CheckBox to Select/Unselect'
RETURN
- Attachments
-
- checkbrowse.zip
- (336.64 KiB) Downloaded 823 times
The eXpress train is coming - and it has more cars.
- Eugene Lutsenko
- Posts: 1649
- Joined: Sat Feb 04, 2012 2:23 am
- Location: Russia, Southern federal district, city of Krasnodar
- Contact:
Re: Click in CheckBrowse to Select/Unselect
Thank you so much, Roger!
I will use! Is there absolutely a similar approach, only radio?
PS
Now found it: c:\exp20\Samples\BUTTONXP\Buttpicker.prg
It was for me as a diamond. And how many more jewels you can find Roger, if you search well?
I will use! Is there absolutely a similar approach, only radio?
PS
Now found it: c:\exp20\Samples\BUTTONXP\Buttpicker.prg
It was for me as a diamond. And how many more jewels you can find Roger, if you search well?
- cobasystems
- Posts: 15
- Joined: Wed Nov 12, 2014 4:44 pm
Re: Click in CheckBrowse to Select/Unselect
Thank you so much, Roger!
Re: Click in CheckBrowse to Select/Unselect
This is similar but different.Is there absolutely a similar approach, only radio?
It uses the right mouse button to popup a dialog of radio button selections.
Code: Select all
#INCLUDE "dcdialog.CH"
FUNCTION Main
LOCAL GetList[0], oBrowse, GetOptions
DC_LoadRdds()
USE CUSTOMER INDEX CUSTOMER VIA 'FOXCDX'
@ 0,0 DCBROWSE oBrowse ALIAS 'customer' SIZE 80,12 ;
PRESENTATION DC_BrowPres() FIT RBSELECT
DCBROWSECOL DATA {|x|GetStatus(CUSTOMER->status)} ;
PARENT oBrowse HEADER 'Status' WIDTH 10 ;
EVAL {|oB|oB:dataArea:rbClick := ;
{|a,b,o|IIF(oBrowse:colPos=1,SetStatus(CUSTOMER->status,oBrowse),nil)}}
DCBROWSECOL FIELD CUSTOMER->bill_name PARENT oBrowse HEADER 'Name' WIDTH 20
DCBROWSECOL FIELD CUSTOMER->bill_strt PARENT oBrowse HEADER 'Address' WIDTH 20
DCBROWSECOL FIELD CUSTOMER->bill_city PARENT oBrowse HEADER 'City' WIDTH 20
DCGETOPTIONS AUTORESIZE
DCREAD GUI FIT ADDBUTTONS MODAL SETAPPWINDOW ;
OPTIONS GetOptions ;
TITLE 'Click in Column 1 to Change Status'
RETURN nil
* ---------
PROC appsys ; RETURN
* ---------
STATIC FUNCTION GetStatus( nStatus, aStatus )
LOCAL cStatus
IF nStatus == 0
nStatus := 1
ENDIF
aStatus := { 'Unknown', ;
'Very Nice', ;
'Belligerent', ;
'Cantankerous', ;
'Insulent', ;
'Uninformed' }
IF nStatus > 0 .AND. nStatus <= Len(aStatus)
cStatus := aStatus[nStatus]
ENDIF
RETURN cStatus
* ---------
STATIC FUNCTION SetStatus( nStatus, oBrowse )
LOCAL aStatus, lStatus, GetList[0], GetOptions, i
GetStatus( @nStatus, @aStatus )
FOR i := 1 TO Len(aStatus)
@ i,1 DCRADIO nStatus VALUE i PROMPT aStatus[i] ;
ACTION {|o|o:getData(),DC_ReadGuiEvent(DCGUI_EXIT_OK,GetList)}
NEXT
DCGETOPTIONS ORIGIN XBPDLG_ORIGIN_MOUSE
DCREAD GUI FIT TITLE 'Status' MODAL TO lStatus OPTIONS GetOptions
IF lStatus
CUSTOMER->(dbRLock())
CUSTOMER->status := nStatus
CUSTOMER->(dbRUnlock())
oBrowse:refreshCurrent()
ENDIF
RETURN nStatus
- Attachments
-
- radiobrowse.zip
- (7.47 KiB) Downloaded 851 times
The eXpress train is coming - and it has more cars.
- Eugene Lutsenko
- Posts: 1649
- Joined: Sat Feb 04, 2012 2:23 am
- Location: Russia, Southern federal district, city of Krasnodar
- Contact:
Re: Click in CheckBrowse to Select/Unselect
Forgive me, Roger, for my bad English (not even mine, but automated).
Now you gave an example that allows you to replace the input field by selecting from a list. It is a valuable.
But unfortunately I had something else in mind. In the beginning of the topic you brought a perfectly working example of selecting many entries. When I said radio, I meant instead of the many entries, just mark one. When we celebrate a lot of records, the mark of another does not remove the previous marker. And when radio, if say one or the other marked, the mark is removed.
I thought it best to tell you honestly, than to leave in misguidance. Of course to blame myself, so can't really do English to explain what I mean.
Now you gave an example that allows you to replace the input field by selecting from a list. It is a valuable.
But unfortunately I had something else in mind. In the beginning of the topic you brought a perfectly working example of selecting many entries. When I said radio, I meant instead of the many entries, just mark one. When we celebrate a lot of records, the mark of another does not remove the previous marker. And when radio, if say one or the other marked, the mark is removed.
I thought it best to tell you honestly, than to leave in misguidance. Of course to blame myself, so can't really do English to explain what I mean.
Re: Click in CheckBrowse to Select/Unselect
I'm sorry, but I don't understand what it is that you want.
The eXpress train is coming - and it has more cars.
- Eugene Lutsenko
- Posts: 1649
- Joined: Sat Feb 04, 2012 2:23 am
- Location: Russia, Southern federal district, city of Krasnodar
- Contact:
Re: Click in CheckBrowse to Select/Unselect
Hey, Roger!!!
Below in the 1st column of the table display the database instead of squares with birds we have seen in the circles. So we can mark the record by clicking on the circle. Then inside the circle instead of the white to become black. If the thus selected any entry, then it is the allocation should have. Then inside the circle is black will become white. The difference between what You did and what I asked is the same as between DCCHECKBOX and DCRADIO. But all this with records databases, not with variables in memory.
PS the Picture I made in PhotoShop. Programmatically I can't do this. Only you can.
Below in the 1st column of the table display the database instead of squares with birds we have seen in the circles. So we can mark the record by clicking on the circle. Then inside the circle instead of the white to become black. If the thus selected any entry, then it is the allocation should have. Then inside the circle is black will become white. The difference between what You did and what I asked is the same as between DCCHECKBOX and DCRADIO. But all this with records databases, not with variables in memory.
PS the Picture I made in PhotoShop. Programmatically I can't do this. Only you can.
- Attachments
-
- Без имени-2.jpg (86.15 KiB) Viewed 13710 times
Re: Click in CheckBrowse to Select/Unselect
If I understand you correctly, you want the "look" of a radio button but the "functionality" of a check box.
The eXpress train is coming - and it has more cars.
-
- Posts: 481
- Joined: Wed Jan 27, 2010 10:25 pm
- Location: Berlin Germany
Re: Click in CheckBrowse to Select/Unselect
Here is an example of selecting only one (multisel:=.F.) or multiple (multisel=.T.).
You do not need a logical field in your database, i use an array for the selected record numbers.
if you create bitmaps for the radiobutton selected and unselected, you can show them instead of BMP_CHECKED/BMP_UNCHECKED depending on the var multisel.
You do not need a logical field in your database, i use an array for the selected record numbers.
if you create bitmaps for the radiobutton selected and unselected, you can show them instead of BMP_CHECKED/BMP_UNCHECKED depending on the var multisel.
Code: Select all
FUNCTION Main
LOCAL GetList[0], oBrowse, GetOptions
local aRecs:={}, multisel:=.F., p
DC_LoadRdds()
USE CUSTOMER INDEX CUSTOMER VIA 'FOXCDX'
@ 0,0 DCBROWSE oBrowse ALIAS 'customer' SIZE 80,12 ;
PRESENTATION DC_BrowPres() FIT ;
DCBROWSECOL DATA {|| iif(AScan(aRecs,recno())>0, BMP_CHECKED, BMP_UNCHECKED) } ;
HEADER "Sel" PARENT oBrowse WIDTH 2 ;
TYPE XBPCOL_TYPE_BITMAP ;
PROTECT {|| .T.} ;
ALIGN XBPALIGN_HCENTER+XBPALIGN_VCENTER ;
EVAL {|oB|oB:dataArea:lbClick := {|a,b,o,w| iif( oBrowse:colPos=1, ;
( p:=Ascan(aRecs, recno()), iif(p>0, ARemove(aRecs,p), (iif(!multisel, ASize(aRecs,0), nil), AAdd(aRecs, recno()))), oBrowse:refreshAll()),nil)}}
DCBROWSECOL FIELD CUSTOMER->bill_name PARENT oBrowse HEADER 'Name' WIDTH 20
DCBROWSECOL FIELD CUSTOMER->bill_strt PARENT oBrowse HEADER 'Address' WIDTH 20
DCBROWSECOL FIELD CUSTOMER->bill_city PARENT oBrowse HEADER 'City' WIDTH 20
DCGETOPTIONS AUTORESIZE
DCREAD GUI FIT ADDBUTTONS MODAL ;
OPTIONS GetOptions ;
TITLE 'Click in CheckBox to Select/Unselect'
RETURN aRecs
_______________________
Best Regards
Wolfgang
Best Regards
Wolfgang