Main Content

EventManager

Create event manager component for target computer events

Since R2024a

Description

hEvtManager = slrealtime.ui.tool.EventManager(hFigure) creates an event manager component that manages target computer events. You can add this component to an instrument panel uifigure figure.

The event manager component manages a collection of event observers and corresponding callback functions that are used by the instrument panel and provides the features of Simulink Real-Time app components. When an instrument panel switches target computers, the managed observers are removed from the previous Speedgoat® target computer and added to the new target computer. For a list of target computer events, create a target object, tg, then in the MATLAB Command Window type:

events(tg)

For information about control properties, see slrealtime.ui Properties. It is important to set the TargetSource property for this control if you plan on using your app with target computers other than the default target computer.

example

Examples

collapse all

Create an event manager component and configure callback functions for the parameter changed events from the target computer.

% Create figure 
hFig = uifigure();

% Create target selector component  
hTgSelect = slrealtime.ui.control.TargetSelector(hFig);
hTgSelect.Position = [3,375,211,33];

% Create EventManager and configure events
hTgEventManager = slrealtime.ui.tool.EventManager(hFig);
hTgEventManager.TargetSource = hTgSelect;
hTgEventManager.EventCallbacks = struct( ...
    'Event', {'ParamChanged'}, ...
    'Callback', {matlab.apps.createCallbackFcn(hFig, @ParamChanged, true)});

Input Arguments

collapse all

The hFigure argument identifies the uifigure to which you are adding the UI component.

Example: hFig = uifigure()

Data Types: function_handle

Output Arguments

collapse all

The hEvtManager argument is the handle to the event manager component that configures callback functions for events from the target computer.

Version History

Introduced in R2024a