xBrowse with „Meter“

xBrowse with „Meter“

Postby Otto » 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:

Code: Select all  Expand view
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
Otto
 
Posts: 6328
Joined: Fri Oct 07, 2005 7:07 pm

Meter and xBrowse

Postby ukoenig » Sun Jun 08, 2008 12:10 pm

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
ukoenig
 
Posts: 4043
Joined: Wed Dec 19, 2007 6:40 pm
Location: Germany

Re: xBrowse with „Meter“

Postby Patrick Mast » Mon Jun 09, 2008 11:47 am

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
Patrick Mast
 
Posts: 246
Joined: Sat Mar 03, 2007 8:42 pm

Postby Antonio Linares » Mon Jun 09, 2008 12:12 pm

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
User avatar
Antonio Linares
Site Admin
 
Posts: 42080
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 101 guests