If a TWebBrowser is put into DesignMode (HTMLDocument2.designMode := 'On';), is there a way to detect changes to the document when a user types in the control, similar to an OnChange event of std ctrls like TEdit/TMemo?
Thanks
If a TWebBrowser is put into DesignMode (HTMLDocument2.designMode := 'On';), is there a way to detect changes to the document when a user types in the control, similar to an OnChange event of std ctrls like TEdit/TMemo?
Thanks
This is quite straightforward to achieve once you impl the IHTMLEditDesigner interface and hook it to the WebBrowser (you should be able to find resources on how to do this on the web).
Then the key part is to use the PreHandleEvent:
function TWebBrowserFrame.PreHandleEvent(inEvtDispId: Integer;
const pIEventObj: IHTMLEventObj): HResult;
begin
Result := S_FALSE;
If inEvtDispId = DISPID_EVMETH_ONKEYDOWN Then
...
if pIEventObj.keyCode = ... etc...
end;
This page had some useful info: (where DISPID constants come from...) http://www.codeproject.com/Articles/6546/Using-IHTMLEditDesigner