Re: Join Group within a tcl script

George Eddy (eddy@ISI.EDU)
Tue, 16 Apr 96 20:43:15 PDT

According to: Kelly J. Jeglum
>
> Does anyone know of a way to have a tcl script add icons to a group that
> already exists without distroying and recreating the group?
>
> The Join Group command is useful from the interactive tkined screen, but,
> I can't use it in my startup script. ... or can I?
>
> I'd like to have the script place groups in a predefined matrix and then
> add other objects to the groups. I'll then be able to view the objects
> in the groups by collapsing and expanding individual group elements of
> the matrix.
>
> Thanks
> Kelly Jeglum

following is an example script. Note you don't destroy and
recreate the group, but you must provide the "ined group" command with
the old as well as the new members. the basic idea is:

set oldmembers [ined -noupdate member $group]
set cmd "ined -noupdate member $group $oldmembers $new1 $new2"
eval $cmd

hope this helps

-- 

- rusty

eddy@isi.edu

========================== (example) ===========================

#!/kit/rusty/bin/scotty -f

## create a couple nodes set node2 [ ined -noupdate create NODE ] ined -noupdate move $node2 193.00 207.00 ined -noupdate icon $node2 machine ined -noupdate font $node2 fixed ined -noupdate name $node2 node2 ined -noupdate label $node2 name

set node0 [ ined -noupdate create NODE ] ined -noupdate move $node0 184.00 109.00 ined -noupdate icon $node0 machine ined -noupdate font $node0 fixed ined -noupdate name $node0 node0 ined -noupdate label $node0 name

## now create a group with the two original nodes set group1 [ ined -noupdate create GROUP $node2 $node0 ] ined -noupdate move $group1 -9999999 -9999999 ined -noupdate move $group1 254.50 158.50 ined -noupdate icon $group1 group ined -noupdate font $group1 fixed ined -noupdate name $group1 agroup ined -noupdate label $group1 name

## now create two new nodes set id1 [ined -noupdate create NODE] ined -noupdate move $id1 184.00 199.00 ined -noupdate name $id1 "newnode1" ined -noupdate label $id1 name

set id2 [ined -noupdate create NODE] ined -noupdate move $id2 144.00 109.00 ined -noupdate name $id2 "newnode2" ined -noupdate label $id2 name

# just to show the new nodes outside of the group. sleep 5

## add the new node with the existing to the group set oldmembers [ined -noupdate member $group1] set cmd "ined -noupdate member $group1 $oldmembers $id1 $id2" eval $cmd