Scripting tab

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

dsquance
Posts: 40
Joined: Mon Jan 18, 2010 2:47 am

Scripting tab

Post by dsquance » Fri Feb 04, 2022 7:07 am

How does one write a script to effect the pressing of the tab key? The dictionary seems to indicate it can't be done, but there must be some workaround.
Thanks,
Dave

stam
Posts: 3061
Joined: Sun Jun 04, 2006 9:39 pm

Re: Scripting tab

Post by stam » Fri Feb 04, 2022 8:57 am

I think maybe separating the code that does the action you expect into a separate handler, then you can call it in code as well as trap the tab key on rawKeyDown...

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 10078
Joined: Fri Feb 19, 2010 10:17 am

Re: Scripting tab

Post by richmond62 » Fri Feb 04, 2022 9:05 am

How about seeing if the TAB key will give you a rawKey signal?

Klaus
Posts: 14177
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: Scripting tab

Post by Klaus » Fri Feb 04, 2022 11:05 am

Hi Dave,

this is what you are looking for:

Code: Select all

...
## do this
## do that
type TAB
...
:D

Best

Klaus

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

Re: Scripting tab

Post by dunbarx » Fri Feb 04, 2022 3:01 pm

What Klaus said, I think.

How and why do you need to, as you say, "press" the tab key? To insert it (ASCII 9) in a string? To invoke some keyboard combination? To have that key invoke some process?

Craig

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

Re: Scripting tab

Post by dunbarx » Fri Feb 04, 2022 3:42 pm

Richmond.
How about seeing if the TAB key will give you a rawKey signal?
Sure, "65289"

All keys give return a value, except for "capsLock", "Shift", "Control", "Option", "Command" and "fn".

Craig

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 10078
Joined: Fri Feb 19, 2010 10:17 am

Re: Scripting tab

Post by richmond62 » Fri Feb 04, 2022 5:50 pm

Sure, "65289"
I knew that, but I have a feeling that getting newbies to do the odd thing by themselves
rather than too much spoon feeding might be pedagogically not such a bad idea.
The dictionary seems to indicate it can't be done
-
SShot 2022-02-04 at 18.51.05.png

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

Re: Scripting tab

Post by dunbarx » Fri Feb 04, 2022 6:12 pm

Be careful.

Jacque might get on your case as she has done on mine. Whatever you, do not call it "homework".

Craig

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 10078
Joined: Fri Feb 19, 2010 10:17 am

Re: Scripting tab

Post by richmond62 » Fri Feb 04, 2022 6:23 pm

Be careful.
Never knowingly done that before. :D
Last edited by richmond62 on Fri Feb 04, 2022 7:09 pm, edited 1 time in total.

andresdt
Posts: 156
Joined: Fri Aug 16, 2019 7:51 pm
Contact:

Re: Scripting tab

Post by andresdt » Fri Feb 04, 2022 6:31 pm

dsquance wrote:
Fri Feb 04, 2022 7:07 am
How does one write a script to effect the pressing of the tab key? The dictionary seems to indicate it can't be done, but there must be some workaround.
Thanks,
Dave
Hi @dsquance
Look this up in the "tabKey" dictionary

Isn't that what you mean?

taken from the LC dictionary

Code: Select all

on tabKey -- go forward in stack on tab, backward on shift-tab
  if the shiftKey is down then go previous card
  else go next card
end tabKey
Be kind, we all have our own wars.
https://torocruzand.com/

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 10078
Joined: Fri Feb 19, 2010 10:17 am

Re: Scripting tab

Post by richmond62 » Fri Feb 04, 2022 6:53 pm

Wait a moment:
How does one write a script to effect the pressing of the tab key?
does not want a tabKey thing,
probably more like this:
-
SShot 2022-02-04 at 19.50.28.png
-
And while Craig may be smirking at trapping me into stating that the Unicode for TAB is 65289 I went to the trouble of
checking that, and 65289 is some sort of parenthesis, while the Unicode for TAB is simply '9'.

And while I am here perhaps I should point out that my 'TAB' is not amused and has stumped off to do some yoga:
-
puss.jpeg
Attachments
TABBY CAT.livecode.zip
Here's the stack.
(1.08 KiB) Downloaded 140 times

stam
Posts: 3061
Joined: Sun Jun 04, 2006 9:39 pm

Re: Scripting tab

Post by stam » Fri Feb 04, 2022 7:05 pm

I took it to mean that <tab> in this case would trigger an action (which could be to insert a tab character or could be something else), and that the OP wanted to trigger this without hitting the tab key - hence i suggested splitting the action into a separate handler that could be called in code and can also be linked to the tab key being pressed (ie sent from on tabKey or on rawKeyDown).
I guess the OP needs to provide a bit more clarity...

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 10078
Joined: Fri Feb 19, 2010 10:17 am

Re: Scripting tab

Post by richmond62 » Fri Feb 04, 2022 7:08 pm

I guess the OP needs to provide a bit more clarity.
You are quite right.

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

Re: Scripting tab

Post by dunbarx » Fri Feb 04, 2022 8:50 pm

And while Craig may be smirking at trapping me into stating that the Unicode for TAB is 65289 I went to the trouble of
checking that, and 65289 is some sort of parenthesis, while the Unicode for TAB is simply '9'.
How did you know I was smirking?

The ASCII value for "tab" is 9. The value returned for tab via "RawKeyWhatever" is 65289. Tab does not return a value, ASCII or whatever, for "keyDown".

I do not think unicode enters into any of this.

Craig

dsquance
Posts: 40
Joined: Mon Jan 18, 2010 2:47 am

Re: Scripting tab

Post by dsquance » Fri Feb 04, 2022 10:12 pm

I guess I needed to be specific. I want a tab action, not a tab in the sense of spacing. My intention is to allow text entry from a screen "keyboard" by clicking on a letter which puts the letter into a field and then the cursor should move to the next field as it would if the tab key were pressed.

But thanks to all who have weighed in.
Dave

Post Reply