## Package Win32::GUI::ListView

Back to the Packages

- Constructor

  - new Win32::GUI::ListView(PARENT, %OPTIONS)

- Methods

  - Add(ITEM, ITEM .. ITEM)

  - Arrange([FLAG])

  - ChangeItem(%OPTIONS)

  - Clear()

  - ColumnWidth(COLUMN, [WIDTH])

  - Count()

  - DeleteColumn(INDEX)

  - DeleteItem(INDEX)

  - EditLabel(INDEX)

  - EnsureVisible(INDEX, [FLAG])

  - GetFirstVisible()

  - GetItem(INDEX, [SUBINDEX])

  - GetStringWidth(STRING)

  - HitTest(X, Y)

  - InsertColumn(%OPTIONS)

  - InsertItem(%OPTIONS)

  - ItemCheck(INDEX)

  - ItemInfo(INDEX, [SUBINDEX])

  - ItemPosition(INDEX, [X, Y])

  - MoveItem(INDEX, X, Y)

  - Select(INDEX)

  - SelectCount()

  - SelectedItems()

  - SetImageList(IMAGELIST, [TYPE])

  - SetItem(%OPTIONS)

  - TextBkColor([COLOR])

  - TextColor([COLOR])

  - View([MODE])

  - VisibleCount()

- Events

  - ColumnClick(ITEM)

  - ItemClick(ITEM)

  - KeyDown(KEY)

### Constructor

new Win32::GUI::ListView(PARENT, %OPTIONS)

  Creates a new ListView object; can also be called as PARENT->AddListView(%OPTIONS).

### Methods

Add(ITEM, ITEM .. ITEM)

  Inserts one or more items in the control; each item must be passed as an hash reference. See InsertItem() for a list of the available key/values of these hashes.

Arrange([FLAG])

  Arranges items in the ListView; the optional FLAG parameter can be one of the following values:

        0 uses the current alignment style (this is the default)
        1 align items along the left edge of the window
        2 align items along the top edge of the window
        5 snaps icons to the nearest grid position

ChangeItem(%OPTIONS)

  [TBD]

Clear()

  Deletes all items from the ListView.

ColumnWidth(COLUMN, [WIDTH])

  Gets or sets the width of the specified COLUMN; WIDTH can be the desired width in pixels or one of the following special values:

        -1 automatically size the column
        -2 automatically size the column to fit the header text

Count()

  Returns the number of items in the ListView.

DeleteColumn(INDEX)

  [TBD]

DeleteItem(INDEX)

  Removes the zero-based INDEX item from the ListView.

EditLabel(INDEX)

  [TBD]

EnsureVisible(INDEX, [FLAG])

  [TBD]

GetFirstVisible()

  Returns the index of the first visible item in the ListView.

GetItem(INDEX, [SUBINDEX])

  See ItemInfo().

GetStringWidth(STRING)

  Returns the width, in pixels, needed to display the specified STRING in the ListView area.

HitTest(X, Y)

  Checks if the specified point in the ListView area is occupied by an item; it returns the index of the found item or zero if none was found. If called in an array context, it returns an additional value containing more info about the position of the specified point.

InsertColumn(%OPTIONS)

  [TBD]

InsertItem(%OPTIONS)

  Inserts a new item in the control. (@)OPT: -image => NUMBER (@)OPT: index of an image from the associated ImageList (@)OPT: -indent => NUMBER (@)OPT: how much the item must be indented; one unit (@)OPT: is the width of an item image, so 2 is twice (@)OPT: the width of the image, and so on. (@)OPT: -item => NUMBER (@)OPT: zero-based index for the new item; the default (@)OPT: is to add the item at the end of the list. (@)OPT: -selected => 0/1, default 0 (@)OPT: -text => STRING (@)OPT: the text for the item

ItemCheck(INDEX)

  Gets the check state of a ListView item (valid only if the control was created with the -checkboxes => 1 option).

ItemInfo(INDEX, [SUBINDEX])

  Returns an associative array of information about the given zero-based INDEX item:

          -image
          -state
          -text

  Optionally, a SUBINDEX (one-based index) can be given, to get the text for the specified column.

ItemPosition(INDEX, [X, Y])

  Moves the specified zero-based INDEX item to the specified position, or returns its current X and Y position if X and Y are not given. See also MoveItem()

MoveItem(INDEX, X, Y)

  Moves the specified zero-based INDEX item to the specified position, if the ListView is in big or small icon view mode; X and Y coordinates are relative to the ListView client area.

Select(INDEX)

  [TBD]

SelectCount()

  Returns the number of currently selected items.

SelectedItems()

  Retuns an array containing the zero-based indexes of selected items.

SetImageList(IMAGELIST, [TYPE])

  [TBD]

SetItem(%OPTIONS)

  See ChangeItem().

TextBkColor([COLOR])

  Gets or sets the background color for the text in the ListView.

TextColor([COLOR])

  Gets or sets the text color for the ListView.

View([MODE])

  Gets or sets the viewing mode of the ListView control; the returned or given MODE can have one of the following values:

        0  big icons
        1  details
        2  small icons
        3  list

VisibleCount()

  Returns the number of items that can be fully visible in a page of the ListView control; if the current view state is big or small icons, the function returns the total number of items in the control.

### Events

ColumnClick(ITEM)

  Sent when the user clicks on a column header in the ListView; ITEM specifies the one-based index of the selected column.

ItemClick(ITEM)

  Sent when the user selects an item in the ListView; ITEM specifies the zero-based index of the selected item.

KeyDown(KEY)

  Sent when the user presses a key while the ListView control has focus; KEY is the ASCII code of the key being pressed.