Possible bugs in OpenXMLDialog()?
Posted: Wed Jul 16, 2014 4:13 pm
Hi,
How the repro works: Click on the OK button in main dialogue. It opens a parent dialogue (PB 5.22 LTS).
Problem 1:
If you try this on Windows, the ParentID seems somehow ignored. The main window is not behaving like a parent (main window still reacts on clicks, its not not behind parent etc).
Problem 2:
On Linux, the OpenXMLDialog() fails with GTK errors. I have to set a Width and Height parameter?
Someone confirms?
Kukulkan
How the repro works: Click on the OK button in main dialogue. It opens a parent dialogue (PB 5.22 LTS).
Problem 1:
If you try this on Windows, the ParentID seems somehow ignored. The main window is not behaving like a parent (main window still reacts on clicks, its not not behind parent etc).
Problem 2:
On Linux, the OpenXMLDialog() fails with GTK errors. I have to set a Width and Height parameter?
Code: Select all
EnableExplicit
CompilerIf #PB_Compiler_Unicode
#XmlEncoding = #PB_UTF8
CompilerElse
#XmlEncoding = #PB_Ascii
CompilerEndIf
Global XML$
XML$ = "<?xml version='1.0' ?>"+
" <window id='#PB_Any' name='test' text='Gridbox' minwidth='auto' minheight='auto' maxheight='auto' flags='#PB_Window_ScreenCentered | #PB_Window_SystemMenu | #PB_Window_SizeGadget'>"+
" <hbox>"+
" <button name='ok' text='OK' width='100'/>"+
" <button name='cancel' text='Cancel' width='100'/>"+
" </hboox>"+
" </window>"
Procedure ParentDialog(ParentWindow.i)
Protected XML.i
Protected Dialog.i
Protected Event.i, EventType.i, EventGadget.i
XML.i = CatchXML(#PB_Any, @XML$, StringByteLength(XML$), 0, #XmlEncoding)
Dialog.i = CreateDialog(#PB_Any)
If OpenXMLDialog(Dialog.i, XML.i, "test", #PB_Ignore, #PB_Ignore, #PB_Ignore, #PB_Ignore, WindowID(ParentWindow.i)) = 0
Debug "Failed to open parent dialogue! " + DialogError(Dialog.i)
ProcedureReturn
EndIf
SetWindowTitle(DialogWindow(Dialog.i), "Parent")
ResizeWindow(DialogWindow(Dialog.i), #PB_Ignore, WindowY(ParentWindow.i) + WindowHeight(ParentWindow.i, #PB_Window_FrameCoordinate), #PB_Ignore, #PB_Ignore)
; Parent GUI loop
Repeat
Event = WaitWindowEvent()
If Event = #PB_Event_Gadget
EventType.i = EventType()
EventGadget.i = EventGadget()
If EventType = #PB_EventType_LeftClick And EventGadget.i = DialogGadget(Dialog.i, "cancel")
Event = #PB_Event_CloseWindow
EndIf
EndIf
Until Event = #PB_Event_CloseWindow
CloseWindow(DialogWindow(Dialog.i))
EndProcedure
Procedure Main()
Protected XML.i
Protected Dialog.i
Protected Event.i, EventType.i, EventGadget.i
XML.i = CatchXML(#PB_Any, @XML$, StringByteLength(XML$), 0, #XmlEncoding)
Dialog.i = CreateDialog(#PB_Any)
If OpenXMLDialog(Dialog.i, XML.i, "test") = 0
Debug "Failed to open main dialogue! " + DialogError(Dialog.i)
ProcedureReturn
EndIf
SetWindowTitle(DialogWindow(Dialog.i), "Main")
; Main GUI loop
Repeat
Event = WaitWindowEvent()
If Event = #PB_Event_Gadget
EventType.i = EventType()
EventGadget.i = EventGadget()
If EventType = #PB_EventType_LeftClick And EventGadget.i = DialogGadget(Dialog.i, "ok")
ParentDialog(DialogWindow(Dialog.i))
EndIf
If EventType = #PB_EventType_LeftClick And EventGadget.i = DialogGadget(Dialog.i, "cancel")
Event = #PB_Event_CloseWindow
EndIf
EndIf
Until Event = #PB_Event_CloseWindow
CloseWindow(DialogWindow(Dialog.i))
EndProcedure
Main()
End
Kukulkan