command_id_handler
-
:confused:Hi, I have a dialog that is invoked form a property sheet that has various controls (edit boxes, check boxes) in my dialog. I need to know if the user modified (touched) any of these. There are function handlers for all of the controls (thru the COMMAND_ID_HANDLER macro). I expcted these to be called only when the user changes something. But these functions are being invoked when the dialog shows up!! What is the problem? Regards HV
-
:confused:Hi, I have a dialog that is invoked form a property sheet that has various controls (edit boxes, check boxes) in my dialog. I need to know if the user modified (touched) any of these. There are function handlers for all of the controls (thru the COMMAND_ID_HANDLER macro). I expcted these to be called only when the user changes something. But these functions are being invoked when the dialog shows up!! What is the problem? Regards HV
Do you put data in those controls (like defaults or previous values) when you show the dialog? That would cause a change. You'll just have to ignore those until the dialog is initialized and displayed. Besides, when you use
COMMAND_ID_HANDLER
, all messages sent to the control invoke your handler. If all you want to do is watch for changes, try this:COMMAND_HANDLER(IDC_MYCTL, EN_CHANGE, OnChange)
...or at least something like it. If you initialize the dialog with text in the controls, you'll still have to ignore it at such time (perhaps through a state variable), but once the dialog is shown, any change on that control would call your handler. Also, different controls use different command messages for changes. TextBox uses
EN_CHANGE
while other controls will most likely use something different.Reminiscent of my younger years...
10 LOAD "SCISSORS" 20 RUN
-
Do you put data in those controls (like defaults or previous values) when you show the dialog? That would cause a change. You'll just have to ignore those until the dialog is initialized and displayed. Besides, when you use
COMMAND_ID_HANDLER
, all messages sent to the control invoke your handler. If all you want to do is watch for changes, try this:COMMAND_HANDLER(IDC_MYCTL, EN_CHANGE, OnChange)
...or at least something like it. If you initialize the dialog with text in the controls, you'll still have to ignore it at such time (perhaps through a state variable), but once the dialog is shown, any change on that control would call your handler. Also, different controls use different command messages for changes. TextBox uses
EN_CHANGE
while other controls will most likely use something different.Reminiscent of my younger years...
10 LOAD "SCISSORS" 20 RUN