Kirix Support Forums

Scroll a wxWebControl

Please post all general questions, comments, bug reports, and any other wxWebConnect feedback here.

Scroll a wxWebControl

Postby Rennnyyy on Mon May 02, 2011 2:15 pm

Hay guys,

I'm new to wxWebConnect. I tried to create a wxWebControl and scroll it with my programm after a spezific time, because the programm should show a HTML page over a period of time and scroll it down till the page is at the end, and then jump back to the beginning.

So I tried all methodes that start with Scroll (ScrollPages, ScrollLines, ScrollWindow) and SetScrollPos, but none of them worked. So please help me, and tell me how to do that.

Visit my code at:

http://pastebin.com/wLvHLC1N

Rennnyyy
Rennnyyy
 

Re: Scroll a wxWebControl

Postby jonmmorgan on Tue May 03, 2011 4:26 am

The scrollbars in the wxWebControl are provided by XULRunner / Gecko rather than being provided by wxWidgets, so none of the wxWindow scrolling methods will work. Instead, you will need to use the Javascript scrolling methods:

Code: Select all
control->Execute("window.scrollTo(100, 200);");


This is not helped by the fact that (from memory) the Execute() method was broken in wxWebConnect 1.1, and there has not been a new release since then. There are other threads on this forum which discuss how to fix this.

Another possibility would be to put all the logic in the HTML file: include a script section, and have it control scrolling and so forth in Javascript. This may or may not be a solution, depending on whether you are reading the same HTML file over and over or many different ones.
jonmmorgan
Registered User
 
Posts: 94
Joined: Fri May 14, 2010 9:48 am

Re: Scroll a wxWebControl

Postby jonmmorgan on Sat May 14, 2011 8:50 am

It turns out that the scrollTo() method is also exposed on the nsIDOMWindow class, so it would be possible to change wxWebConnect to expose this (though it doesn't currently).

window.scrollBy() and window.scrollByLines / window.scrollByPages might also be useful methods for what you are trying to do.
jonmmorgan
Registered User
 
Posts: 94
Joined: Fri May 14, 2010 9:48 am

Return to wxWebConnect Questions, Thoughts & Feedback