Geometry question

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller

Post Reply
japino
Posts: 78
Joined: Sun Oct 14, 2012 10:56 am

Geometry question

Post by japino » Wed Nov 30, 2016 5:19 pm

This is probably a very simple question, but I can't seem to get it right. I've created a few stacks in the past and now I'm creating a stack in which I want to resize some fields and controls or change their positions when the stack size changes (when the user resizes the stack window). I'm using the Geometry Manager for this. It works really well for most controls. However, I find this hard to implement although I imagine the solution may be simple:
I have 2 fields side by side. Let's say field A on the left is 200 pixels wide and field B on the right is 200 pixels wide too.
Now, if I resize the width of the stack by 100 pixels, I want field A to be resized by 50 points, field B to be moved 50 points to the right and then resized by 50 points too. I've tried various things in the Geometry Manager but no luck; the fact that the User Guide is empty doesn't help either. May be I should sleep on it one night and experiment a bit more tomorrow or try to get it right using a resizeStack script. Any input much appreciated.

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 9578
Joined: Wed May 06, 2009 2:28 pm
Location: New York, NY

Re: Geometry question

Post by dunbarx » Wed Nov 30, 2016 6:27 pm

Hi.

A fun problem. But you sort of already solved it. Just consider the margins as another item to scale

In your own thinking, you would decrease the width of each field by 50, and then set their lefts accordingly,scaling the margin values. Doing this in the Y direction is the same. This can work even if controls overlap.

One thing, though. Reducing the stack width by 100 is entirely dependent on the original width. If that value was 110, it ought to have an entirely different effect on the field width than if the original value was 1000. It is a ratio thing, not an arithmetic thing.

Craig Newman

japino
Posts: 78
Joined: Sun Oct 14, 2012 10:56 am

Re: Geometry question

Post by japino » Thu Dec 01, 2016 3:11 pm

Thanks Craig, I was finally able to figure it out using a combination of the Geometry Manager and a resizeStack script.

Post Reply

Return to “Getting Started with LiveCode - Complete Beginners”