Property list ActiveX control






3.88/5 (23 votes)
Jun 3, 2004
3 min read

198755

7060
Property list similar to VB.NET, implemented as ActiveX control.
- Download source files - 104 Kb
- Download demo project for VB6 - 7.15 Kb
- Download demo project for VC6 - 21.5 Kb
Important
The article is updated! See below for the changes!
Introduction
This property list control is similar to other property lists available, with two main differences:
- It's very easy to implement.
- It's implemented as an ActiveX control, so it's suitable for C++, C#, and VB as one. Also, it can be placed on an HTML page or any other container that supports ActiveX and script.
Reference
Properties
BorderStyle As BorderStyle
The border style of the control.
BorderStyle enum
:
BorderNone
= 0 - No borderBorderRaized
= 1 -EDGE_RAISED
BorderSunken
= 2 -EDGE_SUNKEN
BorderFlat
= 3 -BDR_RAISEDOUTER|BDR_RAISEDINNER
,BF_FLAT
BorderStatic
= 4 -BDR_SUNKENINNER
Precision As Short
Overall precision of
double
values (* not used at the moment).
Methods
Clear()
Clears all the properties from control.
AddProperty(BSTR Category, BSTR Caption, VARIANT Value, BSTR Description, buttonType ButtonType,VARIANT_BOOL IsEnabled)
Adds new property to the control.
Category
- the category of the property.Caption
- the caption (the string name of the property).Value
- the property value (String
,Short
,Long
,String
array,DateTime
,Picture
etc...).Description
- the text to display in the description window.ButtonType
- the button type of the property (* applicable to edit controls, andDateTime
control).IsEnabled
- is the property enabled.ButtonNone
= 0 - no buttonButtonElipsis
= 1 - ellipsis button (three dots), edit control created.ButtonPick
= 2 - pick button (arrow with x), edit control created.ButtonOpen
= 3 - button opens a file open dialog, edit control created.ButtonLink
= 4 - button opens the Explorer, edit control created.ButtonColor
= 5 - button opens pick color dialog, color control created.ButtonMail
= 6 - button opens new mail message, edit control created.ButtonLongDate
= 7 - displays a date in long format,DateTime
control created.ButtonShortDate
= 8 - displays a date in short format,DateTime
control created.ButtonTime
= 9 - displays a time,DateTime
control created.
ButtonType enum
:
SetValue(BSTR PropertyName, VARIANT Value)
Sets a value for single property.
PropertyName
- the name of the property to set the value for.Value
- the value to set.
Events
PropertyChanged(BSTR PropertyName, VARIANT NewValue)
Fired on property change.
PropertyName
- the name of the property that changed.NewValue
- the new value.
ButtonClicked(BSTR PropertyName, short ButtonType, VARIANT* Value)
Fired on button click allowing you to perform some custom action for the button, and set the value to a new one as the result of performed actions.
PropertyName
- the name of the property whose button was clicked.ButtonType
- the type of the button.Value
- passedByRef
(as pointer) allowing you to set a new value on function return.
* Note that some of the controls have a default action for button click, as the color button, linkbutton, mail button etc...
History
Update - 04/11/2004
New Properties
ShowDescription As Boolean
Controls display of the description (
True
/False
).
New Methods
CloseAll()
Closes all the categories (useful if you'd like to start the list when all the categories are closed. You can fill the list then call
CloseAll()
to close the categories).
New button types
ButtonMultyText
=10
- Creates a text window five rows high for multiple lines text.ButtonButton
=11
- Creates a button which occupies the entire row.ButtonFunction
=12
- Creates a property whose value is calculated from the provided function which may be based on other properties. For example:You have a property named
Diameter
and its value is 10. You add a function type property namedarea
, click on its button, the "Enter function" dialog appears where you write - 3.14 * ([Diameter]/2)^2. After you close the dialog, the value displayed in the property would be: 78.5. If you now change theDiameter
to 4, theArea
property will automatically update to 12.56.ButtonPicture
=-1
- The passed string is a path to an image file (you can also pass images asIDispatch
interface).