Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
2077
Menu with StateButtonTool that doesn't change Checked state
posted

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

Parents
No Data
Reply
  • 469350
    Verified Answer
    Offline posted

    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. 

Children