ctlUniListView ControlRepresents a Windows list view control, which displays a collection of items that can be displayed using one of four different views
|
| Name | Description |
|---|---|
| eCtlUniListView_ListArrangeConstants | ListArrange constants |
| eCtlUniListView_ListLabelEditConstants | LabelEdit constants |
| eCtlUniListView_ListSortOrderConstants | SortOrder constants |
| eCtlUniListView_ListViewConstants | View constants |
| eCtlUniListView_NotifyConsts | ListView notify consts, Reserved, don't use |
| Name | Description |
|---|---|
| Click | |
| DblClick | |
| KeyDown | |
| KeyPress | |
| KeyUp | |
| MouseDown | |
| MouseMove | |
| MouseUp | |
| MouseWheel | |
| VScroll | |
| HScroll | |
| ColumnClick | Raised when a user clicks on a column header |
| BeforeLabelEdit | Raised before start the editing of a label, set Cancel=1 to stop the operation |
| AfterLabelEdit | Raised after a label editing if the value of the label has been changed |
| ItemCheck | Raised then a user clicks on a item checkbox |
| ItemClick | Raised when a new item is selected |
| SortCompareRows | Raised when the [SortWithCustomEvent] property is True and permits you to sort rows in a custom way |
| OLEStartDrag | |
| OLESetData | |
| OLEGiveFeedback | |
| OLEDragOver | |
| OLEDragDrop | |
| OLECompleteDrag |
| Name | Type | Description |
|---|---|---|
| AllowColumnReorder | (Boolean) | Returns/sets whether a user can reorder columns in report view PS. NOT WORKING NOW |
| Arrange | (eCtlUniListView_ListArrangeConstants) | Returns/sets how the icons in a ListView control's Icon or SmallIcon view are arranged. |
| AutoSelectFirstItem | (Boolean) | If True automatically highlights the first item in list if none is selected, default is True |
| BackColor | (OLE_COLOR) | Gets or sets the Background color of the control |
| BorderColor | (OLE_COLOR) | Gets or sets the Border color |
| CellPadding | (Long) | Gets or sets the space between the cell content and the cell border in pixels |
| CellsBorderColor | (OLE_COLOR) | Gets or sets the color used to draw gridlines in Report view |
| CheckBoxes | (Boolean) | Returns/sets a value which determines if the control displays a checkbox next to each item in the list. |
| ColumnHeaderIcons | (Object) | Returns/sets the ImageList or [ctlImageBag] control to be used for ColumnHeader icons |
| ColumnHeaders | (clsUniLV_ColumnHeaders) | Returns a reference to a collection of ColumnHeader objects. |
| DropHighlight | (clsUniLV_ListItem) | Returns a reference to a Node or ListItem object and highlights the object with the system highlight color. |
| Enabled | (Boolean) | Enables or disables the control |
| Font | (Font) | Gets or sets the font used for text in the control, check the [ApplyFontChanges] for details |
| ForeColor | (OLE_COLOR) | Gets or sets the Foreground (Text) color for the control |
| FullRowSelect | (Boolean) | Returns/sets whether selecting a column highlights the entire row. |
| GridLines | (Boolean) | Returns/sets whether grid lines appear between rows and columns |
| HeaderBackColor | (OLE_COLOR) | Gets or sets the background color of the header |
| HeaderForeColor | (OLE_COLOR) | Gets or sets the text color used in the header section |
| HeaderStyle | (eCtlButtonStyle) | Gets or sets the Header style |
| HideColumnHeaders | (Boolean) | Returns/sets whether or not a ListView control's column headers are hidden in Report view. |
| HideSelection | (Boolean) | Determines whether the selected item will display as selected when the ListView loses focus |
| HotTracking | (Boolean) | Returns/sets whether hot tracking is enabled. PS. NOT WORKING: Works only as HotTracking = False |
| HoverSelection | (Boolean) | Returns/sets whether hover selection is enabled. PS. NOT WORKING: Works only as HoverSelection = False |
| HScroll | (Object) | Returns a reference to the horizontal scrollbar (in case you want to customize it) |
| HScroll_Max | (Long) | Gets the maximum value of the horizontal scrollbar |
| HScroll_Value | (Long) | Gets or sets the value of the horizontal scrollbar |
| hWnd | (Long) | Returns the usercontrol window handle |
| Icons | (Object) | Returns/sets the images associated with the Icon properties of a ListView control. Supports a standard ImageList or a [ctlImageBag] control |
| LabelEdit | (eCtlUniListView_ListLabelEditConstants) | Returns/sets a value that determines if a user can edit the label of a ListItem or Node object. |
| LabelWrap | (Boolean) | Returns or sets a value that determines if labels are wrapped when the ListView is in Icon view. |
| ListItems | (clsUniLV_ListItems) | Gets or sets the ListItems collection |
| MaxIconSize | (Long) | Gets or sets the maximum size of Icons or Pictures used in the control; if a picture is bigger it will be resized every time the control needs to show it |
| MinIconSize | (Long) | Gets or sets the minimum size preserved for Icons or Pictures in items |
| MouseIcon | (Picture) | Gets or sets the MouseIcon for the control |
| MousePointer | (VBRUN.MousePointerConstants) | Gets or sets the MousePointer for the control |
| MultiSelect | (Boolean) | Returns/sets a value indicating whether a user can make multiple selections in the ListView control and how the multiple selections can be made. |
| OLEDropMode | (eCtlOLEDropMode) | Gets or sets the OleDropMode for the control |
| ScrollOnMouseWheel | (Boolean) | Gets or sets the ability to capture the mouse wheel and scroll the view |
| SelBackColor | (OLE_COLOR) | Gets or sets the background color of the list item selector |
| SelectedItem | (clsUniLV_ListItem) | Returns a reference to the current selected item |
| SelectItemOnRightClick | (Boolean) | Permits the selection of items also when pressing the right mouse button (like the standard control) |
| SelectorStyle | (eCtlButtonStyle) | Gets or sets the style of the row selector |
| SelForeColor | (OLE_COLOR) | Gets or sets the foreground color of the list item selector |
| ShowFocus | (Boolean) | If True, draws the focus rectangle when the control gains the keyboard focus |
| SmallIcons | (Object) | Returns/sets the images associated with the SmallIcons property of a ListView control. Supports a standard ImageList or a [ctlImageBag] control |
| Sorted | (Boolean) | Indicates whether the elements of a control are automatically sorted alphabetically. |
| SortKey | (Variant) | Represents the Column index or key used for sorting |
| SortOrder | (eCtlUniListView_ListSortOrderConstants) | Returns/sets whether or not the ListItems will be sorted in ascending or descending order. |
| SortWithCustomEvent | (Boolean) | Gets or sets the ability to sort the ListView data using the [SortCompareRows] event |
| StandardScrollBars | (Boolean) | Returns/sets whether or not the control uses standard or styled scrollbars |
| Tip | (String) | Gets or sets the Unicode Tooltip for the control |
| View | (eCtlUniListView_ListViewConstants) | Returns/sets whether or not the ListItems will be sorted in ascending or descending order. |
| VScroll | (Object) | Returns a reference to the vertical scrollbar (in case you want to customize it) |
| VScroll_Max | (Long) | Gets the maximum value of the vertical scrollbar |
| VScroll_Value | (Long) | Gets or sets the value of the vertical scrollbar |
| zPicDragImage | (StdPicture) | Reserved, don't use |
| Name | Type | Description |
|---|---|---|
| ApplyFontChanges | When setting a new font on the control you need to call this function in order to refresh the interface | |
| BeginUpdate | Permits you to start a long-time update on the control (for example by adding 1000 elements) without sending out many and many events. So it is faster! Use un conjunction with [EndUpdate] |
|
| Clear | Clears the listview removing all items and optionally also the header | |
| CountChecked | (Long) | Returns the number of checked items (doesn't depend on the MultiSelection flag) |
| CountSelected | (Long) | Returns the number of selected items when using MultiSelection |
| EndLabelEdit | Terminates a label edit operation | |
| EndUpdate | Terminates a [BeginUpdate] reactivating the control after a long-time update | |
| FocusItem | Focuses the given item scrolling it into view | |
| FormatNumber | (String) | Formats a number using a specified format |
| GetFirstVisible | (clsUniLV_ListItem) | Retrieves a reference of the first item visible in the client area. |
| HitTest | (clsUniLV_ListItem) | Returns a reference to the ListItem object or Node object located at the coordinates of x and y. Used with drag and drop operations. |
| ItemCompletelyInViewport | (Boolean) | Returns True if the specified item is completely visible in the ViewPort |
| ItemVisibleInViewport | (Boolean) | Returns True if the specified item is visible (also partially) in the ViewPort |
| NoUpdate | Terminates a [BeginUpdate] reactivating the control after a long-time update Doesn't refresh the control view |
|
| OLEDrag | Starts an OLEDrag operation | |
| Refresh | Updates the control view | |
| SelectAll | Selects all items | |
| SelectRange | Selects a range of items | |
| Sort | Sorts the list data using [SortKey] and [SortOrder] properties | |
| StartLabelEdit | Begins a label editing operation on a ListItem or Node object. | |
| ViewPortHeight | (Long) | The Viewport height |
| ViewPortWidth | (Long) | The Viewport width |
Option Explicit
Private Sub Form_Load()
With ctlUniListView1
.SmallIcons = ImageList1
.Icons = ImageList1
Set .ColumnHeaderIcons = ImageList1
.ColumnHeaders.Add , , "aaaa dsadsa dsad sadsa dsads a", , , 1
.ColumnHeaders.Add , , "bbbb", , elvca_right
.ColumnHeaders.Add , , "ccc", , , pic1.Picture
End With
End Sub
Private Sub btnAdd_Click()
Dim li2 As clsUniLV_ListItem
Dim lsi2 As clsUniLV_ListSubItem
Set li2 = ctlUniListView1.ListItems.Add(, , "Text dsadsa dsad sadas dsad sadas dsadsa a", 1, 2)
li2.Checked = True
li2.Bold = True
li2.ForeColor = vbRed
li2.Tip = "qqqqqqq"
Set lsi2 = li2.ListSubItems.Add(, , "second", 1, "Tip")
lsi2.Bold = True
lsi2.ForeColor = vbRed
li2.ListSubItems.Add , , "third", , "Tip"
Set li2 = ctlUniListView1.ListItems.Add(, , "aaa")
li2.Tip = "aaaaaa bbbbbbb"
Dim p As StdPicture
Set p = Ctl_LoadPicture("u:\hexagora.png")
Set li2 = ctlUniListView1.ListItems.Add(, , , p, p)
End Sub
Private Sub ctlUniListView1_MouseMove(Button As Integer, Shift As Integer, x As Single, y As Single)
If Button = vbLeftButton Then
Dim li As clsUniLV_ListItem
Set li = ctlUniListView1.HitTest(x, y)
If Not li Is Nothing Then
Set ctlUniListView1.SelectedItem = li
Set ctlUniListView1.DragIcon = li.CreateDragImage()
ctlUniListView1.Drag
End If
End If
Debug.Print Time & " > " & x & ", " & y
End Sub
Private Sub ctlUniListView1_DragDrop(Source As Control, x As Single, y As Single)
If Source Is ctlUniListView1 Then
Dim liIns As clsUniLV_ListItem
Set liIns = ctlUniListView1.SelectedItem
ctlUniListView1.ListItems.Remove liIns.Index
Dim li As clsUniLV_ListItem
Set li = ctlUniListView1.HitTest(x, y, True)
If Not li Is Nothing Then
Debug.Print li.Index
ctlUniListView1.ListItems.Add li.Index, liIns.Key, liIns.Text, liIns.Icon, liIns.SmallIcon
Else
ctlUniListView1.ListItems.Add , liIns.Key, liIns.Text, liIns.Icon, liIns.SmallIcon
End If
End If
End Sub