Skip to content

ListviewControl


Members

gui

desc: The parent GUI of the ListView.

type: GridGUI.GUI

meta: [object]

Methods

__GetRow

__GetRow(index)

Retrieves a row as an array of strings, without changing the currently selected ListView.

parameters

name: index

desc: The index of the row to retrieve.

type: number

return value

desc: The contents of the row at index.

type: array

__New

__New(guiHwnd, options := "", text := "")

Constructor.

parameters

name: guiHwnd

desc: The hwnd of the gui that the GuiControl should be added to.

type: hwnd

name: options

desc: The options that the ListView will be created with. Does not accept vVars.

type: string

default: ""

link: link

name: text

desc: A list of the initial column titles separated by |, e.g. "ColumnTitle1|ColumnTitle2|...".

type: string

default: ""

return value

desc: A new GridGUI.ListviewControl instance.

type: GridGUI.ListviewControl

__ResetCurrentLV

__ResetCurrentLV(previous)

Sets the default GUI and ListView. Used to restore the old default GUI and ListView, so that using the methods of the class won't have any side effects.

parameters

name: previous

desc: An object of the hwnds that should be set as the default GUI and ListView indexed under the keys "gui" and "lv".

type: object

__SetCurrentLV

__SetCurrentLV()

Selects this ListView and sets the default GUI to GridGUI.ListviewControl.gui so that the LV_Functions work on the right ListView.

return value

desc: The hwnd of the previous default GUI and ListView as an object with the keys "gui" and "lv".

type: object

Add

Add(Options := "", Fields*)

Adds a new row to the bottom of the list.

parameters

name: Options

desc: The row options to apply to the new row. See link for a list of available options.

type: string

default: ""

link: link

name: Fields

desc: The columns of the new row, which can be text or numeric. If there are too few fields to fill all the columns, the columns at the end are left blank. If there are too many fields, the fields at the end are completely ignored.

type: string|number

meta: [variadic]

return value

desc: Returns 0 upon failure. Upon success, it returns the new row number, which is not necessarily the last row if the ListView has the Sort or SortDesc style.

type: number

link: link

AddArray

AddArray(lst)

Adds an array of rows to the ListView.

parameters

name: lst

desc: The array of rows to add. Each row should be an array of the text that should be in each column.

type: array

Delete

Delete(RowNumber := Null)

Deletes the specified row or all rows.

parameters

name: RowNumber

desc: The index of the row to delete. If the parameter is omitted, all rows in the ListView are deleted.

type: number

default: Null

return value

desc: Returns 1 upon success and 0 upon failure.

type: number

link: link

DeleteCol

DeleteCol(ColumnNumber)

Deletes the specified column and all of the contents beneath it.

parameters

name: ColumnNumber

desc: The index of the column to delete. Once a column is deleted, the column numbers of any that lie to its right are reduced by 1. Consequently, calling LV_DeleteCol(2) twice would delete the second and third columns.

type: number

return value

desc: It returns 1 upon success and 0 upon failure.

type: number

link: link

DeleteHeaders

DeleteHeaders()

Deletes all headers of the ListView.

return value

desc: Returns 1 if all the headers where removed successfully or 0 if one or more headers could not be deleted.

type: bool

FindItem

FindItem(text, index := 0, partial := false)

Finds the index of a row containing a given string.

parameters

name: text

desc: The text to search for.

type: string

link: link

name: index

desc: The index to start the search from, the index itself won't be part of the search. 0 searches from the top of the list.

type: number

default: 0

link: link

name: partial

desc: Whether or not to detect partial matches.

type: bool

default: false

return value

desc: The index of the found row or -1 on failure.

type: number

link: link

GetCount

GetCount(Mode := "")

Retrieves the total number of rows or columns, or the number of selected rows only.

parameters

name: Mode

desc: When the parameter is omitted, the function returns the total number of rows in the control. When the parameter is "S" or "Selected", the count includes only the selected/highlighted rows. When the parameter is "Col" or "Column", the function returns the number of columns in the control. This function is always instantaneous because the control keeps track of these counts.

type: string

default: ""

return value

desc: The number of rows or columns of the type specified in Mode.

type: number

link: link

GetHeaders

GetHeaders()

Retrieves the column titles as an array.

return value

desc: The column titles in an array.

type: array

GetNext

GetNext(StartingRowNumber := "", RowType := "")

Retrieves the row number of the next selected, checked, or focused row.

parameters

name: StartingRowNumber

desc: The row index to search from. If StartingRowNumber is omitted or less than 1, the search begins at the top of the list. Otherwise, the search begins at the row after StartingRowNumber.

type: string

default: ""

name: RowType

desc: The type of row to find. If RowType is omitted, the function searches for the next selected/highlighted row. Otherwise, specify "C" or "Checked" to find the next checked row; or "F" or "Focused" to find the focused row.

type: string

default: ""

return value

desc: The row number of the next selected, checked, or focused row.

type: number

link: link

GetRow

GetRow(index)

Retrieves a row as an array of strings.

parameters

name: index

desc: The index of the row to retrieve.

type: number

return value

desc: The contents of the row at index.

type: array

GetSelection

GetSelection()

Retrieves an array of the selected rows.

return value

desc: The selected rows in an array.

type: array

GetText

GetText(ByRef OutputVar, RowNumber, ColumnNumber := 1)

