guiAI Posted June 19, 2009 Posted June 19, 2009 Can anyone explain why _GUICtrlListView_GetItemText() returns nothing?#include <GUIConstantsEx.au3> #include <ListViewConstants.au3> #include <GuiListView.au3> #include <WindowsConstants.au3> GUICreate("listview items", 225, 200) $listview = GUICtrlCreateListView("col1|col2|col3", 10, 10, 200, 150) GUICtrlSendMsg(-1, 0x101E, 0, 50) GUICtrlSendMsg(-1, 0x101E, 1, 50) GUICtrlSendMsg(-1, 0x101E, 2, 50) $listview_0 = GUICtrlCreateListViewItem("item1|col12|col13", $listview) $listview_1 = GUICtrlCreateListViewItem("item2|col22|col23", $listview) $listview_2 = GUICtrlCreateListViewItem("item3|col32|col33", $listview) $listviewcontext = GUICtrlCreateContextMenu($listview) $MenuItem1 = GUICtrlCreateMenuItem("ContextItem1", $listviewcontext) GUISetState() While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $MenuItem1 $ind = _GUICtrlListView_GetSelectedIndices($listview) $item = _GUICtrlListView_GetItemText($listview, $ind) MsgBox(0, "Listview item", "Index: " & $ind & @CRLF & "Item: " & $item) EndSwitch WEnd guiAI
99ojo Posted June 19, 2009 Posted June 19, 2009 Can anyone explain why _GUICtrlListView_GetItemText() returns nothing? #include <GUIConstantsEx.au3> #include <ListViewConstants.au3> #include <GuiListView.au3> #include <WindowsConstants.au3> GUICreate("listview items", 225, 200) $listview = GUICtrlCreateListView("col1|col2|col3", 10, 10, 200, 150) GUICtrlSendMsg(-1, 0x101E, 0, 50) GUICtrlSendMsg(-1, 0x101E, 1, 50) GUICtrlSendMsg(-1, 0x101E, 2, 50) $listview_0 = GUICtrlCreateListViewItem("item1|col12|col13", $listview) $listview_1 = GUICtrlCreateListViewItem("item2|col22|col23", $listview) $listview_2 = GUICtrlCreateListViewItem("item3|col32|col33", $listview) $listviewcontext = GUICtrlCreateContextMenu($listview) $MenuItem1 = GUICtrlCreateMenuItem("ContextItem1", $listviewcontext) GUISetState() While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $MenuItem1 $ind = _GUICtrlListView_GetSelectedIndices($listview) $item = _GUICtrlListView_GetItemText($listview, $ind) MsgBox(0, "Listview item", "Index: " & $ind & @CRLF & "Item: " & $item) EndSwitch WEndHi, set in your Case Statement $Menuitem1 $ind = Number (_GUICtrlListView_GetSelectedIndices($listview)) then it should work. ;-)) Stefan
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now