[Closed] How to resize a dialog?
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:
[left]on <Rollout> moved <Point2> do[/left]
Called when the dialog is being moved.
[left]on <Rollout> resized <Point2> do[/left]
Called when the dialog is being resized.
[left]on <Rollout> mousemove <Point2> do[/left]
Called when the mouse is being moved within the dialogs client area.
[left][/left]
I think this one should work
[left]on <Rollout> resized <Point2> do[/left]
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!
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
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