Efo74 Posted April 28, 2020 Share Posted April 28, 2020 Hello Autoit Team I have a listview and it works fine. But there is a problem, i want handle double click to the "0" index coloum (when I double click to this coloums I want open another form). Is there a way ? Coloumn 1 and 2 are ok Can Someone help me ? This is the example code: listexample.au3 :rolleyes: Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted April 28, 2020 Moderators Share Posted April 28, 2020 Efo74, You can do it like this: expandcollapse popup#include <GuiConstantsEx.au3> #include <WindowsConstants.au3> #include "GUIListViewEx.au3" #include <Array.au3> Global $lw_col2 = 0xCECBCE Global $lw_col1 = 0xADAAAD $hGUI = GUICreate("Example Listview", 600, 300) $lw_Example = GUICtrlCreateListView("", 10, 10, 500, 280, BitOR($LVS_SINGLESEL, $LVS_SHOWSELALWAYS)) _GUICtrlListView_SetExtendedListViewStyle($lw_Example, $LVS_EX_FULLROWSELECT) _GUICtrlListView_AddColumn($lw_Example, "ID", 40) ;0 _GUICtrlListView_AddColumn($lw_Example, "COL1", 138) ;1 _GUICtrlListView_AddColumn($lw_Example, "COL2", 300) ;2 _GUICtrlListView_SetBkColor($lw_Example, $lw_col1) _GUICtrlListView_SetTextColor($lw_Example, $CLR_BLACK) _GUICtrlListView_SetTextBkColor($lw_Example, $lw_col1) GUICtrlSetFont($lw_Example, 11, 400, 1) $iCurrentColor_lw_Example = $lw_col2 For $i = 0 To 20 $sRecord = "0" & "|" $sRecord &= "list" & "|" $sRecord &= $i & "|" $ctrItemListview_Func = GUICtrlCreateListViewItem($sRecord, $lw_Example) If $iCurrentColor_lw_Example = $lw_col2 Then $iCurrentColor_lw_Example = $lw_col1 Else $iCurrentColor_lw_Example = $lw_col2 EndIf GUICtrlSetBkColor($ctrItemListview_Func, $iCurrentColor_lw_Example) Next $iListviewIndex_lw_Example = _GUIListViewEx_Init($lw_Example, "", 1, 0xFFFFFF, False, 512) ;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> ; Get funtion handle Local $hFunc = _MyFunc ; Set column to use mode 9 _GUIListViewEx_SetEditStatus($iListviewIndex_lw_Example, 0, 9, $hFunc) ;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> _GUIListViewEx_SetEditStatus($iListviewIndex_lw_Example, 1, 1) _GUIListViewEx_SetEditStatus($iListviewIndex_lw_Example, 2, 2, "Choice1|Choice2|Choice3", True) _GUIListViewEx_EditWidth($iListviewIndex_lw_Example, 400) GUISetState() _GUIListViewEx_MsgRegister() While True Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit EndSwitch $vRet = _GUIListViewEx_EventMonitor(0) ; Use combos to change EditMode Switch @extended Case 0 ; No event detected Case 1 If $vRet = "" Then MsgBox($MB_SYSTEMMODAL, "Edit", "Edit aborted" & @CRLF) Else _ArrayDisplay($vRet, "ListView " & _GUIListViewEx_GetActive() & " content edited", Default, 8) EndIf Case 2 If $vRet = "" Then MsgBox($MB_SYSTEMMODAL, "Header edit", "Header edit aborted" & @CRLF) Else _ArrayDisplay($vRet, "ListView " & _GUIListViewEx_GetActive() & " header edited", Default, 8) EndIf Case 3 MsgBox($MB_SYSTEMMODAL, "Sorted", "ListView: " & $vRet & @CRLF) Case 4 ToolTip("") MsgBox($MB_SYSTEMMODAL, "Dragged", "From : To" & @CRLF & $vRet & @CRLF) EndSwitch WEnd ;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> ; And here is the function - note you need all 4 parameters even if you do not need them Func _MyFunc($hLV, $iLVIndex, $iRow, $iCol) MsgBox($MB_SYSTEMMODAL, "Column One clicked", "Row = " & $iRow) EndFunc ;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> All clear? M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
Nine Posted April 28, 2020 Share Posted April 28, 2020 Another way : ;;; the above code goes here ;;; edit the line to _GUIListViewEx_MsgRegister(False) ;;; add this line GUIRegisterMsg($WM_NOTIFY, _WM_NOTIFY) ;;; below code goes here ;;; add this function Func _WM_NOTIFY($hWnd, $iMsg, $wParam, $lParam) Local $tStruct = DllStructCreate("hwnd;uint_ptr;int_ptr;int;int", $lParam) Local $hLV = DllStructGetData($tStruct, 1) Local $iCode = BitAND(DllStructGetData($tStruct, 3), 0xFFFFFFFF) If $hLV = GUICtrlGetHandle ($lw_Example) And $iCode = $NM_DBLCLK Then $iRow = DllStructGetData($tStruct, 4) $iCol = DllStructGetData($tStruct, 5) If $iCol = 0 Then ConsoleWrite("double click " & $iRow & "/" & $iCol & @CRLF) ; call your function here ; Return 1 ; that will depends what your are doing, but this will cause to stop the message chain EndIf EndIf Return _GUIListViewEx_WM_NOTIFY_Handler($hWnd, $iMsg, $wParam, $lParam) EndFunc ;==>_WM_NOTIFY But to be honest M23 solution is simpler “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Screen Scraping Multi-Threading Made Easy Link to comment Share on other sites More sharing options...
Efo74 Posted April 28, 2020 Author Share Posted April 28, 2020 Thanks for your help you are all fantastic. Now I try and let you know. :rolleyes: 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