Resizing Groups

LiveCode is the premier environment for creating multi-platform solutions for all major operating systems - Windows, Mac OS X, Linux, the Web, Server environments and Mobile platforms. Brand new to LiveCode? Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

odysseus
Posts: 42
Joined: Tue Aug 25, 2020 2:15 pm

Resizing Groups

Post by odysseus » Wed Nov 25, 2020 5:51 pm

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.

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 9322
Joined: Fri Feb 19, 2010 10:17 am
Location: Bulgaria

Re: Resizing Groups

Post by richmond62 » Wed Nov 25, 2020 6:05 pm

Screenshot 2020-11-25 at 19.03.33.png
-
I don't believe you.
Attachments
Squeezy.livecode.zip
Here's the stack.
(946 Bytes) Downloaded 195 times

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 9817
Joined: Sat Apr 08, 2006 7:05 am
Location: Los Angeles
Contact:

Re: Resizing Groups

Post by FourthWorld » Wed Nov 25, 2020 6:07 pm

Is there anything outside the group that needs to maintain a consistent size when the group contents are scaled?
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

odysseus
Posts: 42
Joined: Tue Aug 25, 2020 2:15 pm

Re: Resizing Groups

Post by odysseus » Wed Nov 25, 2020 6:23 pm

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.

odysseus
Posts: 42
Joined: Tue Aug 25, 2020 2:15 pm

Re: Resizing Groups

Post by odysseus » Wed Nov 25, 2020 6:53 pm

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.

Klaus
Posts: 13814
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany
Contact:

Re: Resizing Groups

Post by Klaus » Wed Nov 25, 2020 7:07 pm

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

odysseus
Posts: 42
Joined: Tue Aug 25, 2020 2:15 pm

Re: Resizing Groups

Post by odysseus » Wed Nov 25, 2020 7:24 pm

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.

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 9322
Joined: Fri Feb 19, 2010 10:17 am
Location: Bulgaria

Re: Resizing Groups

Post by richmond62 » Wed Nov 25, 2020 8:04 pm

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.

Klaus
Posts: 13814
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany
Contact:

Re: Resizing Groups

Post by Klaus » Wed Nov 25, 2020 8:05 pm

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.

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 9322
Joined: Fri Feb 19, 2010 10:17 am
Location: Bulgaria

Re: Resizing Groups

Post by richmond62 » Wed Nov 25, 2020 8:07 pm

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)

odysseus
Posts: 42
Joined: Tue Aug 25, 2020 2:15 pm

Re: Resizing Groups

Post by odysseus » Wed Nov 25, 2020 8:33 pm

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.

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 9817
Joined: Sat Apr 08, 2006 7:05 am
Location: Los Angeles
Contact:

Re: Resizing Groups

Post by FourthWorld » Wed Nov 25, 2020 8:53 pm

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
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

odysseus
Posts: 42
Joined: Tue Aug 25, 2020 2:15 pm

Re: Resizing Groups

Post by odysseus » 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. 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.

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 9817
Joined: Sat Apr 08, 2006 7:05 am
Location: Los Angeles
Contact:

Re: Resizing Groups

Post by FourthWorld » Wed Nov 25, 2020 11:52 pm

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.
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

stam
Posts: 2673
Joined: Sun Jun 04, 2006 9:39 pm
Location: London, UK

Re: Resizing Groups

Post by stam » Thu Nov 26, 2020 12:37 am

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 :)

Post Reply

Return to “Getting Started with LiveCode - Experienced Developers”