resize event only called once???? [message #447843] |
Fri, 17 December 2004 19:57  |
Eclipse User |
|
|
|
Originally posted by: gopowereclipse.yahoo.com
I customized a dialog to allow resizing and registered a listener to watch
for RESIZE events. The event handler is only invoked once when the dialog is
coming up. When I resize the dialog with the mouse, the event never gets
triggered any more. If try to register the RESIZE listener in any control
that is hosted in the dialog, the controls' resize handler never gets
called, either. Does someone know why this is happening? Did I do something
wrong? Thanks a lot for your help.
--Vivian
================================================
import org.eclipse.jface.dialogs.Dialog;
public class MyDialog extends Dialog
{
public MyDialog(Shell parentShell)
{
super(parentShell);
setShellStyle(getShellStyle() | SWT.RESIZE); <== allow resizing
}
protected void configureShell(Shell shell)
{
super.configureShell(shell);
shell.setText(TITLE);
shell.addListener(SWT.RESIZE, new Listener (){
public void handleEvent (Event event)
{
int width = getShell().getClientArea().width; <== only hit
once during the dialog open
...
}
});
}
}
|
|
|
Re: resize event only called once???? [message #447869 is a reply to message #447843] |
Mon, 20 December 2004 12:02  |
Eclipse User |
|
|
|
You need to listen for SWT.Resize, not SWT.RESIZE. One is an untyped event,
the other is a style constant. Sorry about that.
"Vivian" <gopowereclipse@yahoo.com> wrote in message
news:cpvva1$k50$1@www.eclipse.org...
> I customized a dialog to allow resizing and registered a listener to watch
> for RESIZE events. The event handler is only invoked once when the dialog
is
> coming up. When I resize the dialog with the mouse, the event never gets
> triggered any more. If try to register the RESIZE listener in any control
> that is hosted in the dialog, the controls' resize handler never gets
> called, either. Does someone know why this is happening? Did I do
something
> wrong? Thanks a lot for your help.
>
> --Vivian
>
> ================================================
> import org.eclipse.jface.dialogs.Dialog;
>
> public class MyDialog extends Dialog
> {
> public MyDialog(Shell parentShell)
> {
> super(parentShell);
> setShellStyle(getShellStyle() | SWT.RESIZE); <== allow resizing
> }
>
> protected void configureShell(Shell shell)
> {
> super.configureShell(shell);
> shell.setText(TITLE);
> shell.addListener(SWT.RESIZE, new Listener (){
> public void handleEvent (Event event)
> {
> int width = getShell().getClientArea().width; <== only hit
> once during the dialog open
> ...
> }
> });
> }
> }
>
>
|
|
|
Powered by
FUDForum. Page generated in 0.03889 seconds