Dials & Gauges Blockset | ![]() ![]() |
Summary of Dialog Box Fields and Check Boxes
Here is a summary of the Block Parameters dialog box fields and check boxes. Each field and check box is described in more detail in sections following this summary:
Program ID
The Program ID is the name of the ActiveX Control block displayed on the block. To determine the Program ID of other ActiveX Control blocks, consult the documentation for the ActiveX Control block.
Connections
The Connections property determines whether the block has an inport, an outport, both, or neither. If the block is connected to a signal, this choice should indicate whether the signal is input to the block, output from the block, passed through the block (both), or not connected directly to the block (neither).
Input Property
The Input property indicates the name of the ActiveX Control block property whose value is set by the input signal. For the name of the property, see the table in Adding ActiveX Control Blocks to a Model.
Output Property
The Output property is the name of the ActiveX Control block property whose value is output from the block. For the name of the property, see the table in Adding ActiveX Control Blocks to a Model.
Event on Which to Output
The Event on which to output is a comma- or space-separated list of events that indicate a change in the output value. After the simulation starts, the output property will only be changed upon one of these events.
Block |
Associated Event |
Demo Joystick Control |
JoyMove |
Frequency Selector |
Change |
Generic Knob |
Turn, Click |
Generic Slider |
Slide, Change |
Generic Toggle |
Click |
Initialization Command
The Initialization command property is a string that sets the initial conditions of the ActiveX Control block. The string is evaluated during the model initialization stage.
hActX
.
Other Events and Handlers
The Other events and handlers property specifies actions taken by the ActiveX Control block when you perform a defined action on the ActiveX Control block. You must enter an event as an nx2
cell array. The first entry in each row must be the name of the ActiveX event. The second entry in each row must be the MATLAB callback to be executed.
Update Command
The Update command property is the string that is evaluated by MATLAB when the block is updated during a simulation. The command is not executed when you update the diagram.
In-Block Control
The In-block control check box determines whether the ActiveX Control block displays an ActiveX Control block or is connected to an ActiveX Control block somewhere else. The ActiveX Control block can be in the same model window or in a different subsystem, model, or MATLAB figure.
For example, if a model named my_model
has a subsystem called sub_disp_signals
that contains an ActiveX Control block named signal1
, the path is my_model/sub_disp_signals/signal1
.
Border
The Border check box determines whether the block displays a border around the ActiveX Control block.
Note Be careful when unchecking this box because the only way to move a block is to drag it with the border. Displaying no border will result in an ActiveX Control block that cannot be moved. |
Notes on Third-Party ActiveX Control Blocks
Note that ActiveX Control blocks that try to determine their color by inheriting from the window in which they reside will not work properly in Simulink.
WM_CTLCOLOR
message to their parent have this problem. WM_CTLCOLOR
is a Microsoft Windows message sent by an ActiveX Control block to allow the parent container to determine the color used by the control.
Placing one of these controls in the ActiveX Control block will cause MATLAB and Simulink to crash.Note that certain ActiveX Control blocks do not handle typical mouse events (double-click, right-click, etc.). These ActiveX Control blocks will appear "uneditable" when used with the Dials & Gauges Blockset. Double-clicking or right-clicking on these ActiveX Control blocks has no effect. To edit this type of ActiveX Control block, you must first select the block so that it is current in the Simulink diagram. Then type the following command at the MATLAB prompt.
propedit(get_param(gcb,'userdata'))This command opens the property editor dialog for that control. See the MATLAB ActiveX documentation for more information on the propedit command and assigning event callbacks to ActiveX controls.
Additionally, you can choose an event on your control through which you want to open the property editor. For example, write an M-file function to open the property editor (or whatever you want the event to do). The funtion must take multiple arguments, of which the first one will be the handle to the ActiveX control. For example, a simple funtion to open the property editor of a control would look like this:
function axeventhandler(varargin) propedit(varargin{1})
Next enter an event with the handler you just wrote in the Other Events and Handlers parameter field. Assume the keypress
event is valid, the event and handler entry would look like this:
{'keypress','axeventhandler'}
To use the error checking code already written for the Dials & Gauges Toolbox, you can use the same handlers we use by entering ax_block_dclk
for events that should open the property editor (note that the editor will not open when the simulation is running). For example, to make a keystroke open the property editor (assuming the keypress
event is valid), enter the event and handler pair as follows:
{'keypress','ax_block_dclk'}
![]() | Connecting to Your Own ActiveX Control Block | Accessing an ActiveX Control Block in a Different Model Window | ![]() |