C# Class SIL.FieldWorks.Common.Widgets.ComboListBox

A "Combo" list box is one that can launch itself as a stand-alone, yet modal window, like the drop-down list in a Combo. It can also be used for other drop-down lists, for example, from an icon button. It is displayed using the Launch method. It is automatically hidden if the user clicks outside it (and the click is absorbed in the process). The item the user is hovering over is highlighted.
Inheritance: FwListBox, IComboList, IDropDownBox
Show file Open project: sillsdev/FieldWorks Class Usage Examples

Private Properties

Property Type Description
ComboListBox System
FindAndHighlightItemStartingWith bool
SetWindowLong int
SetWindowPos bool
ShowInactiveTopmost void
ShowWindow bool
m_ListForm_Deactivate void

Public Methods

Method Description
AdjustSize ( int maxWidth, int maxHeight ) : void

Adjust the size of the list box, so it is just large enough to show all items, or at most the size specified by the arguments (or at least 100x10).

HideForm ( ) : void

Hide the containing form (and thus the list box as a whole).

HighlightItemStartingWith ( string start ) : void

Cycle the selection to the next item that begins with the specified text. (Case insensitive. Trims whitespace in list items.)

Launch ( Rectangle launcherBounds, Rectangle screenBounds ) : void

Launch the ComboListBox. Typical usage, where 'this' is a control that the list should appear below: m_listBox.Launch(Parent.RectangleToScreen(Bounds), Screen.GetWorkingArea(this)); Or, where rect is a rectangle in the client area of control 'this': m_listBox.Launch(RectangleToScreen(rect), Screen.GetWorkingArea(this); (Be sure to set the height and width of the ComboListBox first.)

OnCapturedClick ( ) : void

This is called when the embedded InnerFwListBox detects a click outside its bounds, which happens only when it has been told to capture the mouse. ComboListBox overrides this to close the list box.

Protected Methods

Method Description
Dispose ( bool disposing ) : void

Clean up any resources being used.

OnLostFocus ( EventArgs e ) : void

If a combo list box loses focus, hide it.

Private Methods

Method Description
ComboListBox ( ) : System
FindAndHighlightItemStartingWith ( int iStarting, int iEnding, string startKey ) : bool

Highlight the item whose text starts with the given startKey string (if item exists).

SetWindowLong ( IntPtr hWnd, int nIndex, int dwNewLong ) : int
SetWindowPos ( int hWnd, int hWndInsertAfter, int X, int Y, int cx, int cy, uint uFlags ) : bool
ShowInactiveTopmost ( Form owner, Form frm ) : void
ShowWindow ( IntPtr hWnd, int nCmdShow ) : bool
m_ListForm_Deactivate ( object sender, EventArgs e ) : void

Method Details

AdjustSize() public method

Adjust the size of the list box, so it is just large enough to show all items, or at most the size specified by the arguments (or at least 100x10).
public AdjustSize ( int maxWidth, int maxHeight ) : void
maxWidth int
maxHeight int
return void

Dispose() protected method

Clean up any resources being used.
protected Dispose ( bool disposing ) : void
disposing bool
return void

HideForm() public method

Hide the containing form (and thus the list box as a whole).
public HideForm ( ) : void
return void

HighlightItemStartingWith() public method

Cycle the selection to the next item that begins with the specified text. (Case insensitive. Trims whitespace in list items.)
public HighlightItemStartingWith ( string start ) : void
start string the search key
return void

Launch() public method

Launch the ComboListBox. Typical usage, where 'this' is a control that the list should appear below: m_listBox.Launch(Parent.RectangleToScreen(Bounds), Screen.GetWorkingArea(this)); Or, where rect is a rectangle in the client area of control 'this': m_listBox.Launch(RectangleToScreen(rect), Screen.GetWorkingArea(this); (Be sure to set the height and width of the ComboListBox first.)
public Launch ( Rectangle launcherBounds, Rectangle screenBounds ) : void
launcherBounds System.Drawing.Rectangle A rectangle in 'screen' coordinates indicating where to display the list. Typically, as shown /// above, the location of something the user clicked to make the list display. It's significance is that /// the list will usually be shown with its top left just to the right of the bottom left of the rectangle, and /// (if the list width has not already been set explicitly) its width will match the rectangle. If there is not /// room to displya the list below this rectangle, it will be displayed above instead.
screenBounds System.Drawing.Rectangle A rectangle in 'screen' coordinates indicating the location of the actual screen /// that the list is to appear on.
return void

OnCapturedClick() public method

This is called when the embedded InnerFwListBox detects a click outside its bounds, which happens only when it has been told to capture the mouse. ComboListBox overrides this to close the list box.
public OnCapturedClick ( ) : void
return void

OnLostFocus() protected method

If a combo list box loses focus, hide it.
protected OnLostFocus ( EventArgs e ) : void
e System.EventArgs
return void