Page 1 of 2

Resizing Groups

Posted: Wed Nov 25, 2020 5:51 pm
by odysseus
I hope somebody can help me here. Once again I am trying to convert a function in my previous graphics program to LC. I needed to resize a rectangular group consisting of 3 components, so I had code which would determine which quarter was clicked, and alter the relevant vertices to make the group bigger or smaller in the correct direction as the mouse was moved.

However it seems in LC you cannot resize a group except by resizing the individual components. In pointer mode attempting to resize a group results in the drag handles moving into empty space while the group remains the same size, or gradually disappears when reducing the size. The rect displays the 'new' size but the group doesn't change. I have checked the button 'resize when setting rect property' in the 'Positions' section of the Property Inspector, but that does nothing. Have I missed something here?

In truth addressing 3 items individually is not a huge problem, but I have a group with 20 or 30 items which will need to be resized when changing screen resolution - each component having to be resized proportionally. Previously I could just resize the group and everything was taken care of. Please tell me there is a simple solution.

Re: Resizing Groups

Posted: Wed Nov 25, 2020 6:05 pm
by richmond62
Screenshot 2020-11-25 at 19.03.33.png
-
I don't believe you.

Re: Resizing Groups

Posted: Wed Nov 25, 2020 6:07 pm
by FourthWorld
Is there anything outside the group that needs to maintain a consistent size when the group contents are scaled?

Re: Resizing Groups

Posted: Wed Nov 25, 2020 6:23 pm
by odysseus
When resizing the rectangular group, it is just that, everything else remains the same. When resizing for screen change, everything on the card is gathered into one group and resized.

Re: Resizing Groups

Posted: Wed Nov 25, 2020 6:53 pm
by odysseus
And richmond62 I dont have a visible border set round the group. Resizing the border is no use to me, I need to resize the group itself. The group consists of a polygon, a rectangle and a field by the way.

Re: Resizing Groups

Posted: Wed Nov 25, 2020 7:07 pm
by Klaus
Hi odysseus,
odysseus wrote:
Wed Nov 25, 2020 6:23 pm
When resizing the rectangular group, it is just that, everything else remains the same.
that is correct behavior.
odysseus wrote:
Wed Nov 25, 2020 6:23 pm
When resizing for screen change, everything on the card is gathered into one group and resized.
Do you mean what setting the "fullscreenmode" on the mobile platform does?
That is a completely different beast, I'm afraid.


Best

Klaus

Re: Resizing Groups

Posted: Wed Nov 25, 2020 7:24 pm
by odysseus
Hi Klaus,
Re the first answer I was stating what I wanted to happen, not what was actually happening. Actually nothing is resizing other than the invisible border around the zone.

Secondly I want to cater for different screen resolutions on a computer. In my current program I go through the pages (cards), group all the components and simply resize one item, the group, so it fits the screen, then just change font sizes individually if required.

Re: Resizing Groups

Posted: Wed Nov 25, 2020 8:04 pm
by richmond62
I dont have a visible border set round the group. Resizing the border is no use to me
Very funny. :?

I only left the border visible so you could see that the group was resized.

Re: Resizing Groups

Posted: Wed Nov 25, 2020 8:05 pm
by Klaus
odysseus wrote:
Wed Nov 25, 2020 7:24 pm
Secondly I want to cater for different screen resolutions on a computer. In my current program I go through the pages (cards), group all the components and simply resize one item, the group, so it fits the screen, then just change font sizes individually if required.
Maybe you should look at and play a bit with -> the scalefactor of stack xyz
That is what the engine does on the mobile platform, scaling the complete stack and of course its content.

Re: Resizing Groups

Posted: Wed Nov 25, 2020 8:07 pm
by richmond62
Actually . . . I have a feeling you have got just about everything wrong.

What you seem to want is that everything inwith a group resizes and retains the same proportional distances
bertween objects inwith the group to take into account the screensize of your end-user.

THis doesn't really have much to do with resizing groups, . . . and . . . come to think of things . . . . why bother grouping
your objects at all?

. . . just concentrate on resizing your objects and re-positioning them. 8)

Re: Resizing Groups

