setting pointer location

Alan Gayne alanira9 at mac.com
Fri Dec 27 12:45:01 EST 2002


On Friday, December 27, 2002, at 10:54 AM, Rob Cozens wrote:

> In HyperCard and Revolution, I control cursor positioning by locking 
> all fields initially and unlocking & tabbing to individual fields.
>
> I personally think the HIG guideline against moving the cursor should 
> NOT be accepted at face value: if it makes sense to you in your 
> design, do it and see how it turns out.


Hi Rob - and happy holidays to all fellow listees,

This may be entirely different  way to look it this, but when it comes 
to "smart" data entry, I don't worry about the cursor at all.  I lock 
ALL of the fields - and then, depending on the required situation, I 
use a predetermined sequence of "ask" and/or "answer" dialogs to fill 
the fields in the order I want them filled.

the scripts for an "ask" sequence might look like this:

on askMeEntry theIDList
   repeat for each item theID in theIDList
     send "askMeTheQuestion" to fld ID theID
   end repeat
end askMeEntry

on askMeTheQuestion
   put "255,255,100" into activeColor
   put the short name of the target into theQuestion
   put the short id of the target into IDnum
   set the backgroundColor of fld id IDnum to activeColor
   ask "Please enter " & theQuestion with fld id IDnum
   put it into fld id IDnum
   set the backgroundColor of fld id IDnum to "255,255,204"
end askMeTheQuestion

In such an arrangement the user gets a visual cue to which field is 
being filled by the temporary change in background color - 
"activeColor".  Naming the fields appropriately generates an 
intelligent prompt.  You can have a generic "askMeTheQuestion" script 
such as the above sample, resident in the stack script.  But if you 
need additional specialized processing, you can put a customized 
"askMeTheQuestion" script in the particular field.  Very, very 
versatile.	

Locking the fields also provides the added benefit (IMHO) of protecting 
data from "accidental editing".  If I DO want to give the user the 
ability to edit a particular field or group of fields, I will typically 
use the following script:

on mouseUp
	if the optionKey is down then askMeTheQuestion
end mouseUp

I have used this technique and numerous variations thereof, with great 
success in Hypercard for many, many years, and it works even better in 
RunRev due to the greater script control possible.  And for ME it's a 
LOT easier than trying to get fields to tab in correct order and a LOT 
easier when you want to change that order.

I have no idea if this approach is offensive to the "HIG police" but it 
really works for me and my end users take to it with great ease.

Regards to all,

Alan





More information about the Use-livecode mailing list