23.12.2012 Views

MATLAB Function Reference Volume 1: A - E - Bad Request

MATLAB Function Reference Volume 1: A - E - Bad Request

MATLAB Function Reference Volume 1: A - E - Bad Request

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

actxcontrol<br />

2-36<br />

'DblClick' 'my2click'; 'MouseDown' 'mymoused'})<br />

where the event handlers, myclick.m, my2click.m, and mymoused.m are<br />

function myclick(varargin)<br />

disp('Single click function')<br />

function my2click(varargin)<br />

disp('Double click function')<br />

function mymoused(varargin)<br />

disp('You have reached the mouse down function')<br />

disp('The X position is: ')<br />

varargin(5)<br />

disp('The Y position is: ')<br />

varargin(6)<br />

You can use the same event handler for all the events you want to monitor<br />

using the cell array pairs. Response time will be better than using the callback<br />

style.<br />

For example<br />

h = actxcontrol('SELECTOR.SelectorCtrl.1', ...<br />

[0 0 200 200], f, {'Click' 'allevents'; ...<br />

'DblClick' 'allevents'; 'MouseDown' 'allevents'})<br />

and allevents.m is<br />

function allevents(varargin)<br />

if (varargin{2} = -600)<br />

disp ('Single Click Event Fired')<br />

elseif (varargin{2} = -601)<br />

disp ('Double Click Event Fired')<br />

elseif (varargin{2} = -605)<br />

disp ('Mousedown Event Fired')<br />

end

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!