MATLAB Object-Oriented Programming
Implement Property Set Listener This example shows how to define a listener for a property set event. The listener callback trig ...
end methods function buttonObj = PushButton myFig = figure; buttonObj.AxHandle = axes('Parent',myFig); uicontrol('Parent',myFig, ...
See Also Related Examples “Listen for Changes to Property Values” on page 11-40 See Also ...
Event and Listener Concepts In this section... “The Event Model” on page 11-14 “Limitations” on page 11-15 “Default Event Data” ...
The following diagram illustrates the event model. Listener1 Properties EventName = ‘InsufficientFunds’ FunctionHandle = @Callba ...
The order in which listeners execute is not defined. Listeners should not modify the event data object passed to the listener c ...
Property-Set and Query Events There are four predefined events related to properties: PreSet — Triggered just before the proper ...
Source — Handle or array of handles of the object that generated the event EventName — Name of the event Callback — Function to ...
Event Attributes Specify Event Attributes The following table lists the attributes you can set for events. To specify a value fo ...
Event Attributes Attribute Name Class Description Hidden logical Default = false If true, event does not appear in list of event ...
Attribute Name Class Description Framework attributes Classes that use certain framework base classes have framework-specific at ...
Events and Listeners Syntax In this section... “Components to Implement” on page 11-22 “Name Events” on page 11-22 “Trigger Even ...
Trigger Events The OnStateChange method calls notify to trigger the ToggledState event. Pass the handle of the object that is th ...
@RespondToToggle.handleEvnt — A function handle to the callback function (see the following definition “Define Listener” on pag ...
classdef RespondToToggle < handle methods function obj = RespondToToggle(toggle_button_obj) addlistener(toggle_button_obj,'To ...
ListenerHandle % Property for listener handle end methods function obj = RespondToToggle(toggle_button_obj) hl = addlistener(tog ...
NewState end methods function data = ToggleEventData(newState) data.NewState = newState; end end end The call to notify can use ...
Listener Lifecycle In this section... “Control Listener Lifecycle” on page 11-28 “Temporarily Deactivate Listeners” on page 11-2 ...
delete(ListenerHandle) NoteDo not use the pack command with objects that define events and listeners. The pack command causes th ...
Listener Callback Syntax In this section... “Specifying Listener Callbacks” on page 11-30 “Input Arguments for Callback Function ...
«
18
19
20
21
22
23
24
25
26
27
»
Free download pdf