Common handler for all dialog controls
-
Hi All, I have a very complex dialog with 5 edit controls,4 comboboxes,3 radio buttons and 2 list boxes. The controls id's are not in sequence(hence i cannot use ON_CONTROL_RANGE).I need to write a handler which will be called whenever user makes any changes to any of the controls.Is there any way to do this without adding an event handler for individual controls. Thanks in advance, Raghu
-
Hi All, I have a very complex dialog with 5 edit controls,4 comboboxes,3 radio buttons and 2 list boxes. The controls id's are not in sequence(hence i cannot use ON_CONTROL_RANGE).I need to write a handler which will be called whenever user makes any changes to any of the controls.Is there any way to do this without adding an event handler for individual controls. Thanks in advance, Raghu
That is not a complex dialog! If you want to centralise (create a handler) the control of any change messages, then you write one function that can handle any change and have have all the the change messages rerouted to that handler. What that means is that you have your on-change functions for each control call the same function to handle the message. On a more practical note; each on-change function should do it's own thing and then call a funcion that, that says "wow, something has changed so we have to update the current status" (display, whatever...) and act accordingly. Of course you could write a hook, to handle the messages, but that is a more than a bit of overkill for simple message handling. You could also handle the messages in PreTranslateMessage(...), which is almost the same as writing your code in C (one message handler for the whole window). Those are the choices I see, but essentualy what you appear to need is just a function that needs to be called it any changed occured. (See "On a more practical note") Good Luck! INTP "The more help VB provides VB programmers, the more miserable your life as a C++ programmer becomes." Andrew W. Troelsen