Interesting question - here's a quick attempt I just put together to explore it. I'm not sure if this will do exactly what you need, but it disables the "main" window when the modal one is launched and reenables it when the modal one closes:
Strict
Local window:TGadget = CreateWindow( "Main", 10,10, 400,300 )
Local button1:TGadget = CreateButton( "Launch modal window", 50,50, 150,24, window, BUTTON_PUSH )
Local text:TGadget = CreateTextArea( 50,110, 100,24, window )
Local buttontest:TGadget = CreateButton( "Test Activity", 50,140, 100,24, window, BUTTON_PUSH )
Local windowmodal:TGadget = CreateWindow( "Modal", 200,200, 200,150 )
Local buttonmodal:TGadget = CreateButton( "Close modal window", 10,10, 120,24, windowmodal, BUTTON_PUSH )
Local modalhidden = True
HideGadget windowmodal
Repeat
WaitEvent
If EventID() = EVENT_APPRESUME Then
ActivateGadget window
If Not modalhidden Then ActivateGadget windowmodal
EndIf
Select EventSource()
Case buttontest
Select EventID()
Case EVENT_GADGETACTION
SetTextAreaText( text, Int( TextAreaText( text ) ) + 1 )
End Select
Case window
Select EventID()
Case EVENT_WINDOWCLOSE
End
End Select
Case button1
Select EventID()
Case EVENT_GADGETACTION
ShowGadget windowmodal
modalhidden = False
DisableGadget window
End Select
Case buttonmodal
Select EventID()
Case EVENT_GADGETACTION
EnableGadget window
HideGadget windowmodal
modalhidden = True
End Select
Case windowmodal
Select EventID()
Case EVENT_WINDOWCLOSE
EnableGadget window
HideGadget windowmodal
modalhidden = True
End Select
End Select
Forever
In this example, you can't do anything with the main window or its gadgets once the modal one is launched. The EVENT_APPRESUME checking makes sure that the right one is brought back to front when you alt-tab away and back. I have to use a "modalhidden" flag since GadgetHidden doesn't seem to work with windows (it always returns false even if the window is hidden).
I've only tried this in Windows, not Mac OS or Linux.