grouping objects by script problem

Mark Schonewille m.schonewille at economy-x-talk.com
Tue Oct 23 05:41:38 EDT 2007


Hi Ron,

Commands like "select" and "group" can't interprete a string variable  
as a reference. They need to be followed by a true reference to  
objects. The solution is to use the "do" command:

on makeGroup
   repeat with x = 1 to 4
     create graphic ("New Object" && x)
     put "graphic" && quote & x & quote & return after grouplist
   end repeat
   replace return with " and " in grouplist
   delete last word of grouplist
   do "group" && grouplist
end makeGroup

Best regards,

Mark Schonewille

--

Economy-x-Talk Consulting and Software Engineering
http://economy-x-talk.com
http://www.salery.biz

Quickly extract data from your HyperCard stacks with DIFfersifier.  
http://differsifier.economy-x-talk.com


Op 23-okt-2007, om 11:09 heeft ron barber het volgende geschreven:

> Hi,
>
> I have been trying to group a set of controls and graphic objects
> after creating them via script but can't seem to find out what I'm
> doing wrong.
> Here's the relevant part of the script:
>
> repeat
> --do some other stuff here--
>      create graphic tname
>      put "graphic"&&quote&tname&quote & return after grouplist
>     end repeat
> replace return with " and " in grouplist
>  delete last word of grouplist
>  select grouplist
>  group
>
> the error I get is a problem with the "object expression" at the
> select statement
>
> grouplist looks like this:
> graphic "g1" and graphic "g2" and graphic "g3" and graphic "g4"
>
> when I manually enter the above text after the select or group command
> it works - but it doesn't seem to like the variable?
>
> how do I group a bunch of controls etc on a stack that is created  
> on the fly?
>
> Thanks
> Ron





More information about the use-livecode mailing list