Data-Entry in a LiveCode form using the tab key

Bob Sneidar bobs at twft.com
Mon Apr 18 18:34:05 EDT 2011


That may work too, only a couple things might happen. The user may start clicking on the fields without dismissing the Answer Dialog, which of course won't work. The user might also get distracted and forget he was in the "Set Field Order" mode unless you supplied some distinct visual feedback. The user might click on a Label Field. You would need to check for that. For a developer function this would work fine, but if you were giving end users this ability it would need a bit more in the way of feedback. 

Also to test this I made a simple stack with this in the card script and a button that calls it:

on doFieldOrder
    put empty into theFieldList
    
    repeat
        if the commandkey is down then exit doFieldOrder
        wait until the mouseclick
        put the clickfield & cr after theFieldList
        wait 1 second
        select empty
    end repeat
    put theFieldList
end doFieldOrder

I have to command click to get out of it, not just hold the command key down. Changing my wait to: 
wait until the mouseclick or the commandKey is down
and putting the check for the commandKey right after that works. 

Also, I get nothing in theFieldList, having to do I think with this from the Livecode Dictionary:

"If the field is unlocked, mouseDown and mouseUp messages are not sent when the user clicks in the field (unless the user right-clicks or holds down the Control key while clicking). Use the clickField function within a selectionChanged handler to determine what field the user is editing."

However, even with right-clicks, the clickField returns empty. Not sure why. Or it may be that this function only works within mouseDown, mouseUp or selectionChanged:"Use the clickField function within a mouseDown, mouseUp, or selectionChanged handler to determine which field the user clicked, in order to provide hypertext (clickable text) or take some action based on the click."

Bob


On Apr 18, 2011, at 2:02 PM, Peter Brigham MD wrote:

> You wouldn't have to make a whole new card, just a menuitem which launches something like (not tested):
> 
> on doFieldOrder
>   answer "Click on the fields in the order you want. When done, press the commandkey."
>   repeat
>      if the commandkey is down then exit repeat
>      wait until the mouseclick
>      put word 2 of the clickfield into cf -- fld nbr
>      if cf = empty then -- not a field
>         answer "You must click on a field!"
>         next repeat
>      end if
>      select the text of fld cf -- user feedback
>      wait 5
>      select empty
>      put the short id of fld cf & cr after fldList
>   end repeat
>   delete char -1 of fldList
>   set the tabOrderList of this card to fldList
>   beep -- user feelback
> end doFieldOrder
> 
> then use the customprop to find the id of the next field in the list when the user tabs out of the field.
> 
> -- Peter




More information about the use-livecode mailing list