MATLAB REAL-TIME WORKSHOP 7 - TARGET LANGUAGE COMPILER Manuel d'utilisateur Page 295

  • Télécharger
  • Ajouter à mon manuel
  • Imprimer
  • Page
    / 408
  • Table des matières
  • MARQUE LIVRES
  • Noté. / 5. Basé sur avis des utilisateurs
Vue de la page 294
Writing Event Handlers
7-9
function myclick(varargin)
disp('Single click function')
function my2click(varargin)
disp('Double click function')
function mymoused(varargin)
disp('You have reached the mouse down function')
disp('The X position is: ')
varargin(5)
disp('The Y position is: ')
varargin(6)
You can use the same event handler for all the events you want to monitor
using the cell array pairs. Response time will be better than using the callback
style.
For instance
h = actxcontrol('SELECTOR.SelectorCtrl.1', [0 0 200 200], f, ...
{'Click' 'allevents'; 'DblClick' 'allevents'; ...
'MouseDown' 'allevents'})
and allevents.m is
function allevents(varargin)
if (varargin{2} = -600)
disp ('Single Click Event Fired')
elseif (varargin{2} = -601)
disp ('Double Click Event Fired')
elseif (varargin{2} = -605)
disp ('Mousedown Event Fired')
end
Note MATLAB does not support event arguments passed by reference or
return values from events.
Vue de la page 294
1 2 ... 290 291 292 293 294 295 296 297 298 299 300 ... 407 408

Commentaires sur ces manuels

Pas de commentaire