Sign in to follow this  
Followers 0
domFr87

_GUICtrlListBox_SetItemData

2 posts in this topic

Hello, this UDF is driving me mad, I'm looking for a little help if someone knows it .. no answers given from the search tool so I'll just ask my questions.

For $k = 1 To $aPlayers[0]
            $temp = $players[$k]
            _GUICtrlListBox_AddString($hListBox, $temp[1])
            _GUICtrlListBox_SetItemData($hListBox, $k-1, $thisvalueisdrivingmemad)
Next

Then

$itemSelected = _GUICtrlListBox_GetItemData($hListBox, _GUICtrlListBox_GetCurSel($hListBox))
ConsoleWrite($itemSelected[1]&@CRLF)

Ideally, I would like to associate for each item in my list box, the array $players[$k] (first item, index 0, array players[1], and so on....)

If I put $thisvalueisdrivingmemad = 1234 as in the example for that UDF ..I get 1234 as display in Console for the FIRST item selected, the rest returns 0 (though the SetItemData is in a loop...)

If I put $thisvalueisdrivingmemad = "this is a test" ... the return is always 0

If I put an array in $thisvalueisdrivingmemad then it just crashes saying itemSelected isn't an array.

So the $iValue we find in the UDF help is mandatory to be an integer ? and more than that we can't fill them with a loop ...? Any idea?

Share this post


Link to post
Share on other sites



Item data is an application specific integer, not a string. It doesn't mean the text of the item. When you use a string as an integer in AutoIt, it generally tries to recast your data as an integer, but "this is a test" is cast as 0 because it is not a valid numeric string like "123".

:graduated:


Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

Share this post


Link to post
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
Sign in to follow this  
Followers 0