Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » resize event only called once????
resize event only called once???? [message #447843] Sat, 18 December 2004 00:57 Go to next message
Eclipse UserFriend
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 17:02 Go to previous message
Steve Northover is currently offline Steve NorthoverFriend
Messages: 1636
Registered: July 2009
Senior Member
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
> ...
> }
> });
> }
> }
>
>
Previous Topic:Loading jpgs into a table?
Next Topic:How to set a border around a Label??
Goto Forum:
  


Current Time: Sat Oct 31 14:27:37 GMT 2020

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

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

Back to the top