Home » Eclipse Projects » Remote Application Platform (RAP) » Shell activate and deactivate events doesn't fire properly
Shell activate and deactivate events doesn't fire properly [message #123784] |
Wed, 04 March 2009 16:39 ![Go to next message Go to next message](theme/Solstice/images/down.png) |
Enrico Zanaga![Friend of Eclipse Friend](/donate/web-api/friends_decorator.php?email=ezanaga%40efsw.it) Messages: 50 Registered: July 2009 |
Member |
|
|
Hi,
having two shells with ShellListeners attached and a button for activate
the other shell, the shellActivated and shellDeactivated events doesn't
fire when the setActive method is called.
Also, shellDeactivated event doesn't fire in active shell when another
shell is created.
I use shellActivated and shellDeactivated events to show/hide an Adobe
Reader plugin, because the plugin stays always on top of other shell. If
these events aren't handled correctly, I don't know if there could be a
workaround for me...
Here's a snippet with a simple log:
public class RapTest implements IEntryPoint {
private Display d;
private Shell s1;
private Shell s2;
@Override
public int createUI() {
d = new Display();
s1 = new Shell(d, SWT.SHELL_TRIM | SWT.NO_FOCUS);
s2 = new Shell(d, SWT.SHELL_TRIM | SWT.NO_FOCUS);
s1.setBounds(0, 0, 400, 200);
s2.setBounds(400, 0, 400, 200);
s1.setLayout(new FillLayout());
s2.setLayout(new FillLayout());
s1.addShellListener(new ShellAdapter() {
@Override
public void shellActivated(ShellEvent e) {
System.out.println("s1: shellActivated");
}
@Override
public void shellDeactivated(ShellEvent e) {
System.out.println("s1: shellDeactivated");
}
});
s2.addShellListener(new ShellAdapter() {
@Override
public void shellActivated(ShellEvent e) {
System.out.println("s2: shellActivated");
}
@Override
public void shellDeactivated(ShellEvent e) {
System.out.println("s2: shellDeactivated");
}
});
Button b1 = new Button(s1, SWT.PUSH);
Button b2 = new Button(s2, SWT.PUSH);
b1.setText("activate s2");
b2.setText("activate s1");
b1.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
System.out.println("b1: widgetSelected");
s2.setActive();
}
});
b2.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
System.out.println("b2: widgetSelected");
s1.setActive();
}
});
s1.open();
s2.open();
while( !s1.isDisposed() && !s2.isDisposed() )
if( !d.readAndDispatch() )
d.sleep();
d.dispose();
return 0;
}
}
In SWT the events are always fired correctly.
Thanks
Enrico
|
|
|
Re: Shell activate and deactivate events doesn't fire properly [message #123799 is a reply to message #123784] |
Wed, 04 March 2009 17:01 ![Go to previous message Go to previous message](theme/Solstice/images/up.png) ![Go to next message Go to next message](theme/Solstice/images/down.png) |
Ivan Furnadjiev![Friend of Eclipse Friend](/donate/web-api/friends_decorator.php?email=ivan%40eclipsesource.com) Messages: 2426 Registered: July 2009 Location: Sofia, Bulgaria |
Senior Member |
|
|
Hi Enrico,
if the events differ from the shell events in SWT please file a bugzilla
about it.
Best,
Ivan
Enrico Zanaga wrote:
> Hi,
>
> having two shells with ShellListeners attached and a button for
> activate the other shell, the shellActivated and shellDeactivated
> events doesn't fire when the setActive method is called.
> Also, shellDeactivated event doesn't fire in active shell when another
> shell is created.
>
> I use shellActivated and shellDeactivated events to show/hide an Adobe
> Reader plugin, because the plugin stays always on top of other shell.
> If these events aren't handled correctly, I don't know if there could
> be a workaround for me...
>
> Here's a snippet with a simple log:
>
> public class RapTest implements IEntryPoint {
>
> private Display d;
> private Shell s1;
> private Shell s2;
>
> @Override
> public int createUI() {
> d = new Display();
> s1 = new Shell(d, SWT.SHELL_TRIM | SWT.NO_FOCUS);
> s2 = new Shell(d, SWT.SHELL_TRIM | SWT.NO_FOCUS);
> s1.setBounds(0, 0, 400, 200);
> s2.setBounds(400, 0, 400, 200);
> s1.setLayout(new FillLayout());
> s2.setLayout(new FillLayout());
>
> s1.addShellListener(new ShellAdapter() {
> @Override
> public void shellActivated(ShellEvent e) {
> System.out.println("s1: shellActivated");
> }
> @Override
> public void shellDeactivated(ShellEvent e) {
> System.out.println("s1: shellDeactivated");
> }
> });
> s2.addShellListener(new ShellAdapter() {
> @Override
> public void shellActivated(ShellEvent e) {
> System.out.println("s2: shellActivated");
> }
> @Override
> public void shellDeactivated(ShellEvent e) {
> System.out.println("s2: shellDeactivated");
> }
> });
>
> Button b1 = new Button(s1, SWT.PUSH);
> Button b2 = new Button(s2, SWT.PUSH);
> b1.setText("activate s2");
> b2.setText("activate s1");
>
> b1.addSelectionListener(new SelectionAdapter() {
> @Override
> public void widgetSelected(SelectionEvent e) {
> System.out.println("b1: widgetSelected");
> s2.setActive();
> }
> });
> b2.addSelectionListener(new SelectionAdapter() {
> @Override
> public void widgetSelected(SelectionEvent e) {
> System.out.println("b2: widgetSelected");
> s1.setActive();
> }
> });
>
> s1.open();
> s2.open();
>
> while( !s1.isDisposed() && !s2.isDisposed() )
> if( !d.readAndDispatch() )
> d.sleep();
> d.dispose();
>
> return 0;
> }
> }
>
>
>
> In SWT the events are always fired correctly.
>
> Thanks
> Enrico
|
|
|
Re: Shell activate and deactivate events doesn't fire properly [message #123811 is a reply to message #123799] |
Wed, 04 March 2009 17:35 ![Go to previous message Go to previous message](theme/Solstice/images/up.png) |
Enrico Zanaga![Friend of Eclipse Friend](/donate/web-api/friends_decorator.php?email=ezanaga%40efsw.it) Messages: 50 Registered: July 2009 |
Member |
|
|
Bug 267056 opened:
https://bugs.eclipse.org/bugs/show_bug.cgi?id=267056
Ivan Furnadjiev ha scritto:
> Hi Enrico,
> if the events differ from the shell events in SWT please file a bugzilla
> about it.
> Best,
> Ivan
>
> Enrico Zanaga wrote:
>> Hi,
>>
>> having two shells with ShellListeners attached and a button for
>> activate the other shell, the shellActivated and shellDeactivated
>> events doesn't fire when the setActive method is called.
>> Also, shellDeactivated event doesn't fire in active shell when another
>> shell is created.
>>
>> I use shellActivated and shellDeactivated events to show/hide an Adobe
>> Reader plugin, because the plugin stays always on top of other shell.
>> If these events aren't handled correctly, I don't know if there could
>> be a workaround for me...
>>
>> Here's a snippet with a simple log:
>>
>> public class RapTest implements IEntryPoint {
>>
>> private Display d;
>> private Shell s1;
>> private Shell s2;
>>
>> @Override
>> public int createUI() {
>> d = new Display();
>> s1 = new Shell(d, SWT.SHELL_TRIM | SWT.NO_FOCUS);
>> s2 = new Shell(d, SWT.SHELL_TRIM | SWT.NO_FOCUS);
>> s1.setBounds(0, 0, 400, 200);
>> s2.setBounds(400, 0, 400, 200);
>> s1.setLayout(new FillLayout());
>> s2.setLayout(new FillLayout());
>>
>> s1.addShellListener(new ShellAdapter() {
>> @Override
>> public void shellActivated(ShellEvent e) {
>> System.out.println("s1: shellActivated");
>> }
>> @Override
>> public void shellDeactivated(ShellEvent e) {
>> System.out.println("s1: shellDeactivated");
>> }
>> });
>> s2.addShellListener(new ShellAdapter() {
>> @Override
>> public void shellActivated(ShellEvent e) {
>> System.out.println("s2: shellActivated");
>> }
>> @Override
>> public void shellDeactivated(ShellEvent e) {
>> System.out.println("s2: shellDeactivated");
>> }
>> });
>>
>> Button b1 = new Button(s1, SWT.PUSH);
>> Button b2 = new Button(s2, SWT.PUSH);
>> b1.setText("activate s2");
>> b2.setText("activate s1");
>>
>> b1.addSelectionListener(new SelectionAdapter() {
>> @Override
>> public void widgetSelected(SelectionEvent e) {
>> System.out.println("b1: widgetSelected");
>> s2.setActive();
>> }
>> });
>> b2.addSelectionListener(new SelectionAdapter() {
>> @Override
>> public void widgetSelected(SelectionEvent e) {
>> System.out.println("b2: widgetSelected");
>> s1.setActive();
>> }
>> });
>>
>> s1.open();
>> s2.open();
>>
>> while( !s1.isDisposed() && !s2.isDisposed() )
>> if( !d.readAndDispatch() )
>> d.sleep();
>> d.dispose();
>>
>> return 0;
>> }
>> }
>>
>>
>>
>> In SWT the events are always fired correctly.
>>
>> Thanks
>> Enrico
|
|
|
Goto Forum:
Current Time: Sat Aug 24 00:35:39 GMT 2024
Powered by FUDForum. Page generated in 0.03336 seconds
|