PDA

View Full Version : How to resize a dialog?


Jausn
02-25-2009, 03:19 AM
Hi ! I've got a question here.

I wanna achive this effect:
Resizing the dialog then the controls on it,like button,listbox,...,automatically change their size and pos to match the dialog's size.

And I've found some related content on Help:

on <Rollout> moved <Point2> do
Called when the dialog is being moved.
on <Rollout> resized <Point2> do
Called when the dialog is being resized.
on <Rollout> mousemove <Point2> do
Called when the mouse is being moved within the dialogs client area.


I think this one should work
on <Rollout> resized <Point2> do

But how it works?

When I type this:
on test_Rollout resized do
I got an error: >> MAXScript Rollout Handler Exception: -- Argument count error: unnamedRollout.resized wanted 0, got 1 <<

Maybe I lost the <Point2> part, so I typed:
on test_Rollout resized [10,10] do
I also got an error: -- Syntax error: at [, expected do -- In line: on unnamedRollout resized [1

That's my problem.
Anyone could help?
Thanks!

JHN
02-25-2009, 07:21 AM
It means the event handler will give you back the point2 of the rollout size so:


on myRollout resized theSize do
(
print theSize
)


Now if you want to move stuff around in the dialog, you'll need to know the original starting size, the new size and calculate an offset value with that and feed those offsets to your controls. It can definitely be done but it can be tricky. I stored all the controls default positions in an array in the tool, so I could always reference their original positions.

-Johan

Jausn
02-25-2009, 07:25 AM
Thank you very much! I've just got it!

LoneRobot
02-25-2009, 12:14 PM
In DotNet, this is taken care of by the dock style and anchor properties of the controls, so if using a dotnet form, you can use these. otherwise you will have to manual resize the controls or put them inside a tablelayoutcontrol.

Polimeno
02-25-2009, 02:44 PM
In DotNet, this is taken care of by the dock style and anchor properties of the controls, so if using a dotnet form, you can use these. otherwise you will have to manual resize the controls or put them inside a tablelayoutcontrol.

interesting.......
can you show me an example in vertical and horizontal resize working at the same time ?

thanks in advance

CGTalk Moderation
02-25-2009, 02:44 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.