Resizing a group
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller
Resizing a group
Hi All,
I have a group composed of a graphic (an oval or a rectangle) and a field.
I want the end user to be able to resize the whole group maintaining the aspect ratio.
I have tried puting this code into the group:
on mouseDoubleDown
choose pointer tool
select me
end mouseDoubleDown
When in running mode, the handlers of the group appear, but they do not resize the objects conteined in it.
I have also tried
on mouseDoubleDown
choose pointer tool
select graphic ¨"oval" and field "topic"
end mouseDoubleDown
In this case the all handlers appear, which of course looks really messy.
I think I might be missing something, maybe just setting a property in the group property inspector.
Any suggestions?
Thanks,
Marta
I have a group composed of a graphic (an oval or a rectangle) and a field.
I want the end user to be able to resize the whole group maintaining the aspect ratio.
I have tried puting this code into the group:
on mouseDoubleDown
choose pointer tool
select me
end mouseDoubleDown
When in running mode, the handlers of the group appear, but they do not resize the objects conteined in it.
I have also tried
on mouseDoubleDown
choose pointer tool
select graphic ¨"oval" and field "topic"
end mouseDoubleDown
In this case the all handlers appear, which of course looks really messy.
I think I might be missing something, maybe just setting a property in the group property inspector.
Any suggestions?
Thanks,
Marta
Marta,
how are the graphic and the field placed on the group, are they centered or do they overlap. Do you want both controls to change size or just one. All this matters when you want to change the size of the controls. What is the effect you want to achieve by changing the size of the group?
regards
Bernd
how are the graphic and the field placed on the group, are they centered or do they overlap. Do you want both controls to change size or just one. All this matters when you want to change the size of the controls. What is the effect you want to achieve by changing the size of the group?
regards
Bernd
The scenario:
end users are constructing a mental map (something similar to what you can do with Inspiration).
So, in the group, the field "topic" is inside the graphic "oval". In some ocasions, users may want to write long sentences, so they need to be able to resize both the field and the graphic at the same time. I though placing them in a group would make it.
end users are constructing a mental map (something similar to what you can do with Inspiration).
So, in the group, the field "topic" is inside the graphic "oval". In some ocasions, users may want to write long sentences, so they need to be able to resize both the field and the graphic at the same time. I though placing them in a group would make it.
Marta,
I posted a stack on the new (>=3.5) RevOnline ResizeGroup. If you search for it you should find it.
You can resize the group by clicking in the lower right hand red square. If you click into the red of the oval graphic you can move the stack around.
The script is generic enough so that you can clone groups without interference (at least I hope)
Tell me what you think.
regards
Bernd
It really helps when you describe a scenario and give a little detail on what you are after.
I posted a stack on the new (>=3.5) RevOnline ResizeGroup. If you search for it you should find it.
You can resize the group by clicking in the lower right hand red square. If you click into the red of the oval graphic you can move the stack around.
The script is generic enough so that you can clone groups without interference (at least I hope)
Tell me what you think.
regards
Bernd
It really helps when you describe a scenario and give a little detail on what you are after.

Marta,
I discovered 2 bugs in the code I posted on RevOnline, and I corrected them. One affects the cloning of the groups. (should have tested before posting...) Now, from all I can see it works. And from what I gather from your earlier posts, you probably will want to clone the group.
If you have difficulties understanding I will be glad to help.
regards
Bernd
I discovered 2 bugs in the code I posted on RevOnline, and I corrected them. One affects the cloning of the groups. (should have tested before posting...) Now, from all I can see it works. And from what I gather from your earlier posts, you probably will want to clone the group.
that is the whole fun, especially if one trys to understand one's own code...Now I am working on understanding the whole thing

