Changing the size of objects
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller
Changing the size of objects
It seems that if I change the width or height of an object, other location properties change automatically. Same thing if change the left, top, bottom, or right. For instance, if I change the width of an object, it's left property changes by half the adjustment I made to the width, if I change the height of an object, it's top changes similarly.
This seems like totally arbitrary behaviour and I'm hoping that someone can point me to a way to prevent it from happening since I have not yet come across a single situation where I wanted this to happen. I thought maybe the "lock size and position" option in the inspector would prevent that behaviour but it doesn't.
Unless I write extra code, this can lead to unfortunate happenings. For example, I changed the height of a stack depending on its data contents and the automatic adjustment of the top location caused the top of the stack to be above the top of the screen! I closed it using the message box but if that happened in a standalone app, it would be a big problem.
Thanks for any advice,
Pete
This seems like totally arbitrary behaviour and I'm hoping that someone can point me to a way to prevent it from happening since I have not yet come across a single situation where I wanted this to happen. I thought maybe the "lock size and position" option in the inspector would prevent that behaviour but it doesn't.
Unless I write extra code, this can lead to unfortunate happenings. For example, I changed the height of a stack depending on its data contents and the automatic adjustment of the top location caused the top of the stack to be above the top of the screen! I closed it using the message box but if that happened in a standalone app, it would be a big problem.
Thanks for any advice,
Pete
Re: Changing the size of objects
Hi Pete,
I am afraid there is no way to avoid a bit more scripting!
I got used to do this:
...
lock screen
put the loc of btn "xyz" into oldloc
# change widht/height etc...
# more changes...
set the loc of btn "xyz" to oldloc
unlock screen
...
You get the picture.
Best
Klaus
I am afraid there is no way to avoid a bit more scripting!
I got used to do this:
...
lock screen
put the loc of btn "xyz" into oldloc
# change widht/height etc...
# more changes...
set the loc of btn "xyz" to oldloc
unlock screen
...
You get the picture.
Best
Klaus
-
- VIP Livecode Opensource Backer
- Posts: 9751
- Joined: Wed May 06, 2009 2:28 pm
- Location: New York, NY
Re: Changing the size of objects
Klaus has a point (no pun intended), in that a little scripting will be required.
But what I am hearing is that you want to lock the topLeft of and object. This will keep it visually "in place" while allowing it to grow in a "normal" way, that is, down and to the right.
So take his script and substitute "topLeft" for "loc.
Craig Newman
But what I am hearing is that you want to lock the topLeft of and object. This will keep it visually "in place" while allowing it to grow in a "normal" way, that is, down and to the right.
So take his script and substitute "topLeft" for "loc.
Craig Newman
Re: Changing the size of objects
Thanks Klaus and Craig. I was really hoping there'd be a way to avoid scripting but I guess in the general scheme of things this isn't too much code.
I love using Rev to develop but every now and then something crops up that makes me wonder just what the original designers were thinking!
Pete
I love using Rev to develop but every now and then something crops up that makes me wonder just what the original designers were thinking!
Pete
-
- VIP Livecode Opensource Backer
- Posts: 9751
- Joined: Wed May 06, 2009 2:28 pm
- Location: New York, NY
Re: Changing the size of objects
I think most of the behavior is logical. If you have an object located somewhere, and you change its width, IMHO it ought not to change its loc. It gets fatter, but stays where it is, if you know what I mean.
You actually want to change its "right", an explicit option open to you, but you originally interpreted such a change as naturally arising from a change in width. You just need to get your head around the fact that there are descriptors for any purpose.
You actually want to change its "right", an explicit option open to you, but you originally interpreted such a change as naturally arising from a change in width. You just need to get your head around the fact that there are descriptors for any purpose.
Re: Changing the size of objects
You're right, I didn't know about some of these properties but I still think it's weird that if I change the height of a stack, I want the top and the bottom to change arbitrarily by half the amount of the height change, unless there's an option to define whether that happens or not.
I thought the dontResize property was going to solve this issue since it stops this automatic adjustment behaviour, eg if it is true and I change the right of an object, the left stays the same and the width changes. But unfortunately, it appears that property is not available for stacks - there is a checkbox in the inspector for a stack but it doesn;t seem to make any difference whether it's checkd or not and if I try to set it in a scrip I get an error saying ti can't be set.
Anyway, thanks for the code to control this. I don;t have many places where I want to do this so it's not a lot of extra code - but I don't think any extra code should be required
Pete
I thought the dontResize property was going to solve this issue since it stops this automatic adjustment behaviour, eg if it is true and I change the right of an object, the left stays the same and the width changes. But unfortunately, it appears that property is not available for stacks - there is a checkbox in the inspector for a stack but it doesn;t seem to make any difference whether it's checkd or not and if I try to set it in a scrip I get an error saying ti can't be set.
Anyway, thanks for the code to control this. I don;t have many places where I want to do this so it's not a lot of extra code - but I don't think any extra code should be required
Pete