Moderators Popular Post Melba23 Posted February 2, 2011 Moderators Popular Post Posted February 2, 2011 (edited) Now replaced by a new version of the UDF in this link. <hr> [NEW VERSION] - 7 Mar 16 Added: A new option for $iAdded (+ 512) allows you to select just one cell of the ListView rather than the whole row. A new function _GUIListViewEx_SetDefColours allows the user to set the default colours when using either or both the "colour" and "single cell selection" options. Another new function _GUIListViewEx_BlockReDraw which prevents ListView redrawing during looped Insert/Delete/Change calls - this greatly speeds up execution by avoiding lengthy redrawing when using either or both the "colour" and "single cell selection" options, use of which forces the redraw to use a WM_NOTIFY handler within the script. Changed: A number of minor internal changes to speed up the loading of the ListView when using either or both of the "colour" and "single cell selection" options. A slightly modified Example_6 script shows the new functions in use. The LH native ListView can have rows and columns added/removed using both the old and new functions and has a context menu to allow for colour selection. The contents of this ListView can be mirrored to the RH UDF-created ListView which has "single cell selection" enabled and allows the colours of any item (including the selected cell) to be changed programmatically. New UDF in the zip below. Previous changes: ChangeLog.txt Hi, It seemed that I wanted to add, delete, edit or move items in a ListView quite often in my scripts and I got fed up with having to rewrite the code to do it each time. I also wanted to be able to drag items within and between ListViews with the mouse, plus edit the items. So I decided to write a UDF to make life easier and here is the result - GUIListViewEx. If you are interested in how it works, then read this bit - if not, then skip over it: Spoiler The UDF creates a Global array holding the handle/ControlID of each ListView and creates a shadow array to match its contents. This shadow array will always have a counter as the first element - that way there are no problems with empty arrays. When the UDF receives an action request it amends this array and then adjusts the ListView data to match. Only one ListView is active at any one time and the main UDF functions only affect that active ListView. To prevent appallingly difficult syntax, I decided that I would create a further shadow array for each function to amend. Once the amendments were over, this array replaces the existing shadow array and is then deleted. The amended data within the shadow array is available at any time - the UDF removes the count element if the user has so decided. The UDF can cope with delimited or array data for later insertion - it sorts out internally how to format the inserted data to match the stored array. If no array is passed then the UDF creates a shadow array automatically - again the [0] element is always a count, but the user can choose whether to have this returned or not. One small point - if no array is passed with a multi-column ListView then the UDF will create and return a 2D array based on the number of columns. The UDF uses only as many elements of the initial array or subsequent insert data as there are columns to fill. So you can have additional data within the array without problem. I use this feature to store the filename as well as data extracted from the file within the same array - the ListView only displays the extracted data. The UDF is pretty easy to use: - You start by creating a ListView (either native or UDF) and passing the returned ControlID/handle and the array you used to fill it to the _Init function of the UDF. You also indicate whether the array has a count in the [0] (or [0][0]) element and if you create an empty ListView, the UDF will still cope and will shadow any items that you insert later. If you have a ListView filled with data but no matching array, there is a function to read that data into an array for you. You can select a colour for the insert mark when dragging items if you are going to use this feature - the default is black - and decide whether to have a shadow of the dragged item follow the mouse. Finally you can set the ListView to be sortable, editable - with various options to determine how the editing process works, determine external drag/drop behaviour and whether user colours are used. - You need to register a few Windows messages, but this is a single call to the _MsgRegister function. If you already have handlers for the relevant messages, there are functions to call within these handlers instead. If you do not want to drag, then you only need the WM_NOTIFY handler loaded. - Then you just need to call the main _Insert($vData), _Delete, _Up, and _Down functions when the appropriate button is pressed, select and drag items, or use one of the edit functions and your ListView responds automatically. - The UDF shadows the contents of the ListView (as explained in the spoiler section above) so you can get its current state at any time with the _ReturnArray function . Many of the functions actually return this data after each call just to help you keep track and there are dedicated Save/Load functions. - If enabled, the user can colour individual items within the ListView - and can set certain elements to be coloured on loading if required. - There are a couple of functions that you need to run in your idle loop if you need the functionality - they detect when items are dragged and edited. - When you have finished with the ListView, you should use the _Close function to clear the memory used by the UDF to shadow its contents. It is not vital, but if you use a lot of ListViews and do not do this, you could end up running out of memory. - You can have as many ListViews as you wish on display at any one time and the same "Insert", "Delete", "Up" and "Down" buttons can be used for them all - you just have to click on the one you want to be active. The UDF also allows you to set the active ListView programatically (_SetActive) - and to determine which is currently active (_GetActive). There are also additional Insert/DeleteSpec functions which allow you to action non-active ListViews. There are 6 example scripts to show the UDF working on native and UDF created ListViews, with single or multiple columns and either filled or empty, along with the UDF itself in this zip file: Credit to martin (for the basic drag code which I found on the forum), the Array UDF authors (for the basis of the array functions) and LarsJ (for the basic colour handler code). Happy for any feedback - hopefully positive! M23 Edited June 2, 2016 by Melba23 marcoauto, Luigi, Skysnake and 12 others 15 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
JohnOne Posted February 2, 2011 Posted February 2, 2011 What a co-inkydink, I made my first ever listliew this morning. Unfortunately because of this I know very little regarding what they are capable of and potential, so I cant offer any feedback. Suffice to say that all the examples work fine, dragging the about etc.. Cheers, I'll be looking more at this once I realize more what I can do in my project. AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans.
czardas Posted February 2, 2011 Posted February 2, 2011 (edited) That's really nice. I was just thinking it would also be nice to be able to drag multiple selections all in one hit. Perhaps that could get complicated, but it was just a thought. I'll most likely find a use for this. Great! Edited February 2, 2011 by czardas operator64 ArrayWorkshop
Ascend4nt Posted February 2, 2011 Posted February 2, 2011 (edited) This looks really useful for people like me who hate working with GUI crap However, there's a problem with the code though - it doesn't work correctly in x64 mode, even after fixing the NMHDR struct (which should be:) Local $tagNMHDR = DllStructCreate("hwnd;uint_ptr;int;int", $lParam) ; NMHDR + 1st element of NMLISTVIEW The 4th element (which is actually part of NMLISTVIEW), should be the item 'index', but always returns 0 in x64 mode. Unfortunately this results in the 1st item in the list being moved, but not the dragged one. Very odd. I haven't seen anything yet indicating why it has this behavior.. still works fine in x86 mode of course. (This is on Win 7 x64) Edited February 2, 2011 by Ascend4nt My contributions: Performance Counters in Windows - Measure CPU, Disk, Network etc Performance | Network Interface Info, Statistics, and Traffic | CPU Multi-Processor Usage w/o Performance Counters | Disk and Device Read/Write Statistics | Atom Table Functions | Process, Thread, & DLL Functions UDFs | Process CPU Usage Trackers | PE File Overlay Extraction | A3X Script Extract | File + Process Imports/Exports Information | Windows Desktop Dimmer Shade | Spotlight + Focus GUI - Highlight and Dim for Eyestrain Relief | CrossHairs (FullScreen) | Rubber-Band Boxes using GUI's (_GUIBox) | GUI Fun! | IE Embedded Control Versioning (use IE9+ and HTML5 in a GUI) | Magnifier (Vista+) Functions UDF | _DLLStructDisplay (Debug!) | _EnumChildWindows (controls etc) | _FileFindEx | _ClipGetHTML | _ClipPutHTML + ClipPutHyperlink | _FileGetShortcutEx | _FilePropertiesDialog | I/O Port Functions | File(s) Drag & Drop | _RunWithReducedPrivileges | _ShellExecuteWithReducedPrivileges | _WinAPI_GetSystemInfo | dotNETGetVersions | Drive(s) Power Status | _WinGetDesktopHandle | _StringParseParameters | Screensaver, Sleep, Desktop Lock Disable | Full-Screen Crash Recovery Wrappers/Modifications of others' contributions: _DOSWildcardsToPCRegEx (original code: RobSaunder's) | WinGetAltTabWinList (original: Authenticity) UDF's added support/programming to: _ExplorerWinGetSelectedItems | MIDIEx UDF (original code: eynstyne) (All personal code/wrappers centrally located at Ascend4nt's AutoIT Code)
Moderators Melba23 Posted February 2, 2011 Author Moderators Posted February 2, 2011 Ascend4nt, I do not have access to an x64 system, so if you could determine what is going wrong I would be happy to amend the code. This x64/x86 problem seems to raise its head more and more frequently as soon as you start getting into structs. We need someone to offer a tutorial - would you be ready to take it on? 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
Ascend4nt Posted February 2, 2011 Posted February 2, 2011 Okay, I figured it out. Funky thing that Windows has done here - they added a little 'buffer' between the end of the NMHDR structure and the next element in the NMLISTVIEW structure, and didn't tell anyone about it! Microsoft deserves a nice smack in the face for this.Anyway, I've modified your function Melba23 to read as follows:expandcollapse popupFunc _GUIListViewEx_WM_NOTIFY_Handler($hWnd, $iMsg, $wParam, $lParam) #forceref $hWnd, $iMsg, $wParam Local $tagNMHDR = "hwnd;uint_ptr;int", $sBuf='' If @AutoItX64 Then $sBuf=';int' Local $tagNMLISTVIEW = $tagNMHDR & $sBuf & ";int Item;int SubItem;uint NewState;uint OldState;uint Changed;long X;long Y;lparam lParam" Local $tNMHDR = DllStructCreate($tagNMHDR, $lParam), $tListView If @error Then Return Switch DllStructGetData($tNMHDR, 3) Case -2, $LVN_COLUMNCLICK ; -2 = $NM_CLICK ; Check if enabled ListView For $i = 1 To $aLVEx_Data[0][0] If DllStructGetData($tNMHDR, 1) = $aLVEx_Data[$i][0] Then ExitLoop EndIf Next If $i > $aLVEx_Data[0][0] Then Return ; Not enabled ; Set values for active ListView $aLVEx_Data[0][1] = $i $hGLVEx_Handle = $aLVEx_Data[$i][0] $hGLVEx_CID = $aLVEx_Data[$i][1] $aLVEx_Array = $aLVEx_Data[$i][2] Case $LVN_BEGINDRAG ; Check if registered ListView For $i = 1 To $aLVEx_Data[0][0] If DllStructGetData($tNMHDR, 1) = $aLVEx_Data[$i][0] Then ExitLoop EndIf Next If $i > $aLVEx_Data[0][0] Then Return ; Not registered ; Set values for ListView $aLVEx_Data[0][1] = $i $hGLVEx_Handle = $aLVEx_Data[$i][0] $hGLVEx_CID = $aLVEx_Data[$i][1] ; Copy array for manipulation $aLVEx_Array = $aLVEx_Data[$i][2] ; Check if Native or UDF and set focus If $hGLVEx_CID Then GUICtrlSetState($hGLVEx_CID, 256) ; $GUI_FOCUS Else _WinAPI_SetFocus($hGLVEx_Handle) EndIf $tListView=DllStructCreate($tagNMLISTVIEW, $lParam) #cs ConsoleWrite("ListView items: Item: "& DllStructGetData($tListView,'Item')& _ ", SubItem: "&DllStructGetData($tListView,'SubItem')& _ ", NewState: "&DllStructGetData($tListView,'NewState')& _ ", OldState: "&DllStructGetData($tListView,'OldState')& _ ", Changed: "&DllStructGetData($tListView,'Changed')& _ ", X: "&DllStructGetData($tListView,'X')& _ ", Y: "&DllStructGetData($tListView,'Y')& _ ", lParam: "&DllStructGetData($tListView,'lParam')& @LF) #ce ; Store index of dragged item $iLVEx_Dragged_Index = DllStructGetData($tListView, 'Item') ; Item ; Set flag $fLVEx_Dragging = True ; Remove highlighting from item _GUICtrlListView_SetItemSelected($hGLVEx_Handle, $iLVEx_Dragged_Index, False) EndSwitch EndFunc ;==>_GUIListViewEx_WM_NOTIFY_HandlerI've filled in the whole NMLISTVIEW structure for you, which provides additional information that may or may not be of interest to you. In testing on Win7 x64, all the elements are returning fine (per the ConsoleWrite() I inserted).You can of course remove all the extra info and modifications I made, but you'll need to retain that buffer for x64 systems, and then pull the 'Item' element by name rather than number.If anyone is running Vista x64, I'd like to confirm that the above altered function works on that O/S as well, as I don't currently have a build to test that on (I'm assuming its an x64 issue, but there's always a chance that its a Win7 x64 issue, I suppose)Oh, and Melba23 - sorry, no tutorial from me lol. For the most part, stick to the structure datatypes found on MSDN and you'll be fine (this is one exception however where its not the case). Also, Jon did a thread on this -> My contributions: Performance Counters in Windows - Measure CPU, Disk, Network etc Performance | Network Interface Info, Statistics, and Traffic | CPU Multi-Processor Usage w/o Performance Counters | Disk and Device Read/Write Statistics | Atom Table Functions | Process, Thread, & DLL Functions UDFs | Process CPU Usage Trackers | PE File Overlay Extraction | A3X Script Extract | File + Process Imports/Exports Information | Windows Desktop Dimmer Shade | Spotlight + Focus GUI - Highlight and Dim for Eyestrain Relief | CrossHairs (FullScreen) | Rubber-Band Boxes using GUI's (_GUIBox) | GUI Fun! | IE Embedded Control Versioning (use IE9+ and HTML5 in a GUI) | Magnifier (Vista+) Functions UDF | _DLLStructDisplay (Debug!) | _EnumChildWindows (controls etc) | _FileFindEx | _ClipGetHTML | _ClipPutHTML + ClipPutHyperlink | _FileGetShortcutEx | _FilePropertiesDialog | I/O Port Functions | File(s) Drag & Drop | _RunWithReducedPrivileges | _ShellExecuteWithReducedPrivileges | _WinAPI_GetSystemInfo | dotNETGetVersions | Drive(s) Power Status | _WinGetDesktopHandle | _StringParseParameters | Screensaver, Sleep, Desktop Lock Disable | Full-Screen Crash Recovery Wrappers/Modifications of others' contributions: _DOSWildcardsToPCRegEx (original code: RobSaunder's) | WinGetAltTabWinList (original: Authenticity) UDF's added support/programming to: _ExplorerWinGetSelectedItems | MIDIEx UDF (original code: eynstyne) (All personal code/wrappers centrally located at Ascend4nt's AutoIT Code)
Ascend4nt Posted February 2, 2011 Posted February 2, 2011 (edited) Melba, hmm.. seems I should have realized this earlier - the NMHDR is where there's an issue. The third element should be 'int_ptr'. The problem with that, and what initially threw me, is the negative numbers in the Case statement would have to be positive since int_ptr is a 64-bit value, and the negative numbers refer to a 32-bit-sized integer. But we can force them to be negative with BitAND.. So all that needs to be done really is this: Local $tagNMHDR = DllStructCreate("hwnd;uint_ptr;int_ptr;int", $lParam) and to make it a signed 32-bit number, this: Switch BitAND(DllStructGetData($tNMHDR, 3), 0xFFFFFFFF) Change those two lines, and your UDF is fixed. One interesting thing though - the NMLISTVIEW structure will tell you the SubItem you are 'moving'. Not sure if that actually can be used tor any good though, since moving just sub-items would be a bit more complex and confusing. *edit: oops, forgot 4th element Edited February 2, 2011 by Ascend4nt My contributions: Performance Counters in Windows - Measure CPU, Disk, Network etc Performance | Network Interface Info, Statistics, and Traffic | CPU Multi-Processor Usage w/o Performance Counters | Disk and Device Read/Write Statistics | Atom Table Functions | Process, Thread, & DLL Functions UDFs | Process CPU Usage Trackers | PE File Overlay Extraction | A3X Script Extract | File + Process Imports/Exports Information | Windows Desktop Dimmer Shade | Spotlight + Focus GUI - Highlight and Dim for Eyestrain Relief | CrossHairs (FullScreen) | Rubber-Band Boxes using GUI's (_GUIBox) | GUI Fun! | IE Embedded Control Versioning (use IE9+ and HTML5 in a GUI) | Magnifier (Vista+) Functions UDF | _DLLStructDisplay (Debug!) | _EnumChildWindows (controls etc) | _FileFindEx | _ClipGetHTML | _ClipPutHTML + ClipPutHyperlink | _FileGetShortcutEx | _FilePropertiesDialog | I/O Port Functions | File(s) Drag & Drop | _RunWithReducedPrivileges | _ShellExecuteWithReducedPrivileges | _WinAPI_GetSystemInfo | dotNETGetVersions | Drive(s) Power Status | _WinGetDesktopHandle | _StringParseParameters | Screensaver, Sleep, Desktop Lock Disable | Full-Screen Crash Recovery Wrappers/Modifications of others' contributions: _DOSWildcardsToPCRegEx (original code: RobSaunder's) | WinGetAltTabWinList (original: Authenticity) UDF's added support/programming to: _ExplorerWinGetSelectedItems | MIDIEx UDF (original code: eynstyne) (All personal code/wrappers centrally located at Ascend4nt's AutoIT Code)
Moderators Melba23 Posted February 2, 2011 Author Moderators Posted February 2, 2011 (edited) Ascend4nt,Thank you for that. I do take exception to the "fixed" bit though - I woudl have preferred "x64 compatible". Pity about the tutorial though. M23 Edited February 2, 2011 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
Moderators Melba23 Posted February 3, 2011 Author Moderators Posted February 3, 2011 NEW VERSION - 3 Feb 11 Improvements: - Now x64 compatible (thanks Ascend4nt ) - Now drags blocks of selected items and deletes all selected items (you can thank czardas for that as he asked for it ) New UDF and zip in 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
czardas Posted February 3, 2011 Posted February 3, 2011 I'm glad I asked. It's really easy to use. Thanks. operator64 ArrayWorkshop
guinness Posted February 3, 2011 Posted February 3, 2011 Nice Example. Plus its good to see the x64 issue with $tagNMHDR has been rectified in this version. I am a little bit reluctant to start changing the ListView includes to work with x64! UDF List: _AdapterConnections() • _AlwaysRun() • _AppMon() • _AppMonEx() • _ArrayFilter/_ArrayReduce • _BinaryBin() • _CheckMsgBox() • _CmdLineRaw() • _ContextMenu() • _ConvertLHWebColor()/_ConvertSHWebColor() • _DesktopDimensions() • _DisplayPassword() • _DotNet_Load()/_DotNet_Unload() • _Fibonacci() • _FileCompare() • _FileCompareContents() • _FileNameByHandle() • _FilePrefix/SRE() • _FindInFile() • _GetBackgroundColor()/_SetBackgroundColor() • _GetConrolID() • _GetCtrlClass() • _GetDirectoryFormat() • _GetDriveMediaType() • _GetFilename()/_GetFilenameExt() • _GetHardwareID() • _GetIP() • _GetIP_Country() • _GetOSLanguage() • _GetSavedSource() • _GetStringSize() • _GetSystemPaths() • _GetURLImage() • _GIFImage() • _GoogleWeather() • _GUICtrlCreateGroup() • _GUICtrlListBox_CreateArray() • _GUICtrlListView_CreateArray() • _GUICtrlListView_SaveCSV() • _GUICtrlListView_SaveHTML() • _GUICtrlListView_SaveTxt() • _GUICtrlListView_SaveXML() • _GUICtrlMenu_Recent() • _GUICtrlMenu_SetItemImage() • _GUICtrlTreeView_CreateArray() • _GUIDisable() • _GUIImageList_SetIconFromHandle() • _GUIRegisterMsg() • _GUISetIcon() • _Icon_Clear()/_Icon_Set() • _IdleTime() • _InetGet() • _InetGetGUI() • _InetGetProgress() • _IPDetails() • _IsFileOlder() • _IsGUID() • _IsHex() • _IsPalindrome() • _IsRegKey() • _IsStringRegExp() • _IsSystemDrive() • _IsUPX() • _IsValidType() • _IsWebColor() • _Language() • _Log() • _MicrosoftInternetConnectivity() • _MSDNDataType() • _PathFull/GetRelative/Split() • _PathSplitEx() • _PrintFromArray() • _ProgressSetMarquee() • _ReDim() • _RockPaperScissors()/_RockPaperScissorsLizardSpock() • _ScrollingCredits • _SelfDelete() • _SelfRename() • _SelfUpdate() • _SendTo() • _ShellAll() • _ShellFile() • _ShellFolder() • _SingletonHWID() • _SingletonPID() • _Startup() • _StringCompact() • _StringIsValid() • _StringRegExpMetaCharacters() • _StringReplaceWholeWord() • _StringStripChars() • _Temperature() • _TrialPeriod() • _UKToUSDate()/_USToUKDate() • _WinAPI_Create_CTL_CODE() • _WinAPI_CreateGUID() • _WMIDateStringToDate()/_DateToWMIDateString() • Au3 script parsing • AutoIt Search • AutoIt3 Portable • AutoIt3WrapperToPragma • AutoItWinGetTitle()/AutoItWinSetTitle() • Coding • DirToHTML5 • FileInstallr • FileReadLastChars() • GeoIP database • GUI - Only Close Button • GUI Examples • GUICtrlDeleteImage() • GUICtrlGetBkColor() • GUICtrlGetStyle() • GUIEvents • GUIGetBkColor() • Int_Parse() & Int_TryParse() • IsISBN() • LockFile() • Mapping CtrlIDs • OOP in AutoIt • ParseHeadersToSciTE() • PasswordValid • PasteBin • Posts Per Day • PreExpand • Protect Globals • Queue() • Resource Update • ResourcesEx • SciTE Jump • Settings INI • SHELLHOOK • Shunting-Yard • Signature Creator • Stack() • Stopwatch() • StringAddLF()/StringStripLF() • StringEOLToCRLF() • VSCROLL • WM_COPYDATA • More Examples... Updated: 22/04/2018
Ascend4nt Posted February 3, 2011 Posted February 3, 2011 Good work Melba. Just curious - is the multiple-item-move supposed to work with contiguous selected items only? Only reason I ask is because doing multiple selection using 'Ctrl-click' works only when the items are bunched together - any other items selected remain where they were. For example, if items #1-3 and item #6 selected, then dragged. Only items 1-3 will be moved. Item #6 stays in the same spot. Otherwise - very nice job. One day I might use it.. though I think I stopped futzing around with ListViews because I wanted 'sort' and 'insert-into-sorted' list functions, but was too lazy to do the work My contributions: Performance Counters in Windows - Measure CPU, Disk, Network etc Performance | Network Interface Info, Statistics, and Traffic | CPU Multi-Processor Usage w/o Performance Counters | Disk and Device Read/Write Statistics | Atom Table Functions | Process, Thread, & DLL Functions UDFs | Process CPU Usage Trackers | PE File Overlay Extraction | A3X Script Extract | File + Process Imports/Exports Information | Windows Desktop Dimmer Shade | Spotlight + Focus GUI - Highlight and Dim for Eyestrain Relief | CrossHairs (FullScreen) | Rubber-Band Boxes using GUI's (_GUIBox) | GUI Fun! | IE Embedded Control Versioning (use IE9+ and HTML5 in a GUI) | Magnifier (Vista+) Functions UDF | _DLLStructDisplay (Debug!) | _EnumChildWindows (controls etc) | _FileFindEx | _ClipGetHTML | _ClipPutHTML + ClipPutHyperlink | _FileGetShortcutEx | _FilePropertiesDialog | I/O Port Functions | File(s) Drag & Drop | _RunWithReducedPrivileges | _ShellExecuteWithReducedPrivileges | _WinAPI_GetSystemInfo | dotNETGetVersions | Drive(s) Power Status | _WinGetDesktopHandle | _StringParseParameters | Screensaver, Sleep, Desktop Lock Disable | Full-Screen Crash Recovery Wrappers/Modifications of others' contributions: _DOSWildcardsToPCRegEx (original code: RobSaunder's) | WinGetAltTabWinList (original: Authenticity) UDF's added support/programming to: _ExplorerWinGetSelectedItems | MIDIEx UDF (original code: eynstyne) (All personal code/wrappers centrally located at Ascend4nt's AutoIT Code)
czardas Posted February 4, 2011 Posted February 4, 2011 I also considered the idea of dragging gapped selections, but it's not clear to me how it should work or why it is needed. I can think of two viable alternatives: either you queue the items that are not selected and insert them between the gaps, or you could collapse the gaps in the selection during the drag. While dragging a contiguous selection in one hit can save a lot of time, I don't see the same benefit with a non-continguous selection, except under very rare circumstances. Although, it would be a pretty neat trick. operator64 ArrayWorkshop
Mat Posted February 4, 2011 Posted February 4, 2011 (edited) I have a request... GUITreeViewEx Don't stop typing Melba, you are way too valuable MatEdit: And use [hr] rather than ###### to seperate your post. It messes up the forum when you have a very long line. Edited February 4, 2011 by Mat AutoIt Project Listing
Moderators Melba23 Posted February 4, 2011 Author Moderators Posted February 4, 2011 (edited) Ascend4nt,You are correct - it will only move a consecutive block of selections - although you can drag any of the items within the section to move it. I could not think of a sensible logic to move the other selected items as well. And anyway it looked as if any solution would require far too much coding! Mat,GUITreeViewEx.....I will have to think about that one a bit. Edit: No need - take a look here.Thanks for the separator tip - you will see it is now implemented. M23 Edited February 4, 2011 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
WeMartiansAreFriendly Posted February 5, 2011 Posted February 5, 2011 (edited) Got a few errorsIn "LVEx_Example_1.au3"These steps are repeatable: (or maybe not? )1. Drag a few list view items (on the first listview) 2. Click elsewhere on the GUI a couple of times (not a button or listview) * Column 0 text disapears * Console says -- Inserting at LV Index: 10 -- Inserting at LV Index: 11 --etc 4. Drag a few more items a couple times 5. ... (944) : ==> Variable used without being declared.: _GUIListViewEx_Array_Insert($aLVEx_Array, $iGLVExInsert_Index + 1, $aInsertData[$i]) _GUIListViewEx_Array_Insert($aLVEx_Array, $iGLVExInsert_Index + 1, ^ ERRORTried this with the second list view and Steps 1 and 2 follow immediatly with an hardcrash errorI also got these errors but I don't recall what I did to cause them ==> Subscript used with non-Array variable.: _GUICtrlListView_SetItemText($hGLVEx_Handle, $i, $aLVEx_Array[$i + 1]) _GUICtrlListView_SetItemText($hGLVEx_Handle, $i, $aLVEx_Array^ ERROR==> Array variable subscript badly formatted.: Local $aInsertData[$iMultipleItems + 1] Local $aInsertData[^ ERRORWindows XP SP3, AutoIt 3.3.6.0[Edit: No hard crash ] Edited February 5, 2011 by WeMartiansAreFriendly Don't bother, It's inside your monitor!------GUISetOnEvent should behave more like HotKeySet()
Moderators Melba23 Posted February 5, 2011 Author Moderators Posted February 5, 2011 WeMartiansAreFriendly, Thank you for that - I can reproduce them all and I know what the problem is. I somehow missed a check line in one of the message handlers so it reacted all the time and not just when dragging. New UDF and zip in first post. Thanks again. 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
strikeraid Posted February 28, 2011 Posted February 28, 2011 I've been getting this error when dragging items. C:\Program Files (x86)\AutoIt3\Include\GuiListViewEx.au3 (954) : ==> Array variable has incorrect number of subscripts or subscript dimension range exceeded.: $aItemData[$i] = $aGLVEx_Array[$iGLVExDragged_Index + 1][$i] $aItemData[$i] = ^ ERROR I'm not sure if I'm missing something or not, but I'm using the UDF Listview with these lines $ListView3_Index = _GUIListViewEx_Init($ListView3, "", 0, 0x00FF00) _GUIListViewEx_DragRegister() Should I set an active Listview since I have 3?
Moderators Melba23 Posted February 28, 2011 Author Moderators Posted February 28, 2011 strikeraid,I need more code than that to give you a sensible answer - I would suggest posting the whole script. When you post your code please use Code tags. Put [autoit] before and [/autoit] after your posted code. 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
strikeraid Posted March 1, 2011 Posted March 1, 2011 Nevermind. I figured it was because I didn't declare an array in $ListView3_Index = _GUIListViewEx_Init($ListView3, "", 0, 0x00FF00) The program adds items to a listview so I don't have an array that is put into the listview. I'll just forget about dragging.
Recommended Posts