Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Remote Application Platform (RAP) » Radiobutton fires twice
Radiobutton fires twice [message #121567] Fri, 13 February 2009 19:13 Go to next message
rollo is currently offline rolloFriend
Messages: 117
Registered: July 2009
Senior Member
Hi,

I have a problem.
The Radiobutton fires twice.

Hit button1 -> fires once.
Hit button2 -> fires twice.
Hit button1 -> fires twice.
...........

Is this a bug???

Roland


Here is a little snippets that shows it.

public class Test implements IEntryPoint {

public int createUI() {
Button radio;
Display display = PlatformUI.createDisplay();
Shell container = new Shell( display );
container.setLayout( new GridLayout() );

for ( int i = 1; i <= 2; i++ ) {
radio = new Button( container, SWT.RADIO );
radio.setText( "radio" );
radio.addSelectionListener( new SelectionAdapter() {
public void widgetSelected( SelectionEvent event ) {
System.out.println( "radio-fire" );
}
} );
}
container.open();
while ( !container.isDisposed() ) {
if ( !display.readAndDispatch() ) {
display.sleep();
}
}
return 0;
}
}
Re: Radiobutton fires twice [message #121581 is a reply to message #121567] Fri, 13 February 2009 20:20 Go to previous message
Ivan Furnadjiev is currently offline Ivan FurnadjievFriend
Messages: 2426
Registered: July 2009
Location: Sofia, Bulgaria
Senior Member
Hi Roland,
recently we fixed the bug:

Bug 224872: Buttons of style radio don't fire Selectionevent properly
https://bugs.eclipse.org/bugs/show_bug.cgi?id=224872

The radio buttons fire selection events on both selection and
deselection. The two events are from selected radio and from deselected
one - check the event source.
Best,
Ivan

Roland Siebert wrote:
> Hi,
>
> I have a problem.
> The Radiobutton fires twice.
>
> Hit button1 -> fires once.
> Hit button2 -> fires twice.
> Hit button1 -> fires twice.
> ..........
>
> Is this a bug???
>
> Roland
>
>
> Here is a little snippets that shows it.
>
> public class Test implements IEntryPoint {
>
> public int createUI() {
> Button radio;
> Display display = PlatformUI.createDisplay();
> Shell container = new Shell( display );
> container.setLayout( new GridLayout() );
>
> for ( int i = 1; i <= 2; i++ ) {
> radio = new Button( container, SWT.RADIO );
> radio.setText( "radio" );
> radio.addSelectionListener( new SelectionAdapter() {
> public void widgetSelected( SelectionEvent event ) {
> System.out.println( "radio-fire" );
> }
> } );
> }
> container.open();
> while ( !container.isDisposed() ) {
> if ( !display.readAndDispatch() ) {
> display.sleep();
> }
> }
> return 0;
> }
> }
Previous Topic:Editor with minimal Layout problem?
Next Topic:insight into different behaviour between fedora firefox and WinXP firefox
Goto Forum:
  


Current Time: Tue Apr 16 20:28:03 GMT 2024

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

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

Back to the top