Skip to main content

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.

public class VisListViewDropDown : VisDropDownBase

Example:

using (var combo = new PPJ.Runtime.Vis.VisListViewDropDown())
{
combo.SetEditable(false);
combo.SetListSize(30, 10);
}

Constructors

Instance member VisListViewDropDown()

Initializes the control, its SAL integration, and default components.

Methods

Instance member AddImage(hpicLarge, hpicSmall)

Adds a pair of pictures to the large and small image lists.

ParameterTypeDescription
hpicLargeSalNumberA valid nonzero large-picture handle.
hpicSmallSalNumberA 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.

Instance member Arrange(nCode)

Sets the list-view icon alignment.

ParameterTypeDescription
nCodeSalNumberA value corresponding to ListViewAlignment.

Returns: SalBoolean. True after assignment.

Instance member AssignColumns(saTitles, naAlignments, naWidths, nNumColumns)

Replaces all columns from parallel arrays.

ParameterTypeDescription
saTitlesSalArray<SalString>Column titles beginning at index zero.
naAlignmentsSalArray<SalNumber>HorizontalAlignment numeric values beginning at index zero.
naWidthsSalArray<SalNumber>Column widths in horizontal form units beginning at index zero.
nNumColumnsSalNumberThe number of entries to read from each array.

Returns: SalBoolean. True when all columns have been added.

Instance member DeleteAllItems()

Clears all items.

Returns: SalBoolean. Always true.

Instance member DeleteItem(nItem)

Removes an item at the specified index.

ParameterTypeDescription
nItemSalNumberThe zero-based item index.

Returns: SalNumber. The remaining item count.

Instance member EnsureVisible(nItem, fPartialOK)

Scrolls the list view to display an existing item.

ParameterTypeDescription
nItemSalNumberThe zero-based item index.
fPartialOKSalBooleanReserved for compatibility; ignored.

Returns: SalBoolean. True if the item exists; otherwise, false.

Instance member FindItem(nFlags, sItemText, nItemStart)

Searches through the native list-view find-item message.

ParameterTypeDescription
nFlagsSalNumberThe LVFI search flags.
sItemTextSalStringThe text used when LVFI_String is set.
nItemStartSalNumberThe 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.

Static member FromHandle(handle)

Resolves this control type from a native window handle.

ParameterTypeDescription
handleSalWindowHandleThe 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.

Instance member GetAllSelectedItems(naSelections)

Replaces an array with the indices of all selected items.

ParameterTypeDescription
naSelectionsSalArray<SalNumber>The output array; reset and made dynamic before filling from index zero.

Returns: SalNumber. The resulting array length.

Instance member GetBkColor()

Reads the list-view background color.

Returns: SalNumber. The Win32 color value.

Instance member GetColumn(nColumn, sTitle, nAlignment, nWidth)

Reads a column's caption, alignment, and width.

ParameterTypeDescription
nColumnSalNumberThe zero-based column index.
sTitle by referenceSalStringReceives the caption.
nAlignment by referenceSalNumberReceives the HorizontalAlignment numeric value.
nWidth by referenceSalNumberReceives the width in horizontal form units.

Returns: SalBoolean. True for an existing column; otherwise false and the outputs are unchanged.

Instance member GetColumnAlignment(nColumn)

Reads a column's text alignment.

ParameterTypeDescription
nColumnSalNumberThe zero-based column index.

Returns: SalNumber. The HorizontalAlignment numeric value, or zero if the column is absent.

Instance member GetColumnTitle(nColumn)

Reads a column's caption.

ParameterTypeDescription
nColumnSalNumberThe zero-based column index.

Returns: SalString. The caption, or an empty string if the column is absent.

Instance member GetColumnWidth(nColumn)

Reads a column's width.

ParameterTypeDescription
nColumnSalNumberThe zero-based column index.

Returns: SalNumber. The width in horizontal form units, or zero if the column is absent.

Instance member GetCountPerPage()

Gets the number of items that fit in a page of the native list view.

