setting the focus with keyboard property on a field

Deploying to Mac OS? Ask Mac OS specific questions here.

Moderators: Klaus, FourthWorld, heatherlaine, kevinmiller, robinmiller

mvillion
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 105
Joined: Sun Feb 24, 2013 12:29 pm

setting the focus with keyboard property on a field

Post by mvillion » Sat Jun 09, 2018 11:41 pm

Hi

I am trying to set the 'focus with keyboard' property of a field via a script but I cannot find out how.

It is available in the properties but I cannot find it in the dictionary for fields properties.

Any ideas people?

thanks
Matt

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 6609
Joined: Wed May 06, 2009 2:28 pm
Location: New York, NY

Re: setting the focus with keyboard property on a field

Post by dunbarx » Sun Jun 10, 2018 1:20 am

Hi.

Do you mean something like tabbing from one field to another? That action does indeed involve the keyboard.

Or you might use the "keyDown" or "rawKeyDown" messages (or their cousins) to send a message giving focus to the next field in the tabbing order (or any other field at all, for that matter)

Is that what you meant?

Craig Newman

mvillion
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 105
Joined: Sun Feb 24, 2013 12:29 pm

Re: setting the focus with keyboard property on a field

Post by mvillion » Sun Jun 10, 2018 10:12 am

Ok.

Set up a stack.
Place a field
Look at the properties of a field. There is a property called 'focus with keyboard'.

This allows the keyboard to focus on the field so things can be typed into it (or not)
Sometimes I want to allow it. Other times I don't.

I want to toggle it via a script but I cannot find the 'property name' to be able to address it.


Thanks

jmburnod
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 2459
Joined: Sat Dec 22, 2007 5:35 pm
Location: Genève
Contact:

Re: setting the focus with keyboard property on a field

Post by jmburnod » Sun Jun 10, 2018 11:48 am

Hi,
I want to toggle it via a script but I cannot find the 'property name' to be able to address it.
I think you look for traversalOn
Best regards
Jean-Marc

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 4345
Joined: Fri Feb 19, 2010 10:17 am
Location: Bulgaria

Re: setting the focus with keyboard property on a field

Post by richmond62 » Sun Jun 10, 2018 3:44 pm

Code: Select all

on mouseUp
   focus on fld "ff1"
end mouseUp
fff.png
Focus.livecode.zip
(990 Bytes) Downloaded 112 times
OK, OK: that's with a mouseClick rather than a keyboard initiator . . .

Code: Select all

on keyDown KD
if KD = "q" then
focus on fld "ff1"
end if
end keyDown

Klaus
Posts: 11724
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany
Contact:

Re: setting the focus with keyboard property on a field

Post by Klaus » Sun Jun 10, 2018 4:22 pm

Hi Matt,

good advice: Open the LC preferences, on the "General" part check -> Property Labels are -> Name of LiveCode properties

Now the inspector will show the names of the properties as used for scripting instead of their "human readable" expalantion.


Best

Klaus

jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 5338
Joined: Sat Apr 08, 2006 8:31 pm
Location: Minneapolis MN
Contact:

Re: setting the focus with keyboard property on a field

Post by jacque » Sun Jun 10, 2018 4:48 pm

One of the first things I tell new users is to do what Klaus suggested. Regardless of which setting you use though, hovering over the label will show a tooltip that gives you the alternate information.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 6609
Joined: Wed May 06, 2009 2:28 pm
Location: New York, NY

Re: setting the focus with keyboard property on a field

Post by dunbarx » Sun Jun 10, 2018 11:26 pm

Oh, You really meant "focus with keyboard".

Why didn't you say so? :wink:

It has been so long since I ever used the "human readable" labels that I never made the connection.

Craig

mvillion
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 105
Joined: Sun Feb 24, 2013 12:29 pm

Re: setting the focus with keyboard property on a field

Post by mvillion » Sun Jun 10, 2018 11:40 pm

Wow.

I feel like a complete NOOB.

Hover over label to get the value. Doh!

Many thanks

bogs
Posts: 4608
Joined: Sat Feb 25, 2017 10:45 pm

Re: setting the focus with keyboard property on a field

Post by bogs » Mon Jun 11, 2018 3:14 am

mvillion wrote:
Sun Jun 10, 2018 11:40 pm
Wow. I feel like a complete NOOB.
Exhilarating isn't it? I feel that way every 3rd or 4th time I start a project... :D
Image

jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 5338
Joined: Sat Apr 08, 2006 8:31 pm
Location: Minneapolis MN
Contact:

Re: setting the focus with keyboard property on a field

Post by jacque » Mon Jun 11, 2018 5:31 am

bogs wrote:
Mon Jun 11, 2018 3:14 am
mvillion wrote:
Sun Jun 10, 2018 11:40 pm
Wow. I feel like a complete NOOB.
Exhilarating isn't it? I feel that way every 3rd or 4th time I start a project... :D
LOL. You would not believe the dumb thing I did last night. Two hours debugging something that wasn't even broken because I overlooked the obvious. Twice.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 4345
Joined: Fri Feb 19, 2010 10:17 am
Location: Bulgaria

Re: setting the focus with keyboard property on a field

Post by richmond62 » Mon Jun 11, 2018 7:38 am

I feel like a complete NOOB.
Continuously since my first contact with HyperCard in 1993. 8)

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 6609
Joined: Wed May 06, 2009 2:28 pm
Location: New York, NY

Re: setting the focus with keyboard property on a field

Post by dunbarx » Mon Jun 11, 2018 2:58 pm

Continuously since my first contact with HC in 1987.

Craig

bogs
Posts: 4608
Joined: Sat Feb 25, 2017 10:45 pm

Re: setting the focus with keyboard property on a field

Post by bogs » Mon Jun 11, 2018 3:27 pm

At least we're in good company eh, mvillion :wink:
Image

RobertC
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 42
Joined: Sun Feb 04, 2007 3:43 pm

Re: setting the focus with keyboard property on a field

Post by RobertC » Sun Feb 16, 2020 11:58 am

I just had exactly mvillion's question.

I'm appalled at the number of answers that simply do not address the very clearly stated question: how does one set the focus with keyboard from a script? For example, dunbarx obviously can't read that, but he is not the only one. This sort of well-meaning, fast response that is completely off the mark is very typical of programming forums. Stack Overflow is full of them, so are all the others and this one is no exception. Sigh. (nothing against dunbarx in particular, he just happened to be the first one encountered, sorry that you happen to function as my example)

As jmburnod answered, it's not possible to set focus with keyboard because the property is actually called traversalon. Thanks Jean-Marc.
I too have set the LiveCode preference to show property labels as name of property, not description of option. But that seemingly does not work: the property inspector still gives wrong information.

The IDE is so full of small bugs that I despair. I've been using Hypercard from 1985, until I discovered runrev in 2000 and have been a LiveCode/RuntimeRevolution user ever since. I would not know what to do without LiveCode.
But I sincerely hope that instead of rushing into the next feature development, the LiveCode team will take a year or so to fix the literally hundreds of annoying small bugs that make development highly irritating. Any first-time user trying out LiveCode will hit these problems, finally give up, and never come back.

The solution to mvillion's problem is indeed to set traversalon to true/false

Bye guys, have a nice day.
The Old Rant Robert.

Post Reply

Return to “Mac OS”