FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour xBrowse with „Meter“
Posts: 6984
Joined: Fri Oct 07, 2005 07:07 PM
xBrowse with „Meter“
Posted: Sun Jun 08, 2008 09: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:

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






Posts: 4043
Joined: Wed Dec 19, 2007 06:40 PM
Meter and xBrowse
Posted: 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.



I will try out your solution.

Best regards

Uwe :-)
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.
Posts: 246
Joined: Sat Mar 03, 2007 08:42 PM
Re: xBrowse with „Meter“
Posted: 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
Posts: 44162
Joined: Thu Oct 06, 2005 05:47 PM
xBrowse with „Meter“
Posted: 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

Continue the discussion