Dear Rao,
is it possible to overlap (free) cells in xBrowse, like it is in Excel?
Little screen shot, showing overlapped cells in Excel:
http://depositfiles.com/files/3bb77rcog
//DrawTextEx( hDC, cData,;
// {nRow, nCol, nRow + nHeight, Min( nCol + nWidth, ::oBrw:BrwWidth() - 5 ) },;
// ::nDataStyle )
Draw TextEx( hDC, cData,;
{ nRow, nCol, nRow + nHeight, nCol + GetTextWidth( hDC, cData ) },;
::nDataStyle )
If oCol:bPaintText is assigned with our codeblock, xbrowse does NOT paint cell text on its own and instead calls our codeblock with the parameters ( oCol, hDC, cData, aRect, aColors, lHighLite ). It is for the programmer to use this facility,
FUNCTION Main()
LOCAL oDlg, oBrw, oCol, aRecord, nAt := 1
USE Customer
aRecord = Array( Customer->( FCount() ) )
DEFINE DIALOG oDlg SIZE 300, 300
@ 0, 0 XBROWSE oBrw OF oDlg ARRAY aRecord // AUTOSORT
oCol := oBrw:AddCol()
oCol:bStrData = { || Customer->( FieldName( oBrw:nArrayAt ) ) }
oCol:cHeader = "FieldName"
oCol := oBrw:AddCol()
oCol:bStrData = { || Customer->( FieldGet( oBrw:nArrayAt ) ) }
oCol:cHeader = "Value"
oCol := oBrw:AddCol()
oCol:bStrData = { || "" }
oCol:cHeader = "Empty"
oCol:bPaintText = { || NIL }
oBrw:nMarqueeStyle = MARQSTYLE_HIGHLROW
oBrw:CreateFromCode()
oBrw:bKeyCount = { || Customer->( FCount() ) }
oDlg:oClient = oBrw
ACTIVATE DIALOG oDlg CENTERED ON INIT oDlg:Resize()
RETURN NIL
...
if !Empty( cData )
oFont:Activate( hDC )
SetTextColor( hDC, aColors[ 1 ] )
SetBkColor( hDC, aColors[ 2 ] )
//DrawTextEx( hDC, cData,;
// {nRow, nCol, nRow + nHeight, Min( nCol + nWidth, ::oBrw:BrwWidth() - 5 ) },;
// ::nDataStyle )
DrawTextEx( hDC, cData,;
{ nRow, nCol, nRow + nHeight, nCol + GetTextWidth( hDC, cData ) },;
::nDataStyle )
//-------------------------
oFont:Deactivate( hDC )
endif
...
FUNCTION Main()
LOCAL oDlg, oBrw, oCol, aRecord, nAt := 1
USE Customer
aRecord = Array( Customer->( FCount() ) )
DEFINE DIALOG oDlg SIZE 300, 300
@ 0, 0 XBROWSE oBrw OF oDlg ARRAY aRecord // AUTOSORT
// 1. column
oCol := oBrw:AddCol()
oCol:bStrData = { || Customer->( FieldName( oBrw:nArrayAt ) ) }
oCol:cHeader = "FieldName"
// 2. column
oCol := oBrw:AddCol()
oCol:bStrData = { || Customer->( FieldGet( oBrw:nArrayAt ) ) }
oCol:cHeader = "Value"
// Overlapping this column
oCol:bPaintText = { | oCol, hDC, cData, aRect | DrawTextEx( hDC, cData, { aRect[ 1 ], aRect[ 2 ], aRect[ 3 ], aRect[ 2 ] + GetTextWidth( hDC, cData ) }, oCol:nDataStyle ) }
// 3. column
oCol := oBrw:AddCol()
oCol:bStrData = { || "abc" }
oCol:cHeader = "Empty"
// Don't draw this column
oCol:bPaintText = { || NIL }
oBrw:nMarqueeStyle = MARQSTYLE_HIGHLROW
oBrw:CreateFromCode()
oBrw:bKeyCount = { || Customer->( FCount() ) }
oDlg:oClient = oBrw
ACTIVATE DIALOG oDlg CENTERED ON INIT oDlg:Resize()
RETURN NIL
oCol:lColTransparent := .T.
oCol:bClrStd := { || { CLR_BLACK, CLR_CYAN } }
oCol:lColTransparent := .T.
Return to FiveWin for Harbour/xHarbour
Users browsing this forum: No registered users and 53 guests