select one item between two List Box
1 回表示 (過去 30 日間)
古いコメントを表示
Hi there,
I'm designing an App with MATLAB App designer. I have two Box List, with different items in them. I want the user could select just in a Box List or in a other, but not have two element selected in the two Box List.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/736904/image.png)
I'm looking something like that: (image modified manually, it is not the program)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/736909/image.png)
Thank you!!
0 件のコメント
採用された回答
Dave B
2021 年 9 月 13 日
編集済み: Dave B
2021 年 9 月 13 日
How about just using the callback of one to deselect the other:
% Set up some example listboxes:
u = uifigure;
lsta = uilistbox(u,'Items',{'Cat' 'Dog'});
lstb = uilistbox(u,'Items',{'Monkey' 'Horse'});
lsta.Position(2) = sum(lstb.Position([2 4]));
% initial state
lstb.Value = {};
% Changing value of lsta deselects lstb (and vice versa)
lsta.ValueChangedFcn = @(~,~)set(lstb,'Value',{});
lstb.ValueChangedFcn = @(~,~)set(lsta,'Value',{});
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Migrate GUIDE Apps についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!