Page 1 of 1
Dismissing the keyboard
Posted: Tue Aug 02, 2011 2:34 am
by marksmithhfx
Has anyone found a good way to dismiss the keyboard in iOS. I have a stack with 2 fields and a button. I don't want the keyboard to popup until the user selects a field, but I've not found a way to make that work.
On OSX I can say:
on opencard
focus on nothing
end opencard
and no field is selected. But that doesn't seem to work on iOS. The first field is still the focus, and the keyboard pops up.
What does work....
in any field if I say:
on returninfield
focus on nothing
end returninfield
Then when the user enters something and presses the enter key the keyboard will go away (and nothing is focused on). Unfortunately I can't get LC to mimic the same behaviour when it first opens the card.
Any suggestions?
-- Mark
Re: Dismissing the keyboard
Posted: Tue Aug 02, 2011 3:55 am
by Dixie
Hi mark...
Stack attached... look at the scripts of the fields
be well
Dixie
Re: Dismissing the keyboard
Posted: Tue Aug 02, 2011 2:24 pm
by marksmithhfx
Dixie wrote:Hi mark...
Stack attached... look at the scripts of the fields
Dixie
Thanks Dixie. This looks like a promising approach (but I've not actually got it working yet so I'll let you know the outcome later). I appreciate the quick response. Take care,
-- Mark
Re: Dismissing the keyboard
Posted: Wed Aug 03, 2011 3:34 am
by marksmithhfx
Dixie wrote:Hi mark...
Stack attached... look at the scripts of the fields
be well
Dixie
Hi Dixie, thanks for this... it certainly had the desired effect. There was a side effect that makes the solution less than ideal but that is not your fault. The first mouse click on the field just unlocks the field. It does not actually make it selectable (so it looks like nothing has happened). But the next click activates the field and the keyboard. Still, it is much much closer to the effect I was looking for so I will use it.
To runrev: the real solution here is for:
on opencard
focus on nothing
to work.
BTW I found I could get the same effect using only TraversalOn and not including the showfocusborder command (and enabling or disabling showfocusborder in the parameters seemed to have no effect)... thought I should pass it along. Thanks again
-- Mark
Re: Dismissing the keyboard
Posted: Wed Aug 03, 2011 8:25 am
by bn
Hi Mark,
I have a stack with 2 fields and a button. I don't want the keyboard to popup until the user selects a field
what you could do is to set the traversalon of the button to true and set the layer of the button (in the inspector, size and position) to the lowest layer. You just send it back. This way the button will get the focus when the card opens but nothing happens and the fields will behave as you expect: touching them will show the keyboard. No scripting necessary.
Kind regards
Bernd
Re: Dismissing the keyboard
Posted: Wed Aug 03, 2011 9:10 am
by Dixie
Mark...
Bernd's solution is the correct one... Nice one Bernd!
be well
Dixie
Re: Dismissing the keyboard
Posted: Thu Aug 04, 2011 4:36 am
by marksmithhfx
Dixie wrote:Mark...
Bernd's solution is the correct one... Nice one Bernd!
be well
Dixie
Bernd, that looked like the **perfect** solution, and in fact works great in the IDE.... but, like the 'focus on nothing' command which does not work on iOS, this didn't either... the focus went straight to the field. Errggh (but thanks for thinking of a great suggestion)
-- Mark
Re: Dismissing the keyboard
Posted: Thu Aug 04, 2011 7:39 am
by bn
Mark,
I did that on a real device and it worked. Could there be something else going on? Could you try this with just a bare bones stack, 1 card, 2 fields, 1 button?
Kind regards
Bernd
Re: Dismissing the keyboard
Posted: Thu Aug 04, 2011 9:08 am
by bn
Hi Mark,
I found the thread in the forum where this was discussed:
http://forums.runrev.com/phpBB2/viewtop ... ard#p30169
if your button is in a group then you would have to set the layer of the group to a lower number than the fields also. (again in the properties inspector for the group -> size and position)
Kind regards
Bernd
Re: Dismissing the keyboard
Posted: Sat Aug 06, 2011 2:56 am
by marksmithhfx
bn wrote:Mark,
I did that on a real device and it worked. Could there be something else going on? Could you try this with just a bare bones stack, 1 card, 2 fields, 1 button?
Hi Bernd, this might be a problem only in the iOS simulator then. I might start the process of getting my iPhone setup to receive stacks this weekend. I've attached the test stack.
-- Mark
Re: Dismissing the keyboard
Posted: Sat Aug 06, 2011 11:20 am
by bn
Hi Mark,
in your teststack you neither set the traversalon of the button, nor is the layer number lower than the fields layer number. This cant work.
Please try setting the layer number of the button to 1 and the traversalOn (or focus with keyboard) of the button to true.
Kind regards
Bernd
Re: Dismissing the keyboard
Posted: Sat Aug 06, 2011 5:22 pm
by marksmithhfx
bn wrote:Hi Mark,
in your teststack you neither set the traversalon of the button, nor is the layer number lower than the fields layer number. This cant work.
Please try setting the layer number of the button to 1 and the traversalOn (or focus with keyboard) of the button to true.
Kind regards
Bernd
Hi Bern, talk about (me) missing the point!! I thought you said to send the field to the back in your last post (my misunderstanding being that if it was in the back LC would see whatever was in the front first). I moved the button to the back (and set traversalon) and it now works properly.
So if I understand correctly, we are moving the button to the back so LC will see it BEFORE it sees the other field (ie. it scans from back to front?)
Thanks for being so patient with me.
-- Mark
Re: Dismissing the keyboard
Posted: Sat Aug 06, 2011 10:21 pm
by bn
HI Mark,
glad it works for you now, without posting your stack I would neve have guessed. It is good to post scripts/stacks.
Kind regards
Bernd