How do you add a MouseUp to an iOS control?

Getting into LiveCode for iOS? Ask your questions here.

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
donryan
Posts: 32
Joined: Mon Jul 23, 2012 1:09 pm

How do you add a MouseUp to an iOS control?

Post by donryan » Mon Nov 26, 2012 4:43 am

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!
LiveCode 5.5.3 -- OS X 10.8.2

Jellicle
Posts: 453
Joined: Thu Feb 24, 2011 11:07 am

Re: How do you add a MouseUp to an iOS control?

Post by Jellicle » Mon Nov 26, 2012 6:52 am

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"
14" MacBook Pro
Former LiveCode developer.
Now recovering.

endernafi
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 296
Joined: Wed May 02, 2012 12:23 pm
Contact:

Re: How do you add a MouseUp to an iOS control?

Post by endernafi » Mon Nov 26, 2012 9:15 am

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
(1.49 KiB) Downloaded 328 times
Hope it helps 8)


Best,

~ Ender Nafi
~... together, we're smarter ...~
__________________________________________

macOS Sierra • LiveCode 7 & xCode 8

Jellicle
Posts: 453
Joined: Thu Feb 24, 2011 11:07 am

Re: How do you add a MouseUp to an iOS control?

Post by Jellicle » Mon Nov 26, 2012 10:33 am

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
14" MacBook Pro
Former LiveCode developer.
Now recovering.

jmburnod
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 2729
Joined: Sat Dec 22, 2007 5:35 pm
Contact:

Re: How do you add a MouseUp to an iOS control?

Post by jmburnod » Mon Nov 26, 2012 10:41 am

Hi Ender,
Nice stack again. Useful and clear.
I played with it without mistake
Best
Jean-Marc
https://alternatic.ch

endernafi
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 296
Joined: Wed May 02, 2012 12:23 pm
Contact:

Re: How do you add a MouseUp to an iOS control?

Post by endernafi » Mon Nov 26, 2012 10:55 am

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
~... together, we're smarter ...~
__________________________________________

macOS Sierra • LiveCode 7 & xCode 8

donryan
Posts: 32
Joined: Mon Jul 23, 2012 1:09 pm

Re: How do you add a MouseUp to an iOS control?

Post by donryan » Mon Nov 26, 2012 2:09 pm

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 8)


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
LiveCode 5.5.3 -- OS X 10.8.2

Jellicle
Posts: 453
Joined: Thu Feb 24, 2011 11:07 am

Re: How do you add a MouseUp to an iOS control?

Post by Jellicle » Mon Nov 26, 2012 11:04 pm

endernafi wrote: Yours was a very intuitive solution
...but based on an incorrect reading of the original question :)

g
14" MacBook Pro
Former LiveCode developer.
Now recovering.

Post Reply