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 #455965] Tue, 24 May 2005 13:37 Go to next message
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 ();
}
}
Re: is is a bug of swt? [message #455984 is a reply to message #455965] Tue, 24 May 2005 14:25 Go to previous messageGo to next message
Steve Northover is currently offline Steve NorthoverFriend
Messages: 1636
Registered: July 2009
Senior Member
I ran your code (on Windows, SWT 3.1) and it didn't happen for me. What
platform and SWT version are you using?

"bbskill" <bbkills@tom.com> wrote in message
news:d6v2ji$c4d$1@news.eclipse.org...
> 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 ();
> }
> }
Re: is is a bug of swt? [message #455990 is a reply to message #455984] Tue, 24 May 2005 18:12 Go to previous messageGo to next message
bbskill is currently offline bbskillFriend
Messages: 26
Registered: July 2009
Junior Member
SWT 3.1M5 + linux2.6.6(debian)!

Steve Northover wrote:
> I ran your code (on Windows, SWT 3.1) and it didn't happen for me. What
> platform and SWT version are you using?
>
> "bbskill" <bbkills@tom.com> wrote in message
> news:d6v2ji$c4d$1@news.eclipse.org...
>
>>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 ();
>>}
>>}
>
>
>
Re: is is a bug of swt? [message #455991 is a reply to message #455990] Tue, 24 May 2005 18:18 Go to previous message
bbskill is currently offline bbskillFriend
Messages: 26
Registered: July 2009
Junior Member
and if I change the Combo to CCombo,and all things go fine .
I think that is a bug of Combo in gtk?

bbskill wrote:
> SWT 3.1M5 + linux2.6.6(debian)!
>
> Steve Northover wrote:
>
>> I ran your code (on Windows, SWT 3.1) and it didn't happen for me. What
>> platform and SWT version are you using?
>>
>> "bbskill" <bbkills@tom.com> wrote in message
>> news:d6v2ji$c4d$1@news.eclipse.org...
>>
>>> 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:is is a bug of swt?
Next Topic:How to get and build the source for SWT M7?
Goto Forum:
  


Current Time: Thu Mar 28 10:30:23 GMT 2024

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

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

Back to the top