Posted: Wed Nov 25, 2020 8:33 pm
by odysseus
Actually richmond62, if I want something to happen in a particular way, and it doesn’t, that doesn’t make me wrong. I was asking for help in case I had missed something obvious. If it isn’t possible then so be it and I will find a way round it as I always do.

Forgetting about screen resolution changes for now, my very simple problem is as follows:

If I place a graphic rectangle I can click on a corner handle and expand or contract it.

If I superimpose something else over it and group the two things, I can no longer resize it in the same way. Clicking on a corner handle resizes a border (which in my case is invisible as I don’t want to alter the appearance of my group). The group itself doesn’t change size. To me this is counterintuitive, but I can’t see the point of changing blank space but leaving the contents unchanged. Perhaps somebody else can explain the logic of it.

Re: Resizing Groups

Posted: Wed Nov 25, 2020 8:53 pm
by FourthWorld
odysseus wrote:
Wed Nov 25, 2020 8:33 pm
If I superimpose something else over it and group the two things, I can no longer resize it in the same way. Clicking on a corner handle resizes a border (which in my case is invisible as I don’t want to alter the appearance of my group). The group itself doesn’t change size. To me this is counterintuitive, but I can’t see the point of changing blank space but leaving the contents unchanged. Perhaps somebody else can explain the logic of it.
I can see where you're coming from if you'd conceptualized the group object as a scaling device. But that's not what LC groups are. They're simply containers. The rectangle you're seeing when you resize that container is the rectangle of the group itself, so once you get the hang of what groups are and aren't, its behavior will become more intuitive. There's a good discussion on using groups in the User Guide (available in the Help menu) starting on page 86.

Back to the main question here...

You may not need to go to the extra step of using a group at all. IF you want EVERYTHING in your layout to scale across devices of different screen sizes, and IF you have no standard controls the user will expect to be rendered at a standard size, and IF you have no objects that need to remain flush with screen edges, and IF you do not want to support both device orientations - if all those conditions are met you may have an app that's well suited for a built-in feature called fullScreenMode.

From your description here it sounds like your app may be a good fit for fullScreenMode - you can learn more about using it here:
https://lessons.livecode.com/m/15262/l/ ... ll-devices

Re: Resizing Groups

Posted: Wed Nov 25, 2020 11:33 pm
by odysseus
Thank you for that, Richard, I will have a look at your suggestions. It seems though that I have come across a serious limitation compared with what I was used to. I guess I will have to think about a way around it. Unfortunately I am finding more of these as I go along (4 months now) but that’s the way it goes I suppose.

Re: Resizing Groups

Posted: Wed Nov 25, 2020 11:52 pm
by FourthWorld
odysseus wrote:
Wed Nov 25, 2020 11:33 pm
Thank you for that, Richard, I will have a look at your suggestions. It seems though that I have come across a serious limitation compared with what I was used to.
Which scripting language have you been using that has a scale container? Might be good to study that for a feature request here.

Re: Resizing Groups

Posted: Thu Nov 26, 2020 12:37 am
by stam
Hi Odysseus & all...

I'm sure a saw video in lockdown learning suggesting you should have an (invisible) rect containing all the group elements and the elements can be moved/sized relative to the rect rather than the group, so that when you resize, you only resize the rect and other stuff should happen relative to the rect.

I tried this and found that without an invisible 'background' rect, resizing groups didn't work as predicted. I've also found the geometry manager to be next to useless - or at least i just can't get it to work with any slightly complex layout; so i resize and layout elements in code instead.

So when resizing the group i resize the invisible background rect relative to the group and then then move/resize group elements relative to the rect in code and this works well.

You can seen an example and code of what i mean with a little plugin i wrote for my own purposes here: viewtopic.php?f=7&t=34834&start=30#p197818

If you run the stack and click the copy button it will copy a 'popover' (a group simulating a popover which is actually a group of 4 elements) to the frontmost stack. Resizing the popover will resize/reposition all elements smoothly (i'm still fine tuning this but will probably share properly at some point once i'm completely happy with this, in case others need a 'popover' interface element - which you probably will do if you're a FileMaker Pro refugee like me :D)
----
*caveat: i still consider myself a newbie to LiveCode so there may be things i'm not doing correctly -- feel free to criticise :)