Broken ButtonDownFcn when used in a class in R2015a
2 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
I have a class, 'scrollwindow', which uses the axis 'ButtonDownFcn' to get a mouse click and do stuff. My code worked fine until Version 8, but is now broken. The error report is:
Undefined function 'down' for input arguments of type 'matlab.graphics.axis.Axes'.
Here's the relevant code, reduced to its essentials:
methods
function s = scrollwindow(varargin)
...
set(gca, 'ButtonDownFcn', @(src, evt)down(src, evt, s));
...
end
methods (Access = private)
function down(src, evt, s)
...
end
end
end
Any suggestions would be appreciated.
0 Commenti
Risposte (2)
Steven Lord
il 28 Ago 2015
The reason this used to work is because prior to the introduction of the new graphics system in release R2014b, axes handles were double precision values and user-defined objects take priority over fundamental classes when determining which function or method is called.
With release R2014b, axes handles are now handle objects. Since the src input argument to the ButtonDownFcn is an axes and is left/before the instance of your scrollwindow class, MATLAB will look for a method named down of the axes class. It can't find it, so you receive this error.
Removing the axes handle from your down call is one way to resolve the problem. Changing the relative precedence of the axes class and your scrollwindow class is another.
Vedere anche
Categorie
Scopri di più su Event Functions in Help Center e File Exchange
Prodotti
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!