1

我有一个包含 CRichEditCtrl 控件的 CDialog 窗口 (CDrafter)。

我重写了 CDrafter::PreTranslateMessage 和 CDrafter::OnNotify 以允许我用鼠标单击 RichTextEdit 中的特殊单词,这又打开另一个对话框 (MyDialog)。

*注意:我这样做是因为我不喜欢 EN_LINK 样式的限制。*

所以在 CDrafter::PreTranslateMessage 我有:

它只是确定单击的位置和单词(仅此而已)(等待 OnNotify 对其进行处理)。

所以在 CDrafter::OnNotify 我有:

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;
}

我已经尝试在 MyDialog::DoModal 之后调用“CDialog::OnNotify(wParam, lParam, pResult)” - 仍然看到同样的问题。MyDialog::DoModal 在与父对话框相同的线程中被调用。

我希望能够做到以下几点:

单击单词,MyDialog 打开,单击 MyDialog::Cancel 按钮,对话框关闭。

但是有一个问题,因为这是我的序列:

单击单词,打开 MyDialog,单击 MyDialog::Cancel 按钮(不起作用 - 仅更改鼠标图标),单击 MyDialog::Cancel 按钮,对话框关闭

我需要(最初单击)鼠标才能在新打开的对话框中获得任何鼠标控制。即按钮等上的鼠标悬停事件在我(单击)之前什么都不做。

4

0 回答 0