Here's my effort.
When I look at the Property window, I see rows of paired boxes. One box contains the name of the property. The other is for user entry. The user entry box is either
a TextBox (e.g. Caption property)
a dropdown (e.g. ShowDropButtonWhen property
a button (showing elipsis) that invokes another dialog box (e.g. Font property).
In the attached, I created a custom control, clsHeaderedList, which contains a list of other custom controls, clsHeaderedRow.
A clsHeaderedList is basicaly a Frame with stuff inside.
A clsHeaderedRow is, at the core, a Header and a Value plus machinery to allow the user to edit the Value
A clsHeaderedList has methods and properties:
AddRow - adds a clsHeaderedRow to the list, the Name argument is required
Clear
ListCount - (read only) the number of rows in the control
RowsList - (read only) a collection of the clsHeaderedRow s in the control. It will accept either Names or index numbers as its arguments.
Parent - the Frame control that holds/is the control
the other properties are (at this time) for internal use only.
A clsHeaderedRow is a HeaderBox and a UserEntryBox.
The properties and methods of clsHeaderedRow are
Name - (read only) the unique name given to the row. Once set as the argument for the RowsList property of the parent clsHeaderedList, it cannot be changed thereafter.
Header - (read/write) the text displayed in the clsHeadederRow 's HeaderBox
Value - (read/write) the Value (contained in the UserEntryBox)
Parent - the clsHeaderedList that contains the clsHeaderedRow. Should be treated as read only.
The UserEntryBox has three modes,
textbox mode, the default entry mode
dropdown mode, select from list
Elipsis mode calls a dialog box when clicked. Which dialog is called is controled by the ElipsisClick event. (see below)
To change to dropdown mode, the developer uses the ValidationList property to set the list of acceptable values for that row.
The HasElipsis property is a read/write boolean value indicating whether the control is in elipsis mode.
The ElipsisTag property is a read/write string, used to pass information back to the developer when the control's button is clicked. HasElipsis is True iff ElipsisTag <> vbNullString
As it is set up, the developer writes all of their code in the userform module.
The developer creates a userform with a Frame to act as the Parent of the clsHeaderedList
Instansizing a clsHeaderedList is done with code like
This code (in the userform code module) creates the HeaderedRows with headers from column A.
Then, the non-textbox mode rows have their input mode set
EVENTS:
A clsHeaderedList has two events:
Change(RowChanged As clsHeaderedRow) - which fires whenever any UserInputBox is changed. The RowChanged argument is the row that was changed.
ElipsisClicked(RowClicked As clsHeaderedRow) - which fires whenever a row that is is elipsis mode has its button clicked. Note how the ElipsisTag is used to tell the userform which dialog box to show.
TO DO:
- Width properties have been ignored. A ColumnWidths property (for clsHeaderedList) would be useful. Accomidating the possibility of a scroll bar is one of the challanges in writting these properties.
- formatting properties (e.g. Backcolor, Font, TextAlign etc) have not yet been addressed
- masked values in dropdown mode. In the property window, the user sees "0-fmListStylePlain" and "1-fmListStyleOption" when the underlying values are actually 0 and 1. Currently clsHeaderedList does not have that capability. Adding a Text property to clsHeaderedRow would require making the UserEntryBox a two column combobox with hidden column.
- RemoveRow method is needed for clsHeaderedList. Similarly the .AddRow could have a indexing argument.
Bookmarks