PDA

View Full Version : Resizing Windows



Tone
02-26-2010, 10:05 PM
Hello everyone, does anyone know how i can resize a window and keep it proportional. What rules do i have to follow, for instance can i use a bordered window or do i have to use a standard one?
Even using a standard window i can't get it to resize. without showing the background window instead of keeping the aspect ratio.

Scriptonite
02-26-2010, 10:21 PM
If you are looking to resize a single page application my favorite is worms resize proportionately found about halfway down the page on this thread: http://www.indigorose.com/forums/showthread.php?t=12944&highlight=adam+resize&page=4

This thread also deals with page object resizing.

Also, all this functions were made into a fantastic, easy-to-use plugin by Centauri Soldier, you can find that thread here:http://www.indigorose.com/forums/showthread.php?t=27430&highlight=adam+resize

Hope you find this helpful.

Centauri Soldier
02-26-2010, 10:24 PM
Hello everyone, does anyone know how i can resize a window and keep it proportional....

Keeping the aspect ratio of a window is done by using some basic algebra.

For example,

We know that the ratio of the Width to the Height of a window sized at 1024 X 768 (respectively) is 4:3.

Using this information we can then take either desired size measurement and apply a basic math function to it.

If we want the Width to be 2000 then we apply the ratio to the height. Since we know the desired width and the aspect ratio, we can say...

Height/3 = Width/4
Height/3 = 2000/4
Multiply Both sides by three to isolate the Height.
Height = (2000/4)*3
Height = (500)*3
Height = 1500

Test the result.
1500/3 = 2000/4;
500=500;

So plug that into a simple function OnSize and there ya go.

Tone
02-26-2010, 10:34 PM
My goodness me it works perfectly.
I've been using AMS for years, and years ago i accepted that it wasn't possible to do this yet, but the other day i saw an app where someone had done it.
I so very grateful for this Scriptonite i can't tell you, this is going to completely change everything for me regarding AMS.

Thank you so very much indeed.

Tone
02-26-2010, 10:37 PM
Centauri Soldier, you too thank you very much for your help. That's another very interesting style that i'll investigate further.
I love this forum, you guys are the best.

Tone
02-27-2010, 03:15 PM
Unfortunately this is not what i am looking for.
It's nice that the background image resizes itself in proportion to everything when dragging it out or entering full screen mode, but i'm looking for my slideshow to do the same.
I'd like the jpegs in the slideshow to resize themselves along with the background image if this is possible.
I downloaded the "resize" project with a view to swapping everything over to that too, but it doesn't do what i would like. It only resizes the background image ( i think )

Centauri Soldier
02-27-2010, 03:21 PM
The Resize code resizes all of the objects on the page. Be sure to read the accompanying help file to see how to properly implement the functions. The function names are intuitive. Just look through them briefly and you'll get a better idea of what's happening.

In order to resize the thumbnails in the slideshow object, you need to create a script for that and place it in your OnSize event.

Tone
02-27-2010, 03:33 PM
Thank you again for your speedy reply. As far as i can tell i did copy and paste all of the function scripts including the global script into their respective places. I know i must be doing something wrong, but i've read Adams post over and over and followed the instructions to the letter.

Centauri Soldier
02-27-2010, 03:39 PM
The original resize script is very different than the Resize Action Plugin. They will not be compatible. Use must choose one or the other.

if you do not have the plugin you can get it from AMSPublic.com (http://www.AMSPublic.com) in the "Plugins" section.

Tone
02-27-2010, 04:05 PM
Thank you for the plugin i've added it to my project.
I've opened your help file and to my "On Size" tab i've copied;

function Resize_OnSize (PageWidth,PageHeight)
if bFirstRun then
setOriginalPageSize(PageWidth,PageHeight);
bFirstRun = false;
end
SetSize(PageWidth,PageHeight);
end

and to my "On Preload" tab i've copied;

function Resize_OnPreLoad()
getOriginalPositions();
Size = Page.GetSize();
if not bFirstRun then
SetSize(Size.Width,Size.Height);
end
end
-- This is a global variable that is used to determine the first time that
-- This page has been Accessed
bFirstRun = true;

Now, you mind find this funny, i know i do, but this is the first time i've EVER copied code into any of my projects. That makes me smile because it's something i've always wanted to know.

So, my next question, if i may, is, where do i put the rest of the code :)

Centauri Soldier
02-27-2010, 04:44 PM
You need to place the OnClose() function in the OnClose event and unless you want to change the exclusion prefix ("_x") to something else then you're done. Making this plugin work is pretty easy as there's not a whole lot to do.

If your project has a million and a half page and/or dialogs you can use the AllOn Action Plugin to put the Resize functions on each page and/or dialog at runtime in three lines instead of doing it manually for each page or dialog.

Here's an example that uses both plugins.

All code can be found in the only existing listbox on the page and in Globals.

Tone
02-27-2010, 05:57 PM
Thank you again for that further plugin, you've been very kind.
I can't get it going but i'm sure the it's just a matter of going over everything again and scrutinising the code to see if i've missed out a semicolon.
I've learned a lot and i'm very grateful.
Have a lovely weekend my friend, i'll pop back in the week to let you know how i've got on with it.
:yes

Tone
02-27-2010, 05:58 PM
this forum is changing my words lol. I thought it was in one of my previous posts. haha