Data-Entry in a LiveCode form using the tab key

Peter Brigham MD pmbrig at gmail.com
Mon Apr 18 17:02:37 EDT 2011


On Apr 18, 2011, at 12:43 PM, Bob Sneidar wrote:

> Or you can get a list of fields whose focusable is true and locktext is false (because you don't want to tab to labels now do you) and then present the developer with an interface where they can click sequentially on the fields in the order that they want to tab through, then save that list in a property of the card. Your tab through function can then get the short name of the current target, find it in the property list, check to see if it's the last one, get the first item if so, the next item if not, and then focus on that field. 
> 
> The advantage to this approach is that it will work universally for any card. Ideally you would want to copy every editable field on the card to a new one, along with a Cancel and Save button, and then save the list of fields in a property of the original card. 

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

Peter M. Brigham
pmbrig at gmail.com
http://home.comcast.net/~pmbrig






More information about the use-livecode mailing list