Re: I receive only 1/20 html event in a CDHTMLDialog
"Guillaume" <Guillaume@discussions.microsoft.com> wrote in message
news:79EE8279-94D2-4208-B5F7-F189F3CFE461@microsoft.com...
Hi everyone,
I got a big problem with a <div> section in the html code of my program
using CDHTMLDialog. I put an entry in the related DHTML_EVENT_MAP,
matching
the Onclick event on this <div> element with a callback function.
This worked perfectfully for a while, but now only about 1 event on 20 is
catched by the application, and I don't know why. Events are not catched
regularly.
Hope you can help me to find the reason of this.
Do you still have the code that worked perfectly? ;)
Does the <DIV> contain child elements that could be receiving the Click
instead? What about the Z-order of the <DIV>? Is another element on top of
it?
You can add to your map:
DHTML_EVENT_TAG_ALL(DISPID_HTMLELEMENTEVENTS_ONMOUSEDOWN,
OnHtmlMouseDown)
to trap mouse down for all elements and handle it with:
HRESULT CDHtmlPopupRequirementsDlg::OnHtmlMouseDown(IHTMLElement*
pElement)
{
// see what pElement got the event
}
DHTML_EVENT_TAG_ALL is defined as:
// From "Dialog with HTML skin using CDHtmlDialog and SetWindowRgn"
// http://www.codeproject.com/dotnet/HtmlSkinCDHtmlDialog.asp
// Define the macro for mapping one event from all HTML tags
#define DHTML_EVENT_TAG_ALL(dispid, memberFxn) { DHTMLEVENTMAPENTRY_TAG, dispid, _T("a"), (DHEVTFUNCCONTROL) (DHEVTFUNC)
theClass::memberFxn }, { DHTMLEVENTMAPENTRY_TAG, dispid, _T("abbr"), (DHEVTFUNCCONTROL) (DHEVTFUNC)
theClass::memberFxn }, { DHTMLEVENTMAPENTRY_TAG, dispid, _T("acronym"), (DHEVTFUNCCONTROL)
(DHEVTFUNC) theClass::memberFxn }, { DHTMLEVENTMAPENTRY_TAG, dispid, _T("address"), (DHEVTFUNCCONTROL)
(DHEVTFUNC) theClass::memberFxn }, ...
{ DHTMLEVENTMAPENTRY_TAG, dispid, _T("div"), (DHEVTFUNCCONTROL) (DHEVTFUNC)
theClass::memberFxn }, ...
and continues for all types of DHTML elements. You can check
http://www.codeproject.com/dotnet/HtmlSkinCDHtmlDialog.asp for complete
code.
-- David