xBrowse with „Meter“

Post Reply
User avatar
Otto
Posts: 4470
Joined: Fri Oct 07, 2005 7:07 pm
Contact:

xBrowse with „Meter“

Post by Otto »

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:

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







Image
User avatar
ukoenig
Posts: 3981
Joined: Wed Dec 19, 2007 6:40 pm
Location: Germany
Contact:

Meter and xBrowse

Post by ukoenig »

Hello Otto,

it'a a good idea.

A customer of mine is selling software for schools.
There are different prices in relation to schoolsize ( schoolchilden ).

In the moment i have a val-field, that shows just a number.
I can change the field with a gradient-background :
start with green and change to red for the highest value.

Image

I will try out your solution.

Best regards

Uwe :lol:
Since 1995 ( the first release of FW 1.9 )
i work with FW.
If you have any questions about special functions, maybe i can help.
User avatar
Patrick Mast
Posts: 244
Joined: Sat Mar 03, 2007 8:42 pm

Re: xBrowse with „Meter“

Post by Patrick Mast »

Otto wrote:„#“ shows it is a meter +
10 characters for the maximum + the value as string
Nice idea Otto!
Antonio, should we not have someting standard in xBrowse? Is it possible to have a REAL meter per cell?

Patrick
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Post by Antonio Linares »

Patrick,

Its a better solution to paint a meter, as Otto has done, instead of using real meter controls, as we may need to manage lots of them, scroll them (change their coordinates), hide them, etc.
regards, saludos

Antonio Linares
www.fivetechsoft.com
Post Reply