Moderators Melba23 Posted August 26, 2018 Author Moderators Share Posted August 26, 2018 robertocm, The limited number of HotKey links in the code you posted above is perfectly acceptable, but if (as I suspect) you want to create many more HotKey links to look for every key on the keyboard then you run into exactly the same problem as before - scanning for ALL key presses is not permissible under the restrictions set by Jon (site owner and AutoIt author). Personally I have some difficulty with the concept that "great proffesionals" (sic) would have difficulty understanding that you first select a cell and then use a defined HotKey to begin editing it - or that double-clicking a cell does the same. 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...
Moderators Melba23 Posted August 26, 2018 Author Moderators Share Posted August 26, 2018 Tersion, I would change the colour of a single row like this: expandcollapse popup#include <GUIConstantsEx.au3> #include <ListViewConstants.au3> #include <WindowsConstants.au3> #include "GUIListViewEx.au3" $hMainWindow = GUICreate("Main Form", 500, 400, 242, 137) $cIDEditableListView = GUICtrlCreateListView("", 5, 5, 490, 390, $LVS_REPORT) _GUIListViewEx_MsgRegister() GUISetState(@SW_SHOW) _GUICtrlListView_AddColumn($cIDEditableListView, "#", 30) _GUICtrlListView_AddColumn($cIDEditableListView, "Name", 150) _GUICtrlListView_AddColumn($cIDEditableListView, "Version", 100) _GUICtrlListView_AddItem($cIDEditableListView, "1") _GUICtrlListView_AddSubItem($cIDEditableListView, 0, "Campaign 1", 1) _GUICtrlListView_AddSubItem($cIDEditableListView, 0, "1.0", 2) _GUICtrlListView_AddItem($cIDEditableListView, "2") _GUICtrlListView_AddSubItem($cIDEditableListView, 1, "Campaign 2", 1) _GUICtrlListView_AddSubItem($cIDEditableListView, 1, "2.0", 2) $aLV_Array = _GUIListViewEx_ReadToArray($cIDEditableListView) $iLV_Index = _GUIListViewEx_Init($cIDEditableListView, $aLV_Array, 0, 0, False, 1 + 32) _GUIListViewEx_SetEditStatus($iLV_Index, "1-2") For $iCol = 0 To 2 ; For each column... _GUIListViewEx_SetColour($iLV_Index, "0xFF0000;0xFFFF00", 1, $iCol) ; ...in row 1 Next While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit EndSwitch _GUIListViewEx_EventMonitor() WEnd Is that good enough? 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...
Tersion Posted August 26, 2018 Share Posted August 26, 2018 robertocm, If I understand correctly, concept in your script is to assign to even and odd rows different colors using loops and arrays to save and load color info to ListView using _GUIListViewEx_LoadColour(). Thanks for that idea! I would check. Link to comment Share on other sites More sharing options...
Tersion Posted August 26, 2018 Share Posted August 26, 2018 Melba23, Similar idea like from robertocm! Use loop through necessary row. Nice to see that implementation on my example. It's a more clearer to see how it's could be done. It's good enough! Thanks! Link to comment Share on other sites More sharing options...
robertocm Posted August 26, 2018 Share Posted August 26, 2018 Dear Melba23, Now i'm convinced, and completely abandoned the 'idea' Many Thanks for all your kind explanations about the rules @Tersion, also note that below (in the OnFilt function) the array is redimensioned if the new recordset have diferent number of rows Link to comment Share on other sites More sharing options...
robertocm Posted August 27, 2018 Share Posted August 27, 2018 (edited) This is different: edit after selection change if the user is not active during a second Global $iLimit = 1 ;idle limit in seconds Global $iLV, $Row, $Col, $EditMode = 22 ;... Case 9 ; This is returned after a selection change by the user, then listview is active $Row = $vRet[1] $Col = $vRet[2] If $Col = 3 Then ;this is an editable column AdlibRegister("_CheckIdleTimeLV", 1000) EndIf ;... ;https://stackoverflow.com/questions/3867584/autoit-how-to-get-system-idle-time-or-if-screensaver-is-active Func _CheckIdleTimeLV() ;Melba23 GUIListViewEx: if editing then abandon If $cGLVEx_EditID <> 9999 Then AdlibUnRegister("_CheckIdleTimeLV") Else If _Timer_GetIdleTime() > 1000 Then ;https://www.autoitscript.com/forum/topic/182492-guilistviewex-new-version-1-aug-18/?do=findComment&comment=1401433 ;I would suggest unregistering the Adlib immediately before entering the edit function rather than after the edit ;you do not want the function firing more than once. AdlibUnRegister("_CheckIdleTimeLV") _GUIListViewEx_EditItem($iLV, $Row, $Col, $EditMode) GUICtrlSetState($cLV, $GUI_FOCUS) EndIf EndIf EndFunc Thanks! Edited August 27, 2018 by robertocm Changed position of unregistering & unregistering if the user has started edit mode (double click or hotkey) Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted August 27, 2018 Author Moderators Share Posted August 27, 2018 robertocm, I would suggest unregistering the Adlib immediately before entering the edit function rather than after the edit - you do not want the function firing more than once. 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...
robertocm Posted August 27, 2018 Share Posted August 27, 2018 Dear Melba23, ok, Many Thanks, Link to comment Share on other sites More sharing options...
Tersion Posted August 27, 2018 Share Posted August 27, 2018 Melba23, I encountered with a problem. When I start my test example from previous post, then just move around in list view with UP and DOWN arrow keys and press BACKSPACE to try edit selected row - next error occur in SciTE Output: "D:\Projects\AutoIt\experiments\GUIListViewEx.au3" (3064) : ==> Variable subscript badly formatted.: Switch $aEditable[0][$aLocation[1]] Switch $aEditable[0][^ ERROR And program is terminated! BUT, if I click at first somewhere in list view, then move around with UP and DOWN arrow keys and press BACKSPACE - NO ERROR! Everything works smoothly! I added two .gif's that you can see what happens in both cases. Case 1 - Terminated with error: Spoiler Case 2 - Everything works correctly: Spoiler Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted August 27, 2018 Author Moderators Share Posted August 27, 2018 Tersion, I see the problem - working on a solution. 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...
Tersion Posted August 27, 2018 Share Posted August 27, 2018 Melba23, I trying to debug what is going on in GUIListViewEx.au3, and found that in firs scenario (don't click anywhere on list view), $aLocation[1] store -1 and then this value uses in Switch $aEditable[0][$aLocation[1]] => Switch $aEditable[0][-1] which is incorrect! If view second scenario (click anywhere on list view) - then $aLocation[1] store 0 value - Switch $aEditable[0][$aLocation[1]] => Switch $aEditable[0][0]. Maybe you must add condition to check what exactly store $aLocation[1] before it's use... Sorry if I'm wrong, because I'm new to AutoIT, but I want to help you to clarify what is going on as far as I can. Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted August 27, 2018 Author Moderators Share Posted August 27, 2018 (edited) Tersion, Quote I'm new to AutoIT But your diagnosis of the problem is quite correct - so congratulations on your detective powers. Now I am back from the airport run I will look at how to prevent the problem happening - your suggestion is one possibility, but I would prefer getting the UDF to recognise the arrow key movements and provide a correct location in all cases. I must say I had not expected to have to do this because I assumed people would use the mouse to select the cell to edit - just goes to show how users always come up with something the developers have not considered! M23 Edited August 28, 2018 by Melba23 Typo 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...
Moderators Melba23 Posted August 27, 2018 Author Moderators Share Posted August 27, 2018 (edited) Tersion, Try this Beta code - if the user has not selected a column using the mouse then the UDF will open the first editable column in the selected row: <snip> Is that good enough? M23 Edited August 29, 2018 by Melba23 Beta code removed 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...
Tersion Posted August 27, 2018 Share Posted August 27, 2018 Melba23, Yes! Now it's works as it should! Thanks for such a quick fix! But I ran into another problem. After you exit from edit mode (by hitting ENTER) you can't move UP by arrow key. No matter how many times I press UP, it would not work. After press twice DOWN arrow key - it's started moves OK, as it should! The same behavior with not modded GUIEventViewEX.au3. Maybe I need change something when I initialize GUIEventViewEX? I make another .gif for you to look. It's under the spoiler: Spoiler Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted August 27, 2018 Author Moderators Share Posted August 27, 2018 Tersion, I see the problem, but I have no idea yet why it happens. Why can you not use the mouse like normal people? 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...
robertocm Posted August 27, 2018 Share Posted August 27, 2018 @Tersion I'm using this after editing, and works ok ;... Case 1 ; This is returned after an edit attempt GUICtrlSetState($cLV, $GUI_FOCUS) ;or try this copied from the UDF ;Melba23, GUIListViewEx ;WinSetState($hGLVEx_Editing, "", @SW_ENABLE) @Melba23 Could i have a subitem selected on loading? I mean: in my example Col 0 is partially hidden (it has info from the database table ids) I would prefer to start showing selected the cell in Col2 Row0 and then the user moves with the arrow keys Many Thanks Link to comment Share on other sites More sharing options...
Tersion Posted August 27, 2018 Share Posted August 27, 2018 Melba23, Ok, I will switch to mouse only, to feel what it's like to be normal... Just kidding! I focused on keyboard just because a such great thing like in place edit with your UDF makes me think like I'm in spread sheet editor (Excel or something), where you can moves only with keyboard. But I understand that with any UDF (not only your) you can meet restrictions with which you must be considered. So, I will be use your GUIListViewEX as it is. And will be write back if found some problem more critical for UDF usage. Link to comment Share on other sites More sharing options...
Tersion Posted August 27, 2018 Share Posted August 27, 2018 robertocm, YOU MY HERO! I added this lines in me example as you sad after _GUIListViewEx_EventMonitor() in my main loop: Switch @extended Case 1 GUICtrlSetState($cIDEditableListView, $GUI_FOCUS) EndSwitch The solution turned out so simple - after edit, return focus to ListView control. Brilliant! Thanks! Link to comment Share on other sites More sharing options...
robertocm Posted August 28, 2018 Share Posted August 28, 2018 11 hours ago, robertocm said: Could i have a subitem selected on loading? I mean: in my example Col 0 is partially hidden (it has info from the database table ids) I would prefer to start showing selected the cell in Col2 Row0 and then the user moves with the arrow keys This is working: ControlSend($hGui, "", $cLV, "{DOWN}{RIGHT}{RIGHT}") Link to comment Share on other sites More sharing options...
robertocm Posted August 28, 2018 Share Posted August 28, 2018 Dear Melba23, I think here there is an issue: _GUIListViewEx_EditItem function does not make _GUIListViewEx_EventMonitor to return @extended = 1 In the example below see the difference in editing from the button vs. double click or backspace: expandcollapse popup#cs ---------------------------------------------------------------------------- Melba23 https://www.autoitscript.com/forum/topic/182492-guilistviewex-new-version-22-feb-18/?do=findComment&comment=1397949 #ce ---------------------------------------------------------------------------- #include <GuiConstantsEx.au3> #include <MsgBoxConstants.au3> #include "GUIListViewEx.au3" ;Create GUI $hGUI = GUICreate("LVEx Example GetLastSel", 640, 510) Global $Row, $Col, $EditMode = 22 Local $vRet, $aLV, $iCheckState = True Global $cLV, $iLV, $Row, $Col, $EditMode = 22 ;Create ListView Global $cLV = GUICtrlCreateListView("Tom|Dick|Harry", 10, 40, 300, 300, $LVS_SHOWSELALWAYS) _GUICtrlListView_SetExtendedListViewStyle($cLV, BitOR($LVS_EX_FULLROWSELECT, $LVS_EX_CHECKBOXES)) _GUICtrlListView_SetColumnWidth($cLV, 0, 93) _GUICtrlListView_SetColumnWidth($cLV, 1, 93) _GUICtrlListView_SetColumnWidth($cLV, 2, 93) ; Create array and fill Left listview Global $aLV_List[10] For $i = 0 To UBound($aLV_List) - 1 $aLV_List[$i] = "Tom " & $i & "|Dick " & $i & "|Harry " & $i GUICtrlCreateListViewItem($aLV_List[$i], $cLV) Next ; Initiate LVEx ;Note that using the left/right keys only returns a "selection change" message if the ListView has been set up to allow single cell highlighting Global $iLV = _GUIListViewEx_Init($cLV, $aLV_List) _GUIListViewEx_SetEditStatus($iLV, "*") $cEdit_Button = GUICtrlCreateButton("Edit Selected", 430, 390, 200, 110) _GUIListViewEx_SetActive($iLV) ; Register for sorting, dragging and editing _GUIListViewEx_MsgRegister() GUISetState() While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit Case $cEdit_Button _Edit_from_Button() EndSwitch $vRet = _GUIListViewEx_EventMonitor($EditMode) If @error Then MsgBox($MB_SYSTEMMODAL, "Error", "Event error: " & @error) EndIf Switch @extended Case 1 ; This is returned after an edit attempt If $vRet = "" Then MsgBox($MB_SYSTEMMODAL, "Edit", "Edit aborted" & @CRLF) Else MsgBox($MB_SYSTEMMODAL, "Edit", "Successful edit" & @CRLF) EndIf Case 9 ; This is returned after a selection change ;MsgBox($MB_SYSTEMMODAL, "Selection changed", "New selection:" & @CRLF & "Row: " & $vRet[1] & @CRLF & "Col: " & $vRet[2]) $Row = $vRet[1] $Col = $vRet[2] EndSwitch WEnd Func _Edit_from_Button() _GUIListViewEx_EditItem($iLV, $Row, $Col, $EditMode) EndFunc 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