How to tell is an "answer file" dialog is up?

Richard Gaskin ambassador at fourthworld.com
Fri Oct 5 11:26:27 EDT 2007


Mark Schonewille wrote:
> Richard,
> 
> I use the suspend message to disable the menubar before the answer or  
> ask dialog shows up. I have modified the ask and answer dialogs to  
> send a resume message to the topstack when they close and enable the  
> menubar again when the resume message is received. (No modification  
> is needed to have the suspend message sent.)

Thanks for the input.  For Rev-based sheets it's not been hard to 
determine when they're sheeted and adjust my menus accordingly.

The hard part is determining when a system dialog ("ask file" or "answer 
file") is a sheet over a Rev window.  In such cases the menubar will 
need to be updated, and the mouseDown message is sent to the group as 
one would expect.  But without a way to determine that the system dialog 
is up, I can't know whether to adjust the menus for a sheet or for a 
fully available document.

For the app I'm working on now I got lucky, since all places that bring 
up an "ask file" or "answer file" dialog do so by calling handlers in a 
centralized common library.  So it was only a few minutes' work to 
modify those library handlers to set a flag before the dialog is called, 
and then clear that flag once the dialog is dismissed, a la:

    global gfwDialogMenuUpdateFlagsA
    put the short name of this stack into tStack
    put "true" into gfwDialogMenuUpdateFlagsA[tStack]
    ask file "Save document as:" as sheet
    put it into tFile
    put empty into gfwDialogMenuUpdateFlagsA[tStack]
    --- do save, etc.

Then in the UpdateMenubar handler triggered by a mouseDown in the menu 
group (and now in v2.8.1 also trigger by any attempt to use a keyboard 
shortcut -- THANK YOU RUNREV!), I just check that array and update the 
menus for sheet mode as needed.

Sure, it's a kludgy workaround, but it got me through the day.

Perhaps down the road the folks at RunRev might consider a new stack 
property which tells us when a stack is blocked by a sheet over it.

-- 
  Richard Gaskin
  Managing Editor, revJournal
  _______________________________________________________
  Rev tips, tutorials and more: http://www.revJournal.com



More information about the use-livecode mailing list