Page Date
2004-05-18
DD-Software
Kapitel zurück / previous Chapter
Main Index
 
Seite zurück / previous page
Backward
Seite vor / next page
Forward
 
Seitenanfang/TopOfPage
Top
Seitenende/EndOfPage
Bottom
MyWbtHelp current version

Dialog udfMsgBoxOKTimer




Dialog udfMsgBoxOKTimer (iSecsToWait, sMsgTitle, sMsgText)

- Simple Dialog with WinBatch box drawing functions.

View Screenshot

Version History
  • 2003:10:07 v1.00
    - Initial release.



;------------------------------------------------------------------------------------------------------------------------------------------
If ItemLocate("udfmsgboxoktimer",IntControl(77,103,0,0,0),@TAB) Then Goto skip_udfmsgboxoktimer

#DefineFunction udfMsgBoxOKTimer (iSecsToWait, sMsgTitle, sMsgText)
@COORD_BOX   = "300,300,700,600"
@COORD_BOXBG = "000,000,999,999"
@COORD_TEXT  = "050,025,950,700"
@COORD_TIMER = "800,875,950,950"
@COORD_OK    = "050,825,200,950"

@FONT_SYSTEM = "System"
@RGB_LTGRAY  = "192,192,192"
@RGB_BLACK   = "000,000,000"
@BUTTON_OK   = "OK"

iBoxID       = 1
iButtonID    = 1

BoxesUp(@COORD_BOX,@NORMAL)
BoxCaption(iBoxID,sMsgTitle)
BoxColor(iBoxID,@RGB_LTGRAY,0)
BoxDrawRect(iBoxID,@COORD_BOXBG,2)
BoxTextFont(iBoxID,@FONT_SYSTEM,70,0,0)
BoxTextColor(iBoxID,@RGB_BLACK)
BoxDrawText(iBoxID,@COORD_TEXT,sMsgText,@TRUE,16)
BoxButtonDraw(iBoxID,iButtonID,@BUTTON_OK,@COORD_OK)
BoxDataTag(iBoxID,1)

sDTStop = TimeAdd(TimeYmdHms(),StrCat("0:0:0:0:0:",iSecsToWait))
iSecsLast = iSecsToWait+1
iButtonPressed = 0
While !iButtonPressed
   TimeDelay(.1)
   iSecs = TimeDiffSecs(sDTStop,TimeYmdHms())
   If (iSecs<iSecsLast)
      iSecsLast = iSecs
      BoxDrawText(iBoxID,@COORD_TIMER,iSecs,1,2)
      BoxDataClear(iBoxID,1)
   EndIf
   If !iSecs Then Break
   iButtonPressed = BoxButtonStat(iBoxId,iButtonID)
EndWhile
BoxDestroy(iBoxID)

Return (iButtonPressed)
;..........................................................................................................................................
; This Function "udfMsgBoxOKTimer" returns an integer value 0 or 1.
;    0   Wait period has timed out.
;    1   User has pressed OK button.
;
; Adapted from WinBatch forum.
; Topic:  Dialog Box Timeout (3 of 3), Read 5 times
; Conf:  WinBatch Dialogs and the Dialog Editor
; From:  dhartman davehartman2007@wideopenwest.com
; Date:  Monday, October 06, 2003 08:15 PM
;
; Modified by Detlev Dalitz.20031007
;..........................................................................................................................................
#EndFunction

:skip_udfmsgboxoktimer
;------------------------------------------------------------------------------------------------------------------------------------------


; --- test ---

iSecsToWait = 30 ; Timeout seconds.
sMsgTitle = "Countdown Timer"
sMsgText = ""
sMsgText = StrCat(sMsgText,"Here is some text to be displayed in the box.",@LF,@LF)
sMsgText = StrCat(sMsgText,"You can then add additional lines of text to display information to the user. ")
sMsgText = StrCat(sMsgText,"An example might be general information or some kind user agreement.")

iResult = udfMsgBoxOKTimer(iSecsToWait,sMsgTitle,sMsgText)

If !iResult
   Message("Timer","The timer expired.")
Else
   Message("Timer","Button was pushed.")
EndIf

Exit
;------------------------------------------------------------------------------------------------------------------------------------------
;*EOF*




Page Date
2004-05-18
DD-Software
Kapitel zurück / previous Chapter
Main Index
 
Seite zurück / previous page
Backward
Seite vor / next page
Forward
 
Seitenanfang/TopOfPage
Top
Seitenende/EndOfPage
Bottom
MyWbtHelp current version