ben Posted March 14, 2011 Share Posted March 14, 2011 Hi, I'm sure this is an easy one but I'm stuck. I want to switch a menu content according to a toggle. I've tried this for the menu I want to update : if (../null1/toogleMenu == 0) then opmenu -l ../null1 menu1 else opmenu -l ../null1 menu2 endif but it doesn't work... How would you do that ? thx toggleMenu.hipnc Quote Link to comment Share on other sites More sharing options...
old school Posted March 14, 2011 Share Posted March 14, 2011 (edited) Call back on the toggle script like this works for setting the first menu1 menu list: if ($script_value == "on"); then; opparm . menu1 (0); else; opparm . menu1 (1); endif You need to supply semicolons as line returns as the callbacks only support a single line. You can echo any variable or state for debugging using the message command like this: message $script_value When off you see it returns "off" and returns "on" when on. Test for that. $script_value returns the current value of the parameter being executed. If you wish this toggle to run callbacks on target parameters, use the -C option to opparm. See the help usage for opparm. Edited March 14, 2011 by old school Quote Link to comment Share on other sites More sharing options...
ben Posted March 14, 2011 Author Share Posted March 14, 2011 Thx Jeff. That help, but I'm still looking for a solution to my problem. Maybe I was unclear : I have 3 menus A, B, C and a toggle. And according to the toggle I want populate menu C with content of A or B. Or another possibility could be : have only 2 menus and a toggle and according to the toggle make menu A or menu B invisible Attached file is real life case. ben Quote Link to comment Share on other sites More sharing options...
ben Posted March 14, 2011 Author Share Posted March 14, 2011 toggleMenu.hipnc Quote Link to comment Share on other sites More sharing options...
graham Posted March 14, 2011 Share Posted March 14, 2011 (edited) Here's what I'd do. Toggle still controls switch, but scripted menu parm looks at toggle to determine which node to use and then copies the menu items from that nodes parameter. The menu parms then reference the one menu. There can be issues with changing the input if you have an unequal amount of geometry files available from each input but you just need to change the drop down menu to an actual valid entry and the error clears up. You could also guard against this with a simple expression on the menu parms to check to see if the index is valid or not and clamp or adjust accordingly. toggleMenu.hipnc Edited March 14, 2011 by graham Quote Link to comment Share on other sites More sharing options...
ben Posted March 14, 2011 Author Share Posted March 14, 2011 Once again thank you, that's perfect. I owe you one more of beer, and I put that on my list drink = [] for grahamHelp in odforce : drink.append("beer") Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.