Dials & Gauges Blockset | ![]() ![]() |
Notes on Third-Party ActiveX Control Blocks
This section contains additional notes about third-party ActiveX control blocks. One note is about editing ActiveX Control blocks that ignore mouse events, while another concerns the colors of ActiveX control blocks.
Editing ActiveX Control Blocks That Ignore Mouse Events
Certain ActiveX controls do not handle typical mouse events (double-click, right-click, etc.). These ActiveX controls appear uneditable when used with the Dials & Gauges Blockset. Double-clicking or right-clicking on blocks that use these controls has no effect. To edit this type of 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 properties dialog box for that control. See the MATLAB COM 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 function must take multiple arguments, of which the first one is the handle of the ActiveX control. For example, a simple function to open the property editor of a control looks like this:
Next enter an event with the handler you just wrote in the Other Events and Handlers parameter field. Assuming the keypress
event is valid, the event and handler entry looks like this:
To use the error-checking code already written for the Dials & Gauges Blockset, you can enter ax_block_dclk
for events that should open the property editor (note that the editor does not open when the simulation is running). For example, to make a keystroke open the property editor (assuming that the keypress
event is valid), enter the event and handler pair as follows:
Colors of ActiveX Control Blocks
ActiveX Control blocks that try to determine their colors by inheriting from the window in which they reside do 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.
Caution Placing one of these controls in the ActiveX Control block causes MATLAB and Simulink to crash. |
![]() | Border | Placing ActiveX Controls in a Different Window | ![]() |