Page 1 of 1
scripting the creation of text fields
Posted: Fri Sep 12, 2008 5:00 am
by Alistair
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
Posted: Fri Sep 12, 2008 6:55 am
by Janschenkel
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.
Posted: Fri Sep 12, 2008 8:34 am
by Mark
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
Posted: Wed Sep 17, 2008 2:46 am
by Alistair
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.