DropDown Control

 

The DDButton control allows developers to build custom drop-down and auto-complete controls with literally few lines of code.

Architecture

Technically, the drop-down control you implement using DDButton has three elements:

  1. The DDButton control.
  2. The parent control(s) that saves the user input. This can be the DDButton control itself, or any other control (e.g., a text box, picture box, etc.).
  3. The form to be dropped down.

The DDButton control may be used as a container (control property IsContainer=True) or as a standalone control (IsContainer=False).

When you use DDButton as a container, it is automatically made a parent control. And, in the most simple case you can use the DDButton control's Text property to display the user input from the drop-down form.

The DDButton control supports automatic resizing based on the font size. So, the control you create as described above will look just like a regular combo box.

To allow users edit the text in the control, place a text box inside the DDButton control. Since DDButton supports docking, your text box can resize automatically when the DDButton control is resized.

To display anything else but the text (e.g., an icon next to a user name), you can place any controls you need inside the DDButton control:

The control on the picture above is comprised of two image controls and two edit boxes inside a DDButton control.

When DDButton is used as standalone control, you can bind a parent control from the code:

Together with the possibility to programmatically drop (at custom location) and hide the drop-down form this in fact allows developers to use any control as "drop down button".

Standalone DDButton control can also be used to create auto-complete tools. For details, see the Creating Auto-Complete Tools section later in this topic.

Drop-Down Form Behavior

The dropped form behaves much like a common drop-down list. The form will be automatically dropped in right direction if there is no space to drop it in default direction, and will automatically hide in all cases when the typical dropped window does.

The difference from the regular dropped windows is that the drop-down form doesn't automatically hide if the focus belongs to the parent control (or to a control inside the parent DDButton control) or to the form itself. This fact makes it possible to create complicated drop-down forms, e.g. treeviews, checklists, grids, etc.

Good news is that you can make the drop-down form resizable using the Alter Sourcing's Grip control. For details, see the Grip Control chapter.

The drop-down direction can be customized:

If there is no space to show the entire form, its position and drop direction will be adjusted.

Creating Auto-Complete Tools

DDButton also allows for easy implementation of auto-complete windows:

In this case the edit box is the parent control, and the drop-down form is displayed and hidden programmatically in response to the keyboard input.

Control Appearance

The DDButton control appearance can be customized using four properties. Below find some examples of control appearance:

The control size can be adjusted automatically when user changes the font size.

Windows XP Themes

DDButton fully supports the Windows XP themes. When user changes the theme, or changes the appearance from Windows Classic to Windows XP and back, appropriate event is raised and the DDButton control appearance is changed automatically.

 
 
 
support@altersourcing.com