Search Tools Links Login

OCX interface tips

3 tips that you should definitely use to make your own developed ActiveX controls more developer friendly:

Original Author: Duncan Jones


(1) Use enumerated types wherever you can in your control's interface

- When you create a property for your control, try to define it as an enumerated type wherever possible. Doing so allows the Visual Basic IDE to populate a listbox with the values and their description in the "properties" tab. Thus where the ImageMap control has a ControlMode property which says how the control is behaving, the property is implemented as an enumerated type:

Private Enum enControlMode
  cm_Runtime = 1     '\ The control is in runtime mode
  cm_DesignTime_Selecting '\ Control is design time but no ImageMapItem is selected
  cm_DesignTime_Selected '\ Control is in design time and an ImageMapItem is selected
  cm_DesignTime_Drawing  '\ Control is drawing a new ImageMapItem
End Enum

This gives the developer more information about what the property is all about.

(2) Use the "Procedure Attributes" screen to give extra information about your properties. Bringing up the procedure attributes screen to set extra information about your properties. In particular, pressing the "Advanced >>>" button brings up three drop down boxes - Procedure ID:, Use this page in property browser:, and Property Category:.

(3) Fill the "Description" box of the "Procedure Attributes" box with a short but informative description. This information is displayed when that property is the currently selected one in the property browser widnow.

About this post

Posted: 2002-06-01
By: ArchiveBot
Viewed: 104 times


Visual Basic 6


No attachments for this post

Loading Comments ...


No comments have been added for this post.

You must be logged in to make a comment.