- Home /
How to Use a UIToolkit button to control other UI elements?
var a = UIButton.create("a_1.PNG", "a_2",0,0);
a.onTouchUpInside += onTouchUpInsidea;
void onTouchUpInsidea (UIButton obj) {
}
First of all, this is how to init a UIButton of UIToolkit by Prime31. In the method onTouchUpInsidea, I got only one parameter, obj. Therefore, I can only control the button itself, or some other UIButton.
What if I'd like to control multi-ui elements? I cannot pass multi parameter into onTouchUpInsidea. And I'd like to set these UI elements local vars, instead of some class properties in the beginning of the class.
Actually I have to say that I'm not familiar with the delegate and event system of C#. But I'm thinking about that gotta be some approach for controlling multi buttons in UIToolkit.
Thank you very much.
Answer by dodgeThis · Apr 30, 2013 at 10:21 PM
I'm not sure if this is what you are asking for, but here is how I made one button change another button to be selected:
UIToggleButton applyButton = UIToggleButton.create("VSS_ItemW.png", "VSS_ItemW__.png", "VSS_ItemW__.png", 0, 0);
UIToggleButton button6Button = UIToggleButton.create("VSS_Button6.png", "VSS_Button1.png", "VSS_Button1.png", 0, 400);
applyButton.onToggle += (sender, newValue) => button6Button.selected = newValue;
When 'applyButton' is clicked 'button6Button' is also set to be selected. I'm assuming that instead of 'button6Button.selected = newValue;' you could have it call a function.
I have only used this toolkit for 3.5 hours today so that's the extent of my knowledge :P. Good Luck!