Page 1 of 1

Native input field help?

Posted: Thu Apr 17, 2014 2:56 am
by EssoAir
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

Re: Native input field help?

Posted: Thu Apr 17, 2014 3:06 am
by Simon
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.

Re: Native input field help?

Posted: Thu Apr 17, 2014 3:26 am
by EssoAir
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?

Re: Native input field help?

Posted: Thu Apr 17, 2014 3:36 am
by EssoAir
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

Re: Native input field help?

Posted: Thu Apr 17, 2014 3:44 am
by EssoAir
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