Setting Properties with OLE Automation





5.00/5 (4 votes)
Jun 3, 2000

103122

2361
Describes an ActiveX Control to use OLE Automation to set an object's properties.
Table of Contents.
- Introduction
- How it works
- Control interface
- Source interface
- User interface
- Environment
- Acknowledgement, References
- Some words about VB demo
Introduction
kPropertySet.kObserver
- This ActiveX control provides a way for
presenting and editing of the set of properties (Visual Basic IDE - like property
browser).
The main features are:
- Editing a set of properties through the
IDispatch
interface. - Works with
IPerPropertyBrowsing
andICategorizeProperties
interfaces - Supports any type of property compatible with OLE automation
- Supports user-defined types
- Sorting for alphabet and categories
- Flexible customization
- Small size: 73.5 KB in release min size configuration
How it works
After receiving the pointer from the IDispatch
interface, the
control explores the type library. For each property with attribute "propget"
there is an object implementing the logic of visualization, data exchange and
data validation. The properties with attributes "hidden", "nonbrowsable", and
"restricted" are skipped.
Control interface
The following is a description of the kObserver
interface:
- Property
Dispatch
: - External dispatch interface.
- Property
Font
: - Current font.
- Property
BackColor
: - Back color of list view window.
- Property
ForeColor
: - Foreground color used for display text.
- Property
GridColor
: - Color used for display grid.
- Property
HighliteBackColor
: - Color used for display selected item.
- Property
HighliteForeColor
: - Color used for display text of selected item.
- Property
EditBackColor
: - Background color used for display edit window.
- Property
EditForeColor
: - Foreground color used for display text in edit window.
- Property
SignColor
: - The sign color.
- Property
EnableContextMenu
: - Must be false if show of the context menu is unnecessary.
- Property
Categorized
: - Sort mode, true if sorting by categories.
- Property
LineSpacing
: - Additional spacing between rows can be negative.
- Property
exStyleEdit
: - Extended window style of edit window.
- Property
SelectName
: - Name of active property.
- Property
SelectDesc
: - Description of active property.
- Property
SelectValue
: - Value of active property.
- Property
SelectDispid
: - DISPID of active property.
Source interface
- Method
OnChangeSelect
: - Occurs when user changes the active property.
User interface
Keyboard keys:
- F5: refresh
- F2, tab: edit property (if possible)
- Space: simulate right button click
Context Menu:
- Alphabetic \ Categorized: select sort mode
- Restore \ Customize Self: edit self property or external
- Refresh: repaint and reload property value
Environment
This component was created with VC 6.0. (SP3) and ATL. It has been tested on Windows 2000 and Windows 98. Requires: Windows 98, Windows NT 4.0, Windows 2000, and Interned Explorer 4.
Acknowledgement, References
The following source code was used in writing this ActiveX control:
- Vladimir Scherbakov : "Template class that implements Property Browser"
- Stefan Belopotocan : "An Adaptable Property List Control"
- Andrew Nosenko : "ATL/AUX Library"
Thanks them once more.
Some words about VB demo
For persisting \ restoreing the property in VB runtime I write the
kPersistMngs.kStorageMng
component. It's a simple wrapper to work with
compound files in VB.
History
- 6 Aug 2000 - updated to version 1.2 and fixes bugs detected by Robert Rolls