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 11:39  |
Eclipse User |
|
|
|
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 12:01   |
Eclipse User |
|
|
|
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 12:35  |
Eclipse User |
|
|
|
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: Thu May 08 23:22:15 EDT 2025
Powered by FUDForum. Page generated in 0.05458 seconds
|