Jump to content
Sign in to follow this  
notsure

GuiCtrlListview [selected item?]

Recommended Posts

notsure

Hello,

I'm having some problems using the Listview. It is not a very easy component to use in a GUI, i discovered.

The helpfile says this;

Do
        $msg = GUIGetMsg()

        Select
            Case $msg = $button
                MsgBox(0, "listview item", GUICtrlRead(GUICtrlRead($listview)), 2)
            Case $msg = $listview
                MsgBox(0, "listview", "clicked=" & GUICtrlGetState($listview), 2)
        EndSelect
    Until $msg = $GUI_EVENT_CLOSE

To retrieve the value's from the selected listview item. Is it also possible to instantly retrieve the info when clicking in the listview itself (on an item)?

If i try to do that, I'd assume to use "case $msg = $listview", but that only works for clicking the columns and such. Not for the items inside the listview. It's not easy to point to an item using an "index" because i'm filling the listview by reading a SQL database into it.

Can anyone explain this? Should be possible IMO.

Thanks in advance.

Share this post


Link to post
Share on other sites
notsure

Also, i'm trying to figure out whether its possible to act when a certain text is dropped into a textbox...

if i use this;

While 1
$nMsg = GUIGetMsg()

Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit

Case $txtSource
;--code--

WEnd

and i drop text (from the listview into the textbox) it will only react when I focus another object in the form, not immediately when I drop it into the textbox... I can't figure out this behaviour.

edit:

Got that working now;

$nMsg = GUIGetMsg()

Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $GUI_EVENT_DROPPED
if @GUI_DROPID = 8 Then
msgbox(1,"", "source")
elseif @GUI_DROPID = 9 Then
msgbox(1,"", "Dest")
EndIf


EndSwitch
Edited by notsure

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  

×