If you have difficulties understanding I will be glad to help.
regards
Bernd
More about resizing groups
The stack Bernd put on RevOnline was great. I made some modifications to fit the needs of my project.
I was able to clone groups containing different types of graphics. However, I have a couple of questions.
I realized my end users will probably want to erase some of those groups if they clone more than they need, so I added a small cross to my group. If the user double click on it the idea is that the group disappear. This is the code I have on the cross,
on mouseDoubleDown
delete the owner of me
end mouseDoubleDown
I dont know why it is not working.
This is the error message I get:
image "Delete2.png": execution error at line n/a (Object: stack locked, or object's script is executing)
The other problem I have is that i need to adjust the location of the cross if my group contains an oval, this is more complicated than if it is a rectangle or a square.
This is the code in the handler:
-- now adjust the locaction of this resize control
set the right of me to the right of grc 1 of of the owner of me
set the bottom of me to the bottom of grc 1 of of the owner of me
unlock screen
So, I though I could just add
set the left of image "Delete2" to the left of grc 1 of of the owner of me
set the bottom of image "Delete2" to the bottom of grc 1 of of the owner of me
And this is the error message I get;
image "Ohandler.png": execution error at line 59 (Chunk: no such object) near "Delete2", char 17
Any suggestions?
Thanks
Marta

The stack Bernd put on RevOnline was great. I made some modifications to fit the needs of my project.
I was able to clone groups containing different types of graphics. However, I have a couple of questions.
I realized my end users will probably want to erase some of those groups if they clone more than they need, so I added a small cross to my group. If the user double click on it the idea is that the group disappear. This is the code I have on the cross,
on mouseDoubleDown
delete the owner of me
end mouseDoubleDown
I dont know why it is not working.
This is the error message I get:
image "Delete2.png": execution error at line n/a (Object: stack locked, or object's script is executing)
The other problem I have is that i need to adjust the location of the cross if my group contains an oval, this is more complicated than if it is a rectangle or a square.
This is the code in the handler:
-- now adjust the locaction of this resize control
set the right of me to the right of grc 1 of of the owner of me
set the bottom of me to the bottom of grc 1 of of the owner of me
unlock screen
So, I though I could just add
set the left of image "Delete2" to the left of grc 1 of of the owner of me
set the bottom of image "Delete2" to the bottom of grc 1 of of the owner of me
And this is the error message I get;
image "Ohandler.png": execution error at line 59 (Chunk: no such object) near "Delete2", char 17
Any suggestions?
Thanks
Marta
edit: The other error, if you pasted your code in, i'd guess the problem is the 2nd "of" in each line, a bit tired at the moment, so if theres another issue, I can't see it.
edit2: Ok, so delete the target gets ride of ALL objects because target returns the card id. DOH. Should know better than to answer while tired.
Still explains why an object can't delete itself though, so its a step.
In this case, it means exactly what it says. You can't delete an object that is currently executing code, and since the code to delete the object is in the object its deleting, its a no win situation.
Instead try this. Its a MUCH simplified form that does zero checking of whether its really what you want to delete, but works as a proof.
Put your mouseDoubleDown script in the stack or card script.
Just as an experiment change the delete line to
This way you should be able to rampage through pretty much any objects in your stack and send em to the void.
edit2: Ok, so delete the target gets ride of ALL objects because target returns the card id. DOH. Should know better than to answer while tired.

Still explains why an object can't delete itself though, so its a step.
Code: Select all
set the left of image "Delete2" to the left of grc 1 [b]of of[/b] the owner of me
set the bottom of image "Delete2" to the bottom of grc 1 [b]of of[/b] the owner of me
Instead try this. Its a MUCH simplified form that does zero checking of whether its really what you want to delete, but works as a proof.
Put your mouseDoubleDown script in the stack or card script.
Just as an experiment change the delete line to
Code: Select all
delete the target
This is the error message I get:
image "Delete2.png": execution error at line n/a (Object: stack locked, or object's script is executing)
Ok, No clue why, but if you use it works.
in a stack or card script it works, mouseDoubleDown for some reason I don't understand always returns the card id as the target. /shrug
Code: Select all
on mouseDoubleUp
delete the target
end mouseDoubleUp
Marta,
I uploaded a version that can delete itself. Just dont let the user delete the last group, then your template group will be gone...
the trick is to send a message to the stack script in 2 milliseconds and then this script deletes the group.
I put the delete image in the upper left corner of the graphic.
regards
Bernd
I uploaded a version that can delete itself. Just dont let the user delete the last group, then your template group will be gone...
the trick is to send a message to the stack script in 2 milliseconds and then this script deletes the group.
I put the delete image in the upper left corner of the graphic.
regards
Bernd