フィルターのクリア

GUI FAULT INDICATOR (GREEN, RED)

3 ビュー (過去 30 日間)
Daniel
Daniel 2016 年 4 月 25 日
コメント済み: Meade 2016 年 4 月 25 日
HI, i want a FAULT indicator in my GUI. lets say A red circle, or a green circle. is there something simple, built in the GUI that i can use? i dont really want to draw a circle from scratch every place i want an indicator
  3 件のコメント
Adam
Adam 2016 年 4 月 25 日
If you are using R2016a and the App Designer you can use
doc uilamp
to do this I would think. I haven't used the App Designer or its components yet myself though so I don't know what the limitations are on GUIs created that way are.
Meade
Meade 2016 年 4 月 25 日
For dead-simple notification, just fill the BackgroundColor of your favorie ui object.
Try this as a template:
function toggleTest
% Make fig
figure('Visible','off',...
'OuterPosition', [0 40 400 400],...
'MenuBar', 'none',...
'ToolBar', 'none');
hFig = gcf;
% A simple pushbutton
uicontrol(hFig,'Style','pushbutton',...
'Units', 'norm',...
'Position',[0.2 0.6 0.6 0.25],...
'String','TOGGLE',...
'Callback',@toggleColor);
% STATUS INDICATOR --------------------------
uipanel(gcf,'units','norm',...
'Position',[0.2 0.2 0.6 0.25],...
'BackgroundColor','g',...
'tag', 'PANEL_TOGGLE')
% --------------------------------------------
% Save toggle state
data.TOGGLE_STATE = true;
% Pass Handles
data.Handles = guihandles(hFig);
% Save & Launch
guidata(hFig,data);
movegui(hFig,'center')
hFig.Visible = 'on';
end
function toggleColor(hObj,~)
h = guidata(hObj);
switch h.TOGGLE_STATE
case true
h.Handles.PANEL_TOGGLE.BackgroundColor = 'r';
case false
h.Handles.PANEL_TOGGLE.BackgroundColor = 'g';
end
h.TOGGLE_STATE = ~h.TOGGLE_STATE
guidata(hObj,h);
end

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

回答 (0 件)

カテゴリ

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