Moderators Melba23 Posted November 19, 2014 Author Moderators Posted November 19, 2014 [bUGFIX VERSION] - 19 Nov 14Fixed: Multiple item drag/drop was not working as the result of previous change.New UDF in the first post. 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
iCode Posted December 22, 2014 Posted December 22, 2014 (edited) little bug... drag the last item (tom 4) down, but keep it inside the LV control, then release it - you'll see what i mean you can test this example, or any of the examples included with the function package #include <GuiConstantsEx.au3> #include <WindowsConstants.au3> #include "GUIListViewEx.au3" $hGUI = GUICreate("Test", 400, 400) ; Create ListViews $cLV_Tom = GUICtrlCreateListView("Tom",10, 30, 300, 300) _GUICtrlListView_SetColumnWidth($cLV_Tom, 0, 140) ; Create arrays and fill ListViews Global $aTom[5] For $i = 0 To 4 $aTom[$i] = "Tom " & $i GUICtrlCreateListViewItem($aTom[$i], $cLV_Tom) Next ; Initiate ListViews and set differing external drag/drop states GUICtrlCreateLabel("Normal", 10, 10, 180, 20) $iLV_Tom = _GUIListViewEx_Init($cLV_Tom, $aTom, 0, 0, True) ; External drag & drop - items deleted on drag GUISetState() _GUIListViewEx_MsgRegister() While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd also, i might suggest adding a return value after a successful call to _GUIListViewEx_WM_LBUTTONUP_Handler() if you think it might be worth while in my case, i need to re-order items in a file after the LV is re-ordered Edited December 22, 2014 by iCode FUNCTIONS: WinDock (dock window to screen edge) | EditCtrl_ToggleLineWrap (line/word wrap for AU3 edit control) | SendEX (yet another alternative to Send( ) ) | Spell Checker (Hunspell wrapper) | SentenceCase (capitalize first letter of sentences) CODE SNIPPITS: Dynamic tab width (set tab control width according to window width)
Moderators Melba23 Posted December 23, 2014 Author Moderators Posted December 23, 2014 (edited) iCode,Thanks for the bug report. This Beta UDF resolves the problem for me - can you please confirm it works for you too: <snip>I cannot see how to provide a return from the WM_LBUTTONUP handler as there is no sensible place to read it. But there is a flag in the UDF itself that you can read to detect the end of a drag operation - as shown in this example:expandcollapse popup#include <GuiConstantsEx.au3> #include <WindowsConstants.au3> #include "GUIListViewEx_Mod.au3" Global $bDraggingFlag = False ; Create flag <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< $hGUI = GUICreate("Test", 400, 400) ; Create ListViews $cLV_Tom = GUICtrlCreateListView("Tom",10, 30, 300, 300) _GUICtrlListView_SetColumnWidth($cLV_Tom, 0, 140) ; Create arrays and fill ListViews Global $aTom[5] For $i = 0 To 4 $aTom[$i] = "Tom " & $i GUICtrlCreateListViewItem($aTom[$i], $cLV_Tom) Next ; Initiate ListViews and set differing external drag/drop states GUICtrlCreateLabel("Normal", 10, 10, 180, 20) $iLV_Tom = _GUIListViewEx_Init($cLV_Tom, $aTom, 0, 0, True) ; External drag & drop - items deleted on drag GUISetState() _GUIListViewEx_MsgRegister() While 1 ; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< ; Read the UDF internal flag If $iGLVEx_Dragging Then ; If dragging is occuring $bDraggingFlag = True ; Set flag Else ; No drag occuring and flag set If $bDraggingFlag Then ; Drag has ended, so clear flag $bDraggingFlag = False ; Do whatever you require at this point ConsoleWrite("Drag over" & @CRLF) EndIf EndIf ; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit EndSwitch WEndDoes that satisfy your requirement? M23 Edited December 24, 2014 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
iCode Posted December 23, 2014 Posted December 23, 2014 hi Melba - works fine for me also! there's still an issue with flickering of the dragged item when you drag it off of the list, or outside of list content, but that's a rather minor visual thing FUNCTIONS: WinDock (dock window to screen edge) | EditCtrl_ToggleLineWrap (line/word wrap for AU3 edit control) | SendEX (yet another alternative to Send( ) ) | Spell Checker (Hunspell wrapper) | SentenceCase (capitalize first letter of sentences) CODE SNIPPITS: Dynamic tab width (set tab control width according to window width)
Moderators Melba23 Posted December 23, 2014 Author Moderators Posted December 23, 2014 iCode, works fine for me also!Great - I will release a new version soon. there's still an issue with flickering of the dragged item when you drag it off of the list, or outside of list content, but that's a rather minor visual thingAnd all to do with Windows' implementation of dragging, not with AutoIt as such. Not a lot I can do about that I am afraid. >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
Moderators Melba23 Posted December 24, 2014 Author Moderators Posted December 24, 2014 (edited) [bUGFIX VERSION] - 24 Dec 14Fixed: Bottom item no longer moves to top if dragged into empty space below in the ListView.New zip in the first post. M23 Edited December 24, 2014 by Melba23 Reworded for clarity 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
iCode Posted December 24, 2014 Posted December 24, 2014 @Melba23 - are you sure you replaced the attachment in the first post? dragging below the list (but within the LV) does not move the bottom item to the top for me - i just quickly tried it using the first LV in example 5 other than that it works great thanks! FUNCTIONS: WinDock (dock window to screen edge) | EditCtrl_ToggleLineWrap (line/word wrap for AU3 edit control) | SendEX (yet another alternative to Send( ) ) | Spell Checker (Hunspell wrapper) | SentenceCase (capitalize first letter of sentences) CODE SNIPPITS: Dynamic tab width (set tab control width according to window width)
Moderators Melba23 Posted December 24, 2014 Author Moderators Posted December 24, 2014 (edited) iCode, dragging below the list (but within the LV) does not move the bottom item to the top for meI am confused. I thought that bottom item moving to the top when dragged down within the ListView was the bug you wanted me to fix - so the fact that it does not means that I have indeed fixed it. The UDF code in the zip is the same as the Beta I posted earlier - I have just downloaded it to check. M23Edit: Re-reading the bugfix post, I can see why you might have interpreted it incorrectly. I have reworded the explanation to make it clearer what behaviour was changed. Edited December 24, 2014 by Melba23 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
iCode Posted December 25, 2014 Posted December 25, 2014 very sorry - i read your post wrong it works fine FUNCTIONS: WinDock (dock window to screen edge) | EditCtrl_ToggleLineWrap (line/word wrap for AU3 edit control) | SendEX (yet another alternative to Send( ) ) | Spell Checker (Hunspell wrapper) | SentenceCase (capitalize first letter of sentences) CODE SNIPPITS: Dynamic tab width (set tab control width according to window width)
LondonNDIB Posted January 1, 2015 Posted January 1, 2015 I was having a huge headache trying to figure out what I was doing wrong because none of my cells were editable. Your examples worked, but when I copy/pasted them into my script they again couldn't be edited. I couldn't figure out why until I started line-by-line commenting out of my other options/variables/etc. So it turns out... your UDF isn't compatible with the following: AutoItSetOption ( "MouseCoordMode", 0 ) Just an FYI in case anyone shows up here in the same situation.
Moderators Melba23 Posted January 1, 2015 Author Moderators Posted January 1, 2015 (edited) LondonNDIB,Thanks for the report. Please try this Beta version which should work regardless of the MouseCoordMode set by the user:<snip>M23 Edited January 2, 2015 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
LondonNDIB Posted January 1, 2015 Posted January 1, 2015 Thanks! But are there other changes I should know about in this Beta vs. the one I downloaded from the start of this that might break my script? Or is this specifically to resolve this issue?
Moderators Melba23 Posted January 1, 2015 Author Moderators Posted January 1, 2015 LondonNDIB,No, the only change I made was to put the UDF into the default MouseCoordMode mode when dealing internally with the mouse and resetting the user-defined mode before returning control to the main script. Look for the 4 Opt("MouseCoordMode", #) lines to see where I did this. 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
LondonNDIB Posted January 1, 2015 Posted January 1, 2015 Great. When you said it was beta I didn't know if it was a fix specific to my post or if it was some long-worked-on beta version that happened to also include this fix. I'm clear now Thanks so much for the fast response to my issue!
Moderators Melba23 Posted January 1, 2015 Author Moderators Posted January 1, 2015 LondonNDIB,Delighted I could fix it so quickly, unlike some bugs! I will release a new version of the UDF soon, but I doubt that it will differ much from the Beta above, so go ahead and use that for the moment. 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
LondonNDIB Posted January 1, 2015 Posted January 1, 2015 Just to confirm... tried the beta and it works fine with the MouseCoordMode option.
LondonNDIB Posted January 2, 2015 Posted January 2, 2015 Is there a simple enough way to programmically alter a cell's value? I see your function: ; _GUIListViewEx_EditItem: Edit ListView items programatically Which sounded exactly like what I want, but that makes the cell editable, but doesn't directly edit it. What i'm looking to do is on-the-fly cell validation. For a given cell, I validate down in this section of code: $aRet = _GUIListViewEx_EditOnClick($iEditMode) ; Use combos to change EditMode ; Array only returned AFTER EditOnClick process - so check array exists If IsArray($aRet) Then ; This looks like a good place to put in some validation code. This fires immediately after a cell is edited ; check if the input is valid, if not then revert. But how?? ; Uncomment to see returned array ;_ArrayDisplay($aRet, @error) EndIf And actually, "revert" is dead easy for my case because the cell in question always starts out blank. So really I just need a way to programically delete the contents of a particular cell. I tried just using your _GUIListViewEx_EditItem function followed by a Send({DEL}{ENTER}) but it does't work... it leaves me with the cell awaiting input (as though Send was completely ignored). I also figured I could just assign "" to that part of "the" array and then invoke your "for internal use only" _GUIListViewEx_ReWriteLV function, but I got pretty confused pretty quick there and thought I better seek assistance before delving further into a function that basically tells me to keep the heck out!
Moderators Melba23 Posted January 2, 2015 Author Moderators Posted January 2, 2015 (edited) LondonNDIB, but I got pretty confused pretty quick there and thought I better seek assistance before delving further into a function that basically tells me to keep the heck out!A very sensible reaction! Try this new Beta with a new function _GUIListViewEx_ChangeItem: Change ListView item content programmatically - I think it does what you require:<snip>And here is an example of it working:#include <GUIConstantsEx.au3> #include "GUIListViewEx_Mod.au3" Opt("MouseCoordMode", 0) ; Just to show that this still works $hGUI = GUICreate("Test", 500, 500) $cLV = GUICtrlCreateListView("Col 1 |Col 2 ", 10, 10, 480, 300) For $i = 0 To 4 GUICtrlCreateListViewItem("Item " & $i & "|SubItem " & $i & "-1", $cLV) Next ; Read content and initiate ListView for editing $aArray = _GUIListViewEx_ReadToArray($cLV) $iLVIndex = _GUIListViewEx_Init($cLV, $aArray, 0, Default, 0, 2) $cButton_1 = GUICtrlCreateButton("Change Data", 10, 350, 80, 30) GUISetState() While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit Case $cButton_1 $aArray = _GUIListViewEx_ReturnArray($iLVIndex) _ArrayDisplay($aArray, "Original", Default, 8) $aArray = _GUIListViewEx_ChangeItem($iLVIndex, 3, 1, "New Data") _ArrayDisplay($aArray, "Changed", Default, 8) EndSwitch WEndI have also reworded the description of the existing "edit" functions to clarify that they only open items for subsequent user editing. M23 Edited January 7, 2015 by Melba23 Removed Beta code 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
LondonNDIB Posted January 2, 2015 Posted January 2, 2015 (edited) Well aren't you Mr. Accommodating! Nice, thanks! I'll test out the new function shortly. Edit: WORKS PERFECTLY! And I'm a little late here expressing how impressed I am with this incredibly useful UDF. Really great job. Edited January 2, 2015 by LondonNDIB
Moderators Melba23 Posted January 2, 2015 Author Moderators Posted January 2, 2015 LondonNDIB, Well aren't you Mr. Accommodating!I like to offer support for my UDFs when I can. WORKS PERFECTLY!Any other requests before I release a new version this weekend? 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
Recommended Posts