scripting the creation of text fields

LiveCode is the premier environment for creating multi-platform solutions for all major operating systems - Windows, Mac OS X, Linux, the Web, Server environments and Mobile platforms. Brand new to LiveCode? Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
Alistair
Posts: 33
Joined: Mon Jun 23, 2008 6:45 am

scripting the creation of text fields

Post by Alistair » Fri Sep 12, 2008 5:00 am

I have been trying to script the creation of a text field but without success. When I use the following I receive an error message "No such object" with "rlabel" being identified as the offending object:

create field "rlabel"
set the location of field "rlabel" to x1+200,y1-27

Janschenkel
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 977
Joined: Sat Apr 08, 2006 7:47 am
Contact:

Post by Janschenkel » Fri Sep 12, 2008 6:55 am

After the engine executes the 'create' command, the 'it' variable contains the long id of the freshly created object.
You may want to wrap it in a 'lock messages'/'unlock messages' pair to prevent the Revolution IDE from tampering with your new object. This will also prevent the phenomenon where you leave 'browse' mode after such a create statement.
Also check 'the result' and 'it' right after the call to 'create' - that might provide additional clues.

Hope this helped,

Jan Schenkel.
Quartam Reports & PDF Library for LiveCode
www.quartam.com

Mark
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 5150
Joined: Thu Feb 23, 2006 9:24 pm
Contact:

Post by Mark » Fri Sep 12, 2008 8:34 am

Hi Alistair,

I just tried the following script:

Code: Select all

on mouseUp
   put 1 into x1
   put 2 into y1
   create fld "rlabel"
   set the location of field "rlabel" to x1+200,y1-27
end mouseUp
and it works fine. Perhaps you could post your complete handler and let us check whether there are any errors in it.

Best,

Mark
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode

Alistair
Posts: 33
Joined: Mon Jun 23, 2008 6:45 am

Post by Alistair » Wed Sep 17, 2008 2:46 am

Thanks for the suggestions on this issue. The problem turned out to be a syntax error that I feel embarrassed not to have picked up.

Post Reply