Returns: SalNumber. The native LVM_GETCOUNTPERPAGE result.

Instance member GetEditable()

Gets whether keyboard input can edit the combo-box text.

Returns: SalBoolean. True when editing is enabled; otherwise, false.

Instance member GetFocusItem()

Reads the item with keyboard focus.

Returns: SalNumber. Its index, or -1 if no item is focused.

Instance member GetImageCount()

Counts images in the small-image list.

Returns: SalNumber. The count, or zero if no small-image list exists.

Instance member GetItem(nItem, nSubItem, sItemText, nItemValue, nImage)

Reads a caption and the main item's value and image index.

ParameterTypeDescription
nItemSalNumberThe zero-based item index.
nSubItemSalNumberZero or a negative value for the main item; a positive subitem index otherwise.
sItemText by referenceSalStringReceives the caption.
nItemValue by referenceSalNumberReceives the main item's Int32 Tag or zero; subitems return zero.
nImage by referenceSalNumberReceives the main image index; subitems return zero.

Returns: SalBoolean. True for an existing item or subitem; otherwise false with outputs unchanged.

Instance member GetItemCount()

Counts the items in the collection.

Returns: SalNumber. The item count.

Instance member GetItemPosition(nItem, ptPosition)

Gets the top-left corner of an item bounding rectangle.

ParameterTypeDescription
nItemSalNumberThe zero-based item index.
ptPositionVisPointReceives the client-area position in pixels; must not be null.

Returns: SalBoolean. True if the item exists; otherwise, false.

Instance member GetItemRect(nItem, rcItem, nCode)

Gets an item bounding rectangle.

ParameterTypeDescription
nItemSalNumberThe zero-based item index.
rcItemVisRectReceives the item bounds in client pixels; must not be null.
nCodeSalNumberReserved for compatibility; the full item bounds are always returned.

Returns: SalBoolean. True if the item exists; otherwise, false.

Instance member GetItemState(nItem, nMask)

Reads masked focus, selection, and state-image flags.

ParameterTypeDescription
nItemSalNumberThe zero-based item index.
nMaskSalNumberThe LVIS_* bits to retain.

Returns: SalNumber. The masked state, or zero if the item is absent.

Instance member GetItemText(nItem, nSubItem)

Reads an item or subitem caption.

ParameterTypeDescription
nItemSalNumberThe zero-based item index.
nSubItemSalNumberZero or negative for the main item; positive for a subitem.

Returns: SalString. The caption, or an empty string if the item is absent.

Instance member GetItemValue(nItem)

Gets the integer value stored in an item tag.

ParameterTypeDescription
nItemSalNumberThe 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.

Instance member GetNextItem(nItem, nFlags)

Finds the next native list-view item matching the specified state and direction.

ParameterTypeDescription
nItemSalNumberThe starting item index; -1 starts before the first item.
nFlagsSalNumberThe LVNI search flags.

Returns: SalNumber. The matching index, or -1 when no item matches.

Instance member GetOrigin(ptOrigin)

Gets the native list-view origin.

ParameterTypeDescription
ptOriginVisPointReceives 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.

Instance member GetSelectedCount()

Counts selected items.

Returns: SalNumber. The selected-item count.

Instance member GetSelectedItem()

Reads the first selected item.

Returns: SalNumber. Its zero-based index, or -1 if there is no selection.

Instance member GetSortColumn()

Reads the configured sort column.

Returns: SalNumber. The zero-based column index.

Instance member GetSortOrder()

Reads the compatibility sort order.

Returns: SalNumber. LVSORT_Descending for descending order; otherwise LVSORT_Ascending, including when sorting is disabled.

Instance member GetStringWidth(sCompare)

Measures text with the native list-view font.

ParameterTypeDescription
sCompareSalStringThe text to measure.

Returns: SalNumber. The measured width converted to horizontal form units.

Instance member GetStyle()

Gets the native list-view window-style flags.

Returns: SalNumber. The GWL_STYLE value.

Instance member GetTextBkColor()

