从图像中可以看到,Right
按钮被选中,但是标签上写着LEFT AREA
,应该为RIGHT AREA
RCPTT中使用的脚本
get-button Right | click
这是ui的示例代码段。选中按钮后,将显示一个标签,说明单击了哪个按钮。
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();
} );
答案 0 :(得分:0)
我能够通过创建自己的自定义ecl命令来解决此问题,该命令发送选择事件并取消选择同一组合中的每个单选按钮,而只需选择目标单选按钮。看起来当您使用点击命令时,aut并没有取消选择周围的单选按钮