Page 1 of 1

Scrolling the webbrowser_control?

Posted: 12 Jan 2015 15:08
by B.Hooijenga
I could not figure out how to do that.
Suggestions, perhaps a small example (?), would be very wellcome.

Kind regards

Ben

Posted: 12 Jan 2015 21:56
by Thomas Linder Puls
The webBrowser control is "merely" a shell that keeps track of "documents" and components that these are loaded in. If the document is an HTML document it is actually in the MSHTML component, and it is that you should instruct to scroll.

I don't know how that is done. I do however know that our COM import mechanism can unfortunately not import that component, so you will have to deal with it in more low-level fashion.

Posted: 13 Jan 2015 10:09
by B.Hooijenga
Thank you Thomas for clearing it up.

It looks as if there are methods for scrolling within mshtml.
But I will not dive into it.

I call an external browser from within my program.


Kind regards,

Ben

Posted: 13 Jan 2015 12:24
by Thomas Linder Puls
But can you scroll the external browser?

Posted: 13 Jan 2015 13:36
by B.Hooijenga
Yes.

This code just calls the standardbrowser one is using, Firefox in my case.
Everything works as normal, but not inside the VIP_webcontrol anymore, of course.

Code: Select all

predicates     onHelpContents : window::menuItemListener. clauses     onHelpContents(_Source, _MenuTag) :-            mainexe::getFileName(Path,_),            shell_api::shellOpen(string::concat(Path,"rs232user.html")).

Kind regards

Ben

Posted: 13 Jan 2015 21:42
by Thomas Linder Puls
I think I have misunderstood the problem. I thought you wanted to scroll the page from the program. But now I believe that you just want a scrollbar to appear so that the user can scroll.

The presence of a scrollbar is controlled by the hostInfoFlags:

Code: Select all

constants     hostInfoFlags_default : docHostUIFlag =         docHostUIFlag_no3dOuterBorder +         docHostUIFlag_scroll_no +         docHostUIFlag_theme. properties     hostInfoFlags : docHostUIFlag.     % @short A combination of docHostUIFlag_XXX flags.     % See IDocHostUIHandler::GetHostInfo and DOCHOSTUIFLAG in MSDN     % @end
As you can see docHostUIFlag_scroll_no is part of the default value of this flag.

Posted: 14 Jan 2015 13:24
by B.Hooijenga
Perhaps I am to blame. I should have asked: how to scroll the content of the webbrowser_control.

I looked around in MSDN and I think that MSHTML makes it possible to change the docHostUIFlags.
But VIP lacks (at the moment) the predicates to do so. So be it, we can not have it all.

I might add that at the very first I was confused by scroll_predicates in the WebBrowserControl_package
as I saw them in the helpfile. But I see now that they have nothing to do with the com_mechanisms.

Kind regards

Ben

Posted: 14 Jan 2015 15:10
by Thomas Linder Puls
No, you can set the hostInfoFlags:

Code: Select all

webBrowser_ctl:hostInfoFlags := docHostUIFlag_no3dOuterBorder + docHostUIFlag_theme,

Posted: 15 Jan 2015 14:05
by B.Hooijenga
Great!

I tried it out in the VIP_webrowser_example and it surely works.

Code: Select all

clauses     new(Parent) :-         formWindow::new(Parent),         generatedInitialize(),         addMenuItemListener(resourceIdentifiers::idr_Navigation_Back, onIdrNavigationBack),         addMenuItemListener(resourceIdentifiers::idr_Navigation_Forward, onIdrNavigationForward),         addMenuItemListener(resourceIdentifiers::idr_Navigation_Home, onIdrNavigationHome),         webBrowserControl_ctl:statusTextChangeEvent:addListener(onStatusTextChange),         webBrowserControl_ctl:hostInfoFlags := webBrowser::docHostUIFlag_no3dOuterBorder + webBrowser::docHostUIFlag_theme,         webBrowserControl_ctl:html := main::html.
Thanks, again Thomas

Kind regards
Ben