Making "Wells": Whose Control Is It Anyway?

MisterX b.xavier at internet.lu
Tue Feb 22 12:55:31 EST 2005


Something like this was reported some time ago...

Have you tried the AltID or using a customProperty?

put the name of grp x into thisgroup
set the TagID of thisgroup to NextIDNumber

Then you're not dependent on the ID of the control.
Very good trick to make custom orders in group
layers...

Stack IDs are variable by the way... Never count on
them! This is a big limitation for end users which I
hope RunRev will fix.

Come to think of it, I haven't encountered your problem
using ControlN2O which browses all controls in a stack. 
I'll do some testing soon!

cheers
Xavier


> -----Original Message-----
> From: use-revolution-bounces at lists.runrev.com 
> [mailto:use-revolution-bounces at lists.runrev.com] On Behalf Of 
> Jerry Balzano
> Sent: Tuesday, February 22, 2005 18:05
> To: How to use Revolution
> Subject: Making "Wells": Whose Control Is It Anyway?
> 
> 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