Click to See Complete Forum and Search --> : CEdit subclass


dickinsw
July 13th, 1999, 11:08 AM
By default, clicking the OK button on a CDialog with the mouse is equivalent to pressing the ENTER key when the OK button is highlighted. In other words, both events trigger CDialog::OnOK(). I have a subclassed CEdit control (CNumEdit described on this web site) which behaves differently depending on whether CDialog::OnOK is tiggered by a mouse click on the OK button, or by pressing the OK button. In the former case, the edit value is retrieved from the control, and in the latter case, the edit value is not retrieved. I thought of adding an OnKeyUp() handler in the subclassed CNumEdit class to detect the ENTER key activity, and then retrieve the edit value from the control, but this seems like a kludge. Does anyone have a suggestion on how best to retrieve edit values from a subclassed control using exisiting CDialog data exchange functionality??

Rail Jon Rogut
July 13th, 1999, 02:10 PM
How you reach OnOK() shouldn't really matter... I'd look at the examples on my web site which deal with subclassing CEdit and see how they're done... You shouldn't have to do anything special.

Check out Examples 5 and 14 at http://home.earthlink.net/~railro/mfc_link.html.

Rail

Recording Engineer/Software Developer
Rail Jon Rogut Software
railro@earthlink.net
http://home.earthlink.net/~railro/