Constraining window dimensions proportionally while resizing

dunbarx at aol.com dunbarx at aol.com
Tue Sep 23 13:44:35 EDT 2014


Devin, I see you have some feedback, but do any of these address what I thought was your real question, that is, to constrain while dragging?


It seems that trapping the "resizeStack" message, which acts sort of like the "mouseMove" message in that it is sent with every nudge of the stack size change, you could track the ratio of the stack window.


By comparing the current ratio to the one just previous, perhaps stored in a custom property, you can see which dimension, X or Y, has exceeded the value of the one before. Since you are starting with a stack of a certain size, this ratio will start off in the way you want it. Then simply adjust that ratio so that you are keeping the aspect constant.

Craig


-----Original Message-----
From: Devin Asay <devin_asay at byu.edu>
To: How to use LiveCode <use-livecode at lists.runrev.com>
Sent: Tue, Sep 23, 2014 11:26 am
Subject: Constraining window dimensions proportionally while resizing


Hi all,

I just posted this question on stackoverflow. But I thought I’d ask it here 
where I think I’ll get some great answers, and hopefully a good answer can get 
posted back to stackoverflow to make the answer more widely accessible to web 
searches.

In a LiveCode project I want the end user to be able to resize a window, but I 
want the window proportions -- the ratio of the width to the height -- to remain 
the same during the resize operation. I have tried various approaches, but none 
was satisfactory, often giving erratic performance. What is the best way to 
resize a stack window and constrain it proportionally?

I feel like I may be missing something really obvious. It wouldn’t be the first 
time. 

Thanks,

Devin


Devin Asay
Office of Digital Humanities
Brigham Young University


_______________________________________________
use-livecode mailing list
use-livecode at lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode

 



More information about the use-livecode mailing list