Duplicated elements in a GUI
1 回表示 (過去 30 日間)
古いコメントを表示
Dear all, I have a gui with 20 different tables. They all perform the same calculation with the data entered in each one of them by the user.
At the moment I have this in my function:
function uitable1_CellEditCallback(hObject, ~, handles)
calculation
function uitable2_CellEditCallback(hObject, ~, handles)
calculation
function uitable3_CellEditCallback(hObject, ~, handles)
calculation
Any chance to do that in a cleaner way without having to repeat the same block of code over and over?
Thanks!
0 件のコメント
回答 (4 件)
Sean de Wolski
2013 年 11 月 8 日
Absolutely.
You can go into GUIDE and use the property inspector to change the callback manually. Copy the callback from the first UITABLE's GUIDE Inspector window and paste it into the others. Now you'll have one callback for all of them and have them all point at it.
Inside of the Callback, the first input hObject is the handle to the specific uitable that is calling the callback. Thus if you need some logic based on the calling uitable, you have it there.
0 件のコメント
Shaun VanWeelden
2013 年 11 月 8 日
Have them all point to the same callback and use the hObject variable to differentiate them. hObject is the current object being used and you can do your get/set stuff based on the hObject
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!