Checkbox in Browse

This forum is for eXpress++ general support.
Message
Author
User avatar
Auge_Ohr
Posts: 1421
Joined: Wed Feb 24, 2010 3:44 pm

Re: Checkbox in Browse

#11 Post by Auge_Ohr »

Tom wrote:There was a XbpCheckBoxColumn or something like this in the XbPacks II or III. Anyone who tried this out?
it is in Service Pack 3 ... but it is (much) to complicate and use Ownerdraw (no need)
greetings by OHR
Jimmy

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

Re: Checkbox in Browse

#12 Post by rdonnay »

Don't try to use the SCALEFONT feature with the Wingdings 2 font.
Also you will need to set the presentation parameters array to fix the row height.

I can't scale up the font when columns are using different fonts. This is because fonts with the same nominal point size do not necessarily produce the same font height.

I can't think of any workaround that will make this work.
The below sample will work.

Code: Select all

/*
This sample shows how to use a checkbox font or checkbox bitmaps
to provide the ability to check and uncheck
items in a browse.
*/

#INCLUDE "dcdialog.CH"
#INCLUDE "dcbitmap.CH"

FUNCTION Main()

LOCAL GetList[0], oBrowse, aDir, n := 1, GetOptions, ;
      aBrowPres

aBrowPres := ;
    { { XBP_PP_COL_HA_FGCLR, GRA_CLR_WHITE },            /* Header FG Color  */  ;
      { XBP_PP_COL_HA_BGCLR, GRA_CLR_DARKGRAY },         /* Header BG Color  */  ;
      { XBP_PP_COL_DA_ROWSEPARATOR, XBPCOL_SEP_DOTTED }, /* Row Sep          */  ;
      { XBP_PP_COL_DA_COLSEPARATOR, XBPCOL_SEP_DOTTED }, /* Col Sep          */  ;
      { XBP_PP_COL_DA_FGCLR, GRA_CLR_BLACK },            /* Row FG Color     */  ;
      { XBP_PP_COL_DA_BGCLR, GRA_CLR_WHITE },            /* Row BG Color     */  ;
      { XBP_PP_COL_DA_ROWHEIGHT, 20 },                   /* Row Height       */  ;
      { XBP_PP_COL_HA_HEIGHT, 20 },                      /* Header Height    */  ;
      { XBP_PP_COL_DA_HILITE_FGCLR, GRA_CLR_WHITE },     /* Hilite FG color  */  ;
      { XBP_PP_COL_DA_HILITE_BGCLR, GRA_CLR_BLUE },      /* Hilite BG color  */  ;
      { XBP_PP_COL_FA_FGCLR, GRA_CLR_WHITE },            /* Footer FG Color  */  ;
      { XBP_PP_COL_FA_BGCLR, GRA_CLR_DARKGRAY },         /* Footer BG Color  */  ;
      { XBP_PP_COL_FA_HEIGHT, 10 }                       /* Footer Height    */  ;
    }

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 aBrowPres FIT ;
      POINTER n ;
      MARK 11 ;
      RESIZE DCGUI_RESIZE_RESIZEONLY

DCBROWSECOL DATA {|x|x:=DC_GetColArray(11,oBrowse), ;
         IIF(x,BITMAP_CHECKBOX_CHECKED_S,BITMAP_CHECKBOX_UNCHECKED_S)} ;
      PARENT oBrowse HEADER 'Sel 1' WIDTH 3 ;
      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 DATA {|x|x:=DC_GetColArray(11,oBrowse),IIF(x,'R',' ')} ;
      PARENT oBrowse HEADER 'Sel 2' WIDTH 3 ;
      FONT '10.Wingdings 2' ;
      EVAL {|oB|oB:dataArea:lbClick := {|a,b,o|IIF(oBrowse:colPos=2,(aDir[n,11]:=!aDir[n,11],oBrowse:refreshCurrent()),nil)}}

DCBROWSECOL ELEMENT 1 PARENT oBrowse HEADER 'Name' WIDTH 10
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 RESIZE

DCREAD GUI FIT ADDBUTTONS MODAL ;
     OPTIONS GetOptions ;
     TITLE 'Click in Sel 1 or Sel 2 column to Select/Unselect'

RETURN aDir

* ---------

PROC appsys ; RETURN
The eXpress train is coming - and it has more cars.

skiman
Posts: 1194
Joined: Thu Jan 28, 2010 1:22 am
Location: Sijsele, Belgium
Contact:

Re: Checkbox in Browse

#13 Post by skiman »

Hi Roger,
I can't scale up the font when columns are using different fonts. This is because fonts with the same nominal point size do not necessarily produce the same font height.
I didn't look in the sources how the scalefont is working, but I assume that you have some scalefactor?
When there are different fonts.
10.Wingdings 2
12.Arial
10.Verdana

And the scalefactor is 1.3, the result should be a scaling of every font? Isn't this exactly the same as a dialog with say and get? There you can have also different fonts?
Best regards,

Chris.
www.aboservice.be

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

Re: Checkbox in Browse

#14 Post by rdonnay »

I can make the scaling work when resizing but the rows will not align correctly due to the automatic method in which Xbase++ sizes the row height to fix the font height. I'm sure that I can make all this work but it will be lots of hours of my time and I don't have that time available now. The row height would need to be fixed rather than -1 and then the presentation parameters would need to be changed to set the height to that of the column with the maximum column height. I have other priorities now and there is no guarantee that this would satisfy the customer.
The eXpress train is coming - and it has more cars.

Post Reply