deleting clones
Posted: Fri Oct 30, 2009 11:29 pm
Hi again,
I need help deleting clones on preOpenCard
This is the scenario:
On my card, I have a group containing a graphic and a field. I also have a button that creates clones of the whole group. Everytime a group is cloned, it receives a different name. This is my code.
on mouseUp
clone group Goval
repeat with i = 1 to the number of groups in card "graphics"
set the name of the last group to "Clone" & i
set the name of the last graphic to "oval" & i
set the name of the last field to "topic" & i
set the location of last group to 157, 176
end repeat
Now, I need to make sure that eveerytime the end user opens this card, there won't be any clone. This is the part that is not working.
on preOpenCard
if exists group ("Clone" & i) then
delete group "Clone" & i
end if
if exists (graphic "oval" & i) then
delete graphic "oval" & i
end if
if exists (field "topic" & i) then
delete field "topic" & i
end if
end preOpenCard
This is the message I get:
card "Graphics": compilation error at line 6 (Function: missing '('), char 7
Any suggestions?
Thanks
Marta
I need help deleting clones on preOpenCard
This is the scenario:
On my card, I have a group containing a graphic and a field. I also have a button that creates clones of the whole group. Everytime a group is cloned, it receives a different name. This is my code.
on mouseUp
clone group Goval
repeat with i = 1 to the number of groups in card "graphics"
set the name of the last group to "Clone" & i
set the name of the last graphic to "oval" & i
set the name of the last field to "topic" & i
set the location of last group to 157, 176
end repeat
Now, I need to make sure that eveerytime the end user opens this card, there won't be any clone. This is the part that is not working.
on preOpenCard
if exists group ("Clone" & i) then
delete group "Clone" & i
end if
if exists (graphic "oval" & i) then
delete graphic "oval" & i
end if
if exists (field "topic" & i) then
delete field "topic" & i
end if
end preOpenCard
This is the message I get:
card "Graphics": compilation error at line 6 (Function: missing '('), char 7
Any suggestions?
Thanks
Marta