How can I deactive ButtonDownFcn temporarily?
2 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Ranjan Sonalkar
am 15 Okt. 2020
Beantwortet: Image Analyst
am 15 Okt. 2020
I am using ginput to select a point within a plotted area. The function ginput allows the button to be pressed and the x,y values to be picked up, even when the button is pressed while outside the selected plot. I can easily restrict the code to accept only those points that are within the plot.
However, I have many action buttons outside the plot. While moving the cursor during selection of a point using ginput, if I click on any of those buttons inadvertantly, the button action is activated. I do not want that to happen. I could set a flag IgnoreButtonPressFlag just before I call ginout and then check this flag in each of the many ButtonDownFcn callbacks. That sounds inefficient. Is there a way to deactivate the ButtonDownFcn function only when I am in the midst of selecting a point with ginput and then activate it right after ginput?
0 Kommentare
Akzeptierte Antwort
Image Analyst
am 15 Okt. 2020
See my functions, attached, that will let you disable all the controls on your figure.
The function DisableControls() lets you disable all controls on your GUIDE figure.
Then there is a function EnableControls() to re-enable all the controls that got disabled.
You call them like this:
% Disable controls.
WasEnabled = DisableControls(handles, 'Watch');
% Now code that the user interacts with where you don't want them to click anything else .....
% When done with all that.....
% Now, re-enable the disabled controls that we had disabled previously.
EnableControls(WasEnabled);
0 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Data Exploration finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!