get the Width of a Column in DCBROWSE to use it in DCADDCELL
get the Width of a Column in DCBROWSE to use it in DCADDCELL
With can get the Width of a Column in DCBROWSE to use it in DCADDCELLITEM
Nolberto Paulino
Regards
Regards
Re: get the Width of a Column in DCBROWSE to use it in DCADD
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.