Sign in to follow this  
Followers 0
yakir

help in ListView

2 posts in this topic

#1 ·  Posted (edited)

im trying to get the Handle into a $RsH but i can only get the Title

$listView = GuiCtrlCreateListView("Title|Handle", 0, 0, 100, 80)

#include <GuiConstantsEx.au3>
#include <GuiListView.au3>

GuiCreate("Sample GUI", 250, 200)
$ref = GUICtrlCreateButton("ref",20,90,80,20)
$hSrProxy = GUICtrlCreateButton("Hide SrProxy", 120, 20, 80, 20)
$hAGbot = GUICtrlCreateButton("Hide SGbot", 120, 160, 80, 20)
$listView = GuiCtrlCreateListView("Title|Handle", 0, 0, 100, 80)
$listView2 = GuiCtrlCreateListView("Title|Handle", 0, 120, 100, 80)
GuiSetState()
Do
    $msg = GUIGetMsg()
    Switch $msg
    Case $ref
            $var = WinList("SrProxy")
            $var2 = winList ("Google - ")
             _GUICtrlListView_DeleteAllItems($listView)
             _GUICtrlListView_DeleteAllItems($listView2)
            For $i = 1 to $var[0][0]
                If $var[$i][0] <> "" AND IsVisible($var[$i][1]) Then
                    GuiCtrlCreateListViewItem($var[$i][0] & " | " & $var[$i][1], $listView)
                EndIf
            Next
            For $i = 1 to $var2[0][0]
                If $var2[$i][0] <> "" AND IsVisible($var2[$i][1]) Then
                    GuiCtrlCreateListViewItem($var2[$i][0] & " | " & $var2[$i][1], $listView2)
                EndIf
            Next
        Case $hSrProxy
            MsgBox(0,"","you prass")
            $SrH = _GUICtrlListView_GetItemText($ListView ,_GUICtrlListView_GetSelectedIndices($ListView,1))
            MsgBox(0,"",$SrH)
        Case $GUI_EVENT_CLOSE
            ExitLoop
        EndSwitch
Until False


Func IsVisible($handle)
  If BitAnd( WinGetState($handle), 2 ) Then 
    Return 1
  Else
    Return 0
  EndIf

EndFunc

how can i take the date from the Handle col

i can only get the date from the Title useing :

$SrH = _GUICtrlListView_GetItemText($ListView ,_GUICtrlListView_GetSelectedIndices($ListView,1))

pls help ~_~

btw im NEW in this autoit and it my first time i try it to

Edited by yakir

Share this post


Link to post
Share on other sites



The function _GUICtrlListView_GetSelectedIndices($listView, 1) returns an array because you set $fArray = 1 in the second parameter. If you were using multi-select, this would display all the handle items:

$aSelections = _GUICtrlListView_GetSelectedIndices($listView, 1)
            For $n = 1 To $aSelections[0]
                $SrH = _GUICtrlListView_GetItemText($listView, $aSelections[$n], 2)
                MsgBox(0, "", $SrH)
            Next

But, by default $LVS_SINGLESEL style is used and there should only be one selection, so you could go with this:

$aSelections = _GUICtrlListView_GetSelectedIndices($listView, 1)
            If $aSelections[0] > 0 Then 
                $SrH = _GUICtrlListView_GetItemText($listView, $aSelections[1], 2)
                MsgBox(0, "", $SrH)
            EndIf

Note the sub-item index = 2 for the handle (second column) in _GUICtrlListView_GetItemText().

:D


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