Putting an object in a specific group

Jan Schenkel janschenkel at yahoo.com
Thu Jan 30 01:55:00 EST 2003


--- Jim Witte <jswitte at bloomington.in.us> wrote:
>    This seems like a very silly question (yes, I
> have looked in the 
> manual), but how do you put an object into a
> specific group by script?  
> You can group objects together, but this always
> creates a new group.  
> Is there a command like "group object(s) <...> into
> group name <...>"
> 
> Thanks,
> Jim
> 

Hi Jim,

As you found out when you read the description in the
'group' entry of the Transcript Dictionary, that
command only creates new groups.
The trick to adding new items to an existing groups is
a bit more elaborate, but it can be done. Look at the
following script, which cuts+pastes the control "foo"
into a group named "bar" :

  select control "foo"
  cut
  start editing group "bar"
  paste
  stop editing group "bar"

If you want, you can bracket these with a lock/unlock
screen pair, and create a library script like:

on addControlToGroup pControlRef, pGroupRef
  lock screen
  select control pControlRef
  cut
  start editing group pGroupRef
  paste
  stop editing group pGroupRef
  unlock screen
end addControlToGroup

Hope this helped,

Jan Schenkel.

=====
"As we grow older, we grow both wiser and more foolish at the same time."  (La Rochefoucauld)

__________________________________________________
Do you Yahoo!?
Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
http://mailplus.yahoo.com



More information about the use-livecode mailing list