Problem using "set(handles, 'Enable', 'off');"

12 views (last 30 days)
Jakob Sørensen
Jakob Sørensen on 28 Mar 2012
Hey,
I made a GUI with a bunch of edit texts and sliders, controlling how to show an image. But in order for them not to mess things up, if used before an image is loaded, i made a function to disable them all like this...
function enableAll(mode,handles)
set(handles.sliderXoffset, 'Enable', mode);
set(handles.sliderYoffset, 'Enable', mode);
...
% And so on, on around 20 objects.
I call the function using 'off' to disable it all in the end of the opening function. And then I call it again using 'on', at the end of my load function (which is a menu point).
It disables it just like it's supposed to, but when i re-enable it, the edit texts are back to standard background color (rather than the one i set in Guide) and there is no text in them. This don't even change when i use the sliders which should otherwise set the string in them.
I got a theory, that maybe because the objects are disabled so early in the program, the CreateFcn's don't get to run, and the objects are somewhat incomplete. Could this be the problem? And if it is, then how do I fix it? Any help is appreciated, thanks.
- Jake
  2 Comments
Jan
Jan on 28 Mar 2012
Which OS and Matlab version are you using?
Jakob Sørensen
Jakob Sørensen on 28 Mar 2012
Tested on:
R2010b in Linux (Ubuntu)
R2011b in Windows 7

Sign in to comment.

Answers (0)

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!