Code: Select all
Procedure Ev2()
Select Event()
Case #PB_Event_Gadget
Select EventGadget()
Case 2
PostEvent(#PB_Event_Gadget, 1, 1)
Case 3
PostEvent(#PB_Event_Gadget, 1, 1)
PostEvent(#PB_Event_CloseWindow, 2, 0)
EndSelect
Case #PB_Event_CloseWindow
UnbindEvent(#PB_Event_Gadget, @Ev2(), 2)
UnbindEvent(#PB_Event_CloseWindow, @Ev2(), 2)
CloseWindow(2)
EndSelect
EndProcedure
Procedure Ev1()
Select Event()
Case #PB_Event_Gadget
Select EventGadget()
Case 0
OpenWindow(2, 0, 0, 400, 400, "1234", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
ButtonGadget(2, 10, 10, 200, 20, "No Bug")
ButtonGadget(3, 10, 40, 200, 20, "Bug!!!!")
BindEvent(#PB_Event_Gadget, @Ev2(), 2)
BindEvent(#PB_Event_CloseWindow, @Ev2(), 2)
Default
MessageRequester("", Str(EventGadget()))
EndSelect
Case #PB_Event_CloseWindow
UnbindEvent(#PB_Event_Gadget, @Ev1(), 1)
UnbindEvent(#PB_Event_CloseWindow, @Ev1(), 1)
End
EndSelect
EndProcedure
If OpenWindow(1, 0, 0, 222, 200, "Main", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
ButtonGadget(0, 10, 10, 200, 20, "Open Window")
ButtonGadget(1, 10, 40, 200, 20, "", #PB_Button_Left) : HideGadget(1, 1)
BindEvent(#PB_Event_Gadget, @Ev1(), 1)
BindEvent(#PB_Event_CloseWindow, @Ev1(), 1)
Repeat : WaitWindowEvent() : ForEver
EndIf
Click on the button "Open Window".
In another window, click on the button "Bug!!!!"
Why the main window is lost focus and not displayed MessageRequester?
When you click on the button "No Bug", no problem.