Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Is there a fancy replacement por WAIT WINDOW NOWAIT?
Message
From
27/09/2021 07:30:50
 
 
To
25/09/2021 14:15:35
General information
Forum:
Visual FoxPro
Category:
Classes - VCX
Miscellaneous
Thread ID:
01682356
Message ID:
01682361
Views:
120
Likes (1)
>Hi! I've been developing many VFP applications over the years and all of them use WAIT WINDOW...NOWAIT to show the user that some process is going on, until one of my clients told me that little dull windows is not seen by their users and they think the app is frozen so they call support to help them, they finally tell the users that they have to wait until that little dull windows disappears.
>
>So, my client wants me to replace it with some fancier and more attractive window so that his users know what is going on.
>
>Does anybody knows a well known class that can be used instead? I tried to create one of my own but I guess it is a lot of work trying to figure out the width and height of the window, so I ask you where can I get one fancier WIT WINDOWS replacement. If it could use a progress bar that would be terrific!
>
>TIA

A quick-and-dirty crude "no frills" progress dialog (note: fixed size - does not resize window to accommodate the message text):
* sample code
oProg = CREATEOBJEcT("T_ProgressDlg")
oProg.VISIBLE = .T.
oProg.SetMessage("Searching...")
FOR I=1 TO 100
    IF m.I=50 THEN
        oProg.SetMessage("Searching... (halfway done!)")
    ENDIF
    oProg.SetFraction( m.I / 100 )  && Set progress bar level ( 0.0 .. 1.0 )
    = INKEY(0.0125)   && force a delay so that we can see screen.
ENDFOR
oProg.SetMessage("Done!")
= INKEY(5.0)   && delay again, to allow us to see the screen before it goes away
RELEASE oProg

*------------------------------------------------------------------------------
* The following classes for the progress dialog:
*
* T_ProgressDlg
*     A "no frills" progress (modeless) dialog.
*     Methods:
*        SetMessage( cTxt )  -- set message text
*        SetFraction( nPct ) -- set level on progress bar, parameter is value
*                               representing level of completeness (0.0 .. 1.0)
*        SetStepSize( nVal ) -- set step size in progress for Step() method
*        Step()              -- increment progress bar by value set by
*                               SetFraction
*
* T_ThermBar
*     A class for implementing a "thermometer" bar (aka progress bar)
*
*------------------------------------------------------------------------------
DEFINE CLASS T_ProgressDlg AS form

	Height = 76
	Width = 501
	DoCreate = .T.
	AutoCenter = .T.
	AlwaysOnTop = .T.
	Caption = "Progress"
	ControlBox = .F.
	Closable = .F.
	MaxButton = .F.
	MinButton = .F.
	*-- Increment size for progress bar update.
	nstepsize = (0)
	Name = "T_ProgressDlg"

	ADD OBJECT lblmsg AS label WITH ;
		Caption = "Overall description of process", ;
		Height = 32, ;
		Left = 4, ;
		Top = 4, ;
		Width = 489, ;
		Name = "lblMsg"

	ADD OBJECT ctltherm AS T_ThermBar WITH ;
		Top = 48, ;
		Left = 8, ;
		Width = 484, ;
		Height = 20, ;
		SpecialEffect = 1, ;
		Name = "ctlTherm", ;
		shpThermBar.Name = "shpThermBar"

	*-- Set progress bar message
	PROCEDURE setmessage
		PARAMETERS cMsg

		THIS.lblMsg.CAPTION = m.cMsg
	ENDPROC

	*-- Set displayed fraction.
	PROCEDURE setfraction
		PARAMETERS nFract

		THIS.ctlTherm.Fraction = m.nFract
	ENDPROC

	*-- Increment fraction for the progress bar.
	PROCEDURE step
		THIS.ctlTherm.Fraction = THIS.ctlTherm.Fraction + THIS.nStepSize
	ENDPROC

	PROCEDURE setstepsize
		PARAMETERS nStepSize

		THIS.nStepSize = m.nStepSize
	ENDPROC

	PROCEDURE Init
		* - Address display problem when running under Vista where
		*   the border of a window is sometimes missing.  This
		*   apparently happens whenever the BorderStyle is
		*   overridden in a form.
		DO CASE
		    CASE NOT OS(1) == "Windows 6.00"
		        * No Vista, no problem.
		    CASE EMPTY(SYS(1271, m.Thisform))
		        * No SCX form, no problem.
		    CASE m.Thisform.SHOWWINDOW == 0        && In Screen.
		        ACTIVATE WINDOW (m.Thisform.NAME) IN SCREEN NOSHOW
		    CASE m.Thisform.SHOWWINDOW == 1        && In Top-Level Form.
		        * LOCAL lcWindowName
		        * lcWindowName = m.Thisform.GetTopLevelFormName()
		        * ACTIVATE WINDOW (m.Thisform.Name) IN WINDOW (m.lcWindowName) NOSHOW
		    OTHERWISE                            && As Top-Level Form.
		        * Top-level forms are not affected.
		ENDCASE
	ENDPROC
	PROCEDURE Resize
		THIS.Width  = MAX(200,THIS.Width)
		THIS.Height = 76

		THIS.ctlTherm.Width = THIS.Width - THIS.ctlTherm.Left - 10
		THIS.lblMsg.Width = THIS.Width - 2.0 * THIS.lblMsg.Left
	ENDPROC

