Hello,
I would like to implement a menu with a list of StateButtonTools that are programatically added. Based on a condition some of them should be checked, others shouldn't, and their checked state should not change when they are clicked. And all of them should be active, so they can be selected.
I've noticed that in the ToolClick event, the checked state is already changed, so I've tried to restore the previous state, but I get a StackOverflowException, the ToolClick event being raised with every state change.
Can you please guide me to get this behavior.
Thanks,
Emanuel
Hi Emanuel,
If you are getting a StackOverflow, it's because you are changing the CheckState inside the ToolClick event which causes the ToolClick even to be fired again, where you again change the CheckState, etc.
You can stop this sort of recursion by using the EventManager and disabling the ToolClick event while you change the CheckState.
Mike Saltzman"]You can stop this sort of recursion by using the EventManager and disabling the ToolClick event while you change the CheckState.
It seems like StateButtonTool doesn't expose any EventManager property, as I've seen in my searches that UltraComboBox or UltraWinGrid do.
I resolved the issue by using the -= and += operators on the StateButtonTool before changing it's checked value back in the event handler method.
If I have missed to find the EventManager, and it can be used with StateButtonTool, I will appreciate any guiding.
Thank you!