Dereferencing control ids

dunbarx at aol.com dunbarx at aol.com
Mon Jan 27 17:05:34 EST 2014


Pete.


How are you selecting? I made a few controls, and did this in a button:




on mouseUp
   select control 1 and  control 1 and control 3
   repeat for each line rLine in the selectedObjects
         put the topLeft of rLine & return after sLocations
   end repeat
   answer sLocations
end mouseUp


No problems. When I first read your post I thought maybe a "do" construction might be in order, but it works just fine as is.


Craig




-----Original Message-----
From: Peter Haworth <pete at lcsql.com>
To: How to use LiveCode <use-livecode at lists.runrev.com>
Sent: Mon, Jan 27, 2014 3:49 pm
Subject: Dereferencing control ids


Getting a problem trying to grab the topLeft of each control in the
selectedObjects.  Code is as follows:

repeat for each line rLine in the selectedObjects
   put the topLeft of rLine & return after sLocations
end repeat

I get a runtime error on the "put" statement:

(Chunk: error in object expression) near "field id 1004 of card id 1002 of
stack "test"", char 23.

The field reference is what's in rLine.

I've also tried using a do statement resulting in a slightly different
error - "error in source expression"

If I enter - put the topleft of field id 1004 of card id 1002 of stack
"test" - into the message box, I get a valid result.

I have a horrible feeling this is going to be something really obvious but
nevertheless, what am I doing wrong?

Pete
lcSQL Software <http://www.lcsql.com>
Home of lcStackBrowser <http://www.lcsql.com/lcstackbrowser.html> and
SQLiteAdmin <http://www.lcsql.com/sqliteadmin.html>
_______________________________________________
use-livecode mailing list
use-livecode at lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode

 



More information about the use-livecode mailing list