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...
Progress Bar on Dialog
-
- Posts: 42
- Joined: Wed Oct 26, 2005 1:20 pm
- Location: Marshall, Virginia, USA
- Contact:
-
- Posts: 42
- Joined: Wed Oct 26, 2005 1:20 pm
- Location: Marshall, Virginia, USA
- Contact:
- Antonio Linares
- Site Admin
- Posts: 42519
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Has thanked: 31 times
- Been thanked: 75 times
- Contact:
-
- Posts: 42
- Joined: Wed Oct 26, 2005 1:20 pm
- Location: Marshall, Virginia, USA
- Contact:
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!
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
#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
Merchant Software Corp
Marshall, Virginia USA
- Antonio Linares
- Site Admin
- Posts: 42519
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Has thanked: 31 times
- Been thanked: 75 times
- Contact:
Bill,
Use Method SetRange() from ON INIT and check the bounds:
Use Method SetRange() from ON INIT and check the bounds:
Code: Select all | Expand
@ 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 ) )