Spiking the focus

Graham Samuel livfoss at mac.com
Tue Oct 2 16:15:17 EDT 2012


Mark, thanks as ever for your reply. I can do what you say and probably will, since I have no idea how to use native text fields in the sense you appear to mean: I would love to understand it, but I only have the available documentation to go on, and it really doesn't help much.

Just to be clear, I want there to be lots of fields showing on the screen (think of a miniature spreadsheet). I want the user to touch any one of them to enter data. AFAIK the only way to do this is to activate an iOS keyboard when field is touched, and have the data appear in the iOS control (a rectangle associated with the instantiation of the keyboard), and after the data is entered I can use a 'inputEndEditing' handler to transfer it to the field (cell) that was clicked on in the first place. I can see that I could make the rectangle coincident with the LC field in question, but that wouldn't really be much of a step forward since I would still have to stick the data in the underlying field purely for persistence reasons, and I would still have the problem of the keyboard inevitably obscuring some parts of the screen.

I am quite happy to be told I am doing this all wrong, but I don't know how to do it any other way. If you or anyone wants to suggest anything else, I would be more than interested.

Graham


On Tue, 2 Oct 2012 17:16:33 +0200, Mark Schonewille <m.schonewille at economy-x-talk.com> wrote:
> 
> Graham,
> 
> Set the traversalon to false in preOpenCard (or better yet, when you build the standalone). et the traversalOn to true in a mouseUp handler and select the text of your field to make the keyboard appear. Still better would be to use native text fields, which would allow you to keep traversalOn false at all times.
> 
> --
> Best regards,
> 
> Mark Schonewille
> 
> Economy-x-Talk Consulting and Software Engineering
> Homepage: http://economy-x-talk.com
> Twitter: http://twitter.com/xtalkprogrammer
> KvK: 50277553
> 
> Use Color Converter to convert CMYK, RGB, RAL, XYZ, H.Lab and other colour spaces. http://www.color-converter.com
> 
> 
> 
> On 2 okt 2012, at 17:00, Graham Samuel wrote:
> 
>> I'm having trouble running some very simple tests of iOS keyboard input, and one problem is that I want the iOS keyboard to come up when the user touches a specific field (or the mouse clicks in the Simulator). These fields are locked with TraversalOn set to true as is usual for iOS keyboard input.
>> 
>> This isn't working, no doubt due to some stupidity on my part (I'm sending another message about this), but while I was testing I found that one of my fields (field number 1) in my very simple test stack was receiving the focus as soon as the card was opened when my script wasn't expecting it. I was surprised after all this time to find the following in the LC documentation:
>> 
>>> When a card is opened, LiveCode automatically focuses the first object on the card that is capable of receiving the keyboard focus. 
>>> 
>> Somehow I never noticed this before.
>> 
>> I don't like this and would like to stop it, but even when I arrange for the fields to have their TravesalOn false on loading and only set it on again during an OpenCard handler, I still get the unwanted focussing. If I leave the TraversalOns false and don't change them, then the card triggers a focusIn handler, which is equally unwanted.
>> 
>> Do I have to live with this or is there a workaround?




More information about the use-livecode mailing list