mobile focus

Gerry gerry.orkin at gmail.com
Fri Aug 29 23:46:06 EDT 2014


iPhoneControlTarget()

Gerry

On 30 August 2014 13:26, Eric Corbett <eric at canelasoftware.com> wrote:
> Hi Mike,
>
> In my limited use of the native field on mobile, I have come across some key features.
>
> First, when you create the field, I would recommend creating each one in a separate control, like a desktop field to be used as a place holder. Here's the reason:
>
> inputBeginEditing
> inputTextChanged
> inputEndEditing
> inputReturnKey
>
> These messages are sent to the script that created the mobile field. Therefore, when more than one field is required on a card, I create a behavior and each dummy field uses the one behavior. Then at the appropriate time (openCard possibly), I send a dispatch to each field to create the appropriate field. I use switch statements in my create field handler to set the appropriate settings like mobileControlSet [control],"keyboardType","[value]; "returnKeyType","[value]", etc. I also use a switch statement in inputReturnKey to determine what to do next. The switch cases become the short name of me since the object is the field and of course the desktop dummy field is named the same as the native mobile field.
>
> I guess each card would have a different behavior so the one script is not switching between too many fields. You could also create behaviors for specific groups, but the need to set the behavior of the dummy fields is the key, not setting the behavior of the group. One other option to try to create a mobileControlCreate library might be by to chain behaviors, but that's a complicated subject I am looking forward to hearing more about at the conference in Scott Rossi's 'Well Behaved Behaviors' talk.
>
> One other command to keep in mind is mobileControlDo. Specifically, mobileControlDo [control name or ID], "focus". This will cause focus on the field and up comes the keyboard. On iOS, the keyboardActivated message is sent, but on Android, this feature is still broken. To take focus away, the only thing I know to do script wise is 'focus on nothing'.
>
> Maybe there's another way; I'll keep my eye on the thread to see who has more experience and a better idea.
>
> HTH
>
> Eric
>
> On Aug 29, 2014, at 8:05 PM, Mike Kerner wrote:
>
>> How do I figure out which native mobilc field has the focus (or if no
>> native field does)?
>>
>> A field doesn't lose the focus when you do other things like hit buttons,
>> or throw up pick lists, which can make it tricky to deal with fields that
>> have updated values.
>>
>> focusedObject() doesn't seem to work as advertised (it returns the same
>> value no matter which mobile field has the focus, or for that matter, if no
>> field has the focus).
>>
>> I know I could do it the hard way, manually, but...
>>
>> --
>> On the first day, God created the heavens and the Earth
>> On the second day, God created the oceans.
>> On the third day, God put the animals on hold for a few hours,
>>   and did a little diving.
>> And God said, "This is good."
>> _______________________________________________
>> use-livecode mailing list
>> use-livecode at lists.runrev.com
>> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
>> http://lists.runrev.com/mailman/listinfo/use-livecode
>
>
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode




More information about the use-livecode mailing list