Hiding an inactive modal window
Posted: Fri Sep 20, 2024 8:32 pm
if the main window is activated, then hide the test window by hovering the mouse cursor over the canvas, after which the main window deactivation events will occur. (it's bad)
if the main window is activated, then show the test window by hovering the mouse cursor over the canvas, after which the main window deactivation events will not occur. (it's good)
why does this happen in the first case?
tested on the windows
if the main window is activated, then show the test window by hovering the mouse cursor over the canvas, after which the main window deactivation events will not occur. (it's good)
why does this happen in the first case?
tested on the windows
Code: Select all
Global mainwin = 0
Global testwin
If OpenWindow(mainwin, 0, 0, 600, 400, "Main Window", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
TextGadget(-1,5,50,40,24, "show")
CanvasGadget(0,5,70,40,24)
TextGadget(-1,50,50,40,24, "hide")
CanvasGadget(1,50,70,40,24)
OpenWindow(11,0,0,400,200,"11", #PB_Window_NoActivate|#PB_Window_WindowCentered | #PB_Window_Tool,WindowID(mainwin))
mainwin = 11 ; comment/uncoment to see
OpenWindow(12,0,0,200,100,"12", #PB_Window_NoActivate|#PB_Window_WindowCentered | #PB_Window_Tool,WindowID(mainwin))
testwin = 12
Repeat
Select WaitWindowEvent()
Case #PB_Event_CloseWindow
Quit = 1
Case #PB_Event_ActivateWindow
Debug "active - "+EventWindow()
Case #PB_Event_DeactivateWindow
Debug "deactive - "+EventWindow()
Case #PB_Event_Gadget
Select EventGadget()
Case 0
HideWindow(testwin, 0, #PB_Window_NoActivate )
Case 1
HideWindow(testwin, 1, #PB_Window_NoActivate )
EndSelect
EndSelect
Until Quit = 1
EndIf