PrefeX
06-07-2011, 07:51 PM
Hello everyone, my first time on the forum, and I got to say there is a lot of talent around here!
As I've just started learning MAXScript I was hoping you might tell me why I can't get my UI to work the way I want. The problem is that it works great until I use RegisterDialogBar. After that, all the buttons all seem to freeze up whenever i move or dock the menu.
Been searching around for an possible solution for a while now, so I would really appreciate it if any of you could help me out.
What I'm trying to do is essentially build a system that shows/hides subRollouts depending on what menu-buttons are active.
(
----------------------------------------- VARIABLES AND FUNCTIONS --------------------------------------
-- Main Dialog Window
global MyDialog
-- Window name
WindowName = "Tools Panel"
----------------------------------------------- ROLLOUTS AND BUTTONS --------------------------------------------
-- Rollouts GEO
rollout Rollout_A "Rollout A"
(
button btn_1 "btn 1" width:30
)
rollout Rollout_B "Rollout B"
(
button btn_2 "btn 2"
)
-- Rollout UV
rollout Rollout_C "Rollout C"
(
button btn_3 "btn 3"
)
--------------------------------------------------- MAIN WINDOW ------------------------------------------------
rollout MyDialog WindowName width:168
(
subRollout menuTools "" pos:[4,38] width:160 height:200
-- Sections buttons (Definition and Initialization, here we define if they are checked by default or not)
checkbutton btn_menu1 "menu1" pos:[4,4] width:30 height:30 checked:true
checkbutton btn_menu2 "menu2" pos:[38,4] width:30 height:30 checked:false
checkbutton btn_menu3 "menu3" pos:[72,4] width:30 height:30 checked:false
-- Inizialitations
on MyDialog open do
(
-- Display Sections if they are active in their definition
if (btn_menu1.state == true) then AddSubRollout MyDialog.menuTools Rollout_A
if (btn_menu3.state == true) then AddSubRollout MyDialog.menuTools Rollout_B
if (btn_menu3.state == true) then AddSubRollout MyDialog.menuTools Rollout_C
)
-- Sections actions (Checkbuttons)
-- We will hide/unhide the rollouts depending on which section is active while changing the height of the main window
on btn_menu1 changed state do
(
if state == on then
AddSubRollout MyDialog.menuTools Rollout_A
else
removeSubRollout MyDialog.menuTools Rollout_A
)
on btn_menu2 changed state do
(
if state == on then
AddSubRollout MyDialog.menuTools Rollout_B
else
removeSubRollout MyDialog.menuTools Rollout_B
)
on btn_menu3 changed state do
(
if state == on then
AddSubRollout MyDialog.menuTools Rollout_C
else
removeSubRollout MyDialog.menuTools Rollout_C
)
)
-- We finally create the window
CreateDialog MyDialog style:#(#style_titlebar, #style_toolwindow, #style_sysmenu ) height:300
cui.RegisterDialogBar MyDialog minSize:[-1,-1] maxSize:[-1,-1] style:#(#cui_dock_left, #cui_dock_right, #cui_floatable)
)
As I've just started learning MAXScript I was hoping you might tell me why I can't get my UI to work the way I want. The problem is that it works great until I use RegisterDialogBar. After that, all the buttons all seem to freeze up whenever i move or dock the menu.
Been searching around for an possible solution for a while now, so I would really appreciate it if any of you could help me out.
What I'm trying to do is essentially build a system that shows/hides subRollouts depending on what menu-buttons are active.
(
----------------------------------------- VARIABLES AND FUNCTIONS --------------------------------------
-- Main Dialog Window
global MyDialog
-- Window name
WindowName = "Tools Panel"
----------------------------------------------- ROLLOUTS AND BUTTONS --------------------------------------------
-- Rollouts GEO
rollout Rollout_A "Rollout A"
(
button btn_1 "btn 1" width:30
)
rollout Rollout_B "Rollout B"
(
button btn_2 "btn 2"
)
-- Rollout UV
rollout Rollout_C "Rollout C"
(
button btn_3 "btn 3"
)
--------------------------------------------------- MAIN WINDOW ------------------------------------------------
rollout MyDialog WindowName width:168
(
subRollout menuTools "" pos:[4,38] width:160 height:200
-- Sections buttons (Definition and Initialization, here we define if they are checked by default or not)
checkbutton btn_menu1 "menu1" pos:[4,4] width:30 height:30 checked:true
checkbutton btn_menu2 "menu2" pos:[38,4] width:30 height:30 checked:false
checkbutton btn_menu3 "menu3" pos:[72,4] width:30 height:30 checked:false
-- Inizialitations
on MyDialog open do
(
-- Display Sections if they are active in their definition
if (btn_menu1.state == true) then AddSubRollout MyDialog.menuTools Rollout_A
if (btn_menu3.state == true) then AddSubRollout MyDialog.menuTools Rollout_B
if (btn_menu3.state == true) then AddSubRollout MyDialog.menuTools Rollout_C
)
-- Sections actions (Checkbuttons)
-- We will hide/unhide the rollouts depending on which section is active while changing the height of the main window
on btn_menu1 changed state do
(
if state == on then
AddSubRollout MyDialog.menuTools Rollout_A
else
removeSubRollout MyDialog.menuTools Rollout_A
)
on btn_menu2 changed state do
(
if state == on then
AddSubRollout MyDialog.menuTools Rollout_B
else
removeSubRollout MyDialog.menuTools Rollout_B
)
on btn_menu3 changed state do
(
if state == on then
AddSubRollout MyDialog.menuTools Rollout_C
else
removeSubRollout MyDialog.menuTools Rollout_C
)
)
-- We finally create the window
CreateDialog MyDialog style:#(#style_titlebar, #style_toolwindow, #style_sysmenu ) height:300
cui.RegisterDialogBar MyDialog minSize:[-1,-1] maxSize:[-1,-1] style:#(#cui_dock_left, #cui_dock_right, #cui_floatable)
)
