Progress Bar on Dialog

Progress Bar on Dialog

Postby Bill Simmeth » Fri Jul 21, 2006 6:28 pm

Does anyone have an example of how to create a progress bar on a dialog? I have tried to define the dialog from a resource and also to create it from scratch. But, I have not been able to get either to function properly.

Thanks in advance...
Bill Simmeth
Merchant Software Corp
Marshall, Virginia USA
Bill Simmeth
 
Posts: 42
Joined: Wed Oct 26, 2005 1:20 pm
Location: Marshall, Virginia, USA

Postby Bill Simmeth » Fri Jul 21, 2006 7:57 pm

Thank you. I have a sample running now. On a dialog, progress bar seems to behave a bit strange. Even though it reports a range of 0 to 10, it acts as though the range is 0,100.
Bill Simmeth
Merchant Software Corp
Marshall, Virginia USA
Bill Simmeth
 
Posts: 42
Joined: Wed Oct 26, 2005 1:20 pm
Location: Marshall, Virginia, USA

Postby Antonio Linares » Sat Jul 22, 2006 5:22 am

Bill,

Would you mind to post your sample here so we can review it ?

Also you may review samples\TestProg.prg
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42122
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Postby Bill Simmeth » Sat Jul 22, 2006 1:44 pm

Hi Antonio,

I have included code below. I used the samples\testprog.prg as a guide but needed to place the progress bar on a dialog, not the window. I was unable to do this using a dialog from a resource. So, I built the dialog dynamically.

I added a function to post the nMin, nMax and nPos of the bar so you see what happens.

Also, it looks like the default DLG_CHARPIX_H and DLG_CHARPIX_W need to be adjusted for FWPPC as they yield objects too large.

Thanks!

Code: Select all  Expand view  RUN
#include "FWCE.ch"

FUNCTION Main()

LOCAL oWnd
DEFINE WINDOW oWnd TITLE "Progress"

@ 2, 2 BUTTON "Progress" SIZE 80, 25 ACTION ProgDialog()

ACTIVATE WINDOW oWnd

RETURN NIL

function ProgDialog()

   local oDlg, oPgr

   DEFINE Dialog oDlg TITLE "Progress Bars" FROM 5,12 TO 180, 230 PIXEL

   @ 1, 1 SAY oSay PROMPT "Testing" OF oDlg SIZE 150, 20

   @ 2, 0.9 PROGRESS oPgr OF oDlg SIZE 100, 15

   @ 3, 1 BUTTON "-" OF oDlg SIZE 20, 20  ;
      ACTION ( oPgr:nPosition -= 10 , BarStat( oSay, oPgr ) )

   @ 3, 4 BUTTON "+" OF oDlg SIZE 20, 20  ;
      ACTION ( oPgr:nPosition += 10 , BarStat( oSay, oPgr ) )

   ACTIVATE DIALOG oDlg ON INIT ( oPgr:nPosition := 50, BarStat( oSay, oPgr ) )

return nil

Procedure BarStat( oSay, oPgr )
oSay:setText( Str( oPgr:nMin ) + ", " + Str( oPgr:nMax ) + ", " + Str( oPgr:nPos ) )
Return
Bill Simmeth
Merchant Software Corp
Marshall, Virginia USA
Bill Simmeth
 
Posts: 42
Joined: Wed Oct 26, 2005 1:20 pm
Location: Marshall, Virginia, USA

Postby Antonio Linares » Sat Jul 22, 2006 4:36 pm

Bill,

Use Method SetRange() from ON INIT and check the bounds:
Code: Select all  Expand view  RUN
   @ 3, 1 BUTTON "-" OF oDlg SIZE 20, 20  ;
      ACTION ( if( oPgr:nPosition > 0, oPgr:nPosition -= 10, ), BarStat( oSay, oPgr ) )

   @ 3, 4 BUTTON "+" OF oDlg SIZE 20, 20  ;
      ACTION ( if( oPgr:nPosition < 100, oPgr:nPosition += 10, ), BarStat( oSay, oPgr ) )

   ACTIVATE DIALOG oDlg ON INIT ( oPgr:SetRange( 0, 100 ), oPgr:nPosition := 50, BarStat( oSay, oPgr ) )
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42122
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain


Return to FiveWin for Pocket PC

Who is online

Users browsing this forum: No registered users and 28 guests