I have a CDialog window (CDrafter) which contains a CRichEditCtrl control.
I overrided CDrafter::PreTranslateMessage and CDrafter::OnNotify to allow me to click on special words in the RichTextEdit with the mouse, which in turn opens another dialog (MyDialog).
*NOTE: I did this as I didn't like the limitations of the EN_LINK styling.*
So within the CDrafter::PreTranslateMessage i have:
It just determines where and which word was clicked (nothing more) (waits for OnNotify to do something with it).
So within the CDrafter::OnNotify I have:
BOOL CSTANAGMessageDrafterDlg::OnNotify( WPARAM wParam, LPARAM lParam, LRESULT* pResult )
{
BOOL r = CDialog::OnNotify(wParam, lParam, pResult);
//if (::PreTranslateMessage found a word clicked on ) {
MyDialog dialog;
dialog.DoModal();
//}
//Awesome my dialog opened and I can start editing the form (via the keyboard) no problems.
//BUG: There is a problem as the mouse curser is still showing the
// move carpet position icon as if it is still focused on the RichTextEdit control.
// If I click the mouse anywhere (in the MyDialog, or within the parent dialog)
// the mouse icon, and focus correctly changes to MyDialog, then I can click OK or CANCEL.
return r;
}
I have tried the calling "CDialog::OnNotify(wParam, lParam, pResult)" after the MyDialog::DoModal - still see same issue. The MyDialog::DoModal is called within the same thread as the parent dialog.
I would expect to be able to do the following:
click on word, and MyDialog opens, click on MyDialog::Cancel button and the dialog closes.
But there is a problem as this is my sequence:
click on word, and MyDialog opens, click on MyDialog::Cancel button (it doesn't work - only the mouse icon changes), click on MyDialog::Cancel button and the dialog closes
I need to (initially click) the mouse in order to get any mouse control within the newly opened dialog. i.e. the mouseover event on buttons, etc. does nothing until I (click).