CyberSlug Posted November 14, 2005 Share Posted November 14, 2005 There is a LOT of room for improvement, but you should get the idea. Notes: You must press Enter for the change to stick! In case you want the change to also take effect if the item loses focus, you would need to keep polling the contents of $editCtrl and get its previous value before $editCtrl disappears..... You might also want HotKeySet("{Esc}", "CancelEdit") or something..... expandcollapse popup#include <GuiConstants.au3> Global $editCtrl = "Edit1";name of the Edit control that pops up when edit a listitem.... Global $editFlag = 0, $listview, $Gui $Gui = GuiCreate("Edit-able ListViewItems") $CloseButton = GuiCtrlCreateButton("Close", 300, 300, 100, 20) $listview = GUICtrlCreateListView ("Items",10,10,300,200, $LVS_EDITLABELS);Important Style!!! ; Populate list and make it wide enough to see For $i = 1 to 10 GUICtrlCreateListViewItem("single quick twice or press F2, then press Enter", $listview) Next GUICtrlSendMsg($listview, 0x101E, 0, -1) ;$listview, LVM_SETCOLUMNWIDTH, 0, resize to widest value GuiSetState(@SW_SHOW) While 1 $msg = GuiGetMsg() If $msg = $GUI_EVENT_CLOSE Or $msg = $CloseButton Then Exit If ControlCommand ($Gui, "", $editCtrl, "IsVisible","") Then If $editFlag = 0 Then $editFlag = 1 HotKeySet("{Enter}", "Enter") EndIf EndIf If WinActive($Gui) Then HotKeySEt("{F2}", "Rename") Else HotKeySet("{Enter}");unregister hotkeys if window loses focus HotKeySEt("{F2}") $editFlag = 0 EndIf WEnd Func Rename() Local $item = GuiCtrlRead($listView) Local $itemIndex = $item - 5;hackish way to convert listItem id to index ; The magic value of 5 will probably be different in windows with more controls! GUICtrlSendMsg($listView, 0x1017, $itemIndex, 10);0xB1 == EM_SETSEL EndFunc Func Enter() Local $newText = ControlGetText($Gui,"",$editCtrl) Local $item = GuiCtrlRead($listView) GuiCtrlSetData($item, $newText) HotkeySet("{Enter}");unregister hotkey Send("{Enter}");quit edit mode $editFlag = 0 EndFunc Use Mozilla | Take a look at My Disorganized AutoIt stuff | Very very old: AutoBuilder 11 Jan 2005 prototype I need to update my sig! Link to comment Share on other sites More sharing options...
layer Posted November 14, 2005 Share Posted November 14, 2005 Wonderful ! Thank you for this !! FootbaG Link to comment Share on other sites More sharing options...
ptrex Posted November 15, 2005 Share Posted November 15, 2005 Perfect !! This should be included in the Beta version. Thanks Contributions :Firewall Log Analyzer for XP - Creating COM objects without a need of DLL's - UPnP support in AU3Crystal Reports Viewer - PDFCreator in AutoIT - Duplicate File FinderSQLite3 Database functionality - USB Monitoring - Reading Excel using SQLRun Au3 as a Windows Service - File Monitor - Embedded Flash PlayerDynamic Functions - Control Panel Applets - Digital Signing Code - Excel Grid In AutoIT - Constants for Special Folders in WindowsRead data from Any Windows Edit Control - SOAP and Web Services in AutoIT - Barcode Printing Using PS - AU3 on LightTD WebserverMS LogParser SQL Engine in AutoIT - ImageMagick Image Processing - Converter @ Dec - Hex - Bin -Email Address Encoder - MSI Editor - SNMP - MIB ProtocolFinancial Functions UDF - Set ACL Permissions - Syntax HighLighter for AU3ADOR.RecordSet approach - Real OCR - HTTP Disk - PDF Reader Personal Worldclock - MS Indexing Engine - Printing ControlsGuiListView - Navigation (break the 4000 Limit barrier) - Registration Free COM DLL Distribution - Update - WinRM SMART Analysis - COM Object Browser - Excel PivotTable Object - VLC Media Player - Windows LogOnOff Gui -Extract Data from Outlook to Word & Excel - Analyze Event ID 4226 - DotNet Compiler Wrapper - Powershell_COM - New Link to comment Share on other sites More sharing options...
CyberSlug Posted November 15, 2005 Author Share Posted November 15, 2005 It is clunky temporary workaround.... I hope someone will replace it with something better! D) Use Mozilla | Take a look at My Disorganized AutoIt stuff | Very very old: AutoBuilder 11 Jan 2005 prototype I need to update my sig! Link to comment Share on other sites More sharing options...
GaryFrost Posted November 17, 2005 Share Posted November 17, 2005 (edited) had a few minutes to play with this expandcollapse popup#include <GuiConstants.au3> #include <GuiListview.au3> _Main() Func _Main() Local $editCtrl = "Edit1";name of the Edit control that pops up when edit a listitem.... Local $editFlag = 0, $listview, $Gui $Gui = GUICreate("Edit-able ListViewItems") $CloseButton = GUICtrlCreateButton("Close", 300, 300, 100, 20) $listview = GUICtrlCreateListView("Items", 10, 10, 300, 200, $LVS_EDITLABELS);Important Style!!! ; Populate list and make it wide enough to see For $i = 1 To 10 GUICtrlCreateListViewItem("single quick twice or press F2, then press Enter", $listview) Next GUICtrlSendMsg($listview, 0x101E, 0, -1);$listview, LVM_SETCOLUMNWIDTH, 0, resize to widest value GUISetState(@SW_SHOW) $dll = DllOpen("user32.dll") While 1 _MonitorEditState($Gui, $editCtrl, $editFlag, $listview, $dll) $msg = GUIGetMsg() If $msg = $GUI_EVENT_CLOSE Or $msg = $CloseButton Then Exit WEnd DllClose($dll) EndFunc ;==>_Main Func _MonitorEditState(ByRef $h_gui, ByRef $editCtrl, ByRef $editFlag, ByRef $listview, ByRef $dll) Local $pressed = _IsPressedMod($dll) If $editFlag And $pressed = 13 Then; pressed enter Update($h_gui, $editCtrl, $listview) ElseIf $editFlag And $pressed = 27 Then; pressed esc CancelEdit($listview) ElseIf Not $editFlag And $pressed = 113 Then; pressed f2 Rename($listview) $editFlag = 1 EndIf Sleep(50) If ControlCommand($h_gui, "", $editCtrl, "IsVisible", "") Then If $editFlag = 0 Then $editFlag = 1 Rename($listview) EndIf Else $editFlag = 0 EndIf ;~ If WinActive($h_gui) Then ;~ $editFlag = 0 ;~ EndIf EndFunc ;==>_MonitorEditState Func Rename(ByRef $listview) Local $itemIndex = _GUICtrlListViewGetCurSel ($listview) GUICtrlSendMsg($listview, $LVM_EDITLABEL, $itemIndex, 0) HotKeySet("{Enter}", "Enter") EndFunc ;==>Rename Func Enter() ; just a dummy function EndFunc ;==>Enter Func Update(ByRef $h_gui, ByRef $editCtrl, ByRef $listview) Local $newText = ControlGetText($h_gui, "", $editCtrl) Local $item = GUICtrlRead($listview) GUICtrlSetData($item, $newText) HotKeySet("{Enter}") Send("{Enter}");quit edit mode $editFlag = 0 $update = 0 EndFunc ;==>Update Func CancelEdit(ByRef $listview) GUICtrlSendMsg($listview, $LVM_CANCELEDITLABEL, 0, 0) EndFunc ;==>CancelEdit Func _IsPressedMod($dll = "user32.dll") Local $aR, $bRv, $hexKey, $i For $i = 8 To 128 $hexKey = '0x' & Hex($i, 2) $aR = DllCall($dll, "int", "GetAsyncKeyState", "int", $hexKey) If $aR[0] <> 0 Then Return $i Next Return 0 EndFunc ;==>_IsPressedMod Edited November 17, 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.  Link to comment Share on other sites More sharing options...
awrog Posted November 17, 2005 Share Posted November 17, 2005 gafrost, Looking great, in other languages it is called Edit In Place (EIP) Pressing F2, entering some new data and pressing [enter] works. Double-clicking, entering some new data and pressing [enter] does not work. Regards, Arno Link to comment Share on other sites More sharing options...
GaryFrost Posted November 17, 2005 Share Posted November 17, 2005 gafrost,Looking great, in other languages it is called Edit In Place (EIP)Pressing F2, entering some new data and pressing [enter] works.Double-clicking, entering some new data and pressing [enter] does not work. Regards,Arno Updated above code, now works with double clicking.Gary SciTE for AutoItDirections for Submitting Standard UDFs  Don't argue with an idiot; people watching may not be able to tell the difference.  Link to comment Share on other sites More sharing options...
ptrex Posted November 17, 2005 Share Posted November 17, 2005 @Gafrost The dubbleclick doesn' t work all the time for me. Maybe it is relating to the time settings between the 2 clicks ? If I click long enough than it works (sometimes). Contributions :Firewall Log Analyzer for XP - Creating COM objects without a need of DLL's - UPnP support in AU3Crystal Reports Viewer - PDFCreator in AutoIT - Duplicate File FinderSQLite3 Database functionality - USB Monitoring - Reading Excel using SQLRun Au3 as a Windows Service - File Monitor - Embedded Flash PlayerDynamic Functions - Control Panel Applets - Digital Signing Code - Excel Grid In AutoIT - Constants for Special Folders in WindowsRead data from Any Windows Edit Control - SOAP and Web Services in AutoIT - Barcode Printing Using PS - AU3 on LightTD WebserverMS LogParser SQL Engine in AutoIT - ImageMagick Image Processing - Converter @ Dec - Hex - Bin -Email Address Encoder - MSI Editor - SNMP - MIB ProtocolFinancial Functions UDF - Set ACL Permissions - Syntax HighLighter for AU3ADOR.RecordSet approach - Real OCR - HTTP Disk - PDF Reader Personal Worldclock - MS Indexing Engine - Printing ControlsGuiListView - Navigation (break the 4000 Limit barrier) - Registration Free COM DLL Distribution - Update - WinRM SMART Analysis - COM Object Browser - Excel PivotTable Object - VLC Media Player - Windows LogOnOff Gui -Extract Data from Outlook to Word & Excel - Analyze Event ID 4226 - DotNet Compiler Wrapper - Powershell_COM - New Link to comment Share on other sites More sharing options...
GaryFrost Posted November 17, 2005 Share Posted November 17, 2005 (edited) @GafrostThe dubbleclick doesn' t work all the time for me.Maybe it is relating to the time settings between the 2 clicks ?If I click long enough than it works (sometimes). Try thisexpandcollapse popup#include <GuiConstants.au3> #include <GuiListview.au3> _Main() Func _Main() Local $editCtrl = "Edit1";name of the Edit control that pops up when edit a listitem.... Local $editFlag = 0, $listview, $Gui, $start, $diff, $doubleclicked, $msg $Gui = GUICreate("Edit-able ListViewItems") $CloseButton = GUICtrlCreateButton("Close", 300, 300, 100, 20) $listview = GUICtrlCreateListView("Items", 10, 10, 300, 200, $LVS_EDITLABELS);Important Style!!! ; Populate list and make it wide enough to see For $i = 1 To 10 GUICtrlCreateListViewItem("single quick twice or press F2, then press Enter", $listview) Next GUICtrlSendMsg($listview, 0x101E, 0, -1);$listview, LVM_SETCOLUMNWIDTH, 0, resize to widest value GUISetState(@SW_SHOW) $dll = DllOpen("user32.dll") While 1 _MonitorEditState($Gui, $editCtrl, $editFlag, $listview, $dll, $msg, $start, $diff, $doubleclicked) $msg = GUIGetMsg() If $msg = $GUI_EVENT_CLOSE Or $msg = $CloseButton Then Exit WEnd DllClose($dll) EndFunc ;==>_Main Func _MonitorEditState(ByRef $h_gui, ByRef $editCtrl, ByRef $editFlag, ByRef $listview, ByRef $dll, ByRef $msg, ByRef $start, ByRef $diff, ByRef $doubleclicked) If $msg = $GUI_EVENT_PRIMARYDOWN Then Local $focus = ControlGetFocus(WinGetTitle($h_gui)) If (StringInStr($focus,"SysListView3")) Then $diff = TimerDiff($start) ; Read the current mouse-doubleclick-settings from registry $mousespeed = RegRead("HKCU\Control Panel\Mouse", "DoubleClickSpeed") If $mousespeed = "" Then $mousespeed = 700 If $diff < $mousespeed And $doubleclicked = 0 Then Rename($listview) $doubleclicked = 1 Else $doubleclicked = 0 EndIf $start = TimerInit() EndIf EndIf Local $pressed = _IsPressedMod($dll) If $editFlag And $pressed = 13 Then; pressed enter Update($h_gui, $editCtrl, $listview) ElseIf $editFlag And $pressed = 27 Then; pressed esc CancelEdit($listview) ElseIf Not $editFlag And $pressed = 113 Then; pressed f2 Rename($listview) $editFlag = 1 EndIf Sleep(50) If ControlCommand($h_gui, "", $editCtrl, "IsVisible", "") Then If $editFlag = 0 Then $editFlag = 1 Rename($listview) EndIf Else $editFlag = 0 EndIf ;~ If WinActive($h_gui) Then ;~ $editFlag = 0 ;~ EndIf EndFunc ;==>_MonitorEditState Func Rename(ByRef $listview) Local $itemIndex = _GUICtrlListViewGetCurSel ($listview) GUICtrlSendMsg($listview, $LVM_EDITLABEL, $itemIndex, 0) HotKeySet("{Enter}", "Enter") EndFunc ;==>Rename Func Enter() ; just a dummy function EndFunc ;==>Enter Func Update(ByRef $h_gui, ByRef $editCtrl, ByRef $listview) Local $newText = ControlGetText($h_gui, "", $editCtrl) Local $item = GUICtrlRead($listview) GUICtrlSetData($item, $newText) HotKeySet("{Enter}") Send("{Enter}");quit edit mode $editFlag = 0 $update = 0 EndFunc ;==>Update Func CancelEdit(ByRef $listview) GUICtrlSendMsg($listview, $LVM_CANCELEDITLABEL, 0, 0) EndFunc ;==>CancelEdit Func _IsPressedMod($dll = "user32.dll") Local $aR, $bRv, $hexKey, $i For $i = 8 To 128 $hexKey = '0x' & Hex($i, 2) $aR = DllCall($dll, "int", "GetAsyncKeyState", "int", $hexKey) If $aR[0] <> 0 Then Return $i Next Return 0 EndFunc ;==>_IsPressedMod Edited November 17, 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.  Link to comment Share on other sites More sharing options...
SlimShady Posted November 17, 2005 Share Posted November 17, 2005 Perfect Link to comment Share on other sites More sharing options...
ptrex Posted November 17, 2005 Share Posted November 17, 2005 Perfect indead. Good Job Contributions :Firewall Log Analyzer for XP - Creating COM objects without a need of DLL's - UPnP support in AU3Crystal Reports Viewer - PDFCreator in AutoIT - Duplicate File FinderSQLite3 Database functionality - USB Monitoring - Reading Excel using SQLRun Au3 as a Windows Service - File Monitor - Embedded Flash PlayerDynamic Functions - Control Panel Applets - Digital Signing Code - Excel Grid In AutoIT - Constants for Special Folders in WindowsRead data from Any Windows Edit Control - SOAP and Web Services in AutoIT - Barcode Printing Using PS - AU3 on LightTD WebserverMS LogParser SQL Engine in AutoIT - ImageMagick Image Processing - Converter @ Dec - Hex - Bin -Email Address Encoder - MSI Editor - SNMP - MIB ProtocolFinancial Functions UDF - Set ACL Permissions - Syntax HighLighter for AU3ADOR.RecordSet approach - Real OCR - HTTP Disk - PDF Reader Personal Worldclock - MS Indexing Engine - Printing ControlsGuiListView - Navigation (break the 4000 Limit barrier) - Registration Free COM DLL Distribution - Update - WinRM SMART Analysis - COM Object Browser - Excel PivotTable Object - VLC Media Player - Windows LogOnOff Gui -Extract Data from Outlook to Word & Excel - Analyze Event ID 4226 - DotNet Compiler Wrapper - Powershell_COM - New Link to comment Share on other sites More sharing options...
busysignal Posted November 24, 2005 Share Posted November 24, 2005 @CyberSlug, nice work! @GaFrost, nice mod.. Cheers.. Link to comment Share on other sites More sharing options...
JRSmile Posted November 24, 2005 Share Posted November 24, 2005 a small request what if the user clicks outside the edit field, and not hits enter, the default text is restored, is there a solution to save the changed text until the cursor clicks elswere? $a=StringSplit("547275737420796F757220546563686E6F6C75737421","") For $b=1 To UBound($a)+(-1*-1*-1)step(2^4/8);&$b+=1*2/40*µ&Asc(4) Assign("c",Eval("c")&Chr(Dec($a[$b]&$a[$b+1])));''Chr("a")&"HI" Next ;time_U&r34d,ths,U-may=get$the&c.l.u.e;b3st-regards,JRSmile; MsgBox(0x000000,"",Eval("c"));PiEs:d0nt+*b3.s4d.4ft3r.1st-try:-) Link to comment Share on other sites More sharing options...
GaryFrost Posted November 24, 2005 Share Posted November 24, 2005 (edited) expandcollapse popup#include <GuiConstants.au3> #include <GuiListview.au3> _Main() Func _Main() Local $editCtrl = "Edit1";name of the Edit control that pops up when edit a listitem.... Local $editFlag = 0, $listview, $Gui, $start, $diff, $doubleclicked, $msg $Gui = GUICreate("Edit-able ListViewItems") $CloseButton = GUICtrlCreateButton("Close", 300, 300, 100, 20) $listview = GUICtrlCreateListView("Items", 10, 10, 300, 200, $LVS_EDITLABELS);Important Style!!! ; Populate list and make it wide enough to see For $i = 1 To 10 GUICtrlCreateListViewItem("single quick twice or press F2, then press Enter", $listview) Next GUICtrlSendMsg($listview, 0x101E, 0, -1);$listview, LVM_SETCOLUMNWIDTH, 0, resize to widest value GUISetState(@SW_SHOW) $dll = DllOpen("user32.dll") While 1 $msg = GUIGetMsg(1) _MonitorEditState($Gui, $editCtrl, $editFlag, $listview, $dll, $msg, $start, $diff, $doubleclicked) Select Case $msg[0] = $GUI_EVENT_CLOSE Or $msg[0] = $CloseButton Exit Case Else EndSelect WEnd DllClose($dll) EndFunc ;==>_Main Func _MonitorEditState(ByRef $h_gui, ByRef $editCtrl, ByRef $editFlag, ByRef $listview, ByRef $dll, ByRef $msg, ByRef $start, ByRef $diff, ByRef $doubleclicked) If $msg[0] = $GUI_EVENT_PRIMARYDOWN Then Local $focus = ControlGetFocus(WinGetTitle($h_gui)) Local $pos = ControlGetPos($h_gui, "", $focus) Local $mpos = MouseGetPos() If ControlCommand($h_gui, "", $editCtrl, "IsVisible", "") Then If $mpos[0] < $pos[0] Or $mpos[0] > $pos[0] + $pos[2] Or _ $mpos[1] < $pos[1] Or $mpos[1] > $pos[1] + $pos[3] Then CancelEdit($listview) $editFlag = 0 EndIf Else If (StringInStr($focus, "SysListView3")) Then $diff = TimerDiff($start) ; Read the current mouse-doubleclick-settings from registry $mousespeed = RegRead("HKCU\Control Panel\Mouse", "DoubleClickSpeed") If $mousespeed = "" Then $mousespeed = 700 If $diff < $mousespeed And $doubleclicked = 0 Then Rename($listview) $doubleclicked = 1 Else $doubleclicked = 0 EndIf $start = TimerInit() EndIf EndIf EndIf Local $pressed = _IsPressedMod($dll) If $editFlag And $pressed = 13 Then; pressed enter Update($h_gui, $editCtrl, $listview) ElseIf $editFlag And $pressed = 27 Then; pressed esc CancelEdit($listview) $editFlag = 0 ElseIf Not $editFlag And $pressed = 113 Then; pressed f2 Rename($listview) $editFlag = 1 EndIf Sleep(50) If ControlCommand($h_gui, "", $editCtrl, "IsVisible", "") Then If $editFlag = 0 Then $editFlag = 1 Rename($listview) EndIf Else $editFlag = 0 EndIf EndFunc ;==>_MonitorEditState Func Rename(ByRef $listview) Local $itemIndex = _GUICtrlListViewGetCurSel ($listview) GUICtrlSendMsg($listview, $LVM_EDITLABEL, $itemIndex, 0) HotKeySet("{Enter}", "Enter") EndFunc ;==>Rename Func Enter() ; just a dummy function EndFunc ;==>Enter Func Update(ByRef $h_gui, ByRef $editCtrl, ByRef $listview) Local $newText = ControlGetText($h_gui, "", $editCtrl) Local $item = GUICtrlRead($listview) GUICtrlSetData($item, $newText) HotKeySet("{Enter}") Send("{Enter}");quit edit mode $editFlag = 0 $update = 0 EndFunc ;==>Update Func CancelEdit(ByRef $listview) GUICtrlSendMsg($listview, $LVM_CANCELEDITLABEL, 0, 0) EndFunc ;==>CancelEdit Func _IsPressedMod($dll = "user32.dll") Local $aR, $bRv, $hexKey, $i For $i = 8 To 128 $hexKey = '0x' & Hex($i, 2) $aR = DllCall($dll, "int", "GetAsyncKeyState", "int", $hexKey) If $aR[0] <> 0 Then Return $i Next Return 0 EndFunc ;==>_IsPressedMod Edited November 24, 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.  Link to comment Share on other sites More sharing options...
ptrex Posted November 25, 2005 Share Posted November 25, 2005 @gafrost I tested this and it' s OK. works fine. When the cell is in editable mode, and you use tha right mouse click. You can copy and paste the data from the cell. Which is fine, but ... I am wondering if there was ever a function created that brings up a SHORT MENU, when RIGHT CLICKING the MOUSE ? I know this is not related to Editable ListView. But you' re the guy that knows most about the GUI' s (I think). And this shortcut menu feature would be a nice addon (if it does not yet exist ?) BTW : Thanks for the nice editable ListView Contributions :Firewall Log Analyzer for XP - Creating COM objects without a need of DLL's - UPnP support in AU3Crystal Reports Viewer - PDFCreator in AutoIT - Duplicate File FinderSQLite3 Database functionality - USB Monitoring - Reading Excel using SQLRun Au3 as a Windows Service - File Monitor - Embedded Flash PlayerDynamic Functions - Control Panel Applets - Digital Signing Code - Excel Grid In AutoIT - Constants for Special Folders in WindowsRead data from Any Windows Edit Control - SOAP and Web Services in AutoIT - Barcode Printing Using PS - AU3 on LightTD WebserverMS LogParser SQL Engine in AutoIT - ImageMagick Image Processing - Converter @ Dec - Hex - Bin -Email Address Encoder - MSI Editor - SNMP - MIB ProtocolFinancial Functions UDF - Set ACL Permissions - Syntax HighLighter for AU3ADOR.RecordSet approach - Real OCR - HTTP Disk - PDF Reader Personal Worldclock - MS Indexing Engine - Printing ControlsGuiListView - Navigation (break the 4000 Limit barrier) - Registration Free COM DLL Distribution - Update - WinRM SMART Analysis - COM Object Browser - Excel PivotTable Object - VLC Media Player - Windows LogOnOff Gui -Extract Data from Outlook to Word & Excel - Analyze Event ID 4226 - DotNet Compiler Wrapper - Powershell_COM - New Link to comment Share on other sites More sharing options...
GaryFrost Posted November 25, 2005 Share Posted November 25, 2005 @gafrostI tested this and it' s OK. works fine.When the cell is in editable mode, and you use tha right mouse click. You can copy and paste the data from the cell. Which is fine, but ...I am wondering if there was ever a function created that brings up a SHORT MENU, when RIGHT CLICKING the MOUSE ?I know this is not related to Editable ListView. But you' re the guy that knows most about the GUI' s (I think). And this shortcut menu feature would be a nice addon (if it does not yet exist ?)BTW : Thanks for the nice editable ListView I'm sure I don't know the most about the GUI's, but I think you might look into GUICtrlCreateContextMenu SciTE for AutoItDirections for Submitting Standard UDFs  Don't argue with an idiot; people watching may not be able to tell the difference.  Link to comment Share on other sites More sharing options...
ptrex Posted November 25, 2005 Share Posted November 25, 2005 @Gafrost I haven't got that much millage on my record than you do. Learning everyday Thanks for the tip !! Contributions :Firewall Log Analyzer for XP - Creating COM objects without a need of DLL's - UPnP support in AU3Crystal Reports Viewer - PDFCreator in AutoIT - Duplicate File FinderSQLite3 Database functionality - USB Monitoring - Reading Excel using SQLRun Au3 as a Windows Service - File Monitor - Embedded Flash PlayerDynamic Functions - Control Panel Applets - Digital Signing Code - Excel Grid In AutoIT - Constants for Special Folders in WindowsRead data from Any Windows Edit Control - SOAP and Web Services in AutoIT - Barcode Printing Using PS - AU3 on LightTD WebserverMS LogParser SQL Engine in AutoIT - ImageMagick Image Processing - Converter @ Dec - Hex - Bin -Email Address Encoder - MSI Editor - SNMP - MIB ProtocolFinancial Functions UDF - Set ACL Permissions - Syntax HighLighter for AU3ADOR.RecordSet approach - Real OCR - HTTP Disk - PDF Reader Personal Worldclock - MS Indexing Engine - Printing ControlsGuiListView - Navigation (break the 4000 Limit barrier) - Registration Free COM DLL Distribution - Update - WinRM SMART Analysis - COM Object Browser - Excel PivotTable Object - VLC Media Player - Windows LogOnOff Gui -Extract Data from Outlook to Word & Excel - Analyze Event ID 4226 - DotNet Compiler Wrapper - Powershell_COM - New Link to comment Share on other sites More sharing options...
randallc Posted November 28, 2005 Share Posted November 28, 2005 gary,Thanks for this.See in my Array2D GUI I have used it to;1. double click on a row to put the row in your GUI.2. Double click on an item there to edit it.I presume we can't edit a "cell" to save the doubling up?Thanks, RandallArray2D.au3 ExcelCOM... AccessCom.. Word2... FileListToArrayNew...SearchMiner... Regexps...SQL...Explorer...Array2D.. _GUIListView...array problem...APITailRW Link to comment Share on other sites More sharing options...
GaryFrost Posted November 28, 2005 Share Posted November 28, 2005 gary,Thanks for this.See in my Array2D GUI I have used it to;1. double click on a row to put the row in your GUI.2. Double click on an item there to edit it.I presume we can't edit a "cell" to save the doubling up?Thanks, RandallArray2D.au3 Currently it will edit an item (1st column), not subitems, i have seen owner drawn listviews where all columns are editable, might be a job for holger SciTE for AutoItDirections for Submitting Standard UDFs  Don't argue with an idiot; people watching may not be able to tell the difference.  Link to comment Share on other sites More sharing options...
GaryFrost Posted March 4, 2006 Share Posted March 4, 2006 (edited) Utilizing the latest beta's with GUIRegisterMsg Found only one problem with this and it's the edit control paint isn't working correctly when using WM_NOTIFY Enjoy! expandcollapse popup#include <GuiConstants.au3> #include <GuiListview.au3> Global Const $DebugIt = 1 Global Const $WM_NOTIFY = 0x004E Global Const $NM_FIRST = 0 Global Const $NM_CLICK = ($NM_FIRST - 2) Global Const $NM_DBLCLK = ($NM_FIRST - 3) Global $ListView = -999 Global $Gui, $editFlag Global $editCtrl = "Edit1";name of the Edit control that pops up when edit a listitem.... _Main() Func _Main() Local $dll Local $Gui = GUICreate("Double Click Demo", 417, 356, 192, 125) $ListView = GUICtrlCreateListView("Items", 10, 10, 300, 200, $LVS_EDITLABELS);Important Style!!! GUICtrlSendMsg($ListView, $LVM_SETEXTENDEDLISTVIEWSTYLE, $LVS_EX_GRIDLINES, $LVS_EX_GRIDLINES) ; Populate list and make it wide enough to see For $i = 1 To 10 GUICtrlCreateListViewItem("DoubleClick or press F2, then press Enter", $ListView) Next GUICtrlSendMsg($ListView, 0x101E, 0, -1);$listview, LVM_SETCOLUMNWIDTH, 0, resize to widest value GUISetState(@SW_SHOW) ;Register WM_NOTIFY events GUIRegisterMsg($WM_NOTIFY, "WM_Notify_Events") $dll = DllOpen("user32.dll") While 1 $msg = GUIGetMsg() _MonitorEditState($Gui, $editCtrl, $editFlag, $ListView, $dll) Select Case $msg = $GUI_EVENT_CLOSE ExitLoop Case $msg = $GUI_EVENT_PRIMARYDOWN CancelEdit($ListView) Case Else ;;;;;;; EndSelect WEnd DllClose($dll) EndFunc ;==>_Main Func ListView_Click() ;---------------------------------------------------------------------------------------------- If $DebugIt Then ConsoleWrite (_DebugHeader("$NM_CLICK")) ;---------------------------------------------------------------------------------------------- If ControlCommand($Gui, "", $editCtrl, "IsVisible", "") Then CancelEdit($ListView) $editFlag = 0 EndIf EndFunc ;==>ListView_Click Func ListView_DoubleClick() ;---------------------------------------------------------------------------------------------- If $DebugIt Then ConsoleWrite (_DebugHeader("$NM_DBLCLK")) ;---------------------------------------------------------------------------------------------- Rename($ListView) EndFunc ;==>ListView_DoubleClick ; WM_NOTIFY event handler Func WM_Notify_Events($hWndGUI, $MsgID, $wParam, $lParam) #forceref $hWndGUI, $MsgID, $wParam Local $tagNMHDR, $event $tagNMHDR = DllStructCreate("int;int;int", $lParam);NMHDR (hwndFrom, idFrom, code) If @error Then Return $event = DllStructGetData($tagNMHDR, 3) Select Case $wParam = $ListView Select Case $event = $NM_CLICK ListView_Click() Case $event = $NM_DBLCLK ListView_DoubleClick() EndSelect EndSelect $tagNMHDR = 0 $event = 0 $lParam = 0 EndFunc ;==>WM_Notify_Events Func _DebugHeader($s_text) Return _ "!===========================================================" & @LF & _ "+===========================================================" & @LF & _ "-->" & $s_text & @LF & _ "+===========================================================" & @LF EndFunc ;==>_DebugHeader Func _MonitorEditState(ByRef $h_gui, ByRef $editCtrl, ByRef $editFlag, ByRef $ListView, ByRef $dll) Local $pressed = _IsPressedMod($dll) If $editFlag And $pressed = 13 Then; pressed enter Update($h_gui, $editCtrl, $ListView) ElseIf $editFlag And $pressed = 27 Then; pressed esc CancelEdit($ListView) $editFlag = 0 ElseIf Not $editFlag And $pressed = 113 Then; pressed f2 Rename($ListView) $editFlag = 1 EndIf Sleep(50) If ControlCommand($h_gui, "", $editCtrl, "IsVisible", "") Then If $editFlag = 0 Then $editFlag = 1 Rename($ListView) EndIf Else $editFlag = 0 EndIf EndFunc ;==>_MonitorEditState Func Rename(ByRef $ListView) Local $itemIndex = _GUICtrlListViewGetCurSel ($ListView) GUICtrlSendMsg($ListView, $LVM_EDITLABEL, $itemIndex, 0) HotKeySet("{Enter}", "Enter") EndFunc ;==>Rename Func Enter() ; just a dummy function EndFunc ;==>Enter Func Update(ByRef $h_gui, ByRef $editCtrl, ByRef $ListView) Local $newText = ControlGetText($h_gui, "", $editCtrl) Local $item = GUICtrlRead($ListView) GUICtrlSetData($item, $newText) HotKeySet("{Enter}") Send("{Enter}");quit edit mode $editFlag = 0 $update = 0 EndFunc ;==>Update Func CancelEdit(ByRef $ListView) GUICtrlSendMsg($ListView, $LVM_CANCELEDITLABEL, 0, 0) EndFunc ;==>CancelEdit Func _IsPressedMod($dll = "user32.dll") Local $aR, $bRv, $hexKey, $i For $i = 8 To 128 $hexKey = '0x' & Hex($i, 2) $aR = DllCall($dll, "int", "GetAsyncKeyState", "int", $hexKey) If $aR[0] <> 0 Then Return $i Next Return 0 EndFunc ;==>_IsPressedMod Edited March 4, 2006 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.  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