OCX interface tips

Submitted on: 1/18/2015 8:59:00 PM
By: Duncan Jones (from psc cd)  
Level: Intermediate
User Rating: By 4 Users
Compatibility: VB 5.0, VB 6.0
Views: 695
     3 tips that you should definitely use to make your own developed ActiveX controls more developer friendly:


(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.

Other 17 submission(s) by this author


Report Bad Submission
Use this form to tell us if this entry should be deleted (i.e contains no code, is a virus, etc.).
This submission should be removed because:

Your Vote

What do you think of this article (in the Intermediate category)?
(The article with your highest vote will win this month's coding contest!)
Excellent  Good  Average  Below Average  Poor (See voting log ...)

Other User Comments

 There are no comments on this submission.

Add Your Feedback
Your feedback will be posted below and an email sent to the author. Please remember that the author was kind enough to share this with you, so any criticisms must be stated politely, or they will be deleted. (For feedback not related to this particular article, please click here instead.)

To post feedback, first please login.