Sign in to follow this  
Followers 0
Cheblon

How do you retrieve the index number of a selected item in a created list

8 posts in this topic

I need to get the index number of a selected item in a list box. The list box is created by me and so for some reason the command ControlListView doesnt seem to work.

GUICtrlRead works but only returns the value in the list and not the index number of that item.

Any help is great, thanks.

Share this post


Link to post
Share on other sites



thanks, i will try this out :mellow:

Share this post


Link to post
Share on other sites

It worked but now it no longer responds to the list item changing.

I am using the method below to check for the item change:

while 1
$nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $lstSUname     
        MsgBox(0,"",_GUICtrlListView_GetSelectedIndices($lstSUname))
EndSwitch
WEnd

I am new to user functions so if there is another way of checking the item change please say

Thanks again

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

It worked but now it no longer responds to the list item changing.

I am using the method below to check for the item change:

while 1
$nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $lstSUname     
        MsgBox(0,"",_GUICtrlListView_GetSelectedIndices($lstSUname))
EndSwitch
WEnd

I am new to user functions so if there is another way of checking the item change please say

Thanks again

If it's a list box you are using then look at the example in the help for

_GUICtrlListBox_GetSelItems

If it's a Listview then you have a parameter missing in _GUICtrlListView_GetSelectedIndices, see the help.

Edited by martin

Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.

Share this post


Link to post
Share on other sites

I am using a ListView. Is there a way to check when the selection has been changed?

Share this post


Link to post
Share on other sites

#7 ·  Posted (edited)

I am using a ListView. Is there a way to check when the selection has been changed?

Look at the example for _GUICtrlListView_Create(). Run this in Scite, if you don't have Scite, get it. Down at the bottom you will see message pop up everytime you click an item on the listivew. You can change that code to do whatever you want to.

Edit: Scite

Edited by Ichigo

My Programs[list][*]Knight Media Player[*]Multiple Desktops[*]Daily Comics[*]Journal[/list]

Share this post


Link to post
Share on other sites

thank you, all works now :mellow:

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