Jump to content
  • Advertisement
Sign in to follow this  
Zipster

[MFC] :: Sensible way to handle CEdit changes?

This topic is 3685 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I'm having some trouble working with a CEdit in an application that supports multi-select. The idea is that the user can select an object, and as they type in the edit box it changes the associated object property. Whenever the user selects a new object, the edit boxes update to display the values for that object. However, whenever the user multi-selects several different objects, I clear the edit boxes for the properties that aren't identical across all the selected objects (which is fairly standard practice). The problem is that setting the window text via code invokes the edit callback, which inadvertently erases all the properties by confusing the application into thinking the user cleared the edit boxes! Obviously the most direct solution would be to add some flag that I set whenever the code is changing the text boxes and early-out from the callback that modifies objects when I detect this flag. However I can't help but have a nagging feeling in the back of my head that tells me there needs to be a more sensible way of detecting whether the text was changed by the user or through code. On the other hand, maybe this is the only way of solving this problems. So far only edit boxes exhibit this behavior, since it appears you can change the state of many other controls without invoking the callbacks.

Share this post


Link to post
Share on other sites
Advertisement
The only sensible solution I can think of is dirty flags. Mark a flag whenever the user modifies the data but not when it's modified from code.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!