Move with tab on combo box

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller

AlessioForconi
Posts: 90
Joined: Sun Feb 15, 2015 2:51 pm

Move with tab on combo box

Post by AlessioForconi » Sun Apr 07, 2019 10:50 am

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.

jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 7392
Joined: Sat Apr 08, 2006 8:31 pm
Contact:

Re: Move with tab on combo box

Post by jacque » Sun Apr 07, 2019 4:51 pm

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.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

AlessioForconi
Posts: 90
Joined: Sun Feb 15, 2015 2:51 pm

Re: Move with tab on combo box

Post by AlessioForconi » Sun Apr 07, 2019 4:53 pm

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

jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 7392
Joined: Sat Apr 08, 2006 8:31 pm
Contact:

Re: Move with tab on combo box

Post by jacque » Sun Apr 07, 2019 6:03 pm

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.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10320
Joined: Wed May 06, 2009 2:28 pm

Re: Move with tab on combo box

Post by dunbarx » 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.

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

AlessioForconi
Posts: 90
Joined: Sun Feb 15, 2015 2:51 pm

Re: Move with tab on combo box

Post by AlessioForconi » Mon Apr 08, 2019 7:43 am

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

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10320
Joined: Wed May 06, 2009 2:28 pm

Re: Move with tab on combo box

Post by dunbarx » Mon Apr 08, 2019 2:05 pm

Are you on a Mac?

Craig

jmburnod
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 2729
Joined: Sat Dec 22, 2007 5:35 pm
Contact:

Re: Move with tab on combo box

Post by jmburnod » 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
(5.79 KiB) Downloaded 254 times
https://alternatic.ch

jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 7392
Joined: Sat Apr 08, 2006 8:31 pm
Contact:

Re: Move with tab on combo box

Post by jacque » 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.

Layers are set in the Size and Location pane of the property inspector (the icon looks like a cross.)
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10320
Joined: Wed May 06, 2009 2:28 pm

Re: Move with tab on combo box

Post by dunbarx » Mon Apr 08, 2019 5:04 pm

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
Last edited by dunbarx on Mon Apr 08, 2019 5:11 pm, edited 3 times in total.

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10320
Joined: Wed May 06, 2009 2:28 pm

Re: Move with tab on combo box

Post by dunbarx » 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:

Craig

jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 7392
Joined: Sat Apr 08, 2006 8:31 pm
Contact:

Re: Move with tab on combo box

Post by jacque » Mon Apr 08, 2019 5:58 pm

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.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

AlessioForconi
Posts: 90
Joined: Sun Feb 15, 2015 2:51 pm

Re: Move with tab on combo box

Post by AlessioForconi » Tue Apr 09, 2019 7:49 am

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?

AlessioForconi
Posts: 90
Joined: Sun Feb 15, 2015 2:51 pm

Re: Move with tab on combo box

Post by AlessioForconi » Tue Apr 09, 2019 8:01 am

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

jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 7392
Joined: Sat Apr 08, 2006 8:31 pm
Contact:

Re: Move with tab on combo box

Post by jacque » Tue Apr 09, 2019 8:04 am

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".
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

Post Reply