Data-Entry in a LiveCode form using the tab key
Peter Brigham MD
pmbrig at gmail.com
Tue Apr 19 08:14:09 EDT 2011
Solved one part of the problem -- there has to be a "wait with messages" after the mouseclick. Without this the mousecontrol always returns empty. I have no idea why.
I haven't yet figured out how to change the cursor to ensure the user knows s/he is still in the doFieldOrder mode -- it doesn't stick after the first click. If you will be actually using this technique then I can investigate further to find a fix for that.
The following works except for the cursor problem. Right clicking ensures that the mouseclick is sent even with unlocked fields.
on doFieldOrder
answer "RIght-click on the fields in the order you want." \
&& "When done, press the commandkey." as sheet
repeat
set the defaultcursor to hand
-- why does this only work the first time??
wait until (the mouseclick or the commandkey is down)
if the commandkey is down then exit repeat
wait 1 tick with messages
put word 2 of the mousecontrol into mc
put the long id of control mc into fID
if not (fID begins with "field") then -- not a field
answer "You must click on a field!"
set the defaultcursor to hand -- try again
next repeat
end if
select the text of fID -- user feedback
wait 5
select empty
put word 3 of fID & cr after fldList -- short id
set the defaultcursor to hand -- try again
end repeat
delete char -1 of fldList
put fldList
-- set the tabOrderList of this card to fldList
set the defaultcursor to empty
beep -- user feedback
end doFieldOrder
-- Peter
Peter M. Brigham
pmbrig at gmail.com
http://home.comcast.net/~pmbrig
On Apr 18, 2011, at 6:39 PM, Bob Sneidar wrote:
>>>
>> 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
>
> WHOOPS! Should be:
>> if the commandkey is down then exit REPEAT
>
> But theFieldList still returns empty, even after I put this into a mouseUp handler. Also, I noticed that the selection did not change. Apparently, mouseUp messages are not getting sent to the object I am clicking on because I am within a mouseUp message already I guess?? Doesn't sound right though.
>
> Bob
>
>
>
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
More information about the use-livecode
mailing list