colored status indicator in GUI
2 views (last 30 days)
Show older comments
i'm trying to crate a text box that changes color if Mat lab is connected to arduino controller.
using the following code, it does not work:
function text3_CreateFcn(hObject, eventdata, handles)
% hObject handle to text3 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
%ADD THE CHECK FUNCTION HERE (as an if function)
global a;
if a.roundTrip(42)==1
set(hObject,'text3_CreateFcn','red');
else
end
% UIWAIT makes guiarduino wait for user response (see UIRESUME)
% uiwait(handles.figure1);
guidata(hObject, handles);
i could not find a simple solution to this problem. thanks!
veronica
0 Comments
Accepted Answer
Jan
on 21 Jun 2015
When should the color change to red? The CreateFcn runs during the creation of the figure.
This cannot work:
set(hObject, 'text3_CreateFcn', 'red');
Look at the documentation of set again. This commands sets a pre-defined property of the text object, but "text3_CreateFcn" is no property. Perhaps you want:
set(hObject, 'BAckgroundColor', 'red');
But I'm in doubt that the CreateFcn is the correct place to do this.
More Answers (0)
See Also
Categories
Find more on Migrate GUIDE Apps in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!