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.

The table below summarizes the events associated with blocks that can have an event on which to output.

Table 3-1: Event Associated With Each Block
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.

The handle of the ActiveX Control block is 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.

For a list and description of supported events for an ActiveX Control block library, consult the help for the library.

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.

If checked, the control whose name is specified in the Program ID field appears on the ActiveX Control block.

If unchecked, the block is connected to the ActiveX control whose handle is specified in the Handle location field (this field appears when you uncheck the box):

Using this feature is useful in a complex model that displays signals in multiple subsystems on ActiveX Control blocks. If you feed the signals into ActiveX Control blocks but display the ActiveX Control blocks themselves in a separate system or window, it is not necessary to have the subsystems open to see the results. For more information, see the section Accessing an ActiveX Control Block in a Different Model Window.

Border
The Border check box determines whether the block displays a border around the ActiveX Control block.

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.

More specifically, ActiveX Control blocks that send the 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.

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:

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:

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:

 Connecting to Your Own ActiveX Control Block Accessing an ActiveX Control Block in a Different Model Window