Sorry the missing space characters in the topic's title, I was limited to a fixed topic title length.
Try the following code:
The example creates two windows and two buttons. If you click on a button, two notify boxes (requesters) open, first one of them, then the second. Normally the second opens directly after the first, except you do the following:
Click Button1.
Leave the requester opened and press Button2.
Now go back to the first requester and press "OK".
The second requester for the first window doesn't appear.
The problem doesn't only apply to the Notify function, it applies to all functions entering a modal loop to wait until their requester closes, polling the system, which could make other parts of code to also open a requester, blocking the first requester function's modal loop to exit.
I added the DocStack function to show you which function calls which.
Is there a way how I can make the second requester always appear directly after the first one closes?
I think it would be usefull if we had the possibility to open a requester without entering a modal loop.
Try the following code:
Strict Framework brl.blitz Import brl.win32maxgui Import brl.fltkmaxgui Import brl.cocoamaxgui Global Stop AddHook EmitEventHook , Hook Global Window1:TGadget = CreateWindow ( "Window1" , 100 , 100 , 200 , 200 , Desktop ( ) , WINDOW_TITLEBAR ) Global Button1:TGadget = CreateButton ( "Button1" , 0 , 0 , 100 , 24 , Window1 ) Global Window2:TGadget = CreateWindow ( "Window2" , 400 , 100 , 200 , 200 , Desktop ( ) , WINDOW_TITLEBAR ) Global Button2:TGadget = CreateButton ( "Button2" , 0 , 0 , 100 , 24 , Window2 ) DocStack "While" , "Not Stop" While Not Stop WaitSystem Wend EndDocStack Function Hook:Object ( ID , Data:Object , Context:Object ) Local Event:TEvent = TEvent ( Data ) Select Event.source Case Null Case Window1 If Event.id = EVENT_WINDOWCLOSE Stop = True EndIf Case Button1 If Event.id = EVENT_GADGETACTION DocStack "Notify" , "~qButton1: notify A~q" Notify "Button1: notify A" EndDocStack DocStack "Notify" , "~qButton1: notify B~q" Notify "Button1: notify B" EndDocStack EndIf Case Window2 If Event.id = EVENT_WINDOWCLOSE Stop = True EndIf Case Button2 If Event.id = EVENT_GADGETACTION DocStack "Notify" , "~qButton2: notify A~q" Notify "Button2: notify A" EndDocStack DocStack "Notify" , "~qButton2: notify B~q" Notify "Button2: notify B" EndDocStack EndIf EndSelect Return Data EndFunction Global DocStackNames$ [] Function DocStack ( Func$ , Param$ = "" ) If Param Param = " " + Param EndIf WriteStdout ( ( Func + Param ) [ -2 * Len DocStackNames ..] + "~n" ) DocStackNames = DocStackNames [ -1 ..] DocStackNames [ 0 ] = Func EndFunction Function EndDocStack ( ) Local Func$ = DocStackNames [ 0 ] DocStackNames = DocStackNames [ 1 ..] WriteStdout ( ( "End" + Func ) [ -2 * Len DocStackNames ..] + "~n" ) EndFunction
The example creates two windows and two buttons. If you click on a button, two notify boxes (requesters) open, first one of them, then the second. Normally the second opens directly after the first, except you do the following:
Click Button1.
Leave the requester opened and press Button2.
Now go back to the first requester and press "OK".
The second requester for the first window doesn't appear.
The problem doesn't only apply to the Notify function, it applies to all functions entering a modal loop to wait until their requester closes, polling the system, which could make other parts of code to also open a requester, blocking the first requester function's modal loop to exit.
I added the DocStack function to show you which function calls which.
Is there a way how I can make the second requester always appear directly after the first one closes?
I think it would be usefull if we had the possibility to open a requester without entering a modal loop.