DCBROWSE Editing

This forum is for eXpress++ general support.
Post Reply
Message
Author
User avatar
GeneB
Posts: 158
Joined: Sun Jan 31, 2010 8:32 am
Location: Albuquerque, New Mexico, USA
Contact:

DCBROWSE Editing

#1 Post 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.} 

User avatar
GeneB
Posts: 158
Joined: Sun Jan 31, 2010 8:32 am
Location: Albuquerque, New Mexico, USA
Contact:

Re: DCBROWSE Editing

#2 Post 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.

User avatar
Auge_Ohr
Posts: 1428
Joined: Wed Feb 24, 2010 3:44 pm

Re: DCBROWSE Editing

#3 Post 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 874 times
greetings by OHR
Jimmy

User avatar
GeneB
Posts: 158
Joined: Sun Jan 31, 2010 8:32 am
Location: Albuquerque, New Mexico, USA
Contact:

Re: DCBROWSE Editing

#4 Post 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

User avatar
Auge_Ohr
Posts: 1428
Joined: Wed Feb 24, 2010 3:44 pm

Re: DCBROWSE Editing

#5 Post 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()
greetings by OHR
Jimmy

User avatar
GeneB
Posts: 158
Joined: Sun Jan 31, 2010 8:32 am
Location: Albuquerque, New Mexico, USA
Contact:

Re: DCBROWSE Editing

#6 Post 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" ?

User avatar
rdonnay
Site Admin
Posts: 4813
Joined: Wed Jan 27, 2010 6:58 pm
Location: Boise, Idaho USA
Contact:

Re: DCBROWSE Editing

#7 Post 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
The eXpress train is coming - and it has more cars.

User avatar
GeneB
Posts: 158
Joined: Sun Jan 31, 2010 8:32 am
Location: Albuquerque, New Mexico, USA
Contact:

Re: DCBROWSE Editing

#8 Post 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

User avatar
rdonnay
Site Admin
Posts: 4813
Joined: Wed Jan 27, 2010 6:58 pm
Location: Boise, Idaho USA
Contact:

Re: DCBROWSE Editing

#9 Post 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)}}
The eXpress train is coming - and it has more cars.

User avatar
GeneB
Posts: 158
Joined: Sun Jan 31, 2010 8:32 am
Location: Albuquerque, New Mexico, USA
Contact:

Re: DCBROWSE Editing

#10 Post by GeneB »

This works perfectly !!
Thank you for your time, I know how valuable it is to you and all of us.
GeneB

Post Reply