Jump to content

[Solved]_Listview delete & recreate items Q


Recommended Posts

Well i tried destroy, removing all items 1 by 1, removing all at once & I always get the same result: After I delete all items & the hit List Windows, it lists all window handles in the First column, but it should list also Window titles in column 2

Hit List Windows

Hit Clear

Hit List Windows Again

Hire is Script Sample: Any ideas?

#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <ListBoxConstants.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <GuiListView.au3>

#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Show / Hiew Window tool", 690, 560, 273, 184)
$Button3 = GUICtrlCreateButton("List Windows", 112, 520, 75, 25, 0)
$Button4 = GUICtrlCreateButton("clear", 16, 520, 75, 25, 0)
 
         $hListView = _GUICtrlListView_Create ($Form1, "", 2, 2, 600, 500)
         _GUICtrlListView_SetExtendedListViewStyle ($hListView, BitOR($LVS_EX_FULLROWSELECT, $LVS_EX_SUBITEMIMAGES))

        ; Add columns
        _GUICtrlListView_AddColumn ($hListView, "Handle", 80)
        _GUICtrlListView_AddColumn ($hListView, "Title", 500)

GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

$row = 0 ; Row 0
While 1
    $nMsg = GUIGetMsg()
    Sleep(10)
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit

;~ ========================================================
        Case $Button3   ; List Wondows
            $var = WinList()
                For $i = 1 to $var[0][0]
                    If $var[$i][0] <> "" Then               
                        _GUICtrlListView_AddItem ($hListView, $var[$i][1], $row)                    ;$var[$i][1] = [Rownr][Column2]
                        _GUICtrlListView_AddSubItem ($hListView, $row, $var[$i][0] , 1)             ;Col 2
                        $row = $row + 1
                  EndIf
              Next
;~ ========================================================
              
          Case $Button4     ;Clear list
          _GUICtrlListView_DeleteAllItems($hListView)

;~ ========================================================
    EndSwitch
WEnd
Edited by goldenix
My Projects:[list][*]Guide - ytube step by step tut for reading memory with autoitscript + samples[*]WinHide - tool to show hide windows, Skinned With GDI+[*]Virtualdub batch job list maker - Batch Process all files with same settings[*]Exp calc - Exp calculator for online games[*]Automated Microsoft SQL Server 2000 installer[*]Image sorter helper for IrfanView - 1 click opens img & move ur mouse to close opened img[/list]
Link to comment
Share on other sites

You have to reset $row when deleting all items. Although I don't think you need that variable at all.

Yes its not needed & Finally, Its working.

Thank you.

EDIT: No no I dont know how it worked after I removed $row(must have been magic), it must be there. But as you said, all was needed was to reset $row back to 0. th is solves all

Edited by goldenix
My Projects:[list][*]Guide - ytube step by step tut for reading memory with autoitscript + samples[*]WinHide - tool to show hide windows, Skinned With GDI+[*]Virtualdub batch job list maker - Batch Process all files with same settings[*]Exp calc - Exp calculator for online games[*]Automated Microsoft SQL Server 2000 installer[*]Image sorter helper for IrfanView - 1 click opens img & move ur mouse to close opened img[/list]
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...