Question about mobileControlCreate [solved]

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller

Post Reply
sms5138
Posts: 126
Joined: Mon Feb 23, 2015 11:49 pm

Question about mobileControlCreate [solved]

Post by sms5138 » Mon Jul 20, 2015 8:41 pm

Hi everyone,

I apologize in advance for the length of this post. I've been going through the following lesson:

http://lessons.runrev.com/m/847/l/13672 ... y-keyboard

I have gotten a test application to function as it should in the ios simulator, but i'm unsure how to call out the the field that's been created....

Here is the code used in the lesson:

Code: Select all

local sinputId

on opencard
if environment() = "mobile" then
mobileControlCreate "input"
put the result into sinputID
mobileControlSet sinputID, "rect", "38,726,748,916"
mobileControlSet sinputID, "visible", "true"
mobileControlSet sinputID, "opaque", "true"
end if
end opencard

on keyboardActivated
mobileControlSet sinputID, "rect", "36,320,746,510"
set the rect of graphic "rectangle" to "36,320,746,510"
end keyboardActivated

on keyboardDeactivated
mobileControlSet sinputID, "rect", "38,726,748,916"
set the rect of graphic "rectangle" to "38,726,748,916"
end keyboardDeactivated
and i'm using the following code:

Code: Select all

local sinputId

on opencard
if environment() = "mobile" then
mobileControlCreate "input", "userName"
put the result into sinputId
mobileControlSet sinputId, "rect", "8,538,232,562"
mobileControlSet sinputId, "visible", "true"
mobileControlSet sinputId, "opaque", "true"
mobileControlSet sinputId, "label", "message"
end if
end opencard

on keyboardActivated
   move graphic "inputback" to 160,304
   move graphic "inputback2" to 160,259
   mobileControlSet sinputId, "rect", "4,226,316,292"
end keyboardActivated

on keyboardDeactivated
   mobileControlSet sinputId, "rect", "8,538,232,562"
      move graphic "inputback2" to 160,700
      move graphic "inputback" to 160,634
end keyboardDeactivated
the movement, and input work perfectly. What I'm trying to do is take the information entered to that field, and move it somewhere else....

I've created a button and used the following code, but have no luck thus far:

Code: Select all

on mouseUp
answer field "userName"
end mouseUp
**according to the dictionary this should be the name i've assigned to the field, but it is quite possible i misunderstood the examples.

Code: Select all

on mouseUp
answer mobileControl("userName")
end mouseUp

Code: Select all

on mouseUp
local sinputID

answer sinputID
end mouseUp
this was one i thought may work since the variable during the open card portion of the script.

Neither of these, nor the other variations of these have yielded any result. I'm sure i'm missing something simple, but can't seem to figure out how to call out to the field that has been created.

Thank you in advance for any assistance (or resources) you can provide.

-Sean
Last edited by sms5138 on Mon Jul 20, 2015 9:37 pm, edited 1 time in total.

Dixie
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 1336
Joined: Sun Jul 12, 2009 10:53 am

Re: Question about mobileControlCreate

Post by Dixie » Mon Jul 20, 2015 9:07 pm

To get the text from the control use ...

Code: Select all

local sinputId

on mouseUp
   put mobilecontrolGet(siputId, "text") into fld 1
end mouseUp

sms5138
Posts: 126
Joined: Mon Feb 23, 2015 11:49 pm

Re: Question about mobileControlCreate

Post by sms5138 » Mon Jul 20, 2015 9:37 pm

Thanks so much Dixie!

Post Reply