Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » Browser widget - howto scroll to end
Browser widget - howto scroll to end [message #448489] Tue, 11 January 2005 12:15 Go to next message
Ishfak Bhagat is currently offline Ishfak BhagatFriend
Messages: 2
Registered: July 2009
Junior Member
Platform - Windows XP

I am using a browser widget to show some text, (its a chat application and
text gets appended to the end everytime)
problem is that I need to scroll to the end of the browser window so that
the user can see the last line.

Is there any way to achieve that?
Calling browser.getVerticalBar() always returns null, and reading the MSDN
docs show that IE does not use the window scroll bar (supplied by the
system), but draws its own

How do I get around this?

Thanks in advance,
Ishfak
Re: Browser widget - howto scroll to end [message #448493 is a reply to message #448489] Tue, 11 January 2005 14:55 Go to previous messageGo to next message
Kalman Hazins is currently offline Kalman HazinsFriend
Messages: 76
Registered: July 2009
Member
I would try calling refresh() on the browser widget ...


<bishfak@in.ibm.com> wrote in message news:cs0g1d$7o2$1@www.eclipse.org...
> Platform - Windows XP
>
> I am using a browser widget to show some text, (its a chat application and
> text gets appended to the end everytime)
> problem is that I need to scroll to the end of the browser window so that
> the user can see the last line.
>
> Is there any way to achieve that?
> Calling browser.getVerticalBar() always returns null, and reading the MSDN
> docs show that IE does not use the window scroll bar (supplied by the
> system), but draws its own
>
> How do I get around this?
>
> Thanks in advance,
> Ishfak
>
Re: Browser widget - howto scroll to end [message #448649 is a reply to message #448489] Wed, 12 January 2005 19:57 Go to previous message
Christophe Cornu is currently offline Christophe CornuFriend
Messages: 304
Registered: July 2009
Senior Member
If you can use SWT 3.1 (e.g. M4):

import org.eclipse.swt.*;
import org.eclipse.swt.widgets.*;
import org.eclipse.swt.layout.*;
import org.eclipse.swt.browser.*;

public class PRBrowser {

public static void main(String[] args) {
final String SCRIPT_SCROLL = "window.scrollTo(0,100000);";

Display display = new Display();
Shell shell = new Shell(display);
shell.setText("PRBrowser");
shell.setLayout(new FillLayout());
final Browser browser = new Browser(shell, SWT.NONE);
String html = "<html><body>";
for (int i = 0; i < 1000; i++) html += "<p id='"+i+"'>Line "+i+"</p>";
html += "</body></html>";
browser.setText(html);
Button b = new Button(shell, SWT.PUSH);
b.setText("Scroll");
b.addListener(SWT.Selection, new Listener() {
public void handleEvent(Event event) {
browser.execute(SCRIPT_SCROLL);
}
});
shell.open();

while (!shell.isDisposed()) {
if (!display.readAndDispatch())
display.sleep();
}
}
}
Previous Topic:New widgets in 3.1?
Next Topic:Browser widget scroll position
Goto Forum:
  


Current Time: Wed Apr 24 17:22:40 GMT 2024

Powered by FUDForum. Page generated in 0.03255 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top