Page 1 of 1

Putting a graphic into a group

Posted: Thu Nov 12, 2009 7:27 pm
by mtecedor
Hi All,

I am having problems moving a line created by the end user into an already existing group.

This is the scenario:

I have a small group containing a really small image.

When the end user click on a button, (s)he can draw a line the size (s)he wants.
This is the code in the button:

on mouseUp
put the number of graphics of this card into tGraphicNo
choose graphic tool

--Creates a line with the following characteristics
set the style of the templateGraphic to "line"
set the lineSize of the templateGraphic to 2
set the endArrow of templateGraphic to true
set the startArrow of templateGraphic to true
set the arrowSize of templateGraphic to 4
set the foregroundColor of templateGraphic to "red"

-- put width and height of new line into variable
put the width of templateGraphic into tWidthGraphic
put the height of templateGraphic into tHeightGraphic
--name the new line
set the name of templateGraphic to "lineclone" & tGraphicNo
end mouseUp

Then I resize the group to be the same size as the line.

This is the code in the card:
on newGraphic
choose browse tool
clone group GLine
put the number of groups of this card into tGroupNo
set the name of last group to "LClone" & tGroupNo
set the invisible of group ("LClone" & tGroupNo) to false

--resize group
set the width of group ("Lclone" & tGroupNo) to the width of graphic ("lineclone" & tGraphicNo)
set the height of group ("Lclone" & tGroupNo) to the height of graphic ("lineclone" & tGraphicNo)
end newGraphic


Then, I need to put that line into the group.

I have tried with the put command, but it tells me that the group is not a container.

Then i have tried with the start/stop editing commands, but it doesnt work. If I put them into the button, it tells me that it cannot find the background. If I put it into the card, it tells me that it cannot find the background in the stop editing command.

Any ideas? Is there any other simpler way to do it?

Thanks

Marta

Posted: Thu Nov 12, 2009 9:09 pm
by Janschenkel
You can set the relayerGroupedControls global property to reue, and then change the layer of your newly created line graphic to move it into the group.

HTH,

Jan Schenkel.

Posted: Fri Nov 13, 2009 2:26 am
by mwieder
There's a bug in the "stop editing" command. *Don't* use the group name.

These work (usually):

Code: Select all

stop editing group
stop editing background
This doesn't:

Code: Select all

stop editing group "LClone"

Posted: Fri Nov 13, 2009 4:03 am
by mtecedor
Thanks for your replies.

I think I found a way around. I ungroup the group, and then, put my image and the new line into a new group. Maybe its not very elegant, but it works.

Marta