Hi,
Here's an example. It is a silly one, but it works.
Make a graphic with the following script:
on mouseUp
try
iPhoneControlCreate "input","test"
iPhoneControlSet "test","rect",the rect of grc 1
iPhoneControlSet "test","text","hi"
put iPhoneControlGet("test","text") into x
iPhoneControlDelete "test"
answer x
catch err
answer err
end try
end mouseUp
It will set and get the text from the UITextView. If you want to have a
UITextView permanently available for editing, you need to create it when the
stack opens:
on openStack
iPhoneControlCreate "input","Sample"
iPhoneControlSet "Sample","rect",the rect of grc 1
iPhoneControlSet "Sample","visible",true
end openStack
The line that makes the UITextView visible is essential, because it is
invisible by default (an incomprehesible choice IMHO). Set the script of the
graphic to:
on mouseUp
iphoneControlDo "Sample", "focus"
end mouseUp
Whenever you need the text, you can access the text property using the
iPhoneControlGet function.
It is quite a shame that UITextFields aren't built into LiveCode as native
objects. I wish we wouldn't need to think about whether we're using Android,
iPhone or Windows. Alas, these objects are simulated rather than native, making
it quite a hassle to use them. Consequently, there is no simple-ish solution
and reading this lesson http://qery.us/xu is necessary to understand how
UITextViews work.
--
Best regards,
Mark Schonewille
Economy-x-Talk Consulting and Software Engineering
Homepage: http://economy-x-talk.com
Twitter: http://twitter.com/xtalkprogrammer
KvK: 50277553
What does that error mean? Buy LiveCodeErrors for iPhone now http://qery.us/v4
A must-have for LiveCode programmers.
On 23 aug 2011, at 09:50, Phil Jimmieson wrote:
> Hi folks,
> Does anyone have any simple-ish examples of using UITextFields and
> UITextViews in LiveCode iOS apps that they're willing to share? I'm a bit
> lost without some actual examples to pick apart.
>
> Thanks
>
> --
> Phil Jimmieson [email protected] (UK) 0151 795 4236
> Computer Science Dept., Liverpool University, Ashton Building, Ashton Street
> Liverpool L69 3BX http://www.csc.liv.ac.uk/~phil/
> I used to sit on a special medical board... ...but now I use this ointment.
_______________________________________________
use-livecode mailing list
[email protected]
Please visit this url to subscribe, unsubscribe and manage your subscription
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode