CreateDialog + OpenXMLDialog + #PB_Any
Posted: Thu Aug 21, 2014 4:18 pm
I think this is a bug in implementation, but I do have to check first.
The idea is that when you click a button, the XML Dialog window will show, and then the only thing you can do is then close it.
If I have the CreateDialog and the XML window id set to the same value, you can then trap that EventWindow().
If you are using #PB_Any, you get one value with CreateDialog() and another with the OpenXMLDialog(). Which makes trapping events to that window impossible.
Am I missing something here?
The idea is that when you click a button, the XML Dialog window will show, and then the only thing you can do is then close it.
If I have the CreateDialog and the XML window id set to the same value, you can then trap that EventWindow().
If you are using #PB_Any, you get one value with CreateDialog() and another with the OpenXMLDialog(). Which makes trapping events to that window impossible.
Am I missing something here?
Code: Select all
Declare Launch_Click()
OpenWindow(0, 0,0,640,480, "XML Builder", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
EditorGadget(1, 0, 24, 640,480-24)
ButtonGadget(2, 580,0,60,24, "Launch")
BindGadgetEvent(2, @Launch_Click())
SetGadgetText(1,
"<window id='#PB_Any' name='test' text='test' minwidth='auto' minheight='auto' flags='#PB_Window_ScreenCentered | #PB_Window_SystemMenu | #PB_Window_SizeGadget'>" + #CRLF$ +
" <panel>" + #CRLF$ +
" <tab text='First tab'>" + #CRLF$ +
" <vbox expand='item:2'>" + #CRLF$ +
" <hbox>" + #CRLF$ +
" <button text='button 1'/>" + #CRLF$ +
" <checkbox text='checkbox 1'/>" + #CRLF$ +
" <button text='button 2'/>" + #CRLF$ +
" </hbox>" + #CRLF$ +
" <editor text='content' height='150'/>" + #CRLF$ +
" </vbox>" + #CRLF$ +
" </tab>" + #CRLF$ +
" <tab text='Second tab'>" + #CRLF$ +
" </tab>" + #CRLF$ +
" </panel>" + #CRLF$ +
"</window>")
Procedure Launch_Click()
Protected xml$ = GetGadgetText(1)
#Xml = 99
If CatchXML(#Xml, @xml$, StringByteLength(xml$), 0, #PB_Unicode) And
XMLStatus(#Xml) = #PB_XML_Success
dialog = CreateDialog(#PB_Any)
If dialog And
OpenXMLDialog(dialog, #Xml, "test")
Repeat
event = WaitWindowEvent()
window = EventWindow()
Until event = #PB_Event_CloseWindow And window = dialog
FreeDialog(dialog)
Else
Debug "Dialog error: " + DialogError(dialog)
EndIf
Else
Debug "XML error: " + XMLError(#Xml) + " (Line: " + XMLErrorLine(#Xml) + ")"
EndIf
EndProcedure
Repeat
event = WaitWindowEvent()
window = EventWindow()
Until event = #PB_Event_CloseWindow And window = 0