Page 1 of 1

[5.70b1, Qt] DisableWindow and Dialog problem

Posted: Thu Jul 19, 2018 1:37 pm
by wombats
When using DisableWindow to disable a parent window of a Dialog, the Dialog is also disabled.

Code: Select all

Enumeration
  #Window1
  #Window2
  #Button
  #XML
EndEnumeration

XML$ = "<window id='#PB_Any' name='Child' text='test' minwidth='auto' minheight='auto' flags='#PB_Window_WindowCentered | #PB_Window_SystemMenu'></window>"

ParseXML(#XML, XML$)

Procedure OnChildWindowClosed()
  CloseWindow(DialogWindow(#Window2))
  FreeDialog(#Window2)
  DisableWindow(#Window1, 0)
EndProcedure

Procedure OnButtonPressed()
  CreateDialog(#Window2)
  OpenXMLDialog(#Window2, #XML, "Child", 0, 0, 200, 150, WindowID(#Window1))
  BindEvent(#PB_Event_CloseWindow, @OnChildWindowClosed(), DialogWindow(#Window2))
  DisableWindow(#Window1, 1)
EndProcedure

OpenWindow(#Window1, 0, 0, 300, 200, "", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
ButtonGadget(#Button, 10, 10, 90, 32, "Open...")
BindGadgetEvent(#Button, @OnButtonPressed())

Repeat
Until WaitWindowEvent() = #PB_Event_CloseWindow And EventWindow() = #Window1
It works as expected without the Qt subsystem.

Re: [5.70b1, Qt] DisableWindow and Dialog problem

Posted: Thu Jul 19, 2018 6:44 pm
by ccode
Hello!

I think that's a normal behavior under QT.
Your child window is subordinate to your main window. If your main window is disabled, your child window will not work anymore.
I think you should therefore change your window concept.

Re: [5.70b1, Qt] DisableWindow and Dialog problem

Posted: Thu Jul 19, 2018 10:38 pm
by wombats
Ah, I did not know that.

Seems I can change "windowModality" to true to achieve the same effect, but now I need the child window to always stay on top of the parent window. StickyWindow kind of works, but it keeps it on top of EVERY window, even when its parent window doesn't have the focus.

Qt has a "Qt::WindowStaysOnTopHint" flag, but I can't find a way to access it from within PB.