Native input field help?

Getting into LiveCode for iOS? Ask your questions here.

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
EssoAir
Posts: 52
Joined: Thu Feb 20, 2014 7:53 pm

Native input field help?

Post by EssoAir » Thu Apr 17, 2014 2:56 am

Hi! I read the tutorial and downloaded the test stack on the RunRev lessons site, but I'm still not clear on how the native mobile fields work.

I've attached an example mainstack that has a button and a normal input field. I would love it if someone could change it to a mobile-compatible field and please explain what they did that way I can learn and understand for the future.

Thank you all

Esso

Edit:had some trouble attaching the file so here's a dropbox link to it https://dl.dropboxusercontent.com/u/122 ... e.livecode

Simon
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3901
Joined: Sat Mar 24, 2007 2:54 am

Re: Native input field help?

Post by Simon » Thu Apr 17, 2014 3:06 am

Yeah that lesson is all over the place, here is a simple version of what you need.

Code: Select all

on openCard
   if the environment <> "mobile" then exit openCard
   mobileControlCreate "input", "myNativeTextField"
   mobileControlSet "myNativeTextField", "visible", true
   mobileControlSet "myNativeTextField", "rect", "50,50,500,500"
   mobileControlSet "myNativeTextField", "text", "My happy text field"
end openCard
Of course this will only run in the sim or on a mobile device.

Check out "mobileControlCreate" and "mobileControlSet" in the dictionary.

Simon
Edit:

Code: Select all

on closeCard
mobileControlDelete "myNativeTextField"
end closeCard
You must always get rid of it when you leave the card.
I used to be a newbie but then I learned how to spell teh correctly and now I'm a noob!

EssoAir
Posts: 52
Joined: Thu Feb 20, 2014 7:53 pm

Re: Native input field help?

Post by EssoAir » Thu Apr 17, 2014 3:26 am

Simon wrote:Yeah that lesson is all over the place, here is a simple version of what you need.

Code: Select all

on openCard
   if the environment <> "mobile" then exit openCard
   mobileControlCreate "input", "myNativeTextField"
   mobileControlSet "myNativeTextField", "visible", true
   mobileControlSet "myNativeTextField", "rect", "50,50,500,500"
   mobileControlSet "myNativeTextField", "text", "My happy text field"
end openCard
Of course this will only run in the sim or on a mobile device.

Check out "mobileControlCreate" and "mobileControlSet" in the dictionary.

Simon
Edit:

Code: Select all

on closeCard
mobileControlDelete "myNativeTextField"
end closeCard
You must always get rid of it when you leave the card.
Cool! Thanks! Does that work on iOS and Android?

EssoAir
Posts: 52
Joined: Thu Feb 20, 2014 7:53 pm

Re: Native input field help?

Post by EssoAir » Thu Apr 17, 2014 3:36 am

Simon,

How do I get the text from the field and put it into a variable?

I want once that button is pressed for the text of the field to be put into something like oInputText

Thanks

EssoAir

EssoAir
Posts: 52
Joined: Thu Feb 20, 2014 7:53 pm

Re: Native input field help?

Post by EssoAir » Thu Apr 17, 2014 3:44 am

Nevermind I get it now

Its mobileControlGet

Ok this mobile stuff is making sense now. sorry I just had the expectation that all the desktop and mobile stuff was the same

Post Reply