[英]Clicking the radio button is not updating the layout when using databinding in RCPTT
從圖像中可以看到,選中了“ 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();
} );
我可以通過創建自己的自定義ecl命令來解決此問題,該命令發送選擇事件並取消選擇同一組合中的每個單選按鈕,而只需選擇目標單選按鈕。 看起來當您使用click命令時aut並未取消選擇周圍的單選按鈕
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.