Additional events for HTML Control

Started by honkinberry, January 25, 2010, 09:12:33 AM

Previous topic - Next topic

honkinberry

Is there any chance we could get additional events for the HTML Control in the future?
Specifically, and most importantly, a BeginNavigation.  Then additionally some method of accessing the DOM would be great.
I work a lot with SketchUp, which has its Web Dialog class.  Having the ability to add action callbacks to HTML elements really opens up the ability to use HTML for a variety of dialog box uses.  Here's their documentation if curious:
http://code.google.com/intl/hu-HU/apis/sketchup/docs/ourdoc/webdialog.html

--J

owenwengerd

Due to the way it is hosted inside an MFC control, the OpenDCL control is pretty difficult to expose beyond the basics. It will still be hampered by the limitations of AutoLISP, but using the ActiveX web browser control instead of the built in HTML control may open a lot more possibilities.

honkinberry

Don't know why I didn't think of that.
That does have a BeforeNavigate Event.  I'll give that a shot and post my progress.
Thanks!

--J

honkinberry

#3
Well this definitely has potential, but I've hit a snag, wondering if there is a solution.

The Microsoft Web Browser Control, inserted as an ActiveX Control, certainly does have a BeforeNavigate2 event.  Yet I can't seem to find a way to stop the navigation from happening.  MSDN says to set the Cancel parameter to true (http://msdn.microsoft.com/en-us/library/aa768326(VS.85).aspx) -- yet I believe the limitations of ActiveX through AutoLISP mean this is not passed ByRef, correct?
Anyway, I have tried throwing a (dcl_AxControl_Invoke <Control> "Stop") in the OnBeforeNavigate2 event, but even that won't stop it from the pending navigation.  Also tried Quit, putting it into Offline mode, anything.
So for now, am just firing Form_Close from within the Navigate2 event, which certainly works, but there are times I don't really want the whole dialog to go away.

In case anyone is curious what exactly I'm after -- Browsing a catalog is one of those cases where it is ideally presented in HTML format.  As well, most manufacturers already have HTML content for their products.  So it potentially can be a very slick method of choosing a particular item -- look through a web page of benches, with little images and text and such -- then when you click a button in the HTML, that DWG is downloaded and inserted, or whatever else might be desired.
So to get all that to work, all I need is to intercept the Navigate event, so that a bogus link like "odcl:additem(9)" will then cause the dialog box to close, and whatever else we want to happen to happen.

Many thanks for any thoughts!

--J

owenwengerd

Quote from: honkinberry on January 25, 2010, 08:36:50 PM
MSDN says to set the Cancel parameter to true (http://msdn.microsoft.com/en-us/library/aa768326(VS.85).aspx) -- yet I believe the limitations of ActiveX through AutoLISP mean this is not passed ByRef, correct?

Exactly. However, there could be a solution to the case where there is only one ByRef parameter, and where that parameter is strictly a return value. The solution would be to omit the argument when calling the event handler, and use the event handler's return value as the value for that parameter.

I've actually been meaning to implement his functionality, but I was waiting for an actual case where it would be useful. Since you've found such a case, you can be the lucky victim to test it in practice.

honkinberry

Sounds like a plan!
You just let me know when there's something for me to test.

--J