Multiline problems

This is the place to discuss anything relating to MobGUI

Moderators: heatherlaine, kevinmiller, robinmiller, malte, splash21

Post Reply
arkstar
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 70
Joined: Mon Dec 21, 2009 1:51 am
Location: Westchester, New York

Multiline problems

Post by arkstar » Mon Feb 24, 2014 1:56 pm

Hi John,

I've added a multiline field for Android to my stack. I cannot set the text using mgText or mobileControlSet.
I would like to put the contents of a variable into it then copy it.
But for now, I can't even set the test to anything.

All i get is a blank box. I can input text though, but that doesn't solve my problem.

Example: mobileControlSet "Instruct", "text", tInstruct
Example 2: mobileControlSet "Instruct", "text", "Continue" (this doesn't work either)
To copy: copy the mgText of grp "Instruct"

Are these correct statements? Any idea as to why this is not working? I am running the app on the simulator....

Thanks,
Rob
Rob Glassman
ArkStar

splash21
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 369
Joined: Sun Dec 19, 2010 1:10 am
Location: UK
Contact:

Re: Multiline problems

Post by splash21 » Mon Feb 24, 2014 5:27 pm

Hi, Rob. Two recent examples spring to mind. The first was strange : the control's text wouldn't set unless an empty string was prepended to it;
(http://forums.runrev.com/viewtopic.php?f=54&t=18887)

The normal command wouldn't work, but the following would;

Code: Select all

mobileControlSet "Instruct", "text", "" & tInstruct
The seconds example was trying to set the text in an openCard handler, but since the openControl message doesn't fire until AFTER openCard, the native control didn't exist yet - we had two alternatives;

use the script of the native input control...

Code: Select all

on openControl
   mobileControlSet "test" , "text", "Trial display text"
end openControl

delay setting the native control properties from the openCard handler...

Code: Select all

on openCard
   send "mobileSetup" to me in 0 millisecs
end openCard

on mobileSetup
   mobileControlSet "test" , "text", "Trial display text"
end mobileSetup

Hopefully, this info will help your situation, but please post again if not!
LiveCode Development & Training : http://splash21.com

arkstar
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 70
Joined: Mon Dec 21, 2009 1:51 am
Location: Westchester, New York

Re: Multiline problems

Post by arkstar » Mon Feb 24, 2014 8:05 pm

Thanks John,

But none of them worked. I now get the control with "tInstruct" in it. I set a breakpoint and tInstruct does contain the proper text.

Here's the code I am using...

put item 8 of line tLineNo of fld "theList" into fld "Instructions"
put the fld "Instructions" into tInstruct
delete char 1 of tInstruct

end preOpenCard

on openCard
   send "mobileSetup" to me in 0 millisecs
end openCard

on mobileSetup
if the environment="mobile" then
mobileControlSet "test" , "Instruct", "" & tInstruct
end if
end mobileSetup

-----------------------------------
I also used "set the mgText of group "Instruct" to "" & tInstruct" instead of mobileControlSet. Also, shows "tInstruct"

Any ideas?

Thanks again, Rob
Rob Glassman
ArkStar

Jellicle
Posts: 453
Joined: Thu Feb 24, 2011 11:07 am

Re: Multiline problems

Post by Jellicle » Mon Feb 24, 2014 9:18 pm

Is tInstruct a local variable that has bee declared at the top of the script?

If it hasn't been declared then of course it won't work :)

Also,your call to the control to set its text is wrong. mobileControlSet "test" , "Instruct", "" & tInstruct should be:

mobileControlSet "test" , "text", "" & tInstruct

Gerry
14" MacBook Pro
Former LiveCode developer.
Now recovering.

splash21
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 369
Joined: Sun Dec 19, 2010 1:10 am
Location: UK
Contact:

Re: Multiline problems

Post by splash21 » Mon Feb 24, 2014 9:30 pm

Gerry's got it :)

I just reconstructed a stack with your data and everything works OK - let us know if it doesn't - in case there's something else going on!
LiveCode Development & Training : http://splash21.com

arkstar
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 70
Joined: Mon Dec 21, 2009 1:51 am
Location: Westchester, New York

Re: Multiline problems

Post by arkstar » Mon Feb 24, 2014 11:58 pm

Thanks Guys,

I did exactly what you said. Also, I don't know what happened but i copied in the wrong tex but my statement was correct.
I hadn't declared the local var but it.

No difference. The multiline show tInstruct.

John,
Can you send me your working stack to compare?

Thanks you both for your help! I really appreciate it!

Rob
Rob Glassman
ArkStar

splash21
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 369
Joined: Sun Dec 19, 2010 1:10 am
Location: UK
Contact:

Re: Multiline problems

Post by splash21 » Tue Feb 25, 2014 12:50 am

Rob - test stack attached. I renamed the script local to sInstruct (force of habit!)
Rob1.zip
(3.2 KiB) Downloaded 296 times
LiveCode Development & Training : http://splash21.com

arkstar
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 70
Joined: Mon Dec 21, 2009 1:51 am
Location: Westchester, New York

Re: Multiline problems

Post by arkstar » Tue Feb 25, 2014 3:22 am

Thanks John! I'l let you know!

Rob
Rob Glassman
ArkStar

arkstar
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 70
Joined: Mon Dec 21, 2009 1:51 am
Location: Westchester, New York

Re: Multiline problems

Post by arkstar » Tue Feb 25, 2014 4:12 am

That did it guys!

I also rebooted the simulator.

Thanks again for all of your help!

Rob
Rob Glassman
ArkStar

arkstar
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 70
Joined: Mon Dec 21, 2009 1:51 am
Location: Westchester, New York

Re: Multiline problems

Post by arkstar » Tue Feb 25, 2014 4:14 am

OOne more question... sorry...

In Android, can I copy the text of the multiline via commands?
Rob Glassman
ArkStar

splash21
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 369
Joined: Sun Dec 19, 2010 1:10 am
Location: UK
Contact:

Re: Multiline problems

Post by splash21 » Tue Feb 25, 2014 8:59 am

Hi, Rob. Glad it's all working. Unfortunately, I think the clipboardData is still only available on desktop platforms, so I don't think copying the text is possible via code :(
LiveCode Development & Training : http://splash21.com

arkstar
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 70
Joined: Mon Dec 21, 2009 1:51 am
Location: Westchester, New York

Re: Multiline problems

Post by arkstar » Tue Feb 25, 2014 10:02 am

Hi John,
I got it. I used this code and it copied into memory...

put the text the mgText of grp "Test" into the selectedLines
copy

Thanks again for all of your help
Rob Glassman
ArkStar

arkstar
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 70
Joined: Mon Dec 21, 2009 1:51 am
Location: Westchester, New York

Re: Multiline problems

Post by arkstar » Tue Feb 25, 2014 2:27 pm

Hi again,

I don't understand... it worked once. Now it's not.
:cry:
Rob Glassman
ArkStar

Klaus
Posts: 13863
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany
Contact:

Re: Multiline problems

Post by Klaus » Tue Feb 25, 2014 4:15 pm

Hi Rob,

I hope this is a copy/paste error:
...
put the text the mgText of grp "Test"...
...
8)


Best

Klaus

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

Re: Multiline problems

Post by Simon » Tue Feb 25, 2014 11:12 pm

This was a puzzle I once saw
A
Bird in the
the hand is worth
two in the bush

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

Post Reply

Return to “MobGUI”