Reads the list-view background color.

Returns: SalNumber. The Win32 color value.

Instance member GetTextColor()

Reads the list-view foreground color.

Returns: SalNumber. The Win32 color value.

Instance member 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.

Instance member GetViewRect(rcView)

Gets the rectangle enclosing the native list-view items.

ParameterTypeDescription
rcViewVisRectReceives 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.

Instance member HitTest(ptTest, nFlags)

Finds the native list-view item at a client-area point.

ParameterTypeDescription
ptTestVisPointThe client-area test point in pixels; must not be null.
nFlags by referenceSalNumberReceives the LVHT hit-test flags.

Returns: SalNumber. The item index, or -1 when no item is hit.

Instance member HitTest(nX, nY, nFlags)

Finds the native list-view item at a client-area point.

ParameterTypeDescription
nXSalNumberThe horizontal client coordinate in pixels.
nYSalNumberThe vertical client coordinate in pixels.
nFlags by referenceSalNumberReceives the LVHT hit-test flags.

Returns: SalNumber. The item index, or -1 when no item is hit.

Instance member InsertDetails(nItem, saText, nImage)

Inserts an item and its detail subitems.

ParameterTypeDescription
nItemSalNumberThe requested index, clamped to the range from zero through the current item count.
saTextSalArray<SalString>A zero-based text array; element zero is the item label and later elements are subitems.
nImageSalNumberThe image-list index.

Returns: SalNumber. The inserted item index.

Instance member InsertDetailsPic(nItem, saText, hpicLarge, hpicSmall)

Inserts a row of item and subitem captions and a newly added image pair.

ParameterTypeDescription
nItemSalNumberInsertion index, clamped to zero through the current item count.
saTextSalArray<SalString>Zero-based captions; element zero is the item caption and later elements are subitems.
hpicLargeSalNumberA valid large-picture handle.
hpicSmallSalNumberA valid small-picture handle.

Returns: SalNumber. The inserted index, or -1 if the picture pair cannot be added.

Instance member InsertDetailsValue(nItem, saText, nItemValue, nImage)

Inserts a row of item and subitem captions with an application value.

ParameterTypeDescription
nItemSalNumberInsertion index, clamped to zero through the current item count.
saTextSalArray<SalString>Zero-based captions; element zero is the item caption and later elements are subitems.
nItemValueSalNumberThe application value, converted to Int32 and stored in Tag.
nImageSalNumberThe index in the image lists, or -1 for no picture.

Returns: SalNumber. The inserted index.

Instance member InsertDetailsValuePic(nItem, saText, nItemValue, hpicLarge, hpicSmall)

Inserts a row of item and subitem captions with an application value and a newly added image pair.

ParameterTypeDescription
nItemSalNumberInsertion index, clamped to zero through the current item count.
saTextSalArray<SalString>Zero-based captions; element zero is the item caption and later elements are subitems.
nItemValueSalNumberThe application value, converted to Int32 and stored in Tag.
hpicLargeSalNumberA valid large-picture handle.
hpicSmallSalNumberA valid small-picture handle.

Returns: SalNumber. The inserted index, or -1 if the picture pair cannot be added.

Instance member InsertItem(nItem, sText, nImage)

Inserts a list-view item.

ParameterTypeDescription
nItemSalNumberThe requested index, clamped to the range from zero through the current item count.
sTextSalStringThe item label.
nImageSalNumberThe image-list index.

Returns: SalNumber. The inserted item index.

Instance member InsertItemPic(nItem, sText, hpicLarge, hpicSmall)

Inserts an item and a newly added image pair.

ParameterTypeDescription
nItemSalNumberInsertion index, clamped to zero through the current item count.
sTextSalStringThe item caption.
hpicLargeSalNumberA valid large-picture handle.
hpicSmallSalNumberA valid small-picture handle.

Returns: SalNumber. The inserted index, or -1 if the picture pair cannot be added.

Instance member InsertItemValue(nItem, sText, nItemValue, nImage)

Inserts an item with an application value.

