Update. After further investigating this, it turns out that the edges of the push button are the ones generating an event even when the 'Enable' property is set to 'off', the "body" of the button behaves as expected
How exactly the 'Enable' property works for GUI elements (ans is it bugged??)
1 view (last 30 days)
Show older comments
George Baltas
on 17 Dec 2018
Answered: George Baltas
on 2 Jan 2019
I experienced the following behavior. Created a push button (we talk about uifigure) set its 'Enable'='off' attached a 'ButtonPushedFcn' to it.
So far so good, then i proceed to play around with my UI the button is disabled and grayed out, I click on it and nothing happens (as it should)
Then I proceed to click it again multiple times in quick succession, nothing happens (again as it should) then suddenly my callback function is called!!!!!!!!
I can reproduce this behavior and it is really confuses me, please let me know if you have any advice on the matter.
For refference:
matlab.ui.control.Button('Parent', myHandle , 'BackgroundColor', myBackground,...
'Position', myPosition ,'Enable','off', 'Text', myText,...
'HorizontalAlignment', 'center','FontName', 'arial','FontWeight', 'bold','FontSize', 11,...
'ButtonPushedFcn', @(src,event) myCallbackFcn(app,src,event,index));
function myCallbackFcn(app,src,event,index)
%%%%
end
4 Comments
Accepted Answer
More Answers (0)
See Also
Categories
Find more on Startup and Shutdown in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!