Home » Eclipse Projects » Standard Widget Toolkit (SWT) » SWT.Deactivate in Eclipse 3.4
| | | |
Re: SWT.Deactivate in Eclipse 3.4 [message #492732 is a reply to message #492471] |
Wed, 21 October 2009 14:43 |
Grant Gayed Messages: 2150 Registered: July 2009 |
Senior Member |
|
|
I've made a snippet based on the code you've provided and I still see these
events (tried swt 3.4.2 on XP). Does the snippet below work for you? The
snippet has the setHelp() invocation commented out, does commenting this out
in your app change anything? There must be more happening to make the
problem happen than what's here, but I can't know what else your app is
doing, so you may need to dig a bit to determine what other conditions are
required to make this happen.
public static void main(String[] args) {
final Display display = new Display();
Shell parentShell = new Shell(display); // <-- would should style be?
parentShell.setBounds(10,10,200,200);
parentShell.setText("parent shell");
Shell shell = new Shell(parentShell, SWT.NONE);
shell.setBounds(300,300,200,200);
shell.setText("child shell");
// if( null != helpContextID )
// PlatformUI.getWorkbench().getHelpSystem().setHelp(shell,
helpContextID);
Listener activateListener = new Listener() {
public void handleEvent(Event event) {
System.out.println("activate received: " +
((Shell)event.widget).getText());
}
};
Listener deactivateListener = new Listener() {
public void handleEvent(Event event) {
System.out.println("deactivate received: " +
((Shell)event.widget).getText());
}
};
shell.addListener(SWT.Deactivate, deactivateListener);
shell.addListener(SWT.Activate, activateListener);
parentShell.addListener(SWT.Deactivate, deactivateListener);
parentShell.addListener(SWT.Activate, activateListener);
parentShell.open();
shell.open();
while (!shell.isDisposed()) {
if (!display.readAndDispatch()) display.sleep();
}
display.dispose();
}
}
Grant
"Irum Godil" <irum@ca.ibm.com> wrote in message
news:hbkimh$9df$1@build.eclipse.org...
> Hi,
>
> I am on WinXP. I also added a Activate event and even that is not being
triggered.
>
> This is how I create the shell and listeners:
>
> shell = new Shell(parentShell, SWT.NONE);
>
>
> if( null != helpContextID )
> PlatformUI.getWorkbench().getHelpSystem().setHelp(shell, helpContextID);
>
>
> shell.addListener(SWT.Deactivate, new Listener() {
> public void handleEvent(Event e) {
> hide();
>
> }
> });
>
> shell.addListener(SWT.Activate, new Listener() {
> public void handleEvent(Event e) {
> hide();
>
> }
> });
|
|
|
Re: SWT.Deactivate in Eclipse 3.4 [message #492772 is a reply to message #492732] |
Wed, 21 October 2009 16:39 |
Irum Godil Messages: 35 Registered: July 2009 |
Member |
|
|
Hi Grant,
Thanks for following up on this. I checked your code and it does work fine. However, in my code I am creating a Tooltip ultimately inside the shell. When I did the same in your code, the shell does not de-activate. I have attached the code below.
Please note that I do not do a Shell.open() anywhere, I did not do in Eclipse 3.2 either and everything worked as it is. Please let me know what you think.
Thanks.
public static void main(String[] args) {
final Display display = new Display();
Shell parentShell = new Shell(display); // <-- would should style be?
parentShell.setBounds(10,10,200,200);
parentShell.setText("parent shell");
Shell shell = new Shell(parentShell, SWT.NONE);
shell.setBounds(300,300,200,200);
shell.setText("child shell");
// if( null != helpContextID )
// PlatformUI.getWorkbench().getHelpSystem().setHelp(shell,
// helpContextID);
Listener activateListener = new Listener() {
public void handleEvent(Event event) {
System.out.println("activate received: " + ((Shell)event.widget).getText());
}
};
Listener deactivateListener = new Listener() {
public void handleEvent(Event event) {
System.out.println("deactivate received: " + ((Shell)event.widget).getText());
}
};
shell.addListener(SWT.Deactivate, deactivateListener);
shell.addListener(SWT.Activate, activateListener);
parentShell.addListener(SWT.Deactivate, deactivateListener);
parentShell.addListener(SWT.Activate, activateListener);
ToolTip tooltip = new org.eclipse.swt.widgets.ToolTip(shell, SWT.ICON_INFORMATION| SWT.BALLOON );
tooltip.setVisible(true);
while (!shell.isDisposed()) {
if (!display.readAndDispatch()) display.sleep();
}
display.dispose();
}
|
|
|
Re: SWT.Deactivate in Eclipse 3.4 [message #492786 is a reply to message #492772] |
Wed, 21 October 2009 17:19 |
Grant Gayed Messages: 2150 Registered: July 2009 |
Senior Member |
|
|
Are you saying that Activate/Deactivate used to be sent for a Shell that was
never opened? If so then this does not seem right, and the change was
likely a bug fix. You'll probably have to change your code that was
expecting this. What are you trying to do?
Grant
"Irum Godil" <irum@ca.ibm.com> wrote in message
news:hbndgj$s54$1@build.eclipse.org...
> Hi Grant,
>
> Thanks for following up on this. I checked your code and it does work
fine. However, in my code I am creating a Tooltip ultimately inside the
shell. When I did the same in your code, the shell does not de-activate. I
have attached the code below.
>
> Please note that I do not do a Shell.open() anywhere, I did not do in
Eclipse 3.2 either and everything worked as it is. Please let me know what
you think.
>
> Thanks.
>
> public static void main(String[] args) {
> final Display display = new Display();
>
>
> Shell parentShell = new Shell(display); // <-- would should style be?
> parentShell.setBounds(10,10,200,200);
> parentShell.setText("parent shell");
> Shell shell = new Shell(parentShell, SWT.NONE);
> shell.setBounds(300,300,200,200);
> shell.setText("child shell");
> // if( null != helpContextID )
> // PlatformUI.getWorkbench().getHelpSystem().setHelp(shell,
> // helpContextID);
> Listener activateListener = new Listener() {
> public void handleEvent(Event event) {
> System.out.println("activate received: " +
((Shell)event.widget).getText());
> }
> };
>
> Listener deactivateListener = new Listener() {
> public void handleEvent(Event event) {
> System.out.println("deactivate received: " +
((Shell)event.widget).getText());
> }
> };
> shell.addListener(SWT.Deactivate, deactivateListener);
> shell.addListener(SWT.Activate, activateListener);
> parentShell.addListener(SWT.Deactivate, deactivateListener);
> parentShell.addListener(SWT.Activate, activateListener);
>
> ToolTip tooltip = new org.eclipse.swt.widgets.ToolTip(shell,
SWT.ICON_INFORMATION| SWT.BALLOON );
>
> tooltip.setVisible(true);
>
> while (!shell.isDisposed()) {
> if (!display.readAndDispatch()) display.sleep();
> }
> display.dispose();
> }
|
|
| |
Goto Forum:
Current Time: Wed Sep 25 12:43:58 GMT 2024
Powered by FUDForum. Page generated in 0.03165 seconds
|