MATLAB REAL-TIME WORKSHOP 7 - TARGET LANGUAGE COMPILER Bedienungsanleitung Seite 295

  • Herunterladen
  • Zu meinen Handbüchern hinzufügen
  • Drucken
  • Seite
    / 408
  • Inhaltsverzeichnis
  • LESEZEICHEN
  • Bewertet. / 5. Basierend auf Kundenbewertungen
Seitenansicht 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.
Seitenansicht 294
1 2 ... 290 291 292 293 294 295 296 297 298 299 300 ... 407 408

Kommentare zu diesen Handbüchern

Keine Kommentare