Wb-FreeKill Posted October 6, 2005 Posted October 6, 2005 How can i detect if the user RIGHT-click on an item in a listview? and is it possible to create a ContextMenu for that specific item if rightclicked? The reason i ask is that i add a 1000 files in a listview with contextmenu on each item, it takes so much longer thx for any help!
Danny35d Posted October 6, 2005 Posted October 6, 2005 Try something like this: While 1 ;Main Loop $msg = GUIGetMsg() If $msg = $GUI_EVENT_CLOSE Then Exit If $msg = $GUI_EVENT_SECONDARYDOWN Then MsgBox(0, '', 'Right Click') EndIf If $msg = $GUI_EVENT_PRIMARYDOWN Then MsgBox(0, '', 'Left Click') EndIf WEnd Exit Hope this help.... AutoIt Scripts:NetPrinter - Network Printer UtilityRobocopyGUI - GUI interface for M$ robocopy command line
GaryFrost Posted October 6, 2005 Posted October 6, 2005 (edited) just a couple of pieces to show you what i've done, might work for you this uses the GuiListView.au3 include file Created the list view and a context menu for the list view $lv_pid = GUICtrlCreateListView("PID|Name|Path", 200, 70, 490, 440, BitOR($LVS_SHOWSELALWAYS, $LVS_NOSORTHEADER)) GUICtrlSendMsg($lv_pid, $LVM_SETEXTENDEDLISTVIEWSTYLE, $LVS_EX_FULLROWSELECT, $LVS_EX_FULLROWSELECT) _GUICtrlListViewSetColumnWidth ($lv_pid, 0, 50) _GUICtrlListViewSetColumnWidth ($lv_pid, 1, 10) _GUICtrlListViewSetColumnWidth ($lv_pid, 2, 320) $lv_pid_contextmenu = GUICtrlCreateContextMenu($lv_pid) $lv_pid_contextKill = GUICtrlCreateMenuItem("Kill Process(s)", $lv_pid_contextmenu) context menu item is selected and the item select from the listview is retrieved to accomplish the task Case $msg = $lv_pid_contextKill If Ping($s_Machine) Then Local $a_pid = _GUICtrlListViewGetSelectedIndices ($lv_pid, 1) If IsArray($a_pid) Then For $i = 1 To $a_pid[0] GUISetCursor($Cursor_WAIT, 1) RunWait('"' & @ScriptDir & '\pskill.exe" [url="file://\\"]\\'[/url] & $s_Machine & " " & _GUICtrlListViewGetItemText ($lv_pid, $a_pid[$i], 0), "", @SW_HIDE) GUISetCursor($Cursor_ARROW, 1) Next GUISetState(@SW_LOCK) _RetrieveProcessList($lv_pid, $s_Machine) GUISetState(@SW_UNLOCK) EndIf EndIf ignore the url tags in the above code, it's just suppose to be 2 back slashes Edited October 6, 2005 by gafrost SciTE for AutoItDirections for Submitting Standard UDFs Don't argue with an idiot; people watching may not be able to tell the difference.
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