I got an gadget number too large error at line 26 in below code. If I use line 14 an 15 (instaed of 15 and 26). It work OK. Any idea?
6.01 x64 win 10, both CBE and ASM BE.
Code: Select all
Procedure TimeOut(DurationSec.i)
Protected.s Message$="Time remaining : "
Protected.s Button$= "Push this button to ABORT"
Protected.i Main,Message,Abort,TimeWinTimer,EditorFont,Event
Enumeration
#Message
EndEnumeration
EditorFont=LoadFont(#PB_Any, "SimHei",16);,#PB_Font_Bold)
SetGadgetFont(#PB_Default, FontID(EditorFont))
Main=OpenWindow(#PB_Any, 0, 0, 500, 250, "Message", #PB_Window_MinimizeGadget| #PB_Window_ScreenCentered )
;TextGadget(#Message, 20, 20, 400, 200,Message$+Str(DurationSec)); ------------This line works OK
Message=TextGadget(#PB_Any, 20, 20, 400, 200,Message$+Str(DurationSec)); ------------This line does not work
Abort=ButtonGadget(#PB_Any,100,150, 300, 30, Button$)
If DurationSec>0
TimeWinTimer=AddWindowTimer(Main, #PB_Any, 1000) ;
EndIf
Repeat
event = WaitWindowEvent(20)
If Event = #PB_Event_Timer
DurationSec-1
;TextGadget(#Message, 20, 20, 400, 200,Message$+Str(DurationSec)); ------------This line works OK
TextGadget(Message, 20, 20, 400, 200,Message$+Str(DurationSec)); ------------This line does not work
If DurationSec<=0
MessageRequester("Info","Time Out")
EndIf
EndIf
If (EventGadget()=Abort )
CloseWindow(Main)
ProcedureReturn
EndIf
Until event = #PB_Event_CloseWindow
CloseWindow(Main)
EndProcedure
TimeOut(15)
Code: Select all
SetGadgetText(Message,Message$+Str(DurationSec))
Thanks
Allen