Page 1 of 1

Am I missing something in my code? [solved]

Posted: Wed Jul 15, 2015 1:11 am
by sms5138
Hi everyone!

I've run into a bit of a snag with mobGUI. I really like how it's been working so far, but wondered if anyone else has tried to set it such that a multiline input, or input field will move up when the keyboard is activated.

I've managed to get it such that the rectangle behind the multiline input, and the confirm button will move to the desired location, but the multiline input field remains stationary... wondered if there was something i'm missing. when just trying to move the multiline input field i use the following:

Code: Select all

on openCard
   if environment() = "mobile" then
      mobileControlCreate "input"
      put the result into sinputID
      mobileControlSet sinputID, "-4,473,326,575"
      mobileControlSet sinputID, "visible", "true"
      mobileControlSet sinputID, "opaque", "true"
   end if
end openCard

on keyboardActivated
   mobileControlSet sinputID, "rect", "-4,256,326,358"
   set the rect of group "input" to "-4,256,326,358"
end keyboardActivated

on keyboardDeactivated
   mobileControlSet sinputID, "rect", "-4,473,326,575"
   set the rect of group "input" to "-4,473,326,575"
end keyboardDeactivated
I wondered if anyone could let me know if i'm perhaps missing something?

Thank you in advance!

-Sean

Re: Am I missing something in my code?

Posted: Wed Jul 15, 2015 1:37 pm
by Klaus
Hi Sean,

no idea if that is the troublemaker, but there is the keyword RECT issing in your "opencard" handler:
...
mobileControlCreate "input"
put the result into sinputID
## mobileControlSet sinputID, "-4,473,326,575"
mobileControlSet sinputID, "rect", "-4,473,326,575"
...


Best

Klaus

Re: Am I missing something in my code?

Posted: Thu Jul 16, 2015 4:05 pm
by sms5138
Thanks Klaus!

I'll have to give this a shot when i have time later today, and let you know if that fixed it!

regards,

Sean

Re: Am I missing something in my code?

Posted: Fri Jul 17, 2015 5:52 pm
by sms5138
Thanks Klaus!

looked at your advise, and got it working!

I really appreciate your help! it was simple, but it was driving me a bit crazy.

regards,

Sean

Re: Am I missing something in my code?

Posted: Sun Jul 19, 2015 3:10 pm
by sms5138
Hello again...

I've come into a strange problem... i thought that this had fixed my issue, but apparently it did not. it will work in live code, but not in the emulator...

I've attached an example project of what i'm trying to do here https://db.tt/EWKntTqh

As you'll see i've changed the code a bit for this example, but regardless of if i use the new code or the old code (shown in the post above) i get the same result.. movement in livecode, and nothing in the iPhone emulator?

does anyone have any ideas as to why this might be the case or know a of possible fix?

thank you in advance for any insight you can provide!

regards,

Sean