LC / Mobgui & Changing Input text fields on openCard

This is the place to discuss anything relating to MobGUI

Moderators: heatherlaine, robinmiller, kevinmiller, malte, splash21

Post Reply
ThomasFireheart
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 48
Joined: Sat May 24, 2008 2:27 pm
Location: Indiana, USA

LC / Mobgui & Changing Input text fields on openCard

Post by ThomasFireheart » Wed May 27, 2015 4:17 pm

I haven't been able to change input fields during the openCard handler. Is there some secret command or function that I am missing ? Attached is a sample stack that has an input field and two buttons. The input field has default text of "Default Text", but I am trying to change it on the openCard. One button then displays the value in the input field and another button sets the text.

Currently, when I run this in the iOS simulator, the input field shows "Default Text" instead of the text that is it should display - "Changed on openCard".

Can anyone provide any guidance ?
Attachments
Untitled1.livecode.zip
(3.88 KiB) Downloaded 89 times

LCNeil
Livecode Staff Member
Livecode Staff Member
Posts: 1223
Joined: Wed Oct 03, 2012 4:07 pm

Re: LC / Mobgui & Changing Input text fields on openCard

Post by LCNeil » Wed May 27, 2015 4:25 pm

Hi Thomas,

MobGui controls are just LiveCode groups, so you should be able to manipulate them via script.

Try the following in your openCard handler

Code: Select all

on openCard
   put "open card" into field "mgcLabel" of group "Input-1005"
end openCard
I hope this helps :)

Kind Regards,

Neil Roger
--
LiveCode Support Team ~ http://www.livecode.com
-

ThomasFireheart
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 48
Joined: Sat May 24, 2008 2:27 pm
Location: Indiana, USA

Re: LC / Mobgui & Changing Input text fields on openCard

Post by ThomasFireheart » Wed May 27, 2015 4:39 pm

Thanks for the quick reply. Making that change yielded no effect. I've previously tried 'set the mgText...' as well as 'mobileControlSet ...' and now 'put xx into field...'

Would you happen to have any other ideas ? I'm trying this with MobGui 1.28 and LC 7.0x and LC 6.7.5 on the iOS Simulator 8.3

Does the attached file work for anyone ?
Attachments
Untitled 1.livecode.zip
(3.94 KiB) Downloaded 103 times

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

Re: LC / Mobgui & Changing Input text fields on openCard

Post by Simon » Wed May 27, 2015 8:57 pm

Hi Thomas,
You have 2 on openCards in the card script.
Remove the empty one.

Simon
I used to be a newbie but then I learned how to spell teh correctly and now I'm a noob!

ThomasFireheart
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 48
Joined: Sat May 24, 2008 2:27 pm
Location: Indiana, USA

Re: LC / Mobgui & Changing Input text fields on openCard

Post by ThomasFireheart » Fri May 29, 2015 1:08 pm

Thanks for the reply. I've now learned that:

-) If there are multiple handlers named the same, Livecode doesn't issue an error.

-) Mobile controls aren't created before the openCard and you need to use the 'send "mobileSetup" to me in 5 milliseconds' or some such workaround.

-) In the mobileSetup handler, 'mobileControlSet...' or 'set the mgText' works but 'put ... into field ...' doesn't work.

As always, thanks for the help :)

Post Reply

Return to “MobGUI”