get the Width of a Column in DCBROWSE to use it in DCADDCELL

This forum is for eXpress++ general support.
Post Reply
Message
Author
User avatar
digitsoft
Posts: 461
Joined: Thu Jan 28, 2010 1:33 pm
Location: Republica Dominicana
Contact:

get the Width of a Column in DCBROWSE to use it in DCADDCELL

#1 Post by digitsoft »

With can get the Width of a Column in DCBROWSE to use it in DCADDCELLITEM
Nolberto Paulino
Regards

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

Re: get the Width of a Column in DCBROWSE to use it in DCADD

#2 Post by rdonnay »

Here is a small modification I made to \exp20\samples\browse\generic.prg:

Code: Select all

DCBROWSECOL DATA {|a,oColumn|CellArray(1,oColumn)} ;
                    HEADER {{'ID'}} WIDTH 5 PARENT oBrowse ;
                    OWNERDRAW

DCBROWSECOL DATA {|a,oColumn|CellArray(2,oColumn)} ;
                    HEADER 'Name/Address'  WIDTH 25 PARENT oBrowse ;
                    COLOR {||{IF('Software'$CUSTOMER->bill_name,GraMakeRGBColor( { 253, 120, 41 } ),GRA_CLR_DARKGREEN),oBrowse:rowColor()[2]}} ;
                    OWNERDRAW

DCBROWSECOL DATA {|a,oColumn|CellArray(3),oColumn} ;
                    HEADER 'Contact'  WIDTH 15 PARENT oBrowse ;
                    COLOR {||{GRA_CLR_DARKRED,oBrowse:rowColor()[2]}} ;
                    OWNERDRAW

DCBROWSECOL DATA {|a,oColumn|CellArray(4,oColumn)} ;
                    HEADER 'Info/Rating' WIDTH 10 PARENT oBrowse ;
                    COLOR {||{GRA_CLR_DARKBLUE,GraMakeRGBColor({240,240,240})}} ;
                    OWNERDRAW

DCBROWSECOL DATA {|a,oColumn|CellArray(5,oColumn)} ;
                    HEADER 'Bitmap' ;
                    WIDTH 6 PARENT oBrowse ;
                    OWNERDRAW

DCBROWSECOL FIELD CUSTOMER->phone  HEADER 'Phone' WIDTH  10 PARENT oBrowse

@ 26,0 DCCHECKBOX lOwnerDraw PROMPT 'Use ownerdrawing' ;
       ACTION {||oBrowse:lOwnerDraw := lOwnerDraw,oBrowse:InvalidateRect()}

DCREAD GUI FIT TITLE 'Ownerdrawing sample' OPTIONS GetOptions

CLOSE ALL
RETURN nil

* ----------

STATIC FUNCTION CellArray( nCol, oColumn )

LOCAL aCell[0], i, nWidth := 0

IF Valtype(oColumn) == 'O'
  nWidth := oColumn:heading:currentSize()[1]
ENDIF
The eXpress train is coming - and it has more cars.

Post Reply