I have a first question about the behavior of the answer dialog with
MetaCard 2.3.2 and a second question about a scripting challenge that led
me to the first one.

I have on a stack a button which brings up an answer dialog which asks the
user to choose among options, A, B, or C (or cancel).  In order to
accelerate the process, I have been trying to find a way to allow for the
user to hold down one of these keys, a, b, or c, while pressing the button
thereby bypassing the need for this answer dialog opening.

While experimenting with this, I have discovered what is either an
undocumented feature of the answer dialog or an interesting hack.  When I
press the button that has the "answer" command in its script while holding
down the a key, the answer dialog box opens with the button for the choice
"A" highlighted as it would be when pressed.  In a fraction of a second,
the answer dialog closes and the program takes the action that results from
pressing the "A" button of the answer dialog box.  The corresponding thing
works with the b and c keys.

Upon further experimentation with another answer dialog that offers buttons
with the choices "Endgame", "Complete", and "Buttons", I found that a
virtual press on these buttons is gotten by pressing the e, c, and b keys
respectively.  Apparently the first letter of the option is enough.  The
key can be depressed as the answer dialog is opened or can be pressed after
it is open.

I've found no mention of this behavior in the MetaCard reference.  Is this
an undocumented feature, or have I discovered an unintended hack?

Now to my second question. The way I was trying to do my own keyboard
bypass of the dialog was to have the following keyDown handler in the
script for the stack:

    on keyDown X
      put X into LetterBox
      send clearOutBox to me in 2 seconds
    end keyDown

LetterBox is a global variable which the mouseUp handler script of the
button in question checks before giving the "answer" command.  If LetterBox
contains the right letter, then the script takes the appropriate action
rather than bringing up the answer dialog.  The clearOutBox handler simply
empties the global variable LetterBox.

This handler does the job nicely from the stack script.  Unfortunately
having this handler in the stack script also prevents the user from typing
into a field in another part of the stack when this is needed.

I moved this handler to the script for the button.  It appears that if one
sets the autoArm property of the button to true, then the button will
accept the keyboard focus and this keyDown handler works fine from the
button script while not interfering with entering data into other fields
when needed.

My question:  Is there a better way to do what I am trying to do here.
Does anyone see any pitfalls with this approach? (I am nervous because I
find nothing in the documentation that this is how autoArm is supposed to
work for a button.)

John Kiltinen



Archives: http://www.mail-archive.com/metacard@lists.runrev.com/
Info: http://www.xworlds.com/metacard/mailinglist.htm
Please send bug reports to <[EMAIL PROTECTED]>, not this list.

Reply via email to