Jump to content
Sign in to follow this  
FireLord

Problem with Listview

Recommended Posts

FireLord

How do I get all the listview items from a listview in another window put into my listview in my program?


[center]See the Helpfile[/center]
While Alive()
	 DrinkWine();
}
[center][/center]

Share this post


Link to post
Share on other sites
Paulie

How do I get all the listview items from a listview in another window put into my listview in my program?

Shouldn't be too hard if you can get the ControlID of the original listview.

_GUICtrlListViewCopyItems($SourceID, $NewID)

Share this post


Link to post
Share on other sites
FireLord

Shouldn't be too hard if you can get the ControlID of the original listview.

_GUICtrlListViewCopyItems($SourceID, $NewID)

I got the handle for the listview control in the other listview and when I go to

copy the items it creates one blank listview item. Here's my code:

Global $Listview

Case $msg = $Find
$Listview = ControlGetHandle("Find", "", "[CLASS:Listbox; INSTANCE:1]" )
                    _GUICtrlListViewCopyItems($Listview, $sListview)
Case $msg = $RefreshButton
; I also use a Refresh button to update the listview in my program.
Refresh()

Func Refresh()
_GUICtrlListViewDeleteAllItems($sListview)
    GUICtrlCreateListViewItem($Listview, $sListview)
EndFunc

It doesn't work though. Just creates a blank line in my listview. :P

Edited by FireLord

[center]See the Helpfile[/center]
While Alive()
	 DrinkWine();
}
[center][/center]

Share this post


Link to post
Share on other sites
Paulie

Heres an example:

#Include <GuiConstants.au3>
#include <GUIListView.au3>
Opt('GuiOnEventMode',1)

$Gui1 = GUiCreate("Window 1", 300, 400,@Desktopwidth/2-150,-1)
$List1 =GUICtrlCreateListView("1",0,0,300,400,BitOr($LVS_ShowSelAlways, $LVS_Report))
For $i = 1 to 10
    GUICtrlCreateListViewItem($i, $List1)
Next
GUISetState(@SW_Show, $Gui1)

$Gui2 = GUiCreate("Window 2", 300, 500, @DesktopWidth/2+150,-1)
$List2 =GUICtrlCreateListView("1",0,0,300,400)
$Button = GuiCtrlCreateButton("Update", 100, 433, 100, 33)
GuiCtrlSetOnEvent(-1, "Update")
GUISetState(@SW_Show, $Gui2)

While 1
    Sleep(100)
WEnd

Func Update()
_GUICtrlListViewCopyAllItems($List1,$List2)
EndFunc

Func _GUICtrlListViewCopyAllItems($Source, $New)
    _GUICtrlListViewSetItemSelState($Source,-1)
    _GUICtrlListViewCopyItems($Source,$New)
EndFunc

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  

×