[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
Re: [platform-swt-dev] Browser widget: keylistener does not work
|
Grant Gayed wrote:
Hi Marco,
This was fixed in HEAD after 3.4M3, so it will be in 3.4M4. If it helps
you, the change that was applied is available at
https://bugs.eclipse.org/bugs/attachment.cgi?id=82352 .
On a second look, it seems to not be perfect yet. RSS feeds will not
fire key events. In the attached snipped, if you press a key in the RSS
view (start page), nothing will be printed. If you follow a story (a
HTML page will be loaded), there, pressed keys will be printed.
This works on Linux, but not on Windows with this setup:
- SWT 3.3 Final Release (with patch
"https://bugs.eclipse.org/bugs/attachment.cgi?id=82352" applied in the
Windows version)
- xulrunner 1.8.1.3
Did I miss a patch or is this still a bug?
thanks
Marco
Grant
------------------------------------------------------------------------
_______________________________________________
platform-swt-dev mailing list
platform-swt-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/platform-swt-dev
import org.eclipse.swt.SWT;
import org.eclipse.swt.browser.Browser;
import org.eclipse.swt.events.KeyAdapter;
import org.eclipse.swt.events.KeyEvent;
import org.eclipse.swt.layout.FillLayout;
import org.eclipse.swt.widgets.*;
public class RssBrowser
{
private Shell shell;
public RssBrowser()
{
shell = new Shell(Display.getDefault());
shell.setText("http://rss.cnn.com/rss/edition.rss");
shell.setLayout(new FillLayout());
Browser browser = new Browser(shell, SWT.MOZILLA);
browser.setUrl(shell.getText());
browser.addKeyListener(new KeyAdapter()
{
public void keyReleased(KeyEvent e)
{
System.out.println("Key pressed: " + e.character);
}
});
shell.setSize(800, 600);
}
public static void main(String[] args)
{
RssBrowser rssBrowser = new RssBrowser();
rssBrowser.shell.setVisible(true);
Display display = Display.getDefault();
while(!rssBrowser.shell.isDisposed())
{
if(!display.readAndDispatch()) display.sleep();
}
}
}