How exactly the 'Enable' property works for GUI elements (ans is it bugged??)

1 Ansicht (letzte 30 Tage)
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 Kommentare
George Baltas
George Baltas am 18 Dez. 2018
classdef test
properties
myFigure
end
methods
function app=test
app.myFigure=uifigure;
matlab.ui.control.Button('Parent',app.myFigure,'Enable','off','ButtonPushedFcn', @(src,event) myCallbackFcn(app,src,event));
end
end
end
function myCallbackFcn(app,src,event)
disp('hello world')
end
George Baltas
George Baltas am 18 Dez. 2018
I am using 2018a
Run the above as is, I click at the edge of the grayed out Button and I can call the callback function. I click at the body of the button and nothing happens. Is this how it is supposed to be or I am missing something. Thank you in advance.matlab problem.PNG

Melden Sie sich an, um zu kommentieren.

Akzeptierte Antwort

George Baltas
George Baltas am 2 Jan. 2019
This bug got fixed in 2018b

Weitere Antworten (0)

Kategorien

Mehr zu Startup and Shutdown finden Sie in Help Center und File Exchange

Produkte

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by