Glyph Posted August 8, 2008 Share Posted August 8, 2008 Dim $item $item = _ArrayCreate("People");0 _ArrayAdd($item, _GUICtrlListView_AddItem($listview, $splitdata[2], 0)) While 1 $msg = GUIGetMsg() For $x = 1 To UBound($item) - 1 If $msg = $item[$x] Then MsgBox(0, UBound($item) - 1, $x) Next wend basically, this works for my treeview code, but not my listview. Does anyone know a way to make it so when you right click on a listview item, it will perform an action (make a box appear with options)? my treeview one is set up where if you left click it executes the directory of the item, basically if $msg = $item[$x] then do action. Thank's for reading, hope you can help! tolle indicium Link to comment Share on other sites More sharing options...
DirtDBaK Posted August 8, 2008 Share Posted August 8, 2008 Well I know for some controls the $SS_NOTIFY will tell the GUIRegisterMsg there was a change I know it works with List, Sliders, Pictures, and I think Labels... For Example $list = GuiCtrlCreateList("",0,0,100,100,$SS_NOTIFY) While 1 $msg = GUIGetMsg() if $msg = $list then MsgBox(0,"Change","List value was changed or clicked") wend I know for a fact that with a listview $SS_NOTIFY will return if you click the column name to allow sorting.. So I know that doesn't help too much, but if you can use a list not a listview it should work the way you want. I am using 3.2.8.1, I stay in the stone age so I don't know half the new listview changes, they were script breaking so I stopped updating autoit. I hope this will help you out a little [center][/center] Link to comment Share on other sites More sharing options...
Oldschool Posted August 8, 2008 Share Posted August 8, 2008 http://www.autoitscript.com/forum/index.php?showtopic=77864 Link to comment Share on other sites More sharing options...
Glyph Posted August 9, 2008 Author Share Posted August 9, 2008 http://www.autoitscript.com/forum/index.php?showtopic=77864 I'm looking for if item is clicked, not click item for me. dbak's post is exactly what im looking for! Unfortunatly though... I need the listview, and not list. I tried $ssnotify like this, and it didn't work... $listview = GUICtrlCreateListView("ID|Username", 210, 30, $guiw - 215, $guih - 75, "", BitOR($LVS_EX_DOUBLEBUFFER, $LVS_EX_GRIDLINES,$SS_NOTIFY)) For $x = 1 To UBound($item) - 1 If $msg = $item[$x] Then MsgBox(0, UBound($item) - 1, $x) Next all it does is keep popping up the messagebox when the listview item appears, rathar then appearing when I click it... tolle indicium Link to comment Share on other sites More sharing options...
Nahuel Posted August 9, 2008 Share Posted August 9, 2008 Try this. Right-click, double click, simple click, return key, any key, column click, etc expandcollapse popup#include <GuiConstantsEx.au3> #include <GuiListView.au3> #include <GuiImageList.au3> #include <WindowsConstants.au3> Global $hListView GUICreate("Listview example", 382, 447, 193, 125) $hListView = GUICtrlCreateListView("Testing", 40, 48, 297, 353) GUICtrlCreateListViewItem("This is one listview item",$hListView) GUICtrlCreateListViewItem("This is another listview item",$hListView) GUICtrlCreateListViewItem("This is a really cool listview item",$hListView) $Label1 = GUICtrlCreateLabel("Doble click something...", 40, 24, 117, 17) GUISetState(@SW_SHOW) GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY");Here's the trick While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd Func WM_NOTIFY($hWnd, $iMsg, $iwParam, $ilParam) #forceref $hWnd, $iMsg, $iwParam Local $hWndFrom, $iIDFrom, $iCode, $tNMHDR, $hWndListView, $tInfo ;~ Local $tBuffer $hWndListView = $hListView;Add the listview's handle here If Not IsHWnd($hListView) Then $hWndListView = GUICtrlGetHandle($hListView) $tNMHDR = DllStructCreate($tagNMHDR, $ilParam) $hWndFrom = HWnd(DllStructGetData($tNMHDR, "hWndFrom")) $iIDFrom = DllStructGetData($tNMHDR, "IDFrom") $iCode = DllStructGetData($tNMHDR, "Code") Switch $hWndFrom Case $hWndListView Switch $iCode Case $LVN_COLUMNCLICK ; A column was clicked $tInfo = DllStructCreate($tagNMLISTVIEW, $ilParam) MsgBox(0,"Info","$LVN_COLUMNCLICK" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _ "-->IDFrom:" & @TAB & $iIDFrom & @LF & _ "-->Code:" & @TAB & $iCode & @LF & _ "-->Item:" & @TAB & DllStructGetData($tInfo, "Item") & @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 & _ "-->Param:" & @TAB & DllStructGetData($tInfo, "Param")) Case $LVN_KEYDOWN ; A key has been pressed $tInfo = DllStructCreate($tagNMLVKEYDOWN, $ilParam) MsgBox(0,"Info","$LVN_KEYDOWN" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _ "-->IDFrom:" & @TAB & $iIDFrom & @LF & _ "-->Code:" & @TAB & $iCode & @LF & _ "-->VKey:" & @TAB & DllStructGetData($tInfo, "VKey") & @LF & _ "-->Flags:" & @TAB & DllStructGetData($tInfo, "Flags")) Case $NM_CLICK ; Sent by a list-view control when the user clicks an item with the left mouse button ;Uncomment for one-click actions ;~ $tInfo = DllStructCreate($tagNMITEMACTIVATE, $ilParam) ;~ MsgBox(0,"Info","$NM_CLICK" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _ ;~ "-->IDFrom:" & @TAB & $iIDFrom & @LF & _ ;~ "-->Code:" & @TAB & $iCode & @LF & _ ;~ "-->Index:" & @TAB & DllStructGetData($tInfo, "Index") & @LF & _ ;~ "-->TEXT:" & _GUICtrlListView_GetItemText($hListView,DllStructGetData($tInfo, "Index") ) ;~ "-->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")) ; No return value Case $NM_DBLCLK ; Sent by a list-view control when the user double-clicks an item with the left mouse button $tInfo = DllStructCreate($tagNMITEMACTIVATE, $ilParam) MsgBox(0,"Info","$NM_DBLCLK" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _ "-->IDFrom:" & @TAB & $iIDFrom & @LF & _ "-->Code:" & @TAB & $iCode & @LF & _ "-->Index:" & @TAB & DllStructGetData($tInfo, "Index") & @LF & _ "-->TEXT:" & _GUICtrlListView_GetItemText($hWndFrom,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")) Case $NM_RCLICK ; Sent by a list-view control when the user clicks an item with the right mouse button $tInfo = DllStructCreate($tagNMITEMACTIVATE, $ilParam) MsgBox(0,"Info","$NM_RCLICK" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _ "-->IDFrom:" & @TAB & $iIDFrom & @LF & _ "-->Code:" & @TAB & $iCode & @LF & _ "-->Index:" & @TAB & DllStructGetData($tInfo, "Index") & @LF & _ "-->TEXT:" & _GUICtrlListView_GetItemText($hWndFrom,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")) ;Return 1 ; not to allow the default processing Return 0 ; allow the default processing Case $NM_RDBLCLK ; Sent by a list-view control when the user double-clicks an item with the right mouse button $tInfo = DllStructCreate($tagNMITEMACTIVATE, $ilParam) MsgBox(0,"Info","$NM_RDBLCLK" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _ "-->IDFrom:" & @TAB & $iIDFrom & @LF & _ "-->Code:" & @TAB & $iCode & @LF & _ "-->Index:" & @TAB & DllStructGetData($tInfo, "Index") & @LF & _ "-->TEXT:" & _GUICtrlListView_GetItemText($hListView,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")) ; No return value Case $NM_RETURN ; The control has the input focus and that the user has pressed the ENTER key MsgBox(0,"Info","$NM_RETURN" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _ "-->IDFrom:" & @TAB & $iIDFrom & @LF & _ "-->TEXT:" & _GUICtrlListView_GetItemText($hListView,DllStructGetData($tInfo, "Index") ) & @LF & _ "-->Code:" & @TAB & $iCode) ; No return value EndSwitch EndSwitch Return $GUI_RUNDEFMSG EndFunc ;==>WM_NOTIFY And... well I made this from the help file, by the way. Look at _GuiCtrlListview_Create() 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