Can't get windowButtonMotionFcn to work
Show older comments
This is my first time working on matlab gui and to be honest I don't know what I'm doing. Hopefully I can provide enough information to solve this. Below are the relevant parts of my program.
classdef title < handle
% code
methods
function obj = title(dirname)
% code
figH = figure(...
'WindowButtonMotionFcn' , @mouse);
end
%
function mouse(obj, hObj, varargin);
obj_han = get(hObj, 'currentpoint');
set(obj.handles.cursorX, 'String', num2str(obj_han(1)));
set(obj.handles.cursorY, 'String', num2str(obj_han(2)));
end
end
"Undefined function 'mouse' for input arguments of type 'matlab.ui.Figure'. Error while evaluating Figure WindowButtonMotionFcn"
If I leave the code of 'mouse' unchanged but change the function to:
function mouse(hObj, varargin);
and define it within function obj = title(dirname), then it works until a call to mouseButtonDwn (which executes changing WindowButtonMotionFcn to a different function, then resets WindowButtonMotionFcn to @mouse). After this the error is the same as the above.
What can I do here?
2 Comments
Adam
on 8 Jun 2016
You need to show some code, there is too little information here to understand what the setup is.
Toby Jackson
on 8 Jun 2016
Accepted Answer
More Answers (0)
Categories
Find more on Creating, Deleting, and Querying Graphics Objects 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!