Page 1 of 1

Question about mobileControlCreate [solved]

Posted: Mon Jul 20, 2015 8:41 pm
by sms5138
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

Re: Question about mobileControlCreate

Posted: Mon Jul 20, 2015 9:07 pm
by Dixie
To get the text from the control use ...

Code: Select all

local sinputId

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

Re: Question about mobileControlCreate

Posted: Mon Jul 20, 2015 9:37 pm
by sms5138
Thanks so much Dixie!