hamsteren Posted June 6, 2007 Posted June 6, 2007 I have a listview i want to rightclick on an item in the listview and get a popup any knows how to do this ?
lod3n Posted June 6, 2007 Posted June 6, 2007 Auto3Lib has a function _Menu_CreatePopup(), that's probably the easiest way, and it's hard. [font="Fixedsys"][list][*]All of my AutoIt Example Scripts[*]http://saneasylum.com[/list][/font]
rambo3889 Posted June 6, 2007 Posted June 6, 2007 You could use GUICtrlCreateContextMenu and Guictrlcreatemenuitem My Scripts:Radioblog Club Music DownloaderOther stuff:Fun movieIm serious read the help file it helps :PFight 'Till you drop. Never stop, You Cant give up. Til you reach the top Fight! youre the best in town Fight!
lod3n Posted June 6, 2007 Posted June 6, 2007 Oh yeah. That would be a lot easier. [font="Fixedsys"][list][*]All of my AutoIt Example Scripts[*]http://saneasylum.com[/list][/font]
hamsteren Posted June 7, 2007 Author Posted June 7, 2007 Thanks, i did this yesterday and the menu popup appeared. now i want to now, how can i read the selected item in the listview ? i want to right click on an item and get information about it.
PaulIA Posted June 7, 2007 Posted June 7, 2007 Thanks, i did this yesterday and the menu popup appeared. now i want to now, how can i read the selected item in the listview ? i want to right click on an item and get information about it.Here is an example of how to do this using Auto3Lib: expandcollapse popup#include <A3LListView.au3> #include <A3LMenu.au3> Global Const $tagNMITEMACTIVATE = "int WndFrom;int IDFrom;int Code;int Item;int SubItem;int NewState;int OldState;int Changed;" & _ "int PointX;int PointY;int Param;int KeyFlags" ; Global variables Global $hGUI, $hList ; Create GUI $hGUI = GUICreate("ListView", 400, 300) $hList = _ListView_Create($hGUI, 2, 2, 396, 296) GUISetState() ; Add columns _ListView_AddColumn($hList, "Column 1", 100) _ListView_AddColumn($hList, "Column 2", 100) _ListView_AddColumn($hList, "Column 3", 100) ; Add items _ListView_AddItem ($hList, "Row 1: Col 1", 0) _ListView_AddSubItem($hList, 0, "Row 1: Col 1", 1) _ListView_AddSubItem($hList, 0, "Row 1: Col 2", 2) _ListView_AddItem ($hList, "Row 2: Col 1", 1) _ListView_AddSubItem($hList, 1, "Row 2: Col 1", 1) _ListView_AddItem ($hList, "Row 3: Col 1", 2) ; Loop until user exits GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY") do until GUIGetMsg() = $GUI_EVENT_CLOSE ; Handle WM_NOTIFY messages Func WM_NOTIFY($hWnd, $iMsg, $iwParam, $ilParam) Local $tItem, $iCode, $aItem, $hMenu $tItem = DllStructCreate ($tagNMITEMACTIVATE, $ilParam) $iCode = DllStructGetData($tItem, "Code") if $iCode = $NM_RCLICK then $aItem = _ListView_SubItemHitTest($hList) if $aItem[0] <> -1 then $hMenu = _Menu_CreatePopup() _Menu_AddMenuItem($hMenu, "Item " & $aItem[0] & ": SubItem " & $aItem[1] & " Open", 1000) _Menu_AddMenuItem($hMenu, "Item " & $aItem[0] & ": SubItem " & $aItem[1] & " Save", 1001) _Menu_TrackPopupMenu($hMenu, $hGUI) _Menu_DestroyMenu($hMenu) endif endif Return $GUI_RUNDEFMSG EndFunc Auto3Lib: A library of over 1200 functions for AutoIt
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