フィルターのクリア

GUI help - Possible to have somethings grayed out until needed

37 ビュー (過去 30 日間)
Will
Will 2012 年 1 月 11 日
Hi, I have a simulator that I have designed that has an intialization file "init.m" to run it. However, I am trying to make it a bit more user friendly and have been creating a gui for it. This is my first time using GUIDE so I am new to it but have been watching and reading tutorials and been picking it up.
I would like to have some items grayed out until somethine else is chosen. For example with radio buttons have
menu 1 = [A B C]
menu 2 is only active only if B is selected from menu 1. Otherwise it is grayed or not visible at all.
Is this possible, if so how?
Thanks in advance

採用された回答

Chandra Kurniawan
Chandra Kurniawan 2012 年 1 月 11 日
Hi,
I have small example that may helps you.
You should design a GUI as shown in picture below
And then save your file.
Unfortunatelly, GUIDE does not automatically create SelectionChangeFcn callback for you.
You can create it by right-click uibuttongroup1 and select SelectionChangeFcn from the View Callbacks context menu item.
Then, write this code below in uipanel1_SelectionChangeFcn
switch get(eventdata.NewValue,'tag')
case 'radiobutton1'
set(handles.uipanel2,'visible','off');
case 'radiobutton2'
set(handles.uipanel2,'visible','on');
case 'radiobutton3'
set(handles.uipanel2,'visible','off');
end
Don't forget to set the uibuttongroup2 unvisible at openingfcn.
set(handles.uipanel2,'visible','off');
Now, run the code.
Try to select radiobutton2, and uibuttongroup2 will appears.
  1 件のコメント
Will
Will 2012 年 1 月 11 日
Thanks! That did the trick

サインインしてコメントする。

その他の回答 (1 件)

Aurelien Queffurust
Aurelien Queffurust 2012 年 1 月 11 日
You must use enable property of uicontrols.

カテゴリ

Help Center および File ExchangeMigrate GUIDE Apps についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by