Page 1 of 2

Move with tab on combo box

Posted: Sun Apr 07, 2019 10:50 am
by AlessioForconi
I have text boxes and a combo box.
I have set the layers correctly so that with tab I move between the text in the order I want.
What I would like to do, which is not succeeding, is to move from a text on the combo and, maybe but not fundamental, to open the entries.
It can be done?

Thank you.

Re: Move with tab on combo box

Posted: Sun Apr 07, 2019 4:51 pm
by jacque
What operating system are you using? Not all of them support tabbing to buttons by default. If the OS supports it, layer the button in the right order and it should work.

Re: Move with tab on combo box

Posted: Sun Apr 07, 2019 4:53 pm
by AlessioForconi
jacque wrote:
Sun Apr 07, 2019 4:51 pm
What operating system are you using?
OS X

Re: Move with tab on combo box

Posted: Sun Apr 07, 2019 6:03 pm
by jacque
That explains it then. Macs don't support tabbing to buttons by default. I think there's a system setting that will let you do that, but if your app will be distributed to others then it won't work for them.

Re: Move with tab on combo box

Posted: Sun Apr 07, 2019 11:26 pm
by dunbarx
I am missing something. I am on a Mac, and if there are three fields and a comboBox on a card, tabbing proceeds naturally through each field and the comboBox, round and round forever. The current text displayed in the combo is selected in its turn.

If, however, I select a menuItem from that ComboBox, LC places the cursor at the beginning of the text of the field. Hitting the tabKey will not then pass focus to the next field unless I physically place the cursor somewhere in the text by hand INCLUDING the very same place that LC did, that is, before the text. There is something different from the cursorLoc that LC sets upon selecting a menuItem from the cursorLoc that I set with my mouse.

Is this an edge case, Richard? :wink:

Again, once *I* set the cursor, even before the text of the field like LC does, tabbing works again, round and round.

Craig

Re: Move with tab on combo box

Posted: Mon Apr 08, 2019 7:43 am
by AlessioForconi
dunbarx wrote:
Sun Apr 07, 2019 11:26 pm
I am missing something. I am on a Mac, and if there are three fields and a comboBox on a card, tabbing proceeds naturally through each field and the comboBox, round and round forever. The current text displayed in the combo is selected in its turn.
This is the problem, which does not work.
I tried creating a card with only fields and a combobox and with tab I move from the first to the last field but not on the combobox, after the last field we return to the first one.
From the property inspector I set the layers of the fields with increasing numbers (from 1 to 6) but the combobox has the number 1 and it is not possible to change it.

Is there a way to set the combobox layer number in sequence to the fields? For example between the penultimate and the last field?

I probably don't understand how layers work.

1.jpg
2.jpg

Re: Move with tab on combo box

Posted: Mon Apr 08, 2019 2:05 pm
by dunbarx
Are you on a Mac?

Craig

Re: Move with tab on combo box

Posted: Mon Apr 08, 2019 2:09 pm
by jmburnod
I played around tabkey and found a quick but dirty way to avoid combobox

Code: Select all

on tabkey
   put the layer of the target into tLayerT
   put the layer of btn "myCombo" into tAvoid
   if tLayerT = tAvoid-1 then
      if  there is a control   (tAvoid +1)  and "field" is in the name of control  (tAvoid +1) then
         select text of control   (tAvoid +1)
         exit tabkey
      else
         select text of fld "f1"
      end if
   end if
   pass tabkey
end tabkey
stTabKeyBehaviourAvoidComboBox.livecode.zip
(5.79 KiB) Downloaded 254 times

Re: Move with tab on combo box

Posted: Mon Apr 08, 2019 4:32 pm
by jacque
From the images it looks a little like the button is an option button. Can you type into the field portion? If it's an option button the Mac will skip it. Apparently since a combo box has a field element it will act like a field in the tabbing order, which I didn't realize.

Layers are set in the Size and Location pane of the property inspector (the icon looks like a cross.)

Re: Move with tab on combo box

Posted: Mon Apr 08, 2019 5:04 pm
by dunbarx
You originally wanted to:
maybe but not fundamental, to open the entries.
So if is indeed an option button, without a field that LC can "see", as Jacque points out, then you have to kluge this. Perhaps (pseudo)

Code: Select all

on tabkey
if the layer of the target is the layer just below the layer of that option button then
  click at the loc of thatOptionButton
Or something just as peculiar.

Craig

Re: Move with tab on combo box

Posted: Mon Apr 08, 2019 5:08 pm
by dunbarx
Jacque.

What made you think it was an option button and not a combo? Was it that two tiny arrows were shown on the right, instead of one? That is knowing your LC trivia indeed. :wink:

Craig

Re: Move with tab on combo box

Posted: Mon Apr 08, 2019 5:58 pm
by jacque
dunbarx wrote:
Mon Apr 08, 2019 5:08 pm
Jacque.

What made you think it was an option button and not a combo? Was it that two tiny arrows were shown on the right, instead of one? That is knowing your LC trivia indeed. :wink:
That, and also the size ratio and text alignment are slightly different.

Re: Move with tab on combo box

Posted: Tue Apr 09, 2019 7:49 am
by AlessioForconi
jacque wrote:
Mon Apr 08, 2019 4:32 pm
From the images it looks a little like the button is an option button. Can you type into the field portion? If it's an option button the Mac will skip it. Apparently since a combo box has a field element it will act like a field in the tabbing order, which I didn't realize.
It's a combo.
I checked better and realized that being a button in fact, which I already knew, and having two other classic buttons on the card, the combo is inserted in a layer of buttons only.
This button layer starts after the fields one.

What I would like to do is (having 6 fields)

ftab on first field --> 1 --> 2 --> 3 --> combo --> 4 --> 5 --> 6
jacque wrote:
Mon Apr 08, 2019 4:32 pm
Layers are set in the Size and Location pane of the property inspector (the icon looks like a cross.)
Isn't that what you see in the screenshots I posted?

Re: Move with tab on combo box

Posted: Tue Apr 09, 2019 8:01 am
by AlessioForconi
jmburnod wrote:
Mon Apr 08, 2019 2:09 pm
I played around tabkey and found a quick but dirty way to avoid combobox

Code: Select all

on tabkey
   put the layer of the target into tLayerT
   put the layer of btn "myCombo" into tAvoid
   if tLayerT = tAvoid-1 then
      if  there is a control   (tAvoid +1)  and "field" is in the name of control  (tAvoid +1) then
         select text of control   (tAvoid +1)
         exit tabkey
      else
         select text of fld "f1"
      end if
   end if
   pass tabkey
end tabkey
stTabKeyBehaviourAvoidComboBox.livecode.zip
Thanks jmburnod.

I tried it and it only works in edit mode, but not in run mode

Re: Move with tab on combo box

Posted: Tue Apr 09, 2019 8:04 am
by jacque
Isn't that what you see in the screenshots I posted?
Nope. You're on the "advanced" pane where you set behaviors and such. The number there is the number of the control (in order of creation) but not its layer.

The size and position pane looks like a cross, it's the fifth icon from the left. The bottom-most field is labelled "layer".