nullschritt Posted June 30, 2013 Author Share Posted June 30, 2013 (edited) Okay, I figured out how to get the text using the included UDFS, however I am running into a small problem, it appears the user can only select the first box in the listview, when the others are clicked, they show an event, but the text is empty.Global $convolist = GUICtrlCreatelistview("0|0|1|1|2|2|3|3|4|4|5|5",230,60,633,75,$LVS_NOCOLUMNHEADER+$LVS_SHOWSELALWAYS,$LVS_EX_GRIDLINES+$LVS_EX_SNAPTOGRID+$WS_EX_CLIENTEDGE)Case $NM_CLICK ; Sent by a list-view control when the user clicks an item with the left mouse button $tInfo = DllStructCreate($tagNMITEMACTIVATE, $ilParam) _DebugPrint("$NM_CLICK" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _ "-->IDFrom:" & @TAB & $iIDFrom & @LF & _ "-->Code:" & @TAB & $iCode & @LF & _ "-->Index:" & @TAB & DllStructGetData($tInfo, "Index") & @LF & _ "-->SubItem:" & @TAB & DllStructGetData($tInfo, "SubItem") & @LF & _ "-->NewState:" & @TAB & DllStructGetData($tInfo, "NewState") & @LF & _ "-->OldState:" & @TAB & DllStructGetData($tInfo, "OldState") & @LF & _ "-->Changed:" & @TAB & DllStructGetData($tInfo, "Changed") & @LF & _ "-->ActionX:" & @TAB & DllStructGetData($tInfo, "ActionX") & @LF & _ "-->ActionY:" & @TAB & DllStructGetData($tInfo, "ActionY") & @LF & _ "-->lParam:" & @TAB & DllStructGetData($tInfo, "lParam") & @LF & _ "-->KeyFlags:" & @TAB & DllStructGetData($tInfo, "KeyFlags")) _DebugPrint(_GUICtrlListView_GetItemText($hWndFrom, DllStructGetData($tInfo, "Index"), DllStructGetData($tInfo, "SubItem")))+======================================================!===========================================================+======================================================-->Line(0069): $NM_CLICK--> hWndFrom: 0x001F1464-->IDFrom: 21-->Code: -2-->Index: 0-->SubItem: 0-->NewState: 0-->OldState: 20223216-->Changed: 0-->ActionX: 0-->ActionY: 0-->lParam: 6484824-->KeyFlags: 0+======================================================!===========================================================+======================================================-->Line(0082): Net+======================================================!===========================================================+======================================================-->Line(0069): $NM_CLICK--> hWndFrom: 0x001F1464-->IDFrom: 21-->Code: -2-->Index: -1-->SubItem: 1-->NewState: 0-->OldState: 20223216-->Changed: 0-->ActionX: 0-->ActionY: 0-->lParam: 6484824-->KeyFlags: 0+======================================================!===========================================================+======================================================-->Line(0082):+====================================================== Edited June 30, 2013 by nullschritt Link to comment Share on other sites More sharing options...
AZJIO Posted July 1, 2013 Share Posted July 1, 2013 GUICtrlRead(GUICtrlRead($ListView)) My other projects or all Link to comment Share on other sites More sharing options...
nullschritt Posted July 1, 2013 Author Share Posted July 1, 2013 GUICtrlRead(GUICtrlRead($ListView))Thanks for the response but it doesn't work, I can still only select the first column, and when I do, the whole row is returned, I'm trying to get just the element clicked on, which seems to work with my code, only I cannot select anything except the first column of each row. Link to comment Share on other sites More sharing options...
AZJIO Posted July 1, 2013 Share Posted July 1, 2013 expandcollapse popup#include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <GuiListView.au3> Opt("GUIOnEventMode", 1) Global $aElement[2], $hActive, $iInput Global $iListView, $hListView, $dummy1, $dummy2 $hGUI = GUICreate('', 450, 360) GUISetOnEvent(-3, '_Exit') $iInput = GUICtrlCreateInput("", 0, 0, 0, 0) GUICtrlSetState(-1, $GUI_HIDE) $iListView = GUICtrlCreateListView('Col 1|Col 2', 5, 5, 440, 330, BitOR($GUI_SS_DEFAULT_LISTVIEW, $LVS_REPORT, $LVS_SHOWSELALWAYS)) $hListView = GUICtrlGetHandle(-1) ; _GUICtrlListView_SetExtendedListViewStyle ($hListView, $LVS_EX_GRIDLINES, $LVS_EX_GRIDLINES) For $i = 1 To 20 $item1 = Random(10, 99, 1) $item2 = '' For $j = 1 To 9 $item2 &= Chr(Random(65, 90, 1)) ; 192, 255 - Ru Next GUICtrlCreateListViewItem($item1 & '|' & $item2, $iListView) ; создаём пункты Next GUISetState() GUIRegisterMsg(0x4E, "_WM_NOTIFY") While 1 Sleep(100000) WEnd Func _WM_NOTIFY($hWnd, $iMsg, $iwParam, $ilParam) Local $hWndFrom, $iIDFrom, $iCode, $tNMHDR $tNMHDR = DllStructCreate($tagNMHDR, $ilParam) $hWndFrom = HWnd(DllStructGetData($tNMHDR, "hWndFrom")) $iIDFrom = DllStructGetData($tNMHDR, "IDFrom") $iCode = DllStructGetData($tNMHDR, "Code") Switch $hWndFrom Case $hListView Switch $iCode Case $NM_CLICK ; двойной клик - редактируем пункт ListView Local $tInfo = DllStructCreate($tagNMITEMACTIVATE, $ilParam) ToolTip(_GUICtrlListView_GetItemText($hListView, DllStructGetData($tInfo, "Index"), DllStructGetData($tInfo, "SubItem"))) EndSwitch EndSwitch Return $GUI_RUNDEFMSG EndFunc Func _Exit() Exit EndFunc http://pastebin.com/WhPLnjRN If anything, search works at a forum My other projects or all Link to comment Share on other sites More sharing options...
nullschritt Posted July 1, 2013 Author Share Posted July 1, 2013 expandcollapse popup#include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <GuiListView.au3> Opt("GUIOnEventMode", 1) Global $aElement[2], $hActive, $iInput Global $iListView, $hListView, $dummy1, $dummy2 $hGUI = GUICreate('', 450, 360) GUISetOnEvent(-3, '_Exit') $iInput = GUICtrlCreateInput("", 0, 0, 0, 0) GUICtrlSetState(-1, $GUI_HIDE) $iListView = GUICtrlCreateListView('Col 1|Col 2', 5, 5, 440, 330, BitOR($GUI_SS_DEFAULT_LISTVIEW, $LVS_REPORT, $LVS_SHOWSELALWAYS)) $hListView = GUICtrlGetHandle(-1) ; _GUICtrlListView_SetExtendedListViewStyle ($hListView, $LVS_EX_GRIDLINES, $LVS_EX_GRIDLINES) For $i = 1 To 20 $item1 = Random(10, 99, 1) $item2 = '' For $j = 1 To 9 $item2 &= Chr(Random(65, 90, 1)) ; 192, 255 - Ru Next GUICtrlCreateListViewItem($item1 & '|' & $item2, $iListView) ; создаём пункты Next GUISetState() GUIRegisterMsg(0x4E, "_WM_NOTIFY") While 1 Sleep(100000) WEnd Func _WM_NOTIFY($hWnd, $iMsg, $iwParam, $ilParam) Local $hWndFrom, $iIDFrom, $iCode, $tNMHDR $tNMHDR = DllStructCreate($tagNMHDR, $ilParam) $hWndFrom = HWnd(DllStructGetData($tNMHDR, "hWndFrom")) $iIDFrom = DllStructGetData($tNMHDR, "IDFrom") $iCode = DllStructGetData($tNMHDR, "Code") Switch $hWndFrom Case $hListView Switch $iCode Case $NM_CLICK ; двойной клик - редактируем пункт ListView Local $tInfo = DllStructCreate($tagNMITEMACTIVATE, $ilParam) ToolTip(_GUICtrlListView_GetItemText($hListView, DllStructGetData($tInfo, "Index"), DllStructGetData($tInfo, "SubItem"))) EndSwitch EndSwitch Return $GUI_RUNDEFMSG EndFunc Func _Exit() Exit EndFunc http://pastebin.com/WhPLnjRN If anything, search works at a forum Thanks for your time to respond(it seems the only problem before was using $LVS_EX_GRIDLINES in extended style, for some reason it broke it), but this method, selects the whole row when a user clicks. Is there any way to either not highlight the clicked row, or to highlight only the selected item, not the whole row? Link to comment Share on other sites More sharing options...
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