The primary purpose of the XEditor control is to expand the RichTextBox control. The primary purpose of the XDropStack control is to limit the ComboBox control. It’s a different emphasis, but there are similarities. In fact, almost any control that delegates to a constituent control will do some extending and some limiting.
XDropStack extends ComboBox by keeping items in a specific order just as XEditor extends RichTextBox by adding lots of new editing features. XDropStack limits ComboBox by setting properties such as Style, Locked, and IntegralHeight to desired settings and disabling them in the control interface. XEditor does the same thing with the MultiLine and MaxLength properties of RichTextBox. The controls supplied with Visual Basic are general purpose controls. One of the main reasons to delegate to them in your own controls is to focus on and simplify one specific use of the general control.
The XDropStack control focuses on a feature that you’ve probably seen in other applications. Microsoft Internet Explorer, for example, has a drop-down list of the most recently requested URLs. Visual Basic’s Find dialog box has a drop-down list of the most recently used search strings. That’s the functionality we’ll be duplicating in the FSearch form and in Edwina’s toolbar.
An XDropStack has these features:
Any combo box features that don’t match this specification are eliminated. If
you think about how these features compare to a stack as a data structure, you can see that the name drop stack, while evocative, isn’t quite accurate. Adding a new item is like pushing a string on a stack, but there’s no comparable pop operation. The way items age off the bottom is more like a queue. And the operation of moving a clicked item to the top isn’t like a stack or a queue. If you have a better name for this control, let me know.