Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » Browser: Showing current URL in location textfield (what Listener to use?)
Browser: Showing current URL in location textfield (what Listener to use?) [message #449678] Thu, 27 January 2005 20:38 Go to next message
Benjamin Pasero is currently offline Benjamin PaseroFriend
Messages: 337
Registered: July 2009
Senior Member
Hi,

according to Snippet 128, the Location (URL) of the browser webpage is
written into the Text field
inside the LocationListener like this:

browser.addLocationListener(new LocationListener() {
public void changed(LocationEvent event) {
if (event.top) location.setText(event.location);
}
});

But using the LocationListener has the disadvantage that the URL is only
set after the entire page
has been loaded, and not after a link has been clicked.

Is there any reason why one should not set the Location with using the
ProgressListener, like:

browser.addProgressListener(new ProgressListener() {
public void changed(ProgressEvent event) {
location.setText(((Browser) event.widget).getUrl());
}
});

?

This allows to have the URL show inside the location Text field as soon
as a link is clicked.

Ben
Re: Browser: Showing current URL in location textfield (what Listener to use?) [message #449683 is a reply to message #449678] Fri, 28 January 2005 00:15 Go to previous message
Ron Capelli is currently offline Ron CapelliFriend
Messages: 10
Registered: July 2009
Junior Member
Something to consider... some URLs are redirected.

For example, navigate to http://www.windows.com and see where you end up...

....Ron Capelli
Previous Topic:How to combine scrolledComposite and Rowlayout ?
Next Topic:How to handle window closing event?
Goto Forum:
  


Current Time: Sat Apr 20 01:52:46 GMT 2024

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

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

Back to the top