Jump to content

Problem with Listview


FireLord
 Share

Recommended Posts

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)

Link to comment
Share on other sites

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]
Link to comment
Share on other sites

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
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...