Progress bar

User avatar
anserkk
Posts: 1280
Joined: Fri Jun 13, 2008 11:04 am
Location: Kochi, India

Re: Progress bar

Post by anserkk »

Any solutions available for this problem ?

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

Re: Progress bar

Post by ukoenig »

Hello Anser,

I using a Gradient-Solution that works on all Window-Versions.
You can define any Range and Steps :

Image

Image

Image

Image

Code: Select all

FUNCTION TEST()
LOCAL oDlg90, hDC, oBMP10, oBtn71, oBtn72, oSay30
local aGrad1 := { { W_MOVE, W_COLOR1, W_COLOR2 }, ;
                            { W_MOVE, W_COLOR2, W_COLOR1 } }

nMove := 0
nMove1 := 0
REDEFINE BITMAP oBMP10  ID 500  ADJUST  RESOURCE "Blanc"  OF oDlg90 
oBMP10:bPainted := {|hDC| PROG_GRAD( oBMP10, 32768, 10853885, nMove ) }     

REDEFINE SAY oSay30 VAR nMove1 ID 510  OF oDlg90 UPDATE
oSAY30:lTransparent := .T.
oSAY30:nClrText := 0

REDEFINE BTNBMP oBtn71 ID 60 OF oDlg90  2007 ;
FILENAME c_path + "\Images\key0.bmp" ;
LEFT ;
PROMPT "  &Move  " ;
FONT oProgFont ;
ACTION ( nMove := nMove + 00.1, oBMP10:Refresh(), ;
                 nMove1 := nMove * 100, oSay30:Refresh() ) 

REDEFINE BTNBMP oBtn72 ID 61 OF oDlg90  2007 ;
FILENAME c_path + "\Images\exit.bmp" ;
LEFT ;
PROMPT "  &Reset  " ;
FONT oProgFont ;
ACTION ( nMove := 0, oBMP10:Refresh() ) 

ACTIVATE DIALOG oDlg90 CENTERED ;
ON PAINT ( D_GRAD( hDC, oDlg90, aGrad1 ) )

RETURN( NIL )

// -----------------------------------------------

STATIC FUNCTION D_GRAD( hDC, oDlg90, aGrad )
local oNewbrush

aRect := GETCLIENTRECT( oDlg90:hWnd )
IF W_DIRECT =  1
    GradientFill( hDC, 0, 0, oDlg90:nHeight, oDlg90:nWidth, aGrad, .T. )
ELSE
    GradientFill( hDC, 0, 0, oDlg90:nHeight, oDlg90:nWidth, aGrad, .F. )
ENDIF

RETURN NIL

//------------- BAR-GRADIENT -----------

FUNCTION PROG_GRAD( oBitmap, nVColor, nBColor, nMove ) 
LOCAL aGrad := { { nMove, nVColor, nBColor }, { nMove, nBColor, nVColor } }
LOCAL aRect := GETCLIENTRECT( oBitmap:hWnd )
LOCAL oNewBrush, hDC := oBitmap:GETDC()

DEFINE BRUSH oNewBrush COLOR GradientFill( hDC,  0, 0, aRect[3], aRect[4], aGrad, .F. )
FillRect( hDC, aRect, oNewBrush:hBrush )

oBitmap:ReleaseDC()
RELEASE BRUSH oNewbrush

RETURN NIL
 
Another Solution ( funny ) : using the VTitle-Painter

Start with 0 % :

Image

Replace the BMP, if a value is reached :

Image

Code: Select all

FUNCTION  SHOW_TITLE(oDlg,oTextFont,oBrush,c_SET)
LOCAL oBar
LOCAL nSCR1 := oDlg:nWidth()  // Screen-Width
LOCAL nSCR2 := oDlg:nHeight()  // Screen-Hight - Title-Height

@  100,100 TITLE oBar SIZE 596,202 of oDlg SHADOW BOTTOMRIGHT SHADOWSIZE 25

oBar:aGrdBack := { { 0.87,10921638,14869218 }, ;
          { 0.87,14869218,10921638 } }

oBar:nClrLine1 := 8388608
oBar:nClrLine2 := 128

oBar:lRound := .T.

@  146,75 TITLETEXT OF oBar TEXT "0 %" FONT oTextFont  COLOR  8388608 SHADOW BOTTOMRIGHT
@  148,282 TITLETEXT OF oBar TEXT "50 %" FONT oTextFont  COLOR  8388608 SHADOW BOTTOMRIGHT
@  148,489 TITLETEXT OF oBar TEXT "100 %" FONT oTextFont  COLOR  8388608 SHADOW BOTTOMRIGHT

@  20, 50 TITLEIMG OF oBar BITMAP c_path + c_SET + "\SMILIES ANGRY.BMP"  REFLEX TRANSPARENT
@  20, 120 TITLEIMG OF oBar BITMAP c_path + c_SET + "\SMILIES SAD.BMP"  REFLEX TRANSPARENT
@  20, 190 TITLEIMG OF oBar BITMAP c_path + c_SET + "\SMILIES ROLL_EYES.BMP"  REFLEX TRANSPARENT
@  20, 260 TITLEIMG OF oBar BITMAP c_path + c_SET + "\SMILIES CONFUSED.BMP"  REFLEX TRANSPARENT
@  20, 330 TITLEIMG OF oBar BITMAP c_path + c_SET + "\SMILIES OOOOH.BMP"  REFLEX TRANSPARENT
@  20, 400 TITLEIMG OF oBar BITMAP c_path + c_SET + "\SMILIES SMILE.BMP"  REFLEX TRANSPARENT
@  20, 470 TITLEIMG OF oBar BITMAP c_path + c_SET + "\SMILIES LOL.BMP"  REFLEX TRANSPARENT

RETURN NIL
 
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
Adolfo
Posts: 815
Joined: Tue Oct 11, 2005 11:57 am
Location: Chile
Contact:

Re: Progress bar

Post by Adolfo »

Simply awesome Uwe...

Good idea. (love the faces progress )


From Chile
Adolfo
;-) Ji,ji,ji... buena la cosa... "all you need is code"

http://www.xdata.cl - Desarrollo Inteligente
----------
Lenovo Legion Y520, 16GB Ram, 1 TB NVME M.2, 1 TB SSD, GTX 1050
User avatar
anserkk
Posts: 1280
Joined: Fri Jun 13, 2008 11:04 am
Location: Kochi, India

Re: Progress bar

Post by anserkk »

Hi Mr.Uwe,

Thank you.

Regards
Anser
Post Reply