Keyboard issues

Getting into LiveCode for iOS? Ask your questions here.

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
andyh1234
Posts: 476
Joined: Mon Aug 13, 2007 4:44 pm
Contact:

Keyboard issues

Post by andyh1234 » Tue Jan 18, 2011 12:59 pm

Hi,

Im still trying to get to grips with iOS, getting better every day, but keep finding little problems I cannot find solutions to.

The problem I have right now is when I first start an app with a text field on it, the keyboard immediately shows. This is easy to replicate in 4.5.3 by creating a new stack, pop a multi line field onto it, then change the settings to compile for iOS and then simulate. Every time the app starts, the keyboard pops up. Is there an easy way to fix so it doesnt happen?

The second problem is to dismiss the keyboard I just tap anywhere else on the screen, which works until I add a backdrop that covers the whole screen and then it seems impossible to dismiss the keyboard. Again, its easy enough to simulate, just use the file -> import as control -> image file to pop an image in, send it to the back and simulate, the keyboard will no longer dismiss. Is this a known issue?

Thanks

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

Re: Keyboard issues

Post by Klaus » Tue Jan 18, 2011 1:21 pm

Hi Andy,

the keyboard will pop up everytime a field is "opened" so you could try this:

Code: Select all

on preopencard 
  ## or "opencard if that doesn't work
  focus on nothing
end preopencard
Best

Klaus

bn
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 4166
Joined: Sun Jan 07, 2007 9:12 pm

Re: Keyboard issues

Post by bn » Tue Jan 18, 2011 1:56 pm

Hi Andy, Klaus,

I also had that problem and had to work around it. What I did was to set the traversalOn of a button that has a lower layer number that all fields. This button happened to be in a group so I had to set the traversalOn of the group also. Be shure to turn showFiocusBorder off for the button. In the property inspector for the button (or the group if the button is in a group) go to Size and Position and change the layer of the button/group to a number lower then the lowest number of your text fields that have traversalOn, i.e. are focusable and ready for text entry.
Now when a card is opened the focus goes to that button, instead of the field. And no keybord pops up until the user clicks into the field.

I tried "focus on nothing" in the preopencard handler, but it did not work in the simulator. Too bad, it would have been a much cleaner and obvious solution.

Kind regards

Bernd

andyh1234
Posts: 476
Joined: Mon Aug 13, 2007 4:44 pm
Contact:

Re: Keyboard issues

Post by andyh1234 » Tue Jan 18, 2011 2:25 pm

Thanks guys, that works.

Andy

andyh1234
Posts: 476
Joined: Mon Aug 13, 2007 4:44 pm
Contact:

Re: Keyboard issues

Post by andyh1234 » Tue Jan 18, 2011 8:56 pm

Just to update the thread about the other problem I had where you add an image that covers the whole screen and the keyboard cannot then be dismissed by tapping on the screen, this can also be fixed by adding a mouseup event to the image that switches focus to the button.

on mouseup
focus on button "btnFocus"
end mouseup

Likewise, if you have a keyboard up, adding the following to the field the keyboard is working with will make the keyboard disappear when someone presses the 'done' or return key on the keyboard.

on returnInField
focus on button "btnFocus"
end returnInField

I hope this helps someone else!

Andy

Post Reply