[Closed] dockable CUI window
Hi,
I’m trying to write the code of an floating window to a docking area (left and right).
I start with this thread : http://forums.cgsociety.org/showthread.php?t=219175
I just add “cui.RegisterDialogBar” on the bottom of the script.
Is this correct ?
Should the window also be unregistred when it closes ?
One problem I have is about the size of the windows.
The size changes a bit if I try to resize it
(2 pixel on X and 5 pixels on Y)
What is the compatibility of dockable windows in previous versions of max ?
Thanks for any information you can give,
Olivier
macroscript xxxxxMacro
category:"test"
buttonText:"xxxxx"
toolTip:"xxxxx"
(
global xxxxxDialog
try(destroyDialog xxxxxDialog)catch()
rollout xxxxxDialog " xxxxx 1.00"
(
group "xxxxx"
(
button btn1 "xxxxx"
)
on btn1 pressed do
(
-- code
)--on
)--rollout
createDialog xxxxxDialog 156 128
cui.RegisterDialogBar xxxxxDialog style:#(#cui_floatable,#cui_dock_left,#cui_dock_right,#cui_handles)
)--macro
I see the same problem with the dialog resizing a bit as I undock the window. I don’t know what is causing it though. I will try to find the time to report the problem though.
Thanks Paul.
You are right about the undocking also…
Independently of this size problem, somebody knows if it is necessary to unregister this window when the user closes it ? Thanks
Thanks Light
I am trying to apply the UnRegisterDialogBar but without success.
If i add this line:
on xxxxxDialog close do ( cui.UnRegisterDialogBar xxxxxDialog )
maxscript return this message:
-- Error occurred in xxxxxDialog.close()
-- Frame:
>> MAXScript Rollout Handler Exception: -- Runtime error: Not a registered dialog bar: Rollout:xxxxxDialog <<
There’s probably something wrong in the order of register/unregister.
Can anyone help me to make this work right?
macroscript xxxxxMacro
category:"test"
buttonText:"xxxxx"
toolTip:"xxxxx"
(
global xxxxxDialog
try(destroyDialog xxxxxDialog)catch()
rollout xxxxxDialog " xxxxx 1.00"
(
group "xxxxx"
(
button btn1 "xxxxx"
)
on btn1 pressed do
(
-- code
)--on
on xxxxxDialog close do ( cui.UnRegisterDialogBar xxxxxDialog )
)--rollout
createDialog xxxxxDialog 156 128
cui.RegisterDialogBar xxxxxDialog style:#(#cui_floatable,#cui_dock_left,#cui_dock_right,#cui_handles)
)--macro
I think that having it in the on close event is to late in the process, if you just close a dialog with the X in the upper right corner I think that is unregistering it for you…as far as I know. If you add a close button you will have to unregister it before you call the destroyDialog command.
Yes I think also that the dialogBar is automatically unregistred when the window is closed.
Here is a little test:
First I declare a rollout in the global scope
global xxxxxDialog
rollout xxxxxDialog " xxxxx 1.00"
(
button btn1 "xxxxx"
)--rollout
I write in the listener:
createDialog xxxxxDialog 156 128
Now the window appears.
The style is the standart windows style and it is not dockable.
I ask to transform this window in a dockable window:
cui.RegisterDialogBar xxxxxDialog style:#(#cui_floatable,#cui_dock_left,#cui_dock_right,#cui_handles)
The style of the window changes and It is dockable now.
I close the window by using the X in the upper right corner.
I open the window again:
createDialog xxxxxDialog 156 128
The window has the first apparence, not dockable.
So when i close the window, maxscript seems to unregister automatically this window.