VisListViewDropDown
Namespace: PPJ.Runtime.Vis
Assembly: PPJ.Runtime.Vis.50 (5.0.0.0)
Hosts a Visual Toolchest list view in a combo-box drop-down.
- C#
- VB.NET
public class VisListViewDropDown : VisDropDownBase
Public Class VisListViewDropDown
Inherits VisDropDownBase
Example:
using (var combo = new PPJ.Runtime.Vis.VisListViewDropDown())
{
combo.SetEditable(false);
combo.SetListSize(30, 10);
}
Constructors
VisListViewDropDown()
Initializes the control, its SAL integration, and default components.
Methods
AddImage(hpicLarge, hpicSmall)
Adds a pair of pictures to the large and small image lists.
| Parameter | Type | Description |
|---|---|---|
| hpicLarge | SalNumber | A valid nonzero large-picture handle. |
| hpicSmall | SalNumber | A valid nonzero small-picture handle. |
Returns: SalNumber. The new large-image index, or -1 if either picture is missing or null.
Creates default image lists if necessary. The paired lists are expected to use matching indices.
Arrange(nCode)
Sets the list-view icon alignment.
| Parameter | Type | Description |
|---|---|---|
| nCode | SalNumber | A value corresponding to ListViewAlignment. |
Returns: SalBoolean. True after assignment.
AssignColumns(saTitles, naAlignments, naWidths, nNumColumns)
Replaces all columns from parallel arrays.
| Parameter | Type | Description |
|---|---|---|
| saTitles | SalArray<SalString> | Column titles beginning at index zero. |
| naAlignments | SalArray<SalNumber> | HorizontalAlignment numeric values beginning at index zero. |
| naWidths | SalArray<SalNumber> | Column widths in horizontal form units beginning at index zero. |
| nNumColumns | SalNumber | The number of entries to read from each array. |
Returns: SalBoolean. True when all columns have been added.
DeleteAllItems()
Clears all items.
Returns: SalBoolean. Always true.
DeleteItem(nItem)
Removes an item at the specified index.
| Parameter | Type | Description |
|---|---|---|
| nItem | SalNumber | The zero-based item index. |
Returns: SalNumber. The remaining item count.
EnsureVisible(nItem, fPartialOK)
Scrolls the list view to display an existing item.
| Parameter | Type | Description |
|---|---|---|
| nItem | SalNumber | The zero-based item index. |
| fPartialOK | SalBoolean | Reserved for compatibility; ignored. |
Returns: SalBoolean. True if the item exists; otherwise, false.
FindItem(nFlags, sItemText, nItemStart)
Searches through the native list-view find-item message.
| Parameter | Type | Description |
|---|---|---|
| nFlags | SalNumber | The LVFI search flags. |
| sItemText | SalString | The text used when LVFI_String is set. |
| nItemStart | SalNumber | The zero-based index after which searching starts; -1 starts at the first item. |
Returns: SalNumber. The matching item index, or -1 when no match is found.
FromHandle(handle)
Resolves this control type from a native window handle.
| Parameter | Type | Description |
|---|---|---|
| handle | SalWindowHandle | The native control handle. |
Returns: VisListViewDropDown. The associated VisListViewDropDown, or null when no managed control owns the handle.
A handle belonging to another control type causes an InvalidCastException.
GetAllSelectedItems(naSelections)
Replaces an array with the indices of all selected items.
| Parameter | Type | Description |
|---|---|---|
| naSelections | SalArray<SalNumber> | The output array; reset and made dynamic before filling from index zero. |
Returns: SalNumber. The resulting array length.
GetBkColor()
Reads the list-view background color.
Returns: SalNumber. The Win32 color value.
GetColumn(nColumn, sTitle, nAlignment, nWidth)
Reads a column's caption, alignment, and width.
| Parameter | Type | Description |
|---|---|---|
| nColumn | SalNumber | The zero-based column index. |
| sTitle | SalString | Receives the caption. |
| nAlignment | SalNumber | Receives the HorizontalAlignment numeric value. |
| nWidth | SalNumber | Receives the width in horizontal form units. |
Returns: SalBoolean. True for an existing column; otherwise false and the outputs are unchanged.
GetColumnAlignment(nColumn)
Reads a column's text alignment.
| Parameter | Type | Description |
|---|---|---|
| nColumn | SalNumber | The zero-based column index. |
Returns: SalNumber. The HorizontalAlignment numeric value, or zero if the column is absent.
GetColumnTitle(nColumn)
Reads a column's caption.
| Parameter | Type | Description |
|---|---|---|
| nColumn | SalNumber | The zero-based column index. |
Returns: SalString. The caption, or an empty string if the column is absent.
GetColumnWidth(nColumn)
Reads a column's width.
| Parameter | Type | Description |
|---|---|---|
| nColumn | SalNumber | The zero-based column index. |
Returns: SalNumber. The width in horizontal form units, or zero if the column is absent.
GetCountPerPage()
Gets the number of items that fit in a page of the native list view.
Returns: SalNumber. The native LVM_GETCOUNTPERPAGE result.
GetEditable()
Gets whether keyboard input can edit the combo-box text.
Returns: SalBoolean. True when editing is enabled; otherwise, false.
GetFocusItem()
Reads the item with keyboard focus.
Returns: SalNumber. Its index, or -1 if no item is focused.
GetImageCount()
Counts images in the small-image list.
Returns: SalNumber. The count, or zero if no small-image list exists.
GetItem(nItem, nSubItem, sItemText, nItemValue, nImage)
Reads a caption and the main item's value and image index.
| Parameter | Type | Description |
|---|---|---|
| nItem | SalNumber | The zero-based item index. |
| nSubItem | SalNumber | Zero or a negative value for the main item; a positive subitem index otherwise. |
| sItemText | SalString | Receives the caption. |
| nItemValue | SalNumber | Receives the main item's Int32 Tag or zero; subitems return zero. |
| nImage | SalNumber | Receives the main image index; subitems return zero. |
Returns: SalBoolean. True for an existing item or subitem; otherwise false with outputs unchanged.
GetItemCount()
Counts the items in the collection.
Returns: SalNumber. The item count.
GetItemPosition(nItem, ptPosition)
Gets the top-left corner of an item bounding rectangle.
| Parameter | Type | Description |
|---|---|---|
| nItem | SalNumber | The zero-based item index. |
| ptPosition | VisPoint | Receives the client-area position in pixels; must not be null. |
Returns: SalBoolean. True if the item exists; otherwise, false.
GetItemRect(nItem, rcItem, nCode)
Gets an item bounding rectangle.
| Parameter | Type | Description |
|---|---|---|
| nItem | SalNumber | The zero-based item index. |
| rcItem | VisRect | Receives the item bounds in client pixels; must not be null. |
| nCode | SalNumber | Reserved for compatibility; the full item bounds are always returned. |
Returns: SalBoolean. True if the item exists; otherwise, false.
GetItemState(nItem, nMask)
Reads masked focus, selection, and state-image flags.
| Parameter | Type | Description |
|---|---|---|
| nItem | SalNumber | The zero-based item index. |
| nMask | SalNumber | The LVIS_* bits to retain. |
Returns: SalNumber. The masked state, or zero if the item is absent.
GetItemText(nItem, nSubItem)
Reads an item or subitem caption.
| Parameter | Type | Description |
|---|---|---|
| nItem | SalNumber | The zero-based item index. |
| nSubItem | SalNumber | Zero or negative for the main item; positive for a subitem. |
Returns: SalString. The caption, or an empty string if the item is absent.
GetItemValue(nItem)
Gets the integer value stored in an item tag.
| Parameter | Type | Description |
|---|---|---|
| nItem | SalNumber | The zero-based item index. |
Returns: SalNumber. The integer tag value, or zero when the item or tag is missing.
A non-integer tag causes an InvalidCastException.
GetNextItem(nItem, nFlags)
Finds the next native list-view item matching the specified state and direction.
| Parameter | Type | Description |
|---|---|---|
| nItem | SalNumber | The starting item index; -1 starts before the first item. |
| nFlags | SalNumber | The LVNI search flags. |
Returns: SalNumber. The matching index, or -1 when no item matches.
GetOrigin(ptOrigin)
Gets the native list-view origin.
| Parameter | Type | Description |
|---|---|---|
| ptOrigin | VisPoint | Receives the origin coordinates in pixels; must not be null. |
Returns: SalBoolean. True when the native operation succeeds; otherwise, false.
The output is assigned even when the native operation fails.
GetSelectedCount()
Counts selected items.
Returns: SalNumber. The selected-item count.
GetSelectedItem()
Reads the first selected item.
Returns: SalNumber. Its zero-based index, or -1 if there is no selection.
GetSortColumn()
Reads the configured sort column.
Returns: SalNumber. The zero-based column index.
GetSortOrder()
Reads the compatibility sort order.
Returns: SalNumber. LVSORT_Descending for descending order; otherwise LVSORT_Ascending, including when sorting is disabled.
GetStringWidth(sCompare)
Measures text with the native list-view font.
| Parameter | Type | Description |
|---|---|---|
| sCompare | SalString | The text to measure. |
Returns: SalNumber. The measured width converted to horizontal form units.
GetStyle()
Gets the native list-view window-style flags.
Returns: SalNumber. The GWL_STYLE value.
GetTextBkColor()
Reads the list-view background color.
Returns: SalNumber. The Win32 color value.
GetTextColor()
Reads the list-view foreground color.
Returns: SalNumber. The Win32 color value.
GetTopIndex()
Gets the index of the top visible item where supported by the current view.
Returns: SalNumber. Zero in large-icon, small-icon, or tile view; otherwise, the top item index, or -1 when no top item exists.
GetViewRect(rcView)
Gets the rectangle enclosing the native list-view items.
| Parameter | Type | Description |
|---|---|---|
| rcView | VisRect | Receives the rectangle in pixels; must not be null. |
Returns: SalBoolean. True when the native operation succeeds; otherwise, false.
The output is assigned even when the native operation fails.
HitTest(ptTest, nFlags)
Finds the native list-view item at a client-area point.
| Parameter | Type | Description |
|---|---|---|
| ptTest | VisPoint | The client-area test point in pixels; must not be null. |
| nFlags | SalNumber | Receives the LVHT hit-test flags. |
Returns: SalNumber. The item index, or -1 when no item is hit.
HitTest(nX, nY, nFlags)
Finds the native list-view item at a client-area point.
| Parameter | Type | Description |
|---|---|---|
| nX | SalNumber | The horizontal client coordinate in pixels. |
| nY | SalNumber | The vertical client coordinate in pixels. |
| nFlags | SalNumber | Receives the LVHT hit-test flags. |
Returns: SalNumber. The item index, or -1 when no item is hit.
InsertDetails(nItem, saText, nImage)
Inserts an item and its detail subitems.
| Parameter | Type | Description |
|---|---|---|
| nItem | SalNumber | The requested index, clamped to the range from zero through the current item count. |
| saText | SalArray<SalString> | A zero-based text array; element zero is the item label and later elements are subitems. |
| nImage | SalNumber | The image-list index. |
Returns: SalNumber. The inserted item index.
InsertDetailsPic(nItem, saText, hpicLarge, hpicSmall)
Inserts a row of item and subitem captions and a newly added image pair.
| Parameter | Type | Description |
|---|---|---|
| nItem | SalNumber | Insertion index, clamped to zero through the current item count. |
| saText | SalArray<SalString> | Zero-based captions; element zero is the item caption and later elements are subitems. |
| hpicLarge | SalNumber | A valid large-picture handle. |
| hpicSmall | SalNumber | A valid small-picture handle. |
Returns: SalNumber. The inserted index, or -1 if the picture pair cannot be added.
InsertDetailsValue(nItem, saText, nItemValue, nImage)
Inserts a row of item and subitem captions with an application value.
| Parameter | Type | Description |
|---|---|---|
| nItem | SalNumber | Insertion index, clamped to zero through the current item count. |
| saText | SalArray<SalString> | Zero-based captions; element zero is the item caption and later elements are subitems. |
| nItemValue | SalNumber | The application value, converted to Int32 and stored in Tag. |
| nImage | SalNumber | The index in the image lists, or -1 for no picture. |
Returns: SalNumber. The inserted index.
InsertDetailsValuePic(nItem, saText, nItemValue, hpicLarge, hpicSmall)
Inserts a row of item and subitem captions with an application value and a newly added image pair.
| Parameter | Type | Description |
|---|---|---|
| nItem | SalNumber | Insertion index, clamped to zero through the current item count. |
| saText | SalArray<SalString> | Zero-based captions; element zero is the item caption and later elements are subitems. |
| nItemValue | SalNumber | The application value, converted to Int32 and stored in Tag. |
| hpicLarge | SalNumber | A valid large-picture handle. |
| hpicSmall | SalNumber | A valid small-picture handle. |
Returns: SalNumber. The inserted index, or -1 if the picture pair cannot be added.
InsertItem(nItem, sText, nImage)
Inserts a list-view item.
| Parameter | Type | Description |
|---|---|---|
| nItem | SalNumber | The requested index, clamped to the range from zero through the current item count. |
| sText | SalString | The item label. |
| nImage | SalNumber | The image-list index. |
Returns: SalNumber. The inserted item index.
InsertItemPic(nItem, sText, hpicLarge, hpicSmall)
Inserts an item and a newly added image pair.
| Parameter | Type | Description |
|---|---|---|
| nItem | SalNumber | Insertion index, clamped to zero through the current item count. |
| sText | SalString | The item caption. |
| hpicLarge | SalNumber | A valid large-picture handle. |
| hpicSmall | SalNumber | A valid small-picture handle. |
Returns: SalNumber. The inserted index, or -1 if the picture pair cannot be added.
InsertItemValue(nItem, sText, nItemValue, nImage)
Inserts an item with an application value.
| Parameter | Type | Description |
|---|---|---|
| nItem | SalNumber | Insertion index, clamped to zero through the current item count. |
| sText | SalString | The item caption. |
| nItemValue | SalNumber | The application value, converted to Int32 and stored in Tag. |
| nImage | SalNumber | The index in the image lists, or -1 for no picture. |
Returns: SalNumber. The inserted index.
InsertItemValuePic(nItem, sText, nItemValue, hpicLarge, hpicSmall)
Inserts an item with an application value and a newly added image pair.
| Parameter | Type | Description |
|---|---|---|
| nItem | SalNumber | Insertion index, clamped to zero through the current item count. |
| sText | SalString | The item caption. |
| nItemValue | SalNumber | The application value, converted to Int32 and stored in Tag. |
| hpicLarge | SalNumber | A valid large-picture handle. |
| hpicSmall | SalNumber | A valid small-picture handle. |
Returns: SalNumber. The inserted index, or -1 if the picture pair cannot be added.
OnFontChanged(e)
Raises the base event and copies the combo-box font to the hosted list view.
| Parameter | Type | Description |
|---|---|---|
| e | EventArgs | The font-change event data. |
RemoveAllImages()
Clears both image lists, creating the lists if necessary.
Returns: SalBoolean. Always true.
RemoveImage(nIndex)
Removes an image at the same index in both image lists.
| Parameter | Type | Description |
|---|---|---|
| nIndex | SalNumber | The zero-based image index. |
Returns: SalBoolean. True if both removals succeed; false on ArgumentOutOfRangeException.
The large-image removal is not rolled back if the small-image removal fails.
ReplaceImage(nIndex, hpicLarge, hpicSmall)
Replaces corresponding entries in the large and small image lists.
| Parameter | Type | Description |
|---|---|---|
| nIndex | SalNumber | The zero-based image index. |
| hpicLarge | SalNumber | The large picture handle. |
| hpicSmall | SalNumber | The small picture handle. |
Returns: SalBoolean. True on success; false when neither picture resolves or an IndexOutOfRangeException occurs.
When only one picture resolves, its bitmap is used for both sizes.
Scroll(size)
Scrolls the native list view by the supplied displacement.
| Parameter | Type | Description |
|---|---|---|
| size | VisSize | The horizontal and vertical displacement in pixels; must not be null. |
Returns: SalBoolean. True when the native operation succeeds; otherwise, false.
SetBkColor(nNewColor)
Sets the list-view background color.
| Parameter | Type | Description |
|---|---|---|
| nNewColor | SalNumber | The SAL color to apply. |
Returns: SalBoolean. Always true.
SetColumn(nColumn, nMask, sTitle, nAlignment, nWidth)
Updates the column attributes selected by a mask.
| Parameter | Type | Description |
|---|---|---|
| nColumn | SalNumber | The zero-based column index. |
| nMask | SalNumber | LVCF_Text, LVCF_Fmt, and LVCF_Width flags selecting the supplied values. |
| sTitle | SalString | The new caption. |
| nAlignment | SalNumber | The HorizontalAlignment numeric value. |
| nWidth | SalNumber | The new width in horizontal form units. |
Returns: SalBoolean. True when the column exists; otherwise false.
SetColumnAlignment(nColumn, nAlignment)
Sets a column's text alignment.
| Parameter | Type | Description |
|---|---|---|
| nColumn | SalNumber | The zero-based column index. |
| nAlignment | SalNumber | The HorizontalAlignment numeric value. |
Returns: SalBoolean. True if the column exists and is updated; otherwise false.
SetColumnTitle(nColumn, sTitle)
Sets a column's caption.
| Parameter | Type | Description |
|---|---|---|
| nColumn | SalNumber | The zero-based column index. |
| sTitle | SalString | The new caption. |
Returns: SalBoolean. True if the column exists and is updated; otherwise false.
SetColumnWidth(nColumn, nWidth)
Sets a column's width.
| Parameter | Type | Description |
|---|---|---|
| nColumn | SalNumber | The zero-based column index. |
| nWidth | SalNumber | The new width in horizontal form units. |
Returns: SalBoolean. True if the column exists and is updated; otherwise false.
SetEditable(fEditable)
Enables or disables keyboard editing of the combo-box text.
| Parameter | Type | Description |
|---|---|---|
| fEditable | SalBoolean | True to enable editing; false to disable it. |
Returns: SalBoolean. True.
SetFocusItem(nItem)
Gives keyboard focus to an item.
| Parameter | Type | Description |
|---|---|---|
| nItem | SalNumber | The zero-based item index. |
Returns: SalBoolean. True if the item exists; otherwise false.
SetItem(nItem, nSubItem, nMask, sItemText, nItemValue, nImage)
Updates selected item attributes.
| Parameter | Type | Description |
|---|---|---|
| nItem | SalNumber | The zero-based item index. |
| nSubItem | SalNumber | Zero or negative for the main item; positive for a subitem. |
| nMask | SalNumber | LVIF_Text, LVIF_Image, and LVIF_Param flags selecting attributes to update. |
| sItemText | SalString | The new caption. |
| nItemValue | SalNumber | The new application value, converted to Int32. |
| nImage | SalNumber | The new image-list index. |
Returns: SalBoolean. True if the item or subitem exists; otherwise false.
Subitems support only text changes.
SetItemPosition(nItem, ptPosition)
Sets an icon item position through the native list view.
| Parameter | Type | Description |
|---|---|---|
| nItem | SalNumber | The zero-based item index. |
| ptPosition | VisPoint | The requested position in pixels; each coordinate is packed into a 16-bit word. |
Returns: SalBoolean. True when the native operation succeeds; otherwise, false.
SetItemState(nItem, nNewState, nStateMask)
Updates item state while suppressing generated SAM_Click notifications.
| Parameter | Type | Description |
|---|---|---|
| nItem | SalNumber | The zero-based item index. |
| nNewState | SalNumber | The new LVIS state bits. |
| nStateMask | SalNumber | The state bits to change. |
Returns: SalBoolean. True if the item exists; otherwise, false.
Supports focus, selection, state image, cut, and drop-highlight state.
SetItemText(nItem, nSubItem, sItemText)
Changes an item or subitem caption.
| Parameter | Type | Description |
|---|---|---|
| nItem | SalNumber | The zero-based item index. |
| nSubItem | SalNumber | Zero or negative for the main item; positive for a subitem. |
| sItemText | SalString | The new caption. |
Returns: SalBoolean. True if the item or subitem exists; otherwise false.
SetItemValue(nItem, nItemValue)
Stores an application value in an item's Tag.
| Parameter | Type | Description |
|---|---|---|
| nItem | SalNumber | The zero-based item index. |
| nItemValue | SalNumber | The value converted to Int32. |
Returns: SalBoolean. True if the item exists; otherwise false.
SetListSize(nWidth, nHeight)
Sets the drop-down size by converting form units to pixels.
| Parameter | Type | Description |
|---|---|---|
| nWidth | SalNumber | The width in horizontal form units. |
| nHeight | SalNumber | The height in vertical form units. |
Returns: SalBoolean. True.
SetSortColumn(nColumn)
Selects the column for the next explicit sort.
| Parameter | Type | Description |
|---|---|---|
| nColumn | SalNumber | The zero-based column index. |
Returns: SalBoolean. Always true.
SetSortOrder(nOrder)
Selects the ordering for the next explicit sort.
| Parameter | Type | Description |
|---|---|---|
| nOrder | SalNumber | LVSORT_Ascending or LVSORT_Descending; other values disable ordering. |
Returns: SalBoolean. Always true.
SetStyle(nStyle, fOn)
Enables or clears list-view styles and updates corresponding managed properties.
| Parameter | Type | Description |
|---|---|---|
| nStyle | SalNumber | The LVS style bits to change. |
| fOn | SalBoolean | True to set the bits; false to clear them. |
Returns: SalNumber. The updated style value.
The return variable is modified during assignment, so the result is not the previous style.
SetTextBkColor(nNewColor)
Sets the list-view background color.
| Parameter | Type | Description |
|---|---|---|
| nNewColor | SalNumber | The SAL color to apply. |
Returns: SalBoolean. Always true.
SetTextColor(nNewColor)
Sets the list-view foreground color.
| Parameter | Type | Description |
|---|---|---|
| nNewColor | SalNumber | The SAL color to apply. |
Returns: SalBoolean. Always true.
SortItems()
Sorts once with the configured item sorter, then removes the sorter.
Returns: SalBoolean. True.
Subsequent insertions are not automatically sorted.
ViewDetails()
Switches the list view to details.
Returns: SalNumber. Always zero.
ViewLargeIcons()
Switches the list view to large icons.
Returns: SalNumber. Always zero.
ViewList()
Switches to list view.
Returns: SalNumber. Zero.
ViewSmallIcons()
Switches the list view to small icons.
Returns: SalNumber. Always zero.
Implements
| Name | Description |
|---|---|
| ISalControl | |
| ISalEditControl | |
| ISalListControl | |
| ISalWindow |