ActiveX
| |  | Medium | In other ActiveX controls, they have descriptive
text in the properties window, instead of numbers.
How can I do that? |
| |  | Medium | My controls don't have cool features,
like having the caption update as you type. |
In other ActiveX controls, they have descriptive
text in the properties window, instead of numbers.
How can I do that?
Compatibility:VB3
VB4
VB5
Simple. Instead of declaring the property
of type integer or long, do this:
Enum MyOptions
[The Description of The First Item]
TheDescriptionofTheSecondItem
end Enum
You only need to enclose the description in brackets
if it contains spaces or other illegal characters.
My controls don't have cool features,
like having the caption update as you type.
Compatibility:VB3
VB4
VB5
In order to give a property a special
function, follow these steps:
- Go into object browser.
- Select the appropriate property.
- Right click on the property and click
on Properties.
- Select Advanced.
The Procedure ID drop-down box
allows you to select a "behavior" of that property.
Here are some of the more interesting settings:
- Caption, Text
Either of these procedure IDs will give a property the Properties window behavior demonstrated by the Caption and Text properties of Visual Basic intrinsic controls. That is, when a user types a value into the Properties window,
the new value will be reflected immediately in the control.
This means that your Property Let procedure will be called for each keystroke the user enters, receiving a complete new value each time.
This is similar to a Text control or a label.
-
(Default)
The default property of a control is the one that will be accessed when no property has been specified. For example, the following assigns the string "Cool VB" to the (default) Caption property of Label1:
Label1 = "Cool VB"
-
Enabled
This procedure ID must be assigned to the Enabled property of your control, in order for its enabled/disabled behavior to match that of other controls.
The other interesting box is the Categories box, which controls what section the properties appear in the Categorized tab.
Copyright 2000, David J Berube<Form1@aol.com>. All Rights Reserved.