Jump to content

_GUICtrlListView_MapIndexToID() does not work

Recommended Posts

Hello.  Both of these don't work:



#include <GuiListView.au3>

$Form1 = GUICreate('Form1', 220, 140, 180, 200)
$ListView1 = GUICtrlCreateListView('col1|col2', 10, 10, 200, 120)


$item_0 = GUICtrlCreateListViewItem('a|b', $ListView1)
$item_1 = GUICtrlCreateListViewItem('foo|bar', $ListView1)

ConsoleWrite('0 acutal ID: ' & $item_0 & @CRLF)
ConsoleWrite('1 actual ID: ' & $item_1 & @CRLF)

$iID = _GUICtrlListView_MapIndexToID($ListView1, 0)

ConsoleWrite('MapIndexToID: ' & $iID & @CRLF)
ConsoleWrite('MapIDToIndex: ' & _GUICtrlListView_MapIDToIndex($ListView1, $iID) & @CRLF)

; Using variable returned from control creation:
ConsoleWrite('MapIDToIndex using creation var: ' & _GUICtrlListView_MapIDToIndex($ListView1, $item_0) & @CRLF)


While 1



0 acutal ID: 4
1 actual ID: 5
MapIndexToID: 0
MapIDToIndex: 0
MapIDToIndex using creation var: -1

Link to comment
Share on other sites

If you read carefully help file, you should understand that the LV ID is not the same as the AutoIt GUI ID.  The listview ID is an internal ID to track uniqueness of an item (changes can happened after deletion/creation).

But you can get the actual AutoIt GUI ID, with _GUICtrlListView_GetItemParam when you create your LV items with GUICtrlCreateListViewItem (as AutoIt assigns its own ID to the data param of the listview)

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...