xBrowse with „Meter“
Posted: Sun Jun 08, 2008 9:08 am
Call:
send in bStrData block:
„#“ shows it is a meter +
10 characters for the maximum + the value as string
oCol:bStrData := { || "#"+"50000 "+ALLTRIM(str(field->test))}
Change the METHOD PaintData as follows:
send in bStrData block:
„#“ shows it is a meter +
10 characters for the maximum + the value as string
oCol:bStrData := { || "#"+"50000 "+ALLTRIM(str(field->test))}
Change the METHOD PaintData as follows:
Code: Select all
METHOD PaintData( nRow, nCol, nHeight, lHighLite, lSelected, nOrder ) CLASS TXBrwColumn
local nPerc := 0
local hBrushgruen := CreateSolidBrush(RGB(0,159,80))
local nMax:=0
local lMeter:=.f.
...
if ::bStrData != nil
cData := Eval( ::bStrData )
IF left(cData,1)="#"
lMeter:=.t.
endif
...
if ! lTransparent
IF lMeter=.t.
nMax := VAL(substr(cData,2,10))
nPerc := ( nRectWidth ) * VAL ( substr(cData,12))/nMax
FillRect( hDC, {nRow, nRectCol, nRectHeight, Min( nRectCol + nRectWidth, ::oBrw:BrwWidth() - 4 ) }, hBrush )
FillRect( hDC, {nRow+5, nRectCol, nRectHeight-5, nRectCol+ nPerc }, hBrushgruen)
else
FillRect( hDC, {nRow, nRectCol, nRectHeight, Min( nRectCol + nRectWidth, ::oBrw:BrwWidth() - 4 ) }, hBrush )
endif
endif
...
if !Empty( cData )
IF lMeter=.t.
else
oFont:Activate( hDC )
SetTextColor( hDC, aColors[ 1 ] )
endif