Inheritance diagram for ListView:
Public Member Functions | |
Add ([in] BSTR Text,[out, retval] IDispatch **pItem) | |
Use this method to add a new item to the collection. | |
Insert ([in] LONG Index,[in] BSTR Text,[out, retval] IDispatch **pItem) | |
Use this method to insert a new item to the collection. | |
Remove ([in] LONG Index) | |
Call this method to remove one item from the collection. | |
Clear () | |
Removes all of the items from the collection. | |
BeginUpdate () | |
Prevents repainting of the control until the EndUpdate method is called. | |
EndUpdate () | |
Enables control repainting that was prevented with the BeginUpdate method. | |
SelectAll () | |
Selects all items. | |
ClearSelection () | |
Clears the selection leaving all items unselected. | |
EditItem ([in] LONG Index) | |
Starts editing an item. | |
Sort ([in, defaultvalue(DT_STRING)] LONG DataType,[in, defaultvalue(FALSE)] VARIANT_BOOL Reverse,[in, defaultvalue(0)] ULONG Column) | |
This method sorts the items by value in the specified column. | |
Arrange () | |
Intended for use with WorkAreas. | |
Properties | |
LPUNKNOWN R | _NewEnum [] |
Returns the enumerator for the collection. | |
VARIANT R | Item [[in] long Index] [] |
Returns the specified item in the collection. | |
long RW | Count [] |
Returns or sets the number of items in the collection. | |
IDispatch *RW | LargeImages [] |
Defines which ImageList will be used to display image for each item in the list when Style = LVS_ICON. | |
IDispatch *RW | SmallImages [] |
Defines which ImageList will be used to display image for each item in the list when Style is not LVS_ICON. | |
IDispatch *RW | StateImages [] |
Defines which ImageList will be used to display state image for each item. | |
LONG RW | Style [] |
Gets or sets the style of the ListView. | |
ULONG RW | TextBkColor [] |
Gets or sets the color of the text background of an item. | |
VARIANT_BOOL RW | MultiSelect [] |
Specifies whether the user can select more than one item at a time. | |
VARIANT_BOOL RW | HideSelection [] |
Specifies whether the ListView displays which item is selected when an another control has focus. | |
LONG R | SelCount [] |
Gets the number of items that are selected. | |
LONG RW | ItemIndex [] |
Gets the index of the focused item. | |
IDispatch *R | Columns [] |
Gets the ListViewColumns object, that used when Style = LVS_REPORT. | |
VARIANT_BOOL RW | CheckBoxes [] |
Specifies whether the ListView displays checkbox for each item. | |
VARIANT_BOOL RW | GridLines [] |
Specifies whether the ListView displays grid lines. | |
VARIANT_BOOL RW | HotTrack [] |
Specifies that the items under the mouse pointer are automatically highlighted. | |
VARIANT_BOOL RW | RowSelect [] |
Specifies that the entire row in the ListView will be selected when an item will be selected. | |
VARIANT_BOOL RW | BorderSelect [] |
Specifies whether the ListView displays border for the selected item. | |
VARIANT_BOOL RW | FlatScrollBars [] |
Specifies that the scrollbars has flat style. | |
VARIANT_BOOL RW | OwnerData [] |
Specifies that the ListView in Virtual mode. | |
VARIANT_BOOL RW | ReadOnly [] |
Use this property to prevent the user from editing text of an item in the ListView control. | |
VARIANT_BOOL RW | WrapText [] |
Specifies that the text of the items can be wrapped. | |
LONG RW | Arrangement [] |
Specifies the items arrangement. | |
VARIANT_BOOL RW | HeaderDragDrop [] |
Enables drag-and-drop reordering of columns. | |
VARIANT_BOOL RW | InfoTip [] |
Enables hints Hint for items. | |
VARIANT W | BackgroundImage [] |
Specifies the image of the background. | |
IDispatch *R | WorkAreas [] |
Defines Work Areas for ListView. | |
IDispatch *R | Groups [] |
Defines Groups for ListView. | |
ULONG RW | TileLines [] |
Intended for Style = LV_VIEW_TILE. | |
ULONG RW | TileWidth [] |
Intended for Style = LV_VIEW_TILE. | |
ULONG RW | TileHeight [] |
Intended for Style = LV_VIEW_TILE. | |
VARIANT_BOOL RW | DoubleBuffering [] |
When "TRUE" control will be painted with double-buffering, which reduces flicker. | |
VARIANT_BOOL RW | TransparentBackground [] |
When "TRUE" control will transparent. | |
IDispatch *RW | GroupHeaderImages [] |
Defines which ImageList will be used to display image for each group (Groups) in the list. | |
LONG RW | IconSpacingWidth [] |
Intended for Style = LVS_ICON. | |
VARIANT_BOOL RW | CustomDraw [] |
When "TRUE" font and colors of an element can be specified by: Font, TextBkColor, SubItemsEx (Font). | |
LONG RW | IconSpacingHeight [] |
Intended for Style = LVS_ICON. | |
VARIANT_BOOL RW | ReadOnlySubItems [] |
If "FALSE" the ListView's sub items can be edited. | |
VARIANT_BOOL RW | QuickEdit [] |
This property used when ReadOnlySubItems = "FALSE" and the user can edit a sub item of an item. | |
VARIANT_BOOL RW | CheckByMouse [] |
If "TRUE" then the user can check an item by mouse. | |
VARIANT W | OnColumnClick [] |
Sets the event handler for the OnColumnClick event. | |
VARIANT W | OnColumnResize [] |
Sets the event handler for the OnColumnResize event. | |
VARIANT W | OnData [] |
Sets the event handler for the OnData event. | |
VARIANT W | OnItemCheck [] |
Sets the event handler for the OnItemCheck event. | |
VARIANT W | OnEdited [] |
Sets the event handler for the OnEdited event. | |
VARIANT W | OnBeginEdit [] |
Sets the event handler for the OnBeginEdit event. | |
VARIANT W | OnGroupLinkClick [] |
Sets the event handler for the OnGroupLinkClick event. | |
VARIANT W | OnDrawItem [] |
Sets the event handler for the OnDrawItem event. | |
VARIANT W | OnSubItemEdited [] |
Sets the event handler for the OnSubItemEdited event. | |
VARIANT W | OnBeginSubItemEdit [] |
Sets the event handler for the OnBeginSubItemEdit event. |
The items can be displayed in columns with column headers, with icons and with subitems.
The ListView object is an collection of ListItem.
See also the method CreateListView of the Frame.
See also ListViewEvents.
Add | ( | [in] BSTR | Text, | |
[out, retval] IDispatch ** | pItem | |||
) |
Use this method to add a new item to the collection.
Text | Text of the item. |
pItem | New ListItem object. |
Arrange | ( | ) |
BeginUpdate | ( | ) |
Prevents repainting of the control until the EndUpdate method is called.
Clear | ( | ) |
Removes all of the items from the collection.
ClearSelection | ( | ) |
Clears the selection leaving all items unselected.
EditItem | ( | [in] LONG | Index | ) |
Starts editing an item.
Index | The index of the item. |
EndUpdate | ( | ) |
Enables control repainting that was prevented with the BeginUpdate method.
Insert | ( | [in] LONG | Index, | |
[in] BSTR | Text, | |||
[out, retval] IDispatch ** | pItem | |||
) |
Use this method to insert a new item to the collection.
Index | The index where the item are to be inserted | |
Text | Text of the item. |
pItem | New ListItem object. |
Remove | ( | [in] LONG | Index | ) |
Call this method to remove one item from the collection.
Index | The index of the element to remove. |
SelectAll | ( | ) |
Selects all items.
Sort | ( | [in, defaultvalue(DT_STRING)] LONG | DataType, | |
[in, defaultvalue(FALSE)] VARIANT_BOOL | Reverse, | |||
[in, defaultvalue(0)] ULONG | Column | |||
) |
This method sorts the items by value in the specified column.
See also Data types.
DataType | The data type. | |
Reverse | Enables reverse sorting. | |
Column | The index of the column. |
o = new ActiveXObject("Scripting.WindowSystemObject") o.EnableVisualStyles = true f = o.CreateForm(0,0,0,0) f.Text = "WSO" f.ClientWidth = 550 f.ClientHeight = 250 f.CenterControl() ListView = f.CreateListView(10,10,280,130,o.Translate("LVS_REPORT")) ListView.Align = o.Translate("AL_CLIENT") ListView.Columns.Add("Column 1",150) ListView.Columns.Add("Column 2",200) ListView.Columns.Add("Column 3",200) ListView.OnColumnClick = OnColumnClick ListView.RowSelect = true for (i = 1; i<25; i++) { var Item = ListView.Add(i) Item.SubItems(0) = RandomText(5) Item.SubItems(1) = Math.round(Math.random()*1000) } function RandomText(Count) { var S = "" var Index for (var i = 0; i<Count; i++) { Index = Math.round(Math.random()*10) S += String.fromCharCode("A".charCodeAt(0) + Index) } return S } SortColumn = -1 SortReverse = false f.Show() o.Run() function OnColumnClick(Sender,Column) { f.Text = Column.Text+": index="+Column.Index if (SortColumn == Column.Index) { SortReverse = !SortReverse } else { SortColumn = Column.Index SortReverse = false } var SortMode = o.Translate("DT_STRING") if (Column.Index == 0) SortMode = o.Translate("DT_INTEGER") if (Column.Index == 2) SortMode = o.Translate("DT_INTEGER") ListView.Sort(SortMode,SortReverse,Column.Index) }
LPUNKNOWN R _NewEnum |
Returns the enumerator for the collection.
LONG RW Arrangement |
Specifies the items arrangement.
Style must be LVS_ICON or LVS_SMALLICON.
This parameter can be one of the following values:
VARIANT W BackgroundImage |
VARIANT_BOOL RW BorderSelect |
Specifies whether the ListView displays border for the selected item.
VARIANT_BOOL RW CheckBoxes |
Specifies whether the ListView displays checkbox for each item.
VARIANT_BOOL RW CheckByMouse |
If "TRUE" then the user can check an item by mouse.
If "FALSE" then the user can check an item only by keyboard (Space key).
CheckBoxes must be "TRUE".
Default value: "TRUE".
IDispatch* R Columns |
Gets the ListViewColumns object, that used when Style = LVS_REPORT.
long RW Count |
Returns or sets the number of items in the collection.
VARIANT_BOOL RW CustomDraw |
When "TRUE" font and colors of an element can be specified by: Font, TextBkColor, SubItemsEx (Font).
Default value: "FALSE".
Example:
o = new ActiveXObject("Scripting.WindowSystemObject") o.EnableVisualStyles = true fs = new ActiveXObject("Scripting.FileSystemObject") f = o.CreateForm(0,0,0,0) f.ClientWidth = 510 f.ClientHeight = 200 f.CenterControl() f.Text = "ListView Colors Demo" Box = f.CreateListView(10,10,250,300,o.Translate("LVS_REPORT")) Box.RowSelect = true Box.Align = o.Translate("AL_CLIENT") //This is required Box.CustomDraw = true Box.Columns.Add("Column 1",200) Box.Columns.Add("Column 2",150) Box.Columns.Add("Column 3",150) //Specify Font Size - maximum value and for an item you can use less. Box.Font.Size = 16 for (i = 0; i<5; i++) { Item = Box.Add("Item "+i) if (i % 2 == 0) { Item.Font.Color = 0x0000FF00 Item.Font.Size = 12 Item.SubItemsEx(0).Font.Color = 0x000000FF Item.SubItemsEx(1).Font.Color = 0x00F0F000 } if (i == 0) Item.TextBkColor = 0x00E0E0FF Item.SubItems(0) = "Text" Item.SubItems(1) = "Text 2" } f.Show() o.Run()
OnDrawItem event also can be used. Example:
o = new ActiveXObject("Scripting.WindowSystemObject") o.EnableVisualStyles = true fs = new ActiveXObject("Scripting.FileSystemObject") f = o.CreateForm(0,0,0,0) f.ClientWidth = 510 f.ClientHeight = 200 f.CenterControl() f.Text = "ListView Colors Demo" Box = f.CreateListView(10,10,250,300,o.Translate("LVS_REPORT")) Box.RowSelect = true Box.Align = o.Translate("AL_CLIENT") //This is required Box.CustomDraw = true Box.Columns.Add("Column 1",200) Box.Columns.Add("Column 2",150) Box.Columns.Add("Column 3",150) //Specify Font Size - maximum value and for an item you can use less. Box.Font.Size = 16 for (i = 0; i<5; i++) { Item = Box.Add("Item "+i) Item.SubItems(0) = "Text" Item.SubItems(1) = "Text 2" } Box.OnDrawItem = OnDrawItem function OnDrawItem(Sender,Item) { i = Item.Index if (i % 2 == 0) { Item.Font.Color = 0x0000FF00 Item.Font.Size = 12 Item.SubItemsEx(0).Font.Color = 0x000000FF Item.SubItemsEx(1).Font.Color = 0x00F0F000 } if (i == 0) Item.TextBkColor = 0x00E0E0FF } f.Show() o.Run()
VARIANT_BOOL RW DoubleBuffering |
VARIANT_BOOL RW FlatScrollBars |
Specifies that the scrollbars has flat style.
VARIANT_BOOL RW GridLines |
Specifies whether the ListView displays grid lines.
IDispatch* RW GroupHeaderImages |
IDispatch* R Groups |
Defines Groups for ListView.
The method returns a ListViewGroups object. An ListViewGroups object is a collection of the ListViewGroup objects. Requires Comctl32.dll version 6. Requires visual styles (Themes). Without visual styles groups not visible. OwnerData = "TRUE" not supported when WorkAreas or Groups defined (Windows limitation). Example:
o = new ActiveXObject("Scripting.WindowSystemObject") o.EnableVisualStyles = true fs = new ActiveXObject("Scripting.FileSystemObject") f = o.CreateForm(0,0,0,0) f.ClientWidth = 550 f.ClientHeight = 650 f.CenterControl() Box = f.CreateListView(10,10,250,300) Box.HotTrack = true Box.Align = o.Translate("AL_CLIENT") Ext = new ActiveXObject("Scripting.WindowSystemObjectExtensions") Box.LargeImages = Ext.SystemImageListLarge Box.SmallImages = Ext.SystemImageListSmall Box.Style = o.Translate("LV_VIEW_ICON") var Data = ["1.txt","1.jpg","1.png","1.exe","1.bat","1.com","1.js","1.vbs","1.bmp","1.ini","1.xml"] Group1 = Box.Groups.Add("Group 1") Group2 = Box.Groups.Add("Group 2") Group1.SubTitle = "The group 1 description where" Group1.Task = "Task" Group1.DescriptionTop = "DescriptionTop" Group1.DescriptionBottom = "DescriptionBottom" Group1.SubsetTitle = "SubsetTitle" Group1.HeaderAlign = o.Translate("AL_CENTER") Group1.FooterAlign = o.Translate("AL_CENTER") Group1.Collapsible = true Group1.Footer = "Group 1 Footer Text" Group2.Footer = "Group 2 Footer Text" for (i = 0; i<Data.length; i++) { Item = Box.Add("Item "+i+": "+Data[i]) Item.ImageIndex = Ext.GetFileSysIconIndexLarge(Data[i],o.Translate("FILE_ATTRIBUTE_ARCHIVE")) Item.SubItems(0) = "The first line for "+i Item.SubItems(1) = "The second line for (a b c d e f g h j k)"+i Item.Group = i % 2 } Box.OnGroupLinkClick = OnGroupLinkClick function OnGroupLinkClick(Sender,Group){ f.MessageBox(Group.Header + " clicked") } f.Show() o.Run()
VARIANT_BOOL RW HeaderDragDrop |
Enables drag-and-drop reordering of columns.
Comctl32.dll 4.70 required.
VARIANT_BOOL RW HideSelection |
Specifies whether the ListView displays which item is selected when an another control has focus.
VARIANT_BOOL RW HotTrack |
Specifies that the items under the mouse pointer are automatically highlighted.
LONG RW IconSpacingHeight |
VARIANT_BOOL RW InfoTip |
VARIANT R Item[[in] long Index] | ( | ) |
Returns the specified item in the collection.
LONG RW ItemIndex |
Gets the index of the focused item.
IDispatch* RW LargeImages |
VARIANT_BOOL RW MultiSelect |
Specifies whether the user can select more than one item at a time.
VARIANT W OnBeginEdit |
Sets the event handler for the OnBeginEdit event.
This event occurs when an item's text editing started.
VARIANT W OnBeginSubItemEdit |
Sets the event handler for the OnBeginSubItemEdit event.
VARIANT W OnColumnClick |
Sets the event handler for the OnColumnClick event.
This event occurs when the user clicks a header of an column.
VARIANT W OnColumnResize |
Sets the event handler for the OnColumnResize event.
This event occurs when the user resizes an column.
VARIANT W OnData |
Sets the event handler for the OnData event.
This event occurs when the ListView needs an data of an item.
VARIANT W OnDrawItem |
VARIANT W OnEdited |
Sets the event handler for the OnEdited event.
This event occurs when an item's text edited.
VARIANT W OnGroupLinkClick |
Sets the event handler for the OnGroupLinkClick event.
This event occurs when an item's text editing started.
VARIANT W OnItemCheck |
Sets the event handler for the OnItemCheck event.
This event occurs when an item's checked state changes.
VARIANT W OnSubItemEdited |
Sets the event handler for the OnSubItemEdited event.
VARIANT_BOOL RW OwnerData |
Specifies that the ListView in Virtual mode.
In that mode the text of an ListItem is not stored in the ListView.
When the ListView needs an data of an item, the OnData event occur.
OwnerData = "TRUE" not supported when WorkAreas or Groups defined (Windows limitation).
Example:
o = new ActiveXObject("Scripting.WindowSystemObject") o.EnableVisualStyles = true f = o.CreateForm(0,0,0,0) f.Text = "WSO" f.ClientWidth = 300 f.ClientHeight = 150 f.CenterControl() ListView = f.CreateListView(10,10,280,130,o.Translate("LVS_REPORT | LVS_OWNERDATA")) ListView.Columns.Add("Column 1",150) ListView.Columns.Add("Column 2",200) ListView.OnData = OnData ListView.Count = 1000 function OnData(Sender,Item) { var i = Item.Index Item.Text = "Item "+i Item.SubItems(0) = "SubItem 1 of "+i } f.Show() o.Run()
VARIANT_BOOL RW QuickEdit |
This property used when ReadOnlySubItems = "FALSE" and the user can edit a sub item of an item.
If "FALSE" then the user must select the item before edit the sub item. If "TRUE" then the sub item editing is started when the user clicks the sub item.
Default value: "TRUE".
VARIANT_BOOL RW ReadOnly |
Use this property to prevent the user from editing text of an item in the ListView control.
VARIANT_BOOL RW ReadOnlySubItems |
If "FALSE" the ListView's sub items can be edited.
Sub items is available only if Style = LVS_REPORT.
Default value: "TRUE".
VARIANT_BOOL RW RowSelect |
Specifies that the entire row in the ListView will be selected when an item will be selected.
LONG R SelCount |
Gets the number of items that are selected.
IDispatch* RW SmallImages |
IDispatch* RW StateImages |
Defines which ImageList will be used to display state image for each item.
LONG RW Style |
Gets or sets the style of the ListView.
This parameter can be one of the following values:
LVS_REPORT
Items displayed in the reports mode, for example:
o = new ActiveXObject("Scripting.WindowSystemObject") o.EnableVisualStyles = true f = o.CreateForm(0,0,0,0) f.Text = "WSO" f.ClientWidth = 300 f.ClientHeight = 150 f.CenterControl() ListView = f.CreateListView(10,10,280,130,o.Translate("LVS_REPORT")) ListView.Columns.Add("Column 1",150) ListView.Columns.Add("Column 2",200) for (i = 1; i<25; i++) { var Item = ListView.Add("Item "+i) Item.SubItems(0) = "SubItem 1 of "+i } f.Show() o.Run()
LV_VIEW_TILE
For LV_VIEW_TILE required Comctl32.dll version 6 and themes (Themes). SubItems defines additional text lines for an element in this mode. TileLines defines count of additional text lines. An Column (Columns) must be specified for displaying additional lines. Example:
o = new ActiveXObject("Scripting.WindowSystemObject") o.EnableVisualStyles = true fs = new ActiveXObject("Scripting.FileSystemObject") f = o.CreateForm(0,0,0,0) f.ClientWidth = 550 f.ClientHeight = 650 f.CenterControl() Box = f.CreateListView(10,10,250,300) Box.HotTrack = true Box.Align = o.Translate("AL_CLIENT") Ext = new ActiveXObject("Scripting.WindowSystemObjectExtensions") Box.LargeImages = Ext.SystemImageListLarge Box.SmallImages = Ext.SystemImageListSmall Box.Style = o.Translate("LV_VIEW_TILE") Box.TileLines = 2 //We need to add some column for tile view Box.Columns.Add("Column 1") Box.Columns.Add("Column 2") var Data = ["1.txt","1.jpg","1.png","1.doc","1.gif","1.xls","1.exe","1.bat"] for (i = 0; i<Data.length; i++) { Item = Box.Add(Data[i]) Item.ImageIndex = Ext.GetFileSysIconIndexLarge(Data[i],o.Translate("FILE_ATTRIBUTE_ARCHIVE")) Item.SubItems(0) = "The first line for "+i Item.SubItems(1) = "The second line for (a b c d e f g h j k)"+i } f.Show() o.Run()
ULONG RW TextBkColor |
Gets or sets the color of the text background of an item.
ULONG RW TileHeight |
ULONG RW TileLines |
Intended for Style = LV_VIEW_TILE.
Defines maximum number of text lines in each item label, not counting the title.
ULONG RW TileWidth |
VARIANT_BOOL RW TransparentBackground |
When "TRUE" control will transparent.
Requires Comctl32.dll version 6. Requires visual styles (Themes).
IDispatch* R WorkAreas |
Defines Work Areas for ListView.
Returns a WorkAreas object. An WorkAreas object is a collection of the WorkArea objects. OwnerData = "TRUE" not supported when WorkAreas or Groups defined (Windows limitation). Example:
o = new ActiveXObject("Scripting.WindowSystemObject") fs = new ActiveXObject("Scripting.FileSystemObject") f = o.CreateForm(0,0,0,0) f.ClientWidth = 450 f.ClientHeight = 550 f.CenterControl() f.Text = "ListView Work Areas Demo" f.BorderWidth = 10 f.MinWidth = 500 f.MinHeight = 350 Box = f.CreateListView(10,10,250,300) Box.HotTrack = true Box.Align = o.Translate("AL_CLIENT") Ext = new ActiveXObject("Scripting.WindowSystemObjectExtensions") Box.LargeImages = Ext.SystemImageListLarge Box.WorkAreas.Add(10,10,180,180) Box.WorkAreas.Add(200,200,200,200) for (i = 0; i<10; i++) { Item = Box.Add("Item "+i) Item.ImageIndex = Ext.GetFileSysIconIndexLarge("1.txt",o.Translate("FILE_ATTRIBUTE_ARCHIVE")) if ((i % 2) == 0) { Item.SetPosition(210,210) } } Box.Arrange() f.Show() o.Run()
VARIANT_BOOL RW WrapText |
Specifies that the text of the items can be wrapped.