As you can see from the image, the Right
button is checked but the label says LEFT AREA
which should be RIGHT AREA
Script used in RCPTT
get-button Right | click
Here's the sample snippet of the ui. When a button is checked, a label will show up saying which button is clicked.
DataBindingContext dataBindingContext = new DataBindingContext();
IObservableValue<Boolean> left = new WritableValue<>( true, Boolean.class );
IObservableValue<Boolean> right = new WritableValue<>( false, Boolean.class );
Composite sampleComposite = new Composite( parent, SWT.NONE );
sampleComposite.setLayout( GridLayoutFactory.fillDefaults().numColumns( 2 ).create() );
Button leftBtn = new Button( sampleComposite, SWT.RADIO );
leftBtn.setText( "Left" );
dataBindingContext.bindValue( WidgetProperties.buttonSelection().observe( leftBtn ), left );
Button rightBtn = new Button( sampleComposite, SWT.RADIO );
rightBtn.setText( "Right" );
dataBindingContext.bindValue( WidgetProperties.buttonSelection().observe( rightBtn ), right );
StackLayout stackLayout = new StackLayout();
Composite stackComposite = new Composite( sampleComposite, SWT.NONE );
stackComposite.setLayout( stackLayout );
Label leftLbl = new Label( stackComposite, SWT.NONE );
leftLbl.setText( "LEFT AREA" );
Label rightLbl = new Label( stackComposite, SWT.NONE );
rightLbl.setText( "RIGHT AREA" );
ISideEffect.create( () -> {
stackLayout.topControl = left.getValue() ? leftLbl : rightLbl;
stackComposite.layout();
} );