Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
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
Enrico Zanaga is currently offline Enrico ZanagaFriend
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 messageGo to next message
Ivan Furnadjiev is currently offline Ivan FurnadjievFriend
Messages: 2359
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
Enrico Zanaga is currently offline Enrico ZanagaFriend
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
Previous Topic:Server delay message dialog
Next Topic:Confuse Service Release and Release version
Goto Forum:
  


Current Time: Sun Nov 28 15:52:46 GMT 2021

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

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

Back to the top