Page 1 of 1

AddWindowTimer and Diologs

Posted: Wed Apr 13, 2016 6:07 am
by tj1010

Code: Select all

AddWindowTimer(DialogWindow(#dialog),1,300)
Is this suppose to work?

Re: AddWindowTimer and Diologs

Posted: Thu Apr 14, 2016 11:01 am
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 !

Re: AddWindowTimer and Diologs

Posted: Thu Apr 14, 2016 1:41 pm
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