PDA

View Full Version : How to enable/disable menu items?


neilson2000
03-29-2005, 09:11 AM
I'm having trouble updating a menu on a rollout. When I have something selected I want "model selected" under the "tools" menu to be enabled. When nothing is selected I want it disabled.

Why doesn't the menu update?


rcMenu TopMenu
(
subMenu "Tools"
(
menuItem menu_sel "model selected" enabled:false
)
on TopMenu open do
(
sel = (selection.count == 1)
menu_sel.enabled = sel
)
)

rollout new_rollout "Test"
(
)

createDialog new_rollout 150 150 menu:TopMenu

galagast
03-29-2005, 10:16 AM
this code might prod u in the right direction...

rollout sel_test "sel_test"
(
label sel_txt ""
on sel_test open do
(
-- we use a [WHEN] construct to check for selection changes in the scene
when select $* changes id:#sel_test_obj obj do
(
-- the contruct runs this argument and returns [obj] as the item de/selected
sel_count = selection.count as string
the_caption = ("There are " + sel_count + " item(s) selected.")
sel_txt.caption = the_caption
)
)
)
createdialog sel_test width:200


i hope this helps!:thumbsup:

CGTalk Moderation
03-29-2005, 10:16 AM
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.