Focus On Nothing

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

Post Reply
physicsclassroom
Posts: 50
Joined: Sun Jun 30, 2013 1:43 am
Contact:

Focus On Nothing

Post by physicsclassroom » Sat Aug 01, 2015 9:54 pm

I'm finishing up a educational app that (among other things) delivers Qs and evaluates answers. The only editable field on each question card is the Answer field. I don't want the field to be in focus when the user arrives at the question card; this pops the keyboard up over half the question. So I've been successfully using the focus on nothing command to prevent the keyboard from popping up as the user navigates from question to question within the stack. However there are two bttns that pop-up different stacks and provide generic help and question-specific help. When the user exits out of either help stack, I'm trying to use the focus on nothing command to prevent the same keyboard pop-up. Unfortunately, the focus goes to the answer field and the keyboard pops-up.

Any ideas why focus on nothing is not working when the help stack closes? Or any ideas on how to do a work around?

dave.kilroy
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 858
Joined: Wed Jun 24, 2009 1:17 pm
Contact:

Re: Focus On Nothing

Post by dave.kilroy » Sat Aug 01, 2015 11:07 pm

Check out the 'traversalOn' property of your field - set it to false during preopenstack so the onscreen keyboard won't be fired as the card opens, and a little bit later set it to true so that is performs normally for when the user needs it:

Code: Select all

on preopenstack
   set the traversalon of fld "fldAnswer" to false
end preopenstack

on openstack
   send initialiseField to me in 2000 millisecs
end openstack

on initialiseField
   set the traversalon of fld "fldAnswer" to true
end initialiseField
"...this is not the code you are looking for..."

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

Re: Focus On Nothing

Post by dunbarx » Sat Aug 01, 2015 11:33 pm

Hi.

Can you explain what you mean by the "keyboard" popping up?

Craig Newman

Simon
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3901
Joined: Sat Mar 24, 2007 2:54 am

Re: Focus On Nothing

Post by Simon » Sun Aug 02, 2015 12:28 am

Hi physicsclassroom,
I just use a hidden button;

Code: Select all

on preOpenCard
focus on btn "focus"
end perOpenCard
The button must have "Focus with keyboard" selected.
Yeah, focus on nothing has it's quirks.

And to stop hurting Craig's head you should mention this is mobile. :)

Simon
I used to be a newbie but then I learned how to spell teh correctly and now I'm a noob!

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

Re: Focus On Nothing

Post by dunbarx » Sun Aug 02, 2015 4:35 am

I keep forgetting that when I cannot understand what is going on around me, it is mobil.

Craig

Simon
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3901
Joined: Sat Mar 24, 2007 2:54 am

Re: Focus On Nothing

Post by Simon » Sun Aug 02, 2015 5:18 am

Hi Craig,
I've just been reminded that there are desktop tablets (e.g. Surface Pro 3) ... I may have been wrong.

Simon
I used to be a newbie but then I learned how to spell teh correctly and now I'm a noob!

physicsclassroom
Posts: 50
Joined: Sun Jun 30, 2013 1:43 am
Contact:

Re: Focus On Nothing

Post by physicsclassroom » Tue Aug 04, 2015 7:19 pm

Thank you all. I still had trouble with focus on nothing but was able to accomplish the intended affect by combining the traversalOn property set to TRUE with Simon's trick of focusing on a invisible button.

Post Reply