Page 1 of 1
DCBROWSE Editing
Posted: Sun Jun 19, 2011 7:09 am
by GeneB
In a DCBROWSE, I am trying to give the choice of either placing a check mark with a mouse click in a cell, or double clicking a different cell and editing the text.
If I add to DCBROWSE the EDIT and MODE in the code below, the text cell can be edited but it changes the action of the column with 'check marks'. When clicking for a check mark, the check mark cell turns to a three character wide Get field. When exiting this field, the check mark then appears in the cell.
Without the EDIT and MODE parameters in the DCBROWSE the 'check mark' column works correctly with a 'click' but the text cell cannot be edited.
Some help would be appreciated.
Thanks.
GeneB
Code: Select all
@ 0,0 DCBROWSE oBrowse DATA aData SIZE 40,22 ;
PRESENTATION DC_BrowPres() FIT ;
MARK 3 ;
EDIT xbeBRW_ItemSelected MODE DCGUI_BROWSE_EDITDOWN
DCBROWSECOL DATA {|x|x:=DC_GetColArray(3,oBrowse), ;
IIF(x,BITMAP_CHECKBOX_CHECKED_S,BITMAP_CHECKBOX_UNCHECKED_S)} ;
PARENT oBrowse HEADER 'Sel' WIDTH 1 ;
TYPE XBPCOL_TYPE_BITMAP
DCBROWSECOL ELEMENT 1 PARENT oBrowse HEADER 'Item' WIDTH 13 PROTECT {||.T.}
DCBROWSECOL ELEMENT 2 PARENT oBrowse HEADER 'Text' WIDTH 24 PROTECT {||.F.}
Re: DCBROWSE Editing
Posted: Tue Jun 21, 2011 8:56 pm
by GeneB
I guess I could write some kind of workaround that gives the user a button to choose either a column of check marks or a column that can be edited, but before I put time into it, has anyone had any experience with what I am trying to do: a 'check mark' column and a column for changing text, in the same browse?
The code I used for the 'check marks' came from an xDemo sample. Is there a better way to do this?
Thanks.
Re: DCBROWSE Editing
Posted: Tue Jun 21, 2011 9:59 pm
by Auge_Ohr
GeneB wrote:I guess I could write some kind of workaround that gives the user a button to choose either a column of check marks or a column that can be edited ...
if you can wait ... i hear about Xbase++ "Service Pack 3" and a "Selection-Column" Class ...
else try this from J.A. Diego Kerejeta
- CheckCol.zip
- XbpCheckColumn Class from
J.A. Diego Kerejeta - (2.99 KiB) Downloaded 873 times
Re: DCBROWSE Editing
Posted: Wed Jun 22, 2011 9:48 am
by GeneB
Thanks Jimmy. That code certainly works for a 'check mark' column in a browse.
I took my code that does the same from xDemo's sample set 6, CheckBrowse.
The column with check marks also works perfectly in the example, but when I add an Edit parameter to DCBrowse it affects the check marks in DCBROWSECOL.
I appreciate your help.
GeneB
Re: DCBROWSE Editing
Posted: Wed Jun 22, 2011 5:29 pm
by Auge_Ohr
GeneB wrote:I took my code that does the same from xDemo's sample set 6, CheckBrowse.
The column with check marks also works perfectly in the example, but when I add an Edit parameter to DCBrowse it affects the check marks in DCBROWSECOL.
I appreciate your help.
sorry i´m not a Express++ User
btw. as i can say FUNCTION XSample_175() work with Bitmap as "checkbox" while Demo from Diego use "real" Checkbox
Code: Select all
INLINE METHOD CreaChecks( nPosIni, nPosFin )
...
oIco:= XbpCheckBox():New( self,, ::cellRect( nCont, .T. ), aSize )
oIco:lbDown := {|a,b,obj| ::_DownCheck( obj ) }
oIco:create()
Re: DCBROWSE Editing
Posted: Thu Jun 23, 2011 12:11 pm
by GeneB
So I assume that it is not possible to have both mouse activated check marks and cell editing in the same row in DCBROWSE .
I can drop the check marks and toggle "Y" and "N" as in xDemo Sample Set 4's 'ToggleCells'. (I would rather keep the check marks). But I have another thought. Is it possible to toggle a cell with a mouse click but have a bitmap of a checkmark visible in the cell rather than "Y" or "N" ?
Re: DCBROWSE Editing
Posted: Thu Jun 23, 2011 5:37 pm
by rdonnay
This seems to work for me:
Code: Select all
#INCLUDE "dcdialog.CH"
#INCLUDE "dcbitmap.CH"
#INCLUDE "appevent.CH"
FUNCTION Main()
LOCAL GetList[0], oBrowse, aDir, n := 1, GetOptions
aDir := Directory()
FOR n := 1 TO Len(aDir)
AAdd(aDir[n],.f.)
NEXT
n := 1
@ 0,0 DCBROWSE oBrowse DATA aDir SIZE 80,12 ;
PRESENTATION DC_BrowPres() FIT ;
POINTER n ;
EDIT xbeBRW_ItemSelected
DCBROWSECOL DATA {|x|x:=DC_GetColArray(11,oBrowse), ;
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,(aDir[n,11]:=!aDir[n,11],oBrowse:refreshCurrent()),nil)}}
DCBROWSECOL ELEMENT 1 PARENT oBrowse HEADER 'Name' WIDTH 10 PROTECT {||.t.}
DCBROWSECOL ELEMENT 2 PARENT oBrowse HEADER 'Size' WIDTH 8
DCBROWSECOL ELEMENT 3 PARENT oBrowse HEADER 'Date' WIDTH 8
DCBROWSECOL ELEMENT 4 PARENT oBrowse HEADER 'Time' WIDTH 8
DCGETOPTIONS AUTORESIZE
DCREAD GUI FIT ADDBUTTONS MODAL ;
OPTIONS GetOptions ;
TITLE 'Click in CheckBox to Select/Unselect'
RETURN aDir
* ----------
PROC appsys ; return
Re: DCBROWSE Editing
Posted: Fri Jun 24, 2011 11:10 am
by GeneB
Roger,
The action of your code is what I was looking for, with one exception.
If a check mark cell is clicked and there is a one second pause before the second click, it works correctly.
If a typical, quicker, double click is performed on the cell, the check mark bitmap disappears and the cell becomes a 'get' awaiting numeric entry.
I also found that the .t./.f. values stored in the array are not correct all the time, depending at how you click to produce the check mark bitmap.
I really appreciate your time helping with this.
GeneB
Re: DCBROWSE Editing
Posted: Sun Jun 26, 2011 10:23 am
by rdonnay
This should do what you want:
Code: Select all
@ 0,0 DCBROWSE oBrowse DATA aDir SIZE 80,12 ;
PRESENTATION DC_BrowPres() FIT ;
POINTER n ;
EDIT xbeBRW_ItemSelected ACTION {|o|o:colPos > 1}
DCBROWSECOL DATA {|x|x:=DC_GetColArray(11,oBrowse), ;
IIF(x,BITMAP_CHECKBOX_CHECKED_S,BITMAP_CHECKBOX_UNCHECKED_S)} ;
PARENT oBrowse HEADER 'Sel' WIDTH 1 ;
TYPE XBPCOL_TYPE_BITMAP ;
PROTECT {||.t.} ;
EVAL {|oB|oB:dataArea:lbClick := {|a,b,o|IIF(oBrowse:colPos=1,(aDir[n,11]:=!aDir[n,11],oBrowse:refreshCurrent()),nil)}}
Re: DCBROWSE Editing
Posted: Tue Jun 28, 2011 8:54 am
by GeneB
This works perfectly !!
Thank you for your time, I know how valuable it is to you and all of us.
GeneB