How to make a scroll button for Web Browser Module

We are cooking up something with the Web Browser Module and a good 70% of our ELO touch screens don’t support multitouch and our environment is also very dusty. so we shy away from sliding or swiping controls on the ELOs. I have figured out so far that things like refresh and back and forward are simply the object.refresh() or .back() or .forward(). However I cannot seem to find what will make the screen scroll. I would appreciate any clues Thanks

Perhaps you can use anchor links on your web pages?

http://www.echoecho.com/htmllinks08.htm

Thanks for the reply Sanderd17, I really appreciate it. That is actually a pretty nice idea. I don’t have control of the development of the web pages though.

So I was able to create a solution with a lot of hair pulling, time on the jxBrowser site. You can scroll a normal web window, however any document that is viewed in the browsers PDF plugin is relatively out of your control. Adobe proprietary such and such… So my scroll up and down buttons use jxBrowser’s recommended line of code and any pdf plugin content use simulated keystrokes.

 from java.awt import Robot
 from java.awt.event import KeyEvent as keyevent
 robot = Robot()
 x = system.tag.read("[Client]currenturl").value
 window = system.gui.getWindow('MAIN')
 browser = window.rootContainer.getComponent('FileBrowser')
 if x[-3:]=="pdf":
     robot.keyPress(keyevent.VK_UP)
     robot.keyRelease(keyevent.VK_UP)
 else:
     browser.getBrowser().executeJavaScript("window.scrollBy(0, -50);")

So that is the script for my scroll up button. For scroll down you would simply change the minus 50 in window.scrollBy to 50, and VK_UP is VK_DOWN. I suppose I could also use the key event for the regular web page but then it takes away my ability to fine tune the scroll. With the PDF I am currently stuck with either the distance given by the arrow keys or the PageDown Page Up keys. So That was fun.

3 Likes