mouseDown/Up - no actions when not on buttons

Silver, Jason jsilver at
Tue Feb 8 17:54:54 EST 2005

Hello (again) :)  After some very useful advice from Jacqueline Landman
Gay at Hyperactive, I've changed the structure of my mobile phone sim
tool.  Now, instead of the buttons being on a palette, they're grouped
and behave like a background, showing up on every card.  When buttons
are pressed, they send a custom ButtonPress message with the name of the
button being pressed to the card.  The card then has a switch statement,
and does some action based on which button was pressed.

The current card I'm working on is a Login type screen, with two
focusable/editable fields, User ID and Password.  (Please see my shared
stack in RevOnline's User Spaces; the username is jsilver).  In the
switch statements, I have this script when the user presses up (or

case navUp
  -- Determine which text field the user is currently in
  put the short name of the selectedField into activeField
  if activeField = "User ID" then
    focus on field "Password"
  else -- The user must be in the password field
    focus on field "User ID"
  end if

This works all well and good, except when pressing on an area that's not
a button (in my stack, the purpleish area).  The cursor then disappears
from either the User ID or Password fields, and then when pressing Up or
Down, the following error occurs (because the focus is not in a field):

Type: Chunk: no target found
Object: Login Screen
Line: put the short name of the selectedField into activeField

Basically, I never want the focus to leave either the User ID or
Password fields; this simulation is supposed to be controlled solely by
the buttons placed in the "Buttons" group.  Is there an easy way to
block the mouseUp (or mouseDown?) handler from doing anything when not
on those buttons?  I've tried adding "exit mouseDown" type handlers in
the card and stack, but this doesn't do anything.  Any help is

Thanks again!

Jason Silver
Human Factors Engineer, Sr.
(858) 845-3444
jsilver at 

More information about the use-livecode mailing list