GUIDE: call an element from the Property Inspector.

5 views (last 30 days)
Hi everyone, I'm using GUIDE to generate just .fig files. I want to recall an element in my GUI [like set(TagElement,'Enable','off')] when something happens in another element. e.g. I want to deactivate an edit text if the user selects one CheckBox. should I write the command set in the callback space of the checkbox, in Property inspector? I'm just generating .fig so I cannot write it in any .m file. How can I identify the edit text element?
  3 Comments
Michele Zendri
Michele Zendri on 9 Nov 2015
Yes of course, the line code to disable the edit box has to write in the checkbox callback.
I'm just programming the .fig file, any .m, in order to interface my .fig with another framework and interface with the user. (Tools --> GUI option --> Generate FIG file only).
So, I don't have for the moment any callbacks function, no opening and no outputs.
I just want to know if it is possible to call one element ( e.g. the edit text box) in the space reserved for the checkbox callback. In this ambient is not possible define any Matlab function and I don't know how my element (e.g. the edit text box) can be called back here.
Adam
Adam on 9 Nov 2015
If you want there to be any logic under your UI you will have to have a .m file of some sort associated with it, whether that is the auto-generated one or .m files you write yourself. Otherwise you are simply defining the look of the GUI and cannot impose any functionality on it.

Sign in to comment.

Answers (1)

Image Analyst
Image Analyst on 9 Nov 2015
You WILL have an m-file associated with it - it's not just a fig file all by itself. So in the callback function for the checkbox, say
checkBoxStatus = get(handles.checkbox1, 'Value');
if checkBoxStatus
% Checkbox is checked so disable the edit field.
set(handles.edit1, 'Enable', 'off');
else
% Checkbox is not checked so enable the edit field.
set(handles.edit1, 'Enable', 'on');
end
  2 Comments
Michele Zendri
Michele Zendri on 9 Nov 2015
Yes of course, the line code to disable the edit box has to write in the checkbox callback.
I'm just programming the .fig file, any .m, in order to interface my .fig with another framework and interface with the user. (Tools --> GUI option --> Generate FIG file only).
So, I don't have for the moment any callbacks function, no opening and no outputs.
I just want to know if it is possible to call one element ( e.g. the edit text box) in the space reserved for the checkbox callback. In this ambient is not possible define any Matlab function and I don't know how my element (_e.g._ the edit text box) can be called back here.
Image Analyst
Image Analyst on 9 Nov 2015
Not that I'm aware of. The callback function as defined in the property inspector just gives the name of a callback function. I don't know if you can put actual code into that property instead of just the name of a callback function. I would doubt it but you'd have to call the Mathworks to make sure.

Sign in to comment.

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!