Notes on Third-Party ActiveX Control Blocks

This section contains additional notes about third-party ActiveX controls. One note is about editing ActiveX controls that ignore mouse events, while another concerns the colors of ActiveX controls.

Editing ActiveX Controls 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 Gauges Blockset. Double-clicking or right-clicking 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 enter the following commands at the MATLAB prompt:

temp = get_param(gcb,'userdata'));
propedit(temp.hActx);

This 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:

function axeventhandler(varargin)
propedit(varargin{1})

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:

{'keypress','axeventhandler'}

To use the error-checking code already written for the 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:

{'keypress','ax_block_dclk'}

Colors of ActiveX Controls

ActiveX controls that try to determine their colors by inheriting from the window in which they reside do not work properly in Simulink. More specifically, ActiveX controls that send the WM_CTLCOLOR message to their parent have this problem. WM_CTLCOLOR is a Microsoft Windows message sent by an ActiveX control to enable the parent container to determine the color used by the control.


Learn more about the latest releases of MathWorks products:

 © 1994-2010 The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS