January 21, 2021
Hot Topics:

Beginning ActiveX - Part 2

  • By John Percival
  • Send Email »
  • More Articles »

Although this seems a bit of a paradox, VB allows you to set properties about each member of the control's interface. To do this open up the Procedure Attributes Dialog by clicking Tools|Procedure Attributes..., and you will be presented by this dialog:

From here, you can set a description that appears in the object browser and the box below the properties window. You can also set a Help Topic ID for the help file specified in the project's help file for this member. Since computers work in numbers, they like to have a procedure ID. This links the procedure with a table of procedure that the container might expect to find. This allows the integration with containers that might not normally be able to access the properties, events and methods properly.

You can also specify which of the default and custom property pages this member uses if it is a property. These are a bit too much for this article, but may be covered in a later one. The Property Category is also only available to properties. This allows you to specify which category the property is put in when properties window is in "Categorized" mode. "Hide this member" allows you to hide the member from the prying eyes of VB's object browser. "Don't show in Property Browser" does a similar thing, just hiding the property from the property browser.

Just because the are hidden, doesn't mean that you can't use them in code. Lastly, "User Interface Default" determines which property is highlighted in the property browser or which event is displayed in the Code window when you double-click the control. Naturally there can only be one default property and one default method.

Similar to the User Interface default is setting the Procedure ID to "(Default)". This allows you to specify a 'value' method and property. These are the property and method that are referred to when you just reference the object. For example, with a label, the caption property has been set to the default 'value' procedure:

Label1.Caption = "Hello"

This is the same as:

Label1 = "Hello"

Another use of the Procedure ID is to add a really professional touch: an AboutBox. By specifying a method for use as the AboutBox member, another item is added in the property browser, called AboutBox. This is followed by the ellipsis (...), and when you click on them, it calls your AboutBox method. For example:

Public Sub AboutBox()
MsgBox "Scrolling Text Demonstration Control" & _
  vbNewLine & "From VB-World.net (http://www.vb-world.net)"
End Sub

Page 6 of 7

This article was originally published on November 20, 2002

Enterprise Development Update

Don't miss an article. Subscribe to our newsletter below.

Thanks for your registration, follow us on our social networks to keep up-to-date