Retrieves the text at the specified RowNumber and ColumnNumber and stores it in OutputVar.

parameters

name: OutputVar

desc: The variable to put the text in to. Upon failure, OutputVar is made blank.

type: string

meta: [ByRef]

name: RowNumber

desc: The index of the row to retrieve the text from. If RowNumber is 0, the column header text is retrieved. If the text is longer than 8191, only the first 8191 characters are retrieved.

type: number

name: ColumnNumber

desc: The index of the column to retrieve the text from. Column numbers seen by the script are not altered by any dragging and dropping of columns the user may have done.

type: number

default: 1

return value

desc: returns 1 upon success and 0 upon failure.

type: number

link: link

Insert

Insert(RowNumber, Options := "", Cols*)

Inserts a new row at the specified row number.

parameters

name: RowNumber

desc: The index to insert the new row at. Any rows at or beneath RowNumber are shifted downward to make room for the new row. If RowNumber is greater than the number of rows in the list (even as high as 2147483647), the new row is added to the end of the list.

type: number

name: Options

desc: The row options to apply to the new row. See link for a list of available options.

type: string

default: ""

link: link

name: Cols

desc: The columns of the new row, which can be text or numeric. If there are too few fields to fill all the columns, the columns at the end are left blank. If there are too many fields, the fields at the end are completely ignored.

type: string|number

meta: [variadic]

return value

desc: Returns 0 upon failure. Upon success, it returns the new row number, which is not necessarily the last row if the ListView has the Sort or SortDesc style.

type: number

link: link

InsertCol

InsertCol(ColumnNumber, Options := "", ColumnTitle := "")

Inserts a new column at the specified column number and shifting any other columns to the right to make room

parameters

name: ColumnNumber

desc: The index to place the new column at. If ColumnNumber is larger than the number of columns currently in the control, the new column is added to the end of the list.

type: number

name: Options

desc: The options to apply to the new column. The new column's attributes always start off at their defaults unless changed via Options.

type: string

default: ""

link: link

name: ColumnTitle

desc: The title of the column.

type: string

default: ""

return value

desc: The index of the newly added column or 0 on failure.

type: number

link: link

Modify

Modify(RowNumber, Options := "", NewCols*)

Modifies the attributes and/or text of a row. See link for details.

parameters

name: RowNumber

desc: The index of the row to modify. If RowNumber is 0, all rows in the control are modified.

type: number

name: Options

desc: The row options to apply to the row. See link for a list of available options.

type: string

default: ""

link: link

name: NewCols

desc: The optional new text to set each column to.

type: string

meta: [variadic]

return value

desc: Returns 1 upon success and 0 upon failure. If RowNumber is 0 then 1 is returned on complete success and 0 is returned if any part of the operation failed.

type: number

link: link

ModifyCol

ModifyCol(ColumnNumber := Null, Options := Null, ColumnTitle := Null)

Modifies the attributes and/or text of the specified column and its header. If all parameters are omitted, the width of every column is adjusted to fit the contents of the rows. If only the first parameter is present, only the specified column is auto-sized. Auto-sizing has no effect when not in Report (Details) view.

parameters

name: ColumnNumber

desc: The index of the column to modify.

type: number

default: Null

name: Options

desc: The options to apply to the column.

type: string

default: Null

link: link

name: ColumnTitle

desc: The title of the column.

type: string

default: Null

return value

desc: Returns 1 upon success and 0 upon failure.

type: number

link: link

Redraw

Redraw(bool)

Enables or disables redrawing of the GridGUI.ListviewControl. While redrawing is disabled then any changes to the rows or columns won't be shown in the GUI. Used to improve performance when performing lots of changes at once.

parameters

name: bool

desc: Whether to enable or disable redrawing of the GridGUI.ListviewControl.

type: bool

ScrollTo

ScrollTo(index := 0, text := "", partial := false)

Scrolls the ListView so that a given row index is visible, or so that a row with a given string is visible.

parameters

name: index

desc: The row index to ensure the viability of. If index is negative then it will count from the bottom of the ListView. If text is true then index will be where the search is started from. See GridGUI.ListviewControl.FindItem.

type: number

default: 0

name: text

desc: Ignored if left unset otherwise it is the text of the row that should be visible. See GridGUI.ListviewControl.FindItem.

type: string

default: ""

name: partial

desc: If text is true then partial is whether or not a complete match is need. See GridGUI.ListviewControl.FindItem.

type: bool

default: false

link: link

SetHeaders

SetHeaders(headers)

Sets the column titles to the ones passed in the argument headers. The number of columns after this call will be equal to the length of headers, meaning that columns will be deleted or added as needed.

parameters

name: headers

desc: An array of the new header titles to set.

type: array

SetImageList

SetImageList(ImageListID, IconType := "")

Sets or replaces an ImageList for displaying icons. See link for details.

parameters

name: ImageListID

desc: The id of an image list returned from a previous call to IL_Create().

type: number

name: IconType

desc: The type of the icons in the image list. specify 0 for large icons, 1 for small icons, and 2 for state icons. If omitted, the type of icons in the ImageList is detected automatically as large or small.

type: string

default: ""

return value

desc: If successful, LV_SetImageList() returns the ImageListID that was previously associated with the ListView (or 0 if none).

type: number

link: link

Back to top