Page 1 of 1
How do you add a MouseUp to an iOS control?
Posted: Mon Nov 26, 2012 4:43 am
by donryan
Can anyone provide some insight on how you add a mouseup event to an iOS text field when the text field is created dynamically at runtime? I want to add a DatePick to an IOS text field but can't figure out how to do it. I've searched the forums but didn't find a solution. Any help would be appreciated. Thanks!
Re: How do you add a MouseUp to an iOS control?
Posted: Mon Nov 26, 2012 6:52 am
by Jellicle
Can't you set the script of an object? Eg:
Code: Select all
set the script of field "field1" to "on mouseup" & return & "answer the long date" & return & "end mouseup"
Re: How do you add a MouseUp to an iOS control?
Posted: Mon Nov 26, 2012 9:15 am
by endernafi
Hi donryan,
You can communicate with native mobile controls only via their special accessors.
There are four messages which may help you.
inputBeginEditing, inputEndEditing, inputTextChanged, inputReturnKey
You should use them with
mobileControlTarget() function.
Check the attached stack for a simple implementation.
Hope it helps
Best,
~ Ender Nafi
Re: How do you add a MouseUp to an iOS control?
Posted: Mon Nov 26, 2012 10:33 am
by Jellicle
Oh right. My assumption was that the field would be locked and the OP wanted it to respond to a touch event e.g.. a mouse up.
Gerry
Re: How do you add a MouseUp to an iOS control?
Posted: Mon Nov 26, 2012 10:41 am
by jmburnod
Hi Ender,
Nice stack again. Useful and clear.
I played with it without mistake
Best
Jean-Marc
Re: How do you add a MouseUp to an iOS control?
Posted: Mon Nov 26, 2012 10:55 am
by endernafi
Hi Jean-Marc,
Thanks, it's your kindness...
Gerry,
Yours was a very intuitive solution but of course it's only viable for native LiveCode objects.
Mobile controls are very different, unfortunately, it causes too much fuss.
Best,
~ Ender Nafi
Re: How do you add a MouseUp to an iOS control?
Posted: Mon Nov 26, 2012 2:09 pm
by donryan
endernafi wrote:Hi donryan,
You can communicate with native mobile controls only via their special accessors.
There are four messages which may help you.
inputBeginEditing, inputEndEditing, inputTextChanged, inputReturnKey
You should use them with
mobileControlTarget() function.
Check the attached stack for a simple implementation.
donryanStack.zip
Hope it helps
Best,
~ Ender Nafi
Ender:
Thank you very much -- the editBeginEditing took care of what I was looking for. Here's an example for anyone else interested:
Code: Select all
on inputBeginEditing
if the environment is "mobile" then
put iPhoneControlTarget() into tTarget
## DatePicker code goes here ...
if tTarget is "txtTransactionDate" or tTarget is "txtDueDate" then
focus on nothing --> hides the keyboard
mobilePickDate "date" --> loads datePicker with the current date
end if
end if
end inputBeginEditing
Re: How do you add a MouseUp to an iOS control?
Posted: Mon Nov 26, 2012 11:04 pm
by Jellicle
endernafi wrote:
Yours was a very intuitive solution
...but based on an incorrect reading of the original question
g