setting the focus with keyboard property on a field

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

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

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

setting the focus with keyboard property on a field

Post by mvillion »

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: 10501
Joined: Wed May 06, 2009 2:28 pm

Re: setting the focus with keyboard property on a field

Post by dunbarx »

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: 108
Joined: Sun Feb 24, 2013 12:29 pm

Re: setting the focus with keyboard property on a field

Post by mvillion »

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: 2734
Joined: Sat Dec 22, 2007 5:35 pm
Contact:

Re: setting the focus with keyboard property on a field

Post by jmburnod »

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
https://alternatic.ch
richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 10415
Joined: Fri Feb 19, 2010 10:17 am

Re: setting the focus with keyboard property on a field

Post by richmond62 »

Code: Select all

on mouseUp
   focus on fld "ff1"
end mouseUp
fff.png
Focus.livecode.zip
(990 Bytes) Downloaded 1316 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: 14324
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: setting the focus with keyboard property on a field

Post by Klaus »

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: 7423
Joined: Sat Apr 08, 2006 8:31 pm
Contact:

Re: setting the focus with keyboard property on a field

Post by jacque »

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: 10501
Joined: Wed May 06, 2009 2:28 pm

Re: setting the focus with keyboard property on a field

Post by dunbarx »

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: 108
Joined: Sun Feb 24, 2013 12:29 pm

Re: setting the focus with keyboard property on a field

Post by mvillion »

Wow.

I feel like a complete NOOB.

Hover over label to get the value. Doh!

Many thanks
bogs
Posts: 5480
Joined: Sat Feb 25, 2017 10:45 pm

Re: setting the focus with keyboard property on a field

Post by bogs »

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: 7423
Joined: Sat Apr 08, 2006 8:31 pm
Contact:

Re: setting the focus with keyboard property on a field

Post by jacque »

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: 10415
Joined: Fri Feb 19, 2010 10:17 am

Re: setting the focus with keyboard property on a field

Post by richmond62 »

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: 10501
Joined: Wed May 06, 2009 2:28 pm

Re: setting the focus with keyboard property on a field

Post by dunbarx »

Continuously since my first contact with HC in 1987.

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

Re: setting the focus with keyboard property on a field

Post by bogs »

At least we're in good company eh, mvillion :wink:
Image
RobertC
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 46
Joined: Sun Feb 04, 2007 3:43 pm

Re: setting the focus with keyboard property on a field

Post by RobertC »

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