[Closed] enabling buttons in same rollout but seperate group
Hi. I’m rying to create a conditional enable for a button which is in a seperate group of a rollout. Not sure how to reference a button which is in another group…I tried this but it doesn’t work:
on openconnectmorphC pressed do
(
rollout myrollout "Connectmorph" width:1700 height:50 ;
(
group " Select Morphs " (
Select
Button UprRight "Default" width:50 height:50 offset:[0,0] align:#right across:3;
on UprRight pressed do(
somefunction ()
CornersConnect.enabled = true
)
--messagebox (Upr+" node") );
)
group "Connections" (
button CornersConnect "Connect Corners" width:200 offset:[10,-26]; enabled:false
)
)
(
on CornersConnect pressed do(
someotherfunction()
)
)
createDialog myrollout 500 450 -- set as a dialogue instead of a rollout
)
Can I use a function for enabled, like I can for filter?
wow, that is some messy code you got there.
All controls are locals of the rollout, Groups are only visual cues for the user, they do not change the hierarchical structure of the rollout.
yes I know its messy – I probably shouldn’t have posted it…it’s just original code with distracting irrelevant stuff deleted for clarity…If you assure me that I can toggle enables over groups within a rollout, I guess I will accept that and figure out why it’s not working in my code. Thanks.
yeah it should work as long as the button has been defined.
Please post the code if it’s still not working.
well I tried this but it doesn’ work:(I apologize for the horrible formatting and messiness):
rollout myrollout "Connectmorph" width:1700 height:50 ;
(
group " Select Morphs Select slider slots"(
Button UprRight "PressMe" width:50 height:50 offset:[0,0] align:#right across:3;
--label lbl2 "Unassigned" width:40 height:10; offset:[20,-60];
on UprRight pressed do(
Corners.enabled = true;
)
--messagebox (Upr+" node") );
--messagebox (LwrMid+" node")
);
group "Connections" (
Button Corners "Connect Corners" width:50 height:50 offset:[10,-30]; enabled:false
--button CornersConnect "Connect Corners" width:200 offset:[10,-26]; enabled:false
)
createDialog myrollout 200 150 -- set as a dialogue instead of a rollout)
whereas this does work:(not what I want)
rollout myrollout "Connectmorph" width:1700 height:50 ;
(
group " Select Morphs Select slider slots"(
Button UprRight "PressMe" width:50 height:50 offset:[0,0] align:#right across:3;
Button Corners "Connect Corners" width:50 height:50 offset:[10,-30]; enabled:false
on UprRight pressed do(
Corners.enabled = true;
)
--messagebox (Upr+" node") );
--messagebox (LwrMid+" node")
);
group "Connections" (
--button CornersConnect "Connect Corners" width:200 offset:[10,-26]; enabled:false
)
createDialog myrollout 200 150 -- set as a dialogue instead of a rollout)
As I said earlier, it will work if the button is already defined.
You must define both the buttons, then define the event handlers for both, if you are referencing the other button in the event handler. There is no necessity for the event handler to be inside the group clause.
rollout myrollout "Some rollout"
(
group "Some Group"
(
Button UprRight "PressMe" width:160
)
group "Another Group"
(
Button Corners "Connect Corners" width:160 enabled:false
)
--This must be AFTER corners has been defined in order to "see" it,
--otherwise you will get
-->> MAXScript Rollout Handler Exception: -- Unknown property: "enabled" in undefined <<
--Also outside of the group's body to work in older Max versions:
on UprRight pressed do
(
Corners.enabled = true
)
on Corners pressed do
(
Corners.enabled = false
)
)--end rollout
createDialog myrollout 200 110
I landed 5 hours ago from a trans-continental trip from Sofia to Vancouver.
I suspect a jury would consider me not responsible for my own actions at this moment
I almost got that without google translate
Rest assured, Denis, there is a Halo awaiting you as well. If it wasn’t for the both of you, me and many others here would still be at “Hello World”