[5.70b1, Qt] DisableWindow and Dialog problem

Post bugreports for the Linux version here
wombats
Enthusiast
Enthusiast
Posts: 664
Joined: Thu Dec 29, 2011 5:03 pm

[5.70b1, Qt] DisableWindow and Dialog problem

Post 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.
ccode
User
User
Posts: 99
Joined: Sat Jun 23, 2018 5:21 pm

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

Post 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.
wombats
Enthusiast
Enthusiast
Posts: 664
Joined: Thu Dec 29, 2011 5:03 pm

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

Post 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.
Post Reply