Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » is is a bug of swt?
is is a bug of swt? [message #455976] Tue, 24 May 2005 16:16
bbskill is currently offline bbskillFriend
Messages: 26
Registered: July 2009
Junior Member
see the sinppet below:
when a keyPressed event occurs to the Combo ,and then I set
the Combo.setEnable(false),but why the Selection event of
Button(returnUp) will occur at the same time ??
But if I comment path.setEnable(false),then the Selection event of
Button(returnUp) will not occur after the keyPressed event of Combo?
is it a bug?


package test;
import org.eclipse.swt.*;
import org.eclipse.swt.custom.*;
import org.eclipse.swt.events.KeyAdapter;
import org.eclipse.swt.events.KeyEvent;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.graphics.*;
import org.eclipse.swt.layout.*;
import org.eclipse.swt.widgets.*;

import edu.sysu.qftp.gui.Resource;
import edu.sysu.qftp.gui.preferences.Preference;

public class Snippet extends KeyAdapter{
static Combo path ;
static Button returnUp;
public void keyPressed(KeyEvent e) {
System.out.println("Path KeyPressed");
path.setEnabled(false);
}
public static void main (String [] args) {
Display display = new Display ();
Shell shell = new Shell (display);

GridLayout gridLayout = new GridLayout();
gridLayout.numColumns = 2;
gridLayout.marginHeight = gridLayout.marginWidth = 2;
gridLayout.horizontalSpacing = gridLayout.verticalSpacing = 0;
shell.setLayout(gridLayout);
path = new Combo(shell,SWT.BORDER);
GridData data = new GridData(SWT.FILL,SWT.FILL,true,false);
data.widthHint = 125;
path.setLayoutData(data);

returnUp = new Button(shell,SWT.NONE);
data = new GridData(SWT.END,SWT.FILL,false,false);
data.widthHint = 25;
returnUp.setLayoutData(data);

returnUp.setImage(Resource.getImage(Resource.ICON_FOLDER));
returnUp.setToolTipText(Resource.getString("BrowserTable_returnUp "));
path.addKeyListener(new Snippet());
returnUp.addSelectionListener(new SelectionAdapter(){
public void widgetSelected(SelectionEvent e) {
System.out.println("returnUp Selection");
}
});

shell.pack ();
shell.open ();
while (!shell.isDisposed ()) {
if (!display.readAndDispatch ()) display.sleep ();
}
display.dispose ();
}
}
Previous Topic:Advanced Graphics flickering
Next Topic:is is a bug of swt?
Goto Forum:
  


Current Time: Thu Apr 25 08:38:57 GMT 2024

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

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

Back to the top