ENDDEFINE

DEFINE CLASS T_ThermBar AS control

	Width = 342
	Height = 27
	BorderWidth = 1
	SpecialEffect = 2
	BackColor = RGB(255,255,255)
	fraction = 0  && Fraction to be represented by the thermometer bar.
	Name = "T_ThermBar"

	ADD OBJECT shpthermbar AS shape WITH ;
		Top = 2, ;
		Left = 2, ;
		Height = 20, ;
		Width = 320, ;
		BackStyle = 1, ;
		BorderStyle = 0, ;
		BackColor = RGB(0,0,128), ;
		Name = "shpThermBar"

	PROCEDURE fraction_assign
		LPARAMETERS vNewVal
		* LOCAL nBdr

		THIS.Fraction = MAX(MIN(m.vNewVal,1.0),0.0)
		* nBdr = THIS.BorderWidth + IIF(THIS.SpecialEffect==2,1,2)
		* THIS.shpThermBar.Width = (THIS.Width- (2.0*m.nBdr)) * THIS.Fraction
		THIS.Refresh()
	ENDPROC

	PROCEDURE borderwidth_assign
		LPARAMETERS vNewVal
		*To do: Modify this routine for the Assign method
		THIS.BorderWidth = m.vNewVal
		THIS.Refresh()
	ENDPROC

	PROCEDURE specialeffect_assign
		LPARAMETERS vNewVal
		*To do: Modify this routine for the Assign method
		THIS.SpecialEffect = m.vNewVal
		THIS.Refresh()
	ENDPROC

	PROCEDURE Refresh
		LOCAL nBdr
		nBdr = THIS.BorderWidth + IIF(THIS.SpecialEffect==2,1,2)

		THIS.shpThermBar.Left = m.nBdr
		THIS.shpThermBar.Top = m.nBdr
		THIS.shpThermBar.Height = THIS.Height - 2.0 * m.nBdr
		THIS.shpThermBar.Width = (THIS.Width- 2.0*m.nBdr) * THIS.Fraction
	ENDPROC

	PROCEDURE Init
		THIS.Refresh()
	ENDPROC

	PROCEDURE Resize
		THIS.Refresh()
	ENDPROC

	PROCEDURE mousepointer_assign
		LPARAMETERS vNewVal
		*To do: Modify this routine for the Assign method
		THIS.MOUSEPOINTER = m.vNewVal
		THIS.shpThermBar.MOUSEPOINTER = m.vNewVal
	ENDPROC

ENDDEFINE  && T_ThermBar
Previous
Reply
Map
View

Click here to load this message in the networking platform