"exit to top" within modal: bug or misconception?

Richard Gaskin ambassador at fourthworld.com
Tue Mar 10 10:59:17 EDT 2009


While it's certainly primitive to use answer dialogs for debugging, 
sometimes it's convenient.  That is, unless you make the mistake of 
doing so within a loop.

In HC, SC, OMO and others, when an answer dialog is up you can type 
Cmd-. to not only close the dialog but also exit to top.

So it seemed reasonable enough that since I'm using the MC IDE and am 
keen to make changes to it whenever I want some affordance, it should be 
simple enough to add something to MC's answer dialog to make that 
happen, no?

No.

I added this to my answer dialog:

on commandKeyDown pKey
  if ("dev" is in the environment) AND (pKey is ".") then
     close this stack
     exit to top
  else
     pass commandKeyDown
end commandKeyDown

Then to test it I put this in a button:

on mouseUp
   repeat 5
     answer "test"
   end repeat
end mouseUp

Then I click my button, the answer dialog appears, and with great 
anticipation I type Cmd-.

The dialog went away sure enough, but then came back immediately.  This 
was repeated another four times until the loop ended.

Turns out this behavior is the same with custom modals as well.

So when should "exit to top" be honored?  Is my expectation that it 
should be honored within a modal unreasonable, or is this a bug?

--
  Richard Gaskin
  Fourth World
  Revolution training and consulting: http://www.fourthworld.com
  Webzine for Rev developers: http://www.revjournal.com



More information about the use-livecode mailing list