Page 2 of 2

Re: Tab order through controls

Posted: Fri Sep 30, 2022 8:36 pm
by Klaus
SparkOut wrote: Fri Sep 30, 2022 8:28 pmJust set the autotab property to true, no need for additional handlers
But then it depends on the number of visible lines in the field until a RETURN in the field "tabs" to the next control!
Know what I mean? See attached screenshot, I could add a couple of RETURNS to the field until it wnet to the next control with AUTOTAB = true!
Bildschirmfoto 2022-09-30 um 21.32.39.png
Bildschirmfoto 2022-09-30 um 21.32.39.png (11.05 KiB) Viewed 4028 times
This li'l sucker will execute immediatley with the first RETURN:

Code: Select all

on returnInField
    type TAB
end returnInField
:)

Re: Tab order through controls

Posted: Fri Sep 30, 2022 8:56 pm
by SparkOut
Aha, yes, I have always used autotab with a single line field. It doesn't really make sense to me have a multi-line field with autotab set.

Re: Tab order through controls

Posted: Fri Sep 30, 2022 9:54 pm
by Klaus
SparkOut wrote: Fri Sep 30, 2022 8:56 pmIt doesn't really make sense to me have a multi-line field with autotab set.
TRUE! :-D
I only wanted to add this for the sake of completeness.

Re: Tab order through controls

Posted: Fri Sep 30, 2022 11:03 pm
by aetaylorBUSBnWt
SparkOut wrote: Fri Sep 30, 2022 8:28 pm
aetaylorBUSBnWt wrote: Fri Sep 30, 2022 8:19 pm
Klaus wrote: Fri Sep 30, 2022 7:58 pm This will do, the field has to have its AUTOTAB property to true:

Code: Select all

on returnInField
    type TAB
end returnInField
ACK!

Sometimes I can't find the simplest things.

Thanks!
much simpler is what Jwack said.

Just set the autotab property to true, no need for additional handlers
Granted that is the simplest, but I am also doing additional field validation checking at that time.
I have done that implementation in the "on tabKey" handler, so it seemed simplest to send everything to one handler for validation.
Yes, I could turn on the "Tab on Return" property found under the Basic tab for the Field properties and then I would have different code in the enterInField and returnInField handlers, because I still need to do the validation.

Some of these questions are to get you experts to expand upon your answers because they don't immediately make sense to us beginners.(or me with marblehead).
// I have the following routines on the Card containing the fields of interest
// so that I don't have to duplicate them for all the date fields.
//Create a custom property called "isDate" whose value is 1 for DATE fields
//Then the following will check the date value when exiting the field.

on tabKey
if target is not empty and the isDate of the target is 1 then
if validDate() then
pass tabKey //allow to leave if date valid
end if
else
pass tabKey //allow to leave if field empty
end if
end tabKey

on enterInField
if the isDate of the target is 1 then
type TAB //go to date validator
else
pass enterInField //not a date field
end if
end enterInField

on returnInField
if the isDate of the target is 1 then
type TAB //go to date validator
else
pass returnInField //not a date field
end if
end returnInField

Re: Tabo order through controls

Posted: Fri Sep 30, 2022 11:24 pm
by aetaylorBUSBnWt
SparkOut wrote: Fri Apr 03, 2015 10:23 pm Tab order is set by the layer of the control in LiveCode. Look in the property inspector and will see you can bring the object nearer the top or bottom. pressing tab will move from bottom to top.

OK, possibly things have changed by October 2022.
I believe you now do this with the Project Browser.
You open up the Card you are interested in and then you can drag the fields up and down to change their order in card's list of fields. That changes the Layer number for the fields based on where you leave the field in the list.
You can still visit each Field's property inspector and change the Layer value under the Position tab.

Re: Tab order through controls

Posted: Sun Oct 02, 2022 11:43 pm
by bobcole
Jacque mentioned the traversalOn property in a previous post.
by jacque ยป Sat Apr 04, 2015 11:09 am
...turn off the traversalon property...
I think this good comment needs reinforcement regarding fields.

First, arrange fields in the Project Browser to the order desired (so the fields' layers follow sequentially). The tab key will move the focus to the next field.
Second, for any other fields that shouldn't receive focus, set the other fields' traversalOn property to false by clicking off the "Focus with Keyboard" box in the property inspector or use this code:

Code: Select all

set the traversalOn of field "tField" to false
See the "traversalOn" entry in the Dictionary for more information regarding groups and other controls. According to the Dictionary, the stack's "lookAndFeel" property plays a role in this story, too.

According to the Dictionary, the "autoTab" property: specifies whether pressing Return (or Enter) moves to the next field.

I hope that provides some clarity rather than confusion,
Bob

Re: Tab order through controls

Posted: Mon Oct 03, 2022 12:24 pm
by stam
bobcole wrote: Sun Oct 02, 2022 11:43 pm According to the Dictionary, the "autoTab" property: specifies whether pressing Return (or Enter) moves to the next field.
and in the IDE the tickbox 'tab on return' in a fields property inspect sets or clears the autoTab property...