Sign in to follow this  
Followers 0
Champak

_GUICtrlListView Get problem

10 posts in this topic

I know this is simple but it's flying over me. I switched from using GUICtrlCreateList to using _GUICtrlListView_Create because I needed to display two columns. The problem now is that I can't click (highlight) an element and retrieve something based on the name I highlighted....because I don't know how with this function (I couldn't figure it out in the help file). So how do I do that?...retrieve the text of the highlighted element in the first column?

Share this post


Link to post
Share on other sites



None of these (along with many many other "get" functions) work for your needs?

_GUICtrlListView_GetItemText

_GUICtrlListView_GetItemTextArray

_GUICtrlListView_GetItemTextString


Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Share this post


Link to post
Share on other sites

Ha, the ONE that I didn't look at was the one. I did the GetItemText, but that didn't work for me, and didn't do the GetItemTextArray, because of how the help said it worked...but I didn't try the GetItemTextString, and that worked sort of. It isn't really doing what I want because it is returning the whole row, but I guess I can use stringreplace I believe to fix that. So I'll go ahead and try that.

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

You can use all the functions from _guictrllistview UDF to work with the normal listview (guictrlcreatelist) by using this :

$listhndl = GUICtrlGetHandle($playlist);CHANGE THIS WITH THE HANDLE OF THE NORMAL LISTVIEW CTRL
_GUICtrlListView_GetItemCount($listhndl)

Hope it helps :) !

Edited by LIMITER

Share this post


Link to post
Share on other sites

You can use all the functions from _guictrllistview UDF to work with the normal listview (guictrlcreatelist) by using this :

$listhndl = GUICtrlGetHandle($playlist);CHANGE THIS WITH THE HANDLE OF THE NORMAL LISTVIEW CTRL
_GUICtrlListView_GetItemCount($listhndl)

Hope it helps :) !

You don't need to do that for the functions to work with the built-in control

SciTE for AutoItDirections for Submitting Standard UDFs

 

Don't argue with an idiot; people watching may not be able to tell the difference.

 

Share this post


Link to post
Share on other sites

Is there a better way of doing this?

$String = _StringReverse(_GUICtrlListView_GetItemTextString($SongListView))
            $String = _StringReverse(StringTrimLeft($String, StringInStr($String, "|", 2, 1)))

if you need to get the text from one column of the listview just use _GUICtrlListView_GetItemText. It will work if you use it correctly.


SciTE for AutoItDirections for Submitting Standard UDFs

 

Don't argue with an idiot; people watching may not be able to tell the difference.

 

Share this post


Link to post
Share on other sites

OK, I figured this way

msgbox(0,0,_GUICtrlListView_GetItemText($SongListView, _GUICtrlListView_GetSelectionMark($SongListView))

It seems to work...haven't really ran it through it's passes and scenarios, but is the the way you were referring to as the "correct" way?

Share this post


Link to post
Share on other sites

Is there a better way of doing this?

$String = _StringReverse(_GUICtrlListView_GetItemTextString($SongListView))
            $String = _StringReverse(StringTrimLeft($String, StringInStr($String, "|", 2, 1)))
Do you have an actual example string without the "_StringReverse"?

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Share this post


Link to post
Share on other sites

#10 ·  Posted (edited)

I don't know what you mean, but what I did in post 8 is working well for me...and it is without "_StringReverse". Thanks.

_GUICtrlListView_GetItemText($SongListView, _GUICtrlListView_GetSelectionMark($SongListView))

...Unless I shouldn't be doing it like this.?.?.

Edited by Champak

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