Jump to content
Sign in to follow this  
zhaicheng

How to dynamically update a listview(Muti-thread)

Recommended Posts

zhaicheng

I use the Gui to create a listview and I want to update the content dynamically without affecting other operation,like clicking the button.

So I come out the idea of using "CoProc.au3" as a simulation of muti-thread operation.

However it does not seem to work.

Can anyone give me some advices on how to achive this goal?

Many thanks!

_CoProc("UpdateList", $hListView)


Func UpdateList($hListView)

    
While 1
    
    Local $aItem, $hwin, $status
    For $i = 0 To _GUICtrlListView_GetItemCount($hListView) - 1

        $aItem = _GUICtrlListView_GetItem($hListView, $i, 6)
        $hwin = HWnd($aItem[3])
        $status = ControlGetText($hwin, "", "[NAME:btnDown]")
        _GUICtrlListView_SetItem($hListView, $status, $i, 5)
    Next
    Sleep(1000)
WEnd

EndFunc   ;==>UpdateList

]

Share this post


Link to post
Share on other sites
PsaltyDS

There is no GUI and no buttons in your demo, so that won't help demonstrate your issue.

Perhaps you mean to run your update function via AdLibRegister()? See help file.

:)


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
wakillon

It 's the function for update my ListView in my it can send you on the right way ! Posted Image

Func _GUICtrlCreateListViewItems ( $_ListArray )
    If $_ListView=0 Then
        $_ListView = GUICtrlCreateListView ( "Radio|Name", 15, 20, 346, 259, BitOr ( $LVS_SINGLESEL, $LVS_SHOWSELALWAYS ), BitOr ( $LVS_EX_FULLROWSELECT, $LVS_EX_GRIDLINES ) ) 
        _GUICtrlListView_SetColumnWidth ( $_ListView, 1, $LVSCW_AUTOSIZE_USEHEADER )    
    Else
        _GUICtrlListView_DeleteAllItems ( GUICtrlGetHandle ( $_ListView ) )
        ReDim $_ListViewItem[UBound ( $_ListArray )]
    EndIf
    For $_G = 1 To UBound ( $_ListArray ) - 1
        $_ListViewItem[$_G] = GUICtrlCreateListViewItem ( StringFormat ( "%02i", $_G ) & "|" & $_ListArray[$_G], $_ListView )
    Next    
    GUICtrlSetTip ( $_ListView, "Double click for get infos about this Station" )
    $_ListViewItemMax = UBound ( $_ListArray )-1
EndFunc ;==> _GUICtrlCreateListViewItem ( )

AutoIt 3.3.14.2 X86 - SciTE 3.6.0WIN 8.1 X64 - Other Example Scripts

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  

×