AddWindowTimer and Diologs

Just starting out? Need help? Post your questions and find answers here.
tj1010
Posts: 218
Joined: Wed May 27, 2015 1:36 pm
Contact:

AddWindowTimer and Diologs

Post by tj1010 »

Code: Select all

AddWindowTimer(DialogWindow(#dialog),1,300)
Is this suppose to work?
Fred
Site Admin
Posts: 1821
Joined: Mon Feb 24, 2014 10:51 am

Re: AddWindowTimer and Diologs

Post by Fred »

It should, as dialogs are based on regular window, so every window related functions should be available to dialogs as well. If not, feel free to submit a bug report !
User avatar
Peter
Posts: 1197
Joined: Mon Feb 24, 2014 10:17 pm
Location: 127.0.0.1:9080
Contact:

Re: AddWindowTimer and Diologs

Post by Peter »

@tj1010: no problem here:

Code: Select all

#Dialog = 0
#Xml = 0
#Timer = 0

Procedure TimerEvent()
  Debug "Tick! (" + FormatDate("%hh:%ii:%ss", Date()) + ")"
EndProcedure

XML$ = "<window id='0' name='test' text='Dialog example' minwidth='300' minheight='300'>" +
       "</window>"

If ParseXML(#Xml, XML$) And XMLStatus(#Xml) = #PB_XML_Success
  If CreateDialog(#Dialog) And OpenXMLDialog(#Dialog, #Xml, "test")
    Debug "Dialog created"
    AddWindowTimer(DialogWindow(#Dialog), #Timer, 1000)
    BindEvent(#PB_Event_Timer, @TimerEvent(), DialogWindow(#Dialog), #Timer)
  Else  
    Debug "Dialog error: " + DialogError(#Dialog)
  EndIf
Else
  Debug "XML error: " + XMLError(#Xml) + " (Line: " + XMLErrorLine(#Xml) + ")"
EndIf
Greetings ... Peter
Post Reply