Search the Community
Showing results for tags 'Edit Listview Cell'.
-
How to Click and Edit single listview cell?
dragan posted a topic in AutoIt General Help and Support
I'm wondering if it's possible to click and edit single cell inside my listview. I've done the sample script, in which the full row is selected, but I want single cell to be selected, but even with full row, if I enter the editing mode, I can only edit the first item text. How can I edit the other subitems as well? #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <GuiListView.au3> #include <GuiMenu.au3> Global $Form1 = GUICreate("Form1", 420, 230) Global $List1 = GUICtrlCreateListView('#|Column1|Column2|Column3|Column4|Column5', 0, 0, 440, 230, BitOR($LVS_EDITLABELS, $LVS_REPORT)) GUICtrlSetResizing(-1, $GUI_DOCKLEFT + $GUI_DOCKTOP + $GUI_DOCKRIGHT + $GUI_DOCKBOTTOM) GUICtrlSendMsg($List1, $LVM_SETEXTENDEDLISTVIEWSTYLE, $LVS_EX_GRIDLINES, $LVS_EX_GRIDLINES) For $i = 1 to 10 GUICtrlCreateListViewItem($i & '|Item' & $i & '|Item' & $i & '|' & Random(0, 1, 1) & '|' & Random(200, 220, 1) & '|ItemX', $List1) Next GUISetState(@SW_SHOW) GUIRegisterMsg($WM_SYSCOMMAND, "WM_SYSCOMMAND") GUIRegisterMsg($WM_NOTIFY, "_WM_NOTIFY") While 1 Sleep(10) WEnd Func WM_SYSCOMMAND($hWnd, $iMsg, $wParam, $lParam) Switch $wParam Case $SC_CLOSE Exit EndSwitch Return $GUI_RUNDEFMSG EndFunc Func _WM_NOTIFY($hWndGUI, $MsgID, $wParam, $lParam) #forceref $hWndGUI, $MsgID, $wParam Local $tNMHDR, $hwndFrom, $code, $tInfo, $tBuffer, $iIDFrom $tNMHDR = DllStructCreate($tagNMHDR, $lParam) $hwndFrom = DllStructGetData($tNMHDR, "hWndFrom") $iIDFrom = DllStructGetData($tNMHDR, "IDFrom") $code = DllStructGetData($tNMHDR, "Code") Local $hWndListView = $List1 If Not IsHWnd($List1) Then $hWndListView = GUICtrlGetHandle($List1) Switch $hwndFrom Case $hWndListView Switch $code Case $LVN_ENDLABELEDITA, $LVN_ENDLABELEDITW $tInfo = DllStructCreate($tagNMLVDISPINFO, $lParam) If $code = $LVN_ENDLABELEDITW then $tBuffer = DllStructCreate("wchar Text[" & DllStructGetData($tInfo, "TextMax") & "]", DllStructGetData($tInfo, "Text")) Else $tBuffer = DllStructCreate("char Text[" & DllStructGetData($tInfo, "TextMax") & "]", DllStructGetData($tInfo, "Text")) EndIf Local $getText = DllStructGetData($tBuffer, "Text") If $getText <> '' Then Return True Else Return False EndIf EndSwitch EndSwitch Return $GUI_RUNDEFMSG EndFunc Also, is it possible to enter the editing mode via double click? Or other function?