ParameterTypeDescription
nItemSalNumberInsertion index, clamped to zero through the current item count.
sTextSalStringThe item caption.
nItemValueSalNumberThe application value, converted to Int32 and stored in Tag.
nImageSalNumberThe index in the image lists, or -1 for no picture.

Returns: SalNumber. The inserted index.

Instance member InsertItemValuePic(nItem, sText, nItemValue, hpicLarge, hpicSmall)

Inserts an item with an application value and a newly added image pair.

ParameterTypeDescription
nItemSalNumberInsertion index, clamped to zero through the current item count.
sTextSalStringThe item caption.
nItemValueSalNumberThe application value, converted to Int32 and stored in Tag.
hpicLargeSalNumberA valid large-picture handle.
hpicSmallSalNumberA valid small-picture handle.

Returns: SalNumber. The inserted index, or -1 if the picture pair cannot be added.

Protected member OnFontChanged(e)

Raises the base event and copies the combo-box font to the hosted list view.

ParameterTypeDescription
eEventArgsThe font-change event data.

Instance member RemoveAllImages()

Clears both image lists, creating the lists if necessary.

Returns: SalBoolean. Always true.

Instance member RemoveImage(nIndex)

Removes an image at the same index in both image lists.

ParameterTypeDescription
nIndexSalNumberThe 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.

Instance member ReplaceImage(nIndex, hpicLarge, hpicSmall)

Replaces corresponding entries in the large and small image lists.

ParameterTypeDescription
nIndexSalNumberThe zero-based image index.
hpicLargeSalNumberThe large picture handle.
hpicSmallSalNumberThe 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.

Instance member Scroll(size)

Scrolls the native list view by the supplied displacement.

ParameterTypeDescription
sizeVisSizeThe horizontal and vertical displacement in pixels; must not be null.

Returns: SalBoolean. True when the native operation succeeds; otherwise, false.

Instance member SetBkColor(nNewColor)

Sets the list-view background color.

ParameterTypeDescription
nNewColorSalNumberThe SAL color to apply.

Returns: SalBoolean. Always true.

Instance member SetColumn(nColumn, nMask, sTitle, nAlignment, nWidth)

Updates the column attributes selected by a mask.

ParameterTypeDescription
nColumnSalNumberThe zero-based column index.
nMaskSalNumberLVCF_Text, LVCF_Fmt, and LVCF_Width flags selecting the supplied values.
sTitleSalStringThe new caption.
nAlignmentSalNumberThe HorizontalAlignment numeric value.
nWidthSalNumberThe new width in horizontal form units.

Returns: SalBoolean. True when the column exists; otherwise false.

Instance member SetColumnAlignment(nColumn, nAlignment)

Sets a column's text alignment.

ParameterTypeDescription
nColumnSalNumberThe zero-based column index.
nAlignmentSalNumberThe HorizontalAlignment numeric value.

Returns: SalBoolean. True if the column exists and is updated; otherwise false.

Instance member SetColumnTitle(nColumn, sTitle)

Sets a column's caption.

ParameterTypeDescription
nColumnSalNumberThe zero-based column index.
sTitleSalStringThe new caption.

Returns: SalBoolean. True if the column exists and is updated; otherwise false.

Instance member SetColumnWidth(nColumn, nWidth)

Sets a column's width.

ParameterTypeDescription
nColumnSalNumberThe zero-based column index.
nWidthSalNumberThe new width in horizontal form units.

Returns: SalBoolean. True if the column exists and is updated; otherwise false.

Instance member SetEditable(fEditable)

Enables or disables keyboard editing of the combo-box text.

ParameterTypeDescription
fEditableSalBooleanTrue to enable editing; false to disable it.

Returns: SalBoolean. True.

Instance member SetFocusItem(nItem)

Gives keyboard focus to an item.

ParameterTypeDescription
nItemSalNumberThe zero-based item index.

Returns: SalBoolean. True if the item exists; otherwise false.

Instance member SetItem(nItem, nSubItem, nMask, sItemText, nItemValue, nImage)

