Making "Wells": Whose Control Is It Anyway?

Jerry Balzano gjbalzano at popmail.ucsd.edu
Tue Feb 22 12:15:27 EST 2005


P.S. Troubleshooting, trying to be more explicit, using variations of 
"the long owner" (at least the variations I could think of), didn't 
help to solve this problem.

	- gjb

On Feb 22, 2005, at 9:04 AM, Jerry Balzano wrote:

> I have a stack where I use grouped objects as “wells” from which users 
> can drag a copy for their own use.  I need to be able to refer to the 
> owner of these grouped objects but it’s also important for the groups 
> to have names.  The copied group has the same name as the original, 
> but this is good, because the name is meaningful.  Anyway, every newly 
> created group has its own distinctive ID, so there should be no 
> problem, right?  Actually, wrong.  If I have a group called “mygroup”, 
> say ID 1004, which I copy and paste to create a new instance of 
> “mygroup”, say ID 1015, my attempts to find out the owner of the 
> objects in the second group always returns the owner of the first 
> group instead.
>
> In more detail, the original group and its copy both have a popup 
> menu.  I have given the button to whom the “menuPick” message is sent 
> a “whoCalled” custom property, so that it resizes the proper controls 
> depending on which instance was the source of the menu choice.  Here’s 
> my menuPick handler:
>
> on menuPick theChoice
>   put the whoCalled of me into caller
>   put theChoice into word 1 of fld id caller
>   if theChoice is "towardsxy" then set the width of fld id caller to 
> 188
>   else set the width of fld id caller to 240
>   put the long id of the owner of fld id caller into owningGroup
>   repeat with i=1 to the number of controls of owningGroup
>     get the name of control i of owningGroup
>     if word 1 of it is "group"
>     then set the right of control i of owningGroup to ((the right of 
> fld id caller) - 5)
>     if word 1 of it is "image"
>     then set the left of control i of owningGroup to ((the left of fld 
> id caller) + 4)
>   end repeat
> end menuPick
>
> (BTW is there not an easier way to get at the elements of a group than 
> this?  I hoped there was, and I was just too dense to figure it out.  
> If so, please let me know.  Any style tips, I would also be grateful 
> to get.)
>
> Everything in the handler works just fine until the command
> put the long id of the owner of fld id caller into owningGroup
>
> What the variable “owningGroup” ends up containing is “Group ID 1004…” 
> (using the same example as above), not “Group ID 1015…”, even when 
> whoCalled is (correctly) referenced as one of the controls in Group ID 
> 1015.
>
> What can I do about this?
>
> Thanks,
> Jerry B
> _______________________________________________
> use-revolution mailing list
> use-revolution at lists.runrev.com
> http://lists.runrev.com/mailman/listinfo/use-revolution
>



More information about the use-livecode mailing list