Home

Awesome

Class LV_Rows

Additional functions for AHK ListView controls

AHK version: 1.1.23.01

This class provides an easy way to add functionalities to ListViews that are not supported by AutoHotkey built-in functions such as Copy, Cut, Paste, Drag and more.

Credits

LV_EX functions by just me

Edit Functions

History Functions

Group Functions

Management Functions


Usage

You can call the function by preceding them with LV_Rows. For example: LV_Rows.Copy() <-- Calls function on active ListView.

Or with a handle initialized via New meta-function. For example: MyListHandle := New LV_Rows() <-- Creates a new handle. MyListHandle.Add() <-- Calls function for that Handle.

Like AutoHotkey built-in functions, these functions operate on the default gui, and active ListView control. When usingle handles, SetHwnd will attempt to set the selected ListView as active, but it's recommend to call Gui, Listview on your script too.

Initializing is required for History and Group functions and in case your ListView has icons to be moved during Drag(). Gui, Add, ListView, hwndhLV, Columns MyListHandle := New LV_Rows(hLV) <-- Creates a new handle with Hwnd.

Gui, Add, ListView, hwndhLV1, Columns Gui, Add, ListView, hwndhLV2, Columns MyListHandle := New LV_Rows(hLV1, hLV2)

You can also use the same handle for the Edit functions. You can create more handles or pass the ListView's Hwnd to operate on different lists with the same handle.


Management Functions

Set, Insert and Remove ListView Hwnd's.

Handle.InsertHwnd()

Inserts one or more ListView Hwnd's to be managed.

Return

No return value.

Parameters

Handle.RemoveHwnd()

Removes a ListView Hwnd.

Return

No return value.

Parameters

Handle.SetHwnd()

Selects a previously inserted ListView or adds it to the handle and selects it, optionally copying the data, history and groups from another Hwnd.

Return

No return value.

Parameters

Handle.GetData()

Retrieves the data, history and groups of a previously inserted ListView.

Return

An object with data, history and groups of a ListView.

Parameters

Handle.SetData()

Retrieves the data, history and groups of a previously inserted ListView.

Return

No return value.

Parameters

LV_Rows.SetCallback()

Sets a callback function where the user can take actions based on the function being called called. The Callback function must return true for the operation to be completed.

Return

No return value.

Parameters

Edit Functions

Edit ListView rows.

LV_Rows.Copy()

Copy selected rows to memory.

Return

Number of copied rows.

Parameters

LV_Rows.Cut()

Copy selected rows to memory and delete them.

Return

Number of copied rows.

Parameters

LV_Rows.Paste()

Paste copied rows at selected position.

Return

True if memory contains data or false if not.

Parameters

LV_Rows.Duplicate()

Duplicates selected rows.

Return

Number of duplicated rows.

LV_Rows.Delete()

Delete selected rows.

Return

Number of removed rows.

LV_Rows.Move()

Move selected rows down or up.

Return

Number of rows moved.

Parameters

LV_Rows.Drag()

Drag-and-Drop selected rows showing a destination bar. Must be called in the ListView G-Label subroutine when A_GuiEvent returns "D" or "d".

Return

The destination row number.

Parameters

History Functions

Keep a history of ListView changes and allow Undo and Redo. These functions operate on the currently selected ListView.

Handle.Add()

Adds an entry on History. This function requires initializing: MyListHandle := New LV_Rows()

Return

The total number of entries in history.

Parameters

Handle.Undo()

Replaces ListView contents with previous entry state, if any.

Return

New entry position or false if it's already the first entry.

Handle.Redo()

Replaces ListView contents with next entry state, if any.

Return

New entry position or false if it's already the last entry.

Handle.ClearHistory()

Removes all history entries from the ListView.

Return

New entry position or false if it's already the last entry.

Group Functions

Set, add and remove Listview Groups. These functions are based on just me's LV_EX library

Handle.EnableGroups()

Enables or disables Groups in the currently selected ListView initializing: MyListHandle := New LV_Rows()

Return

No return value.

Parameters

Handle.InsertGroup()

Inserts or renames a group on top of the specified row.

Return

TRUE if Row is bigger than 0 or FALSE otherwise.

Parameters

Handle.RemoveGroup()

Removes the group the indicated row belongs to.

Return

TRUE if Row is bigger than 0 or FALSE otherwise.

Parameters

Handle.InsertAtGroup()

Inserts a row at indicated position, moving groups after it one row down.

Return

No return value.

Parameters

Handle.RemoveAtGroup()

Removes a row from indicated position, moving groups after it one row up.

Return

No return value.

Parameters

Handle.SetGroups()

Sets one or more groups in the selected ListView.

Return

No return value.

Parameters

Handle.GetGroups()

Returns a string or object representing the current groups in the selected ListView.

Return

No return value.

Parameters

Handle.SetGroupCollapisable()

Enables or disables Groups Collapsible style.

Return

No return value.

Parameters

Handle.RemoveAllGroups()

Removes all groups in the selected ListView.

Return

No return value.

Parameters

Handle.CollapseAll()

Collapses or expands all groups.

Return

No return value.

Parameters

Handle.RefreshGroups()

Reloads the ListView to update groups. This function is called automatically in from other functions, usually it's not necessary to use it in your script.

Return

No return value.

Parameters