The advantage of a child window is that it doesn't show up in the task bar, but still has the regular controls (maximize, minimize, full screen, resize etc).
However, it cannot be placed behind the parent window. It always floats above the parentwindow, it seems.
Is there a way to do that?
Move a childwindow behind a parent window.
Move a childwindow behind a parent window.
( PB6.00 LTS Win11 x64 Asrock AB350 Pro4 Ryzen 5 3600 32GB GTX1060 6GB)
( The path to enlightenment and the PureBasic Survival Guide right here... )
( The path to enlightenment and the PureBasic Survival Guide right here... )
Re: Move a childwindow behind a parent window.
Code: Select all
OpenWindow(0,0,0,800,600,"", #PB_Window_SystemMenu| #PB_Window_ScreenCentered)
OpenWindow(1,WindowX(0)-200,WindowY(0),400,300,"",#PB_Window_SystemMenu,WindowID(0))
ButtonGadget(0,10,10,80,24,"RUN")
Repeat
Select WaitWindowEvent()
Case #PB_Event_CloseWindow
Quit = 1
Case #PB_Event_Gadget
Select EventGadget()
Case 0
run ! 1
If run = 1
SetWindowLongPtr_(WindowID(1), #GWLP_HWNDPARENT,GetDesktopWindow_())
SetWindowLongPtr_(WindowID(0), #GWLP_HWNDPARENT,WindowID(1))
BringWindowToTop_(WindowID(0))
Else
SetWindowLongPtr_(WindowID(0), #GWLP_HWNDPARENT,GetDesktopWindow_())
SetWindowLongPtr_(WindowID(1), #GWLP_HWNDPARENT,WindowID(0))
BringWindowToTop_(WindowID(1))
EndIf
EndSelect
EndSelect
Until Quit = 1
Egypt my love
Re: Move a childwindow behind a parent window.
That's one way to do it. I was wondering if we couldn't 'remove' the always-on-top effect of the child windows. I've seen other programs do it. My key reason for doing this is that I don't want to populate the taskbar with all my application windows.
It's not a biggy, but thanks for your example. I might fool around a bit more...
( PB6.00 LTS Win11 x64 Asrock AB350 Pro4 Ryzen 5 3600 32GB GTX1060 6GB)
( The path to enlightenment and the PureBasic Survival Guide right here... )
( The path to enlightenment and the PureBasic Survival Guide right here... )
Re: Move a childwindow behind a parent window.
Something like this (though it's not exactly a childwindow of the other window)?
Code: Select all
OpenWindow(0,0,0,800,600,"", #PB_Window_SystemMenu| #PB_Window_ScreenCentered|#PB_Window_Invisible)
OpenWindow(1,WindowX(0)-200,WindowY(0),400,300,"",#PB_Window_SystemMenu,WindowID(0))
OpenWindow(2,0,0,800,600,"", #PB_Window_SystemMenu| #PB_Window_ScreenCentered)
ButtonGadget(0,10,10,80,24,"RUN")
Repeat
Until WaitWindowEvent()=#PB_Event_CloseWindow
PureBasic 6.04/XProfan X4a/Embarcadero RAD Studio 11/Perl 5.2/Python 3.10
Windows 11/Ryzen 5800X/32GB RAM/Radeon 7770 OC/3TB SSD/11TB HDD
Synology DS1821+/36GB RAM/130TB
Synology DS920+/20GB RAM/54TB
Synology DS916+ii/8GB RAM/12TB
Windows 11/Ryzen 5800X/32GB RAM/Radeon 7770 OC/3TB SSD/11TB HDD
Synology DS1821+/36GB RAM/130TB
Synology DS920+/20GB RAM/54TB
Synology DS916+ii/8GB RAM/12TB