Re: event sink for CHtmlEditCtrl object
On May 1, 10:55 am, "David Ching" <d...@remove-this.dcsoft.com> wrote:
<d_b...@yahoo.com> wrote in message
news:1177966364.411358.212400@q75g2000hsh.googlegroups.com...
My problem is that now the parent dialog class is no longer catching
any events (mouse over, double click ...).
I am only familiar with CDHtmlDialog; I've not used CHtmlEditCtrl. However,
one limitation of CDHtmlDialog is that it does not bubble unhandled events
to the parent class. So I had created
class CMyDHtmlDialog : public CDHtmlDialog
and
class CMyDerivedDHtmlDialog : public CMyDHtmlDialog
and I could not create event handlers in CMyDHtmlDialog class because they
needed to be caught in the CMyDerivedDHtmlDialog. Does the
DECLARE_MESSAGE_MAP (or equivalent) macro take a parent class parameter? If
not, maybe that is the problem; creating a derived edit class prevents the
base class from properly raising events?
-- David
Hi David,
Here is the basic struture of my program
My htmleditor class which extends from CHtmlEditCtrl
CMyHtmlEditor : public CHtmlEditCtrl;
my dialog class which contains a pointer to CMyHtmlEditor, and the
eventsink
/* declaration */
CHtmlEditDlg : CDialog
{
protected:
CMyHtmlEditor *m_pHtmlEditor;
DECLARE_EVENTSINK_MAP()
}
/* instantiation */
BOOL
CHtmlEditDlg :: OnInitDialog()
{
m_pHtmlEditor = new CMyHtmlEditor();
CRect r;
CWnd* pWnd = GetDlgItem(IDC_PLACEHOLDER);
pWnd->GetWindowRect(r);
pWnd->ShowWindow(FALSE);
ScreenToClient(r);
m_pHtmlEditor->Create( _T(""), // not used
WS_CHILD | WS_TABSTOP | WS_VISIBLE |
WM_VSCROLL, // not used
r,
this,
IDC_DHTMLSAFE ) )
...
}
I am not overridding the Create function. This ones comes with
ChtmlEditCtrl.
Now the event sink map is currently implemented in CHtmlEditDlg and
it does take the base class. The event sinks are enabled by the
dialog item id ( IDC_DHTMLSAFE).
BEGIN_EVENTSINK_MAP( CHtmlEditDlg, CDialog )
ON_EVENT( WebEdit, IDC_DHTMLSAFE, 11, OnDBLClick, VTS_NONE )
END_EVENTSINK_MAP()
Now am I correct in assuming that in your example, you were also
unable to catch events in CMyDHtmlDialog also or only in
CMyDerivedDHtmlDialog.
For my case, my inheritance in only one level deep. I can see that an
event sink is declared for ChtmlEditCtrl in afxhtml.h. but there is
no
event map (i.e DECLARE_EVENT_MAP ) . Does that mean that CHtmlEditCtrl
does not raise any events. ? any idea if I am correct in my
reasoning.
any other pointers are much appreciated.
thanks