Jump to content

[Question] ListView Search


Recommended Posts

Hello Here is my script ----> questions after script

#include <GUIConstants.au3>
#Include <Misc.au3>
#include <EditConstants.au3>
#include <ButtonConstants.au3>
#include <GuiConstantsEx.au3>
#include <WindowsConstants.au3>
#include <GuiListView.au3>
#include <ListViewConstants.au3>
#include <GUIConstantsEx.au3>
#include <ListviewConstants.au3>


Dim $N = False
GuiCreate("Freeze Me", 200,230)
$myedit = GUICtrlCreateListView("         [Procces List]           ", 10, 10, 180, 150)
$list = ProcessList()
$d = 1
$Check = GUICtrlCreateButton("Refresh List", 10, 165, 100, 25)
for $i = 1 to $list[0][0]
    $s1 = GUICtrlCreateListViewItem($list[$i][0],$myedit)
    $d = $d + 1
next
While 1
    GUISetState()
    $msg = GUIGetMsg()
    If $msg = $GUI_EVENT_CLOSE Then
        Exit
    EndiF
    If $msg = $Check Then
    $myedit = GUICtrlCreateListView("         [Procces List]           ", 10, 10, 180, 150)
    for $i = 1 to $list[0][0]
    $s1 = GUICtrlCreateListViewItem($list[$i][0],$myedit)
    $d = $d + 1
Next
EndIf
WEnd

How to search if process exist w/o using "ProcessExist" command but with read from the list view ty.

Edited by Cha0sBG

Have Questions About GUI (Graphical User Interface) ? Post Them Here :GUI Help And Support ForumHave Questions About General AutoIt ? Post Them Here : General Help And Support ForumNew To AutoIt ? Be Shure To Check Out The FaQ's (Frequently Asked Questions) Or FaQ ¹ There You May Find Great Help That Will Guide You True The Wonderful Programming Language AutoItOthere Good Place To Get Some Knolage Of AutoIt Is The Example Script ForumNotice A Bug ? Please Go And Report it At Bug Report Section And Help The Devolepers Of AutoIt Update And Fix The Programming LanguageWant To Thank The People For This Great Forum And Programming Language ? Then DonateWhen You Found The Answer Your Looking For Please Add [Resolved] To The Thread's Name That Will Show Otheres That You Have Found What Your Looking For And They Whount Have To Enter The Thread.

Link to comment
Share on other sites

Anyone got an idea ?

Have Questions About GUI (Graphical User Interface) ? Post Them Here :GUI Help And Support ForumHave Questions About General AutoIt ? Post Them Here : General Help And Support ForumNew To AutoIt ? Be Shure To Check Out The FaQ's (Frequently Asked Questions) Or FaQ ¹ There You May Find Great Help That Will Guide You True The Wonderful Programming Language AutoItOthere Good Place To Get Some Knolage Of AutoIt Is The Example Script ForumNotice A Bug ? Please Go And Report it At Bug Report Section And Help The Devolepers Of AutoIt Update And Fix The Programming LanguageWant To Thank The People For This Great Forum And Programming Language ? Then DonateWhen You Found The Answer Your Looking For Please Add [Resolved] To The Thread's Name That Will Show Otheres That You Have Found What Your Looking For And They Whount Have To Enter The Thread.

Link to comment
Share on other sites

Cha0sBG

Example:

#include <GUIConstants.au3>
#Include <Misc.au3>
#include <EditConstants.au3>
#include <ButtonConstants.au3>
#include <GuiConstantsEx.au3>
#include <WindowsConstants.au3>
#include <GuiListView.au3>
#include <ListViewConstants.au3>

Dim $N = False

$hGUI = GuiCreate("Freeze Me", 200,230)

$hListView = GUICtrlCreateListView("         [Procces List]           ", 10, 10, 180, 150)

$list = ProcessList()

$d = 1

$Check = GUICtrlCreateButton("Refresh List", 10, 165, 75, 25)

$Find = GUICtrlCreateButton("Find", 118, 165, 75, 25)

for $i = 1 to $list[0][0]
    $s1 = GUICtrlCreateListViewItem($list[$i][0],$hListView)
    $d = $d + 1
next

GUISetState()

While 1
    $msg = GUIGetMsg()
    Switch $msg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $Check
            _Refresh()
        Case $Find
            _FindItem()
    EndSwitch
WEnd

Func _Refresh()
    Local $list, $i
    
    _GUICtrlListView_DeleteAllItems($hListView)
    
    $list = ProcessList()
    
    For $i = 1 to $list[0][0]
        $s1 = GUICtrlCreateListViewItem($list[$i][0],$hListView)
    Next
EndFunc

Func _FindItem()
    Local $iText = InputBox("Searching...", "Type item text which you want to find", "", "", -1, -1, -1, -1, 0, $hGUI)
    If $iText = "" Then Return False
    
    Local $iItem = _GUICtrlListView_FindText($hListView, $iText, -1, False)
    If $iItem = -1 Then Return False
    
    _GUICtrlListView_SetItemSelected($hListView, $iItem, True, True)
    _GUICtrlListView_ClickItem($hListView, $iItem)
EndFunc
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...