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
25
Setting a value without firing the ToolValueChanged event
posted

Hi,

I have a a toolbar with a comboBoxTool which I populate on the BeforeToolDropDown event, after I populate the combo I need to set the default Value.

My problem is that by setting the default value at this point it triggers the ToolValueChanged event which I don't want to do at this point as there is code in this event which I only want to run if the value is changed by a user. Does anyone know how I can edit the value in a comboBoxtool without firing the ToolValueChanged event or if there is an alternative to detect that the user has changed the value in the comboboxtool without using ToolValueChanged.

 

Also I have noticed that the ToolValueChanged event sometimes fires when I click on the comboBoxtool but do not change the value, is this a known bug?

 

Thanks

Parents
  • 44743
    Suggested Answer
    posted

    You can define a Boolean member variable called something like initializingDefaultValue. Set it to True before setting the default value and then set it back to False again afterward. When the ToolValueChanged event is fired, only perform your logic if the value of the variable is False.

    I haven't seen the other issue. What values are in your ComboBoxTool and what value is selected before you click on the tool.

Reply Children
No Data