Click to See Complete Forum and Search --> : edit control in ActiveX control


April 5th, 1999, 10:10 AM
I have a subclassed edit control (CMyEdit) in an MFC ActiveX control. The arrow keys do not work. I understand the PreTranslateMsg() override for special keys to be handled by the control instead of the container (its in there too.. that fix helped in that the focus no longer leaves the control). Still, in the edit, the arrow keys do nothing. I also implemented the forced OLE activation mechanism for the control's MouseActivate handler, per a tech note, as suggested OnActivateInPlace(TRUE, NULL) to UI-activate the control, to no avail. It should be noted that the same embedded edit control is also used inside a modeless dialog hosted by the ActiveX control, and they arrow-keys do not work there, as well. Also, Spy++ shows the ActiveX control getting the WM_KEYDOWN for the arrows, but the edit seems to do nothing with them (moreover, when I tried passing on the arrow-key specific msgs to CMyEdit from the COleControl::PreTranslateMsg(), that would hang the control).

Thanks in advance to anyone who has any ideas,

Sincerely,

Steve B.

April 12th, 1999, 12:16 PM
Ok, since no one came to the rescue on this one, I was lucky to be able to figure it out: In the COleControl's PreTranslateMsg() handler, you have to "pass on" WM_KEYDOWN, and WM_KEYUP msgs to the edit. I mentioned I was, but I did it wrong. You want to do this: pEdt->SendMessage(WM_KEYDOWN, wparam, lparam).

wparam, and lparam are passed into the PreTranslateMsg() handler, so just pass them on.