Updates selected item attributes.

ParameterTypeDescription
nItemSalNumberThe zero-based item index.
nSubItemSalNumberZero or negative for the main item; positive for a subitem.
nMaskSalNumberLVIF_Text, LVIF_Image, and LVIF_Param flags selecting attributes to update.
sItemTextSalStringThe new caption.
nItemValueSalNumberThe new application value, converted to Int32.
nImageSalNumberThe new image-list index.

Returns: SalBoolean. True if the item or subitem exists; otherwise false.

Subitems support only text changes.

Instance member SetItemPosition(nItem, ptPosition)

Sets an icon item position through the native list view.

ParameterTypeDescription
nItemSalNumberThe zero-based item index.
ptPositionVisPointThe requested position in pixels; each coordinate is packed into a 16-bit word.

Returns: SalBoolean. True when the native operation succeeds; otherwise, false.

Instance member SetItemState(nItem, nNewState, nStateMask)

Updates item state while suppressing generated SAM_Click notifications.

ParameterTypeDescription
nItemSalNumberThe zero-based item index.
nNewStateSalNumberThe new LVIS state bits.
nStateMaskSalNumberThe state bits to change.

Returns: SalBoolean. True if the item exists; otherwise, false.

Supports focus, selection, state image, cut, and drop-highlight state.

Instance member SetItemText(nItem, nSubItem, sItemText)

Changes an item or subitem caption.

ParameterTypeDescription
nItemSalNumberThe zero-based item index.
nSubItemSalNumberZero or negative for the main item; positive for a subitem.
sItemTextSalStringThe new caption.

Returns: SalBoolean. True if the item or subitem exists; otherwise false.

Instance member SetItemValue(nItem, nItemValue)

Stores an application value in an item's Tag.

ParameterTypeDescription
nItemSalNumberThe zero-based item index.
nItemValueSalNumberThe value converted to Int32.

Returns: SalBoolean. True if the item exists; otherwise false.

Instance member SetListSize(nWidth, nHeight)

Sets the drop-down size by converting form units to pixels.

ParameterTypeDescription
nWidthSalNumberThe width in horizontal form units.
nHeightSalNumberThe height in vertical form units.

Returns: SalBoolean. True.

Instance member SetSortColumn(nColumn)

Selects the column for the next explicit sort.

ParameterTypeDescription
nColumnSalNumberThe zero-based column index.

Returns: SalBoolean. Always true.

Instance member SetSortOrder(nOrder)

Selects the ordering for the next explicit sort.

ParameterTypeDescription
nOrderSalNumberLVSORT_Ascending or LVSORT_Descending; other values disable ordering.

Returns: SalBoolean. Always true.

Instance member SetStyle(nStyle, fOn)

Enables or clears list-view styles and updates corresponding managed properties.

ParameterTypeDescription
nStyleSalNumberThe LVS style bits to change.
fOnSalBooleanTrue 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.

Instance member SetTextBkColor(nNewColor)

Sets the list-view background color.

ParameterTypeDescription
nNewColorSalNumberThe SAL color to apply.

Returns: SalBoolean. Always true.

Instance member SetTextColor(nNewColor)

Sets the list-view foreground color.

ParameterTypeDescription
nNewColorSalNumberThe SAL color to apply.

Returns: SalBoolean. Always true.

Instance member SortItems()

Sorts once with the configured item sorter, then removes the sorter.

Returns: SalBoolean. True.

Subsequent insertions are not automatically sorted.

Instance member ViewDetails()

Switches the list view to details.

Returns: SalNumber. Always zero.

Instance member ViewLargeIcons()

Switches the list view to large icons.

Returns: SalNumber. Always zero.

Instance member ViewList()

Switches to list view.

Returns: SalNumber. Zero.

Instance member ViewSmallIcons()

Switches the list view to small icons.

Returns: SalNumber. Always zero.

Implements

NameDescription
ISalControl
ISalEditControl
ISalListControl
ISalWindow