LarsJ Posted April 5, 2021 Share Posted April 5, 2021 (edited) Here is the virtual listview with sort indexes. You can choose from 10,000 - 100,000 rows in the combobox. There are two examples. In ArrayDisplay.au3, the sorting is performed on the fly when you click the column header. But the index is saved. The next time you click the same column header, the index doesn't need to be calculated again. In ArrayDisplay2.au3, sorting of all columns is performed in advance when you select a row number in the combobox. This is ArrayDisplay2.au3 on Windows 10: Time measurements in ArrayDisplay2.au3 on Windows 7 and Windows 10. Windows 7: expandcollapse popup$iRows = 10000 Generating array = 358.781013572459 Sorting array by column 0 Sorting array = 725.168987383328 Sorting array by column 1 Sorting array = 691.547153983459 Sorting array by column 2 Sorting array = 674.460721151355 Sorting array by column 3 Sorting array = 712.971753847876 Sorting array by column 4 Sorting array = 669.573738173515 $iRows = 20000 Generating array = 740.15795150085 Sorting array by column 0 Sorting array = 1573.40517161372 Sorting array by column 1 Sorting array = 1483.93515161976 Sorting array by column 2 Sorting array = 1450.29254023103 Sorting array by column 3 Sorting array = 1596.44574493107 Sorting array by column 4 Sorting array = 1457.82719306824 Displaying array $iRows = 30000 Generating array = 1112.6809728199 Sorting array by column 0 Sorting array = 2482.22581573692 Sorting array by column 1 Sorting array = 2342.03367751841 Sorting array by column 2 Sorting array = 2292.68983255434 Sorting array by column 3 Sorting array = 2564.00964209499 Sorting array by column 4 Sorting array = 2300.08984402379 Displaying array $iRows = 40000 Generating array = 1467.92280229134 Sorting array by column 0 Sorting array = 3421.94277520238 Sorting array by column 1 Sorting array = 3227.61289443203 Sorting array by column 2 Sorting array = 3173.90594884902 Sorting array by column 3 Sorting array = 3585.83262526565 Sorting array by column 4 Sorting array = 3179.76118610734 Displaying array $iRows = 50000 Generating array = 1850.58769848866 Sorting array by column 0 Sorting array = 4419.27792887224 Sorting array by column 1 Sorting array = 4162.76700754573 Sorting array by column 2 Sorting array = 4038.98393972278 Sorting array by column 3 Sorting array = 4644.78587451369 Sorting array by column 4 Sorting array = 4123.59412664434 Displaying array $iRows = 60000 Generating array = 2133.9393487735 Sorting array by column 0 Sorting array = 5399.97794762783 Sorting array by column 1 Sorting array = 5083.85636148603 Sorting array by column 2 Sorting array = 4944.67929728288 Sorting array by column 3 Sorting array = 5747.94969732011 Sorting array by column 4 Sorting array = 5037.79626988003 Displaying array $iRows = 70000 Generating array = 2445.89702594949 Sorting array by column 0 Sorting array = 6429.4995912277 Sorting array by column 1 Sorting array = 6034.70311993969 Sorting array by column 2 Sorting array = 5900.32909563942 Sorting array by column 3 Sorting array = 6903.26765734271 Sorting array by column 4 Sorting array = 6027.34937412542 Displaying array $iRows = 80000 Generating array = 2805.65848355588 Sorting array by column 0 Sorting array = 7468.49128806631 Sorting array by column 1 Sorting array = 7060.91469139561 Sorting array by column 2 Sorting array = 6864.93254495179 Sorting array by column 3 Sorting array = 8110.69459708571 Sorting array by column 4 Sorting array = 6996.29736238669 Displaying array $iRows = 90000 Generating array = 3159.49876841934 Sorting array by column 0 Sorting array = 8534.18796433611 Sorting array by column 1 Sorting array = 8005.49702473052 Sorting array by column 2 Sorting array = 7811.69684415594 Sorting array by column 3 Sorting array = 9256.5217258807 Sorting array by column 4 Sorting array = 8016.83709696589 Displaying array $iRows = 100000 Generating array = 3479.57703771814 Sorting array by column 0 Sorting array = 9648.39958233472 Sorting array by column 1 Sorting array = 9036.15148428256 Sorting array by column 2 Sorting array = 8904.49328164509 Sorting array by column 3 Sorting array = 10498.6470758859 Sorting array by column 4 Sorting array = 9075.35483956761 Displaying array Windows 10: expandcollapse popup$iRows = 10000 Generating array = 469.5655 Sorting array by column 0 Sorting array = 1047.509 Sorting array by column 1 Sorting array = 1004.8089 Sorting array by column 2 Sorting array = 942.9591 Sorting array by column 3 Sorting array = 1002.2672 Sorting array by column 4 Sorting array = 951.8781 $iRows = 20000 Generating array = 916.4006 Sorting array by column 0 Sorting array = 2061.4822 Sorting array by column 1 Sorting array = 1992.4709 Sorting array by column 2 Sorting array = 1924.7481 Sorting array by column 3 Sorting array = 2127.4384 Sorting array by column 4 Sorting array = 1936.3358 Displaying array $iRows = 30000 Generating array = 1372.8649 Sorting array by column 0 Sorting array = 3244.5609 Sorting array by column 1 Sorting array = 3180.6722 Sorting array by column 2 Sorting array = 3092.1707 Sorting array by column 3 Sorting array = 3382.2133 Sorting array by column 4 Sorting array = 3058.7045 Displaying array $iRows = 40000 Generating array = 1856.9411 Sorting array by column 0 Sorting array = 4525.1955 Sorting array by column 1 Sorting array = 4296.5849 Sorting array by column 2 Sorting array = 4182.7308 Sorting array by column 3 Sorting array = 4746.0117 Sorting array by column 4 Sorting array = 4244.3555 Displaying array $iRows = 50000 Generating array = 2382.5111 Sorting array by column 0 Sorting array = 5770.5723 Sorting array by column 1 Sorting array = 5710.5163 Sorting array by column 2 Sorting array = 6483.6553 Sorting array by column 3 Sorting array = 7055.8409 Sorting array by column 4 Sorting array = 6588.6965 Displaying array $iRows = 60000 Generating array = 2751.5795 Sorting array by column 0 Sorting array = 7473.5253 Sorting array by column 1 Sorting array = 6755.4111 Sorting array by column 2 Sorting array = 6581.2973 Sorting array by column 3 Sorting array = 7716.1906 Sorting array by column 4 Sorting array = 6670.898 Displaying array $iRows = 70000 Generating array = 3159.6544 Sorting array by column 0 Sorting array = 8270.8446 Sorting array by column 1 Sorting array = 7956.5928 Sorting array by column 2 Sorting array = 7698.139 Sorting array by column 3 Sorting array = 8988.3115 Sorting array by column 4 Sorting array = 7851.209 Displaying array $iRows = 80000 Generating array = 3610.7372 Sorting array by column 0 Sorting array = 9663.0729 Sorting array by column 1 Sorting array = 9416.2116 Sorting array by column 2 Sorting array = 9397.7431 Sorting array by column 3 Sorting array = 10748.4111 Sorting array by column 4 Sorting array = 9382.0706 Displaying array $iRows = 90000 Generating array = 4181.5457 Sorting array by column 0 Sorting array = 11512.0692 Sorting array by column 1 Sorting array = 10848.8297 Sorting array by column 2 Sorting array = 10596.1946 Sorting array by column 3 Sorting array = 12445.5149 Sorting array by column 4 Sorting array = 10686.9957 Displaying array $iRows = 100000 Generating array = 4784.8767 Sorting array by column 0 Sorting array = 12814.0628 Sorting array by column 1 Sorting array = 12111.9869 Sorting array by column 2 Sorting array = 11753.6472 Sorting array by column 3 Sorting array = 14061.7319 Sorting array by column 4 Sorting array = 12092.2128 Displaying array Most of the code is copied from Data display functions. That's a lot of code. And it isn't mainstream code. ArrayDisplay.7z Edited April 5, 2021 by LarsJ argumentum and pixelsearch 1 1 Controls, File Explorer, ROT objects, UI Automation, Windows Message MonitorCompiled code: Accessing AutoIt variables, DotNet.au3 UDF, Using C# and VB codeShell menus: The Context menu, The Favorites menu. Shell related: Control Panel, System Image ListsGraphics related: Rubik's Cube, OpenGL without external libraries, Navigating in an image, Non-rectangular selectionsListView controls: Colors and fonts, Multi-line header, Multi-line items, Checkboxes and icons, Incremental searchListView controls: Virtual ListViews, Editing cells, Data display functions Link to comment Share on other sites More sharing options...
jpm Posted April 7, 2021 Share Posted April 7, 2021 Thanks Larsj I try to add the justification column but it has some drawback to set to left if selected For $i = 0 To $iCols - 1 _GUICtrlListView_AddColumn( $idListView, $aCols[$i], $aWidths[$i] ) _GUICtrlListView_JustifyColumn($idListview, $i, 1) ; <<<<<<<<<<<<<<<<<<<<<<<<<<<< Next is it possible to keep the justify after the click to sort Thanks for the help Link to comment Share on other sites More sharing options...
pixelsearch Posted April 7, 2021 Author Share Posted April 7, 2021 @Melba23 When you have some time, could you please be kind enough and have a look at this link where a bug has been fixed in ArrayDisplayInternals beta 3.3.15.3.au3 I guess the problem isn't solved totally because what works fine now with Beta 3.3.15.3 ... #include <Array.au3> Local $aArray[1] = [0] _ArrayDisplay($aArray, "Title", "1:") ; no error with beta 3.3.15.3 ...still generates an error in some other cases. Here is a related example generating an error with a 1D array : #include <Array.au3> Local $aArray[2] = [0, 1] _ArrayDisplay($aArray, "Title", "2:") ; fatal error with beta 3.3.15.3 "ArrayDisplayInternals.au3" (363) : ==> Array variable has incorrect number of subscripts or subscript dimension range exceeded.: $vTmp = $aArray[$i] $vTmp = ^ ERROR This range checking (lines 137-184 in beta) seems to be a real nightmare to prevent fatal errors, especially its interaction with the bunch of variables related to item & subitems start/end, dimensions, row count & col count etc.. Thanks Link to comment Share on other sites More sharing options...
pixelsearch Posted April 7, 2021 Author Share Posted April 7, 2021 2 hours ago, jpm said: is it possible to keep the justify after the click to sort Hi Jpm While waiting for LarsJ's answer, here is what's doable as you right justified all LV columns : Example ArrayDisplay.au3 (extracted from ArrayDisplay.7z) Original line # 115 DataDisplay_SetHeaderItemFormat( $hHeader, $iColumnPrev, $HDF_STRING ) becomes DataDisplay_SetHeaderItemFormat( $hHeader, $iColumnPrev, $HDF_STRING + $HDF_RIGHT) Original line # 119 DataDisplay_SetHeaderItemFormat( $hHeader, $iColumn, $HDF_STRING + $iSortDir ) becomes DataDisplay_SetHeaderItemFormat( $hHeader, $iColumn, $HDF_STRING + $iSortDir + $HDF_RIGHT) As you already added 1 line in his script (_GUICtrlListView_JustifyColumn...) then both lines should now be #116 / #120 ... if you didn't add something else Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted April 7, 2021 Moderators Share Posted April 7, 2021 pixelsearch, jpm rewrote very nearly all of the _ArrayDisplay code to create the 2 separate functions so I do not consider that I should be the arbiter of your proposed changes as the code is now quite different from that which I originally developed. Please deal with jpm directly. But I agree with your comments on the range checking code - that was certainly my biggest headache when I rewrote the Array library all those years ago. 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...
LarsJ Posted April 8, 2021 Share Posted April 8, 2021 jpm, The only formatting in the example apart from default formatting is the up/down arrow in the column header to indicate the sorting direction. It may well be the case that all other formatting is reset. But column alignment certainly works in a virtual listview. Controls, File Explorer, ROT objects, UI Automation, Windows Message MonitorCompiled code: Accessing AutoIt variables, DotNet.au3 UDF, Using C# and VB codeShell menus: The Context menu, The Favorites menu. Shell related: Control Panel, System Image ListsGraphics related: Rubik's Cube, OpenGL without external libraries, Navigating in an image, Non-rectangular selectionsListView controls: Colors and fonts, Multi-line header, Multi-line items, Checkboxes and icons, Incremental searchListView controls: Virtual ListViews, Editing cells, Data display functions Link to comment Share on other sites More sharing options...
jpm Posted April 8, 2021 Share Posted April 8, 2021 Thanks Larsj the pixelsearch suggestion was cleaning my problem. I am working on a new _ArrayDisplay with your solution. I am on the process to handle 1D array and also transpose Thanks again for posting such awesome solution. Link to comment Share on other sites More sharing options...
LarsJ Posted April 8, 2021 Share Posted April 8, 2021 You should definitely not make any kind of transpose in an array of up to 16 mill. elements. It will take several eternities. There are some things that simply should not be implemented for large arrays. Unless it can be done in advance with a standalone piece of code like calculating a sort index. But it should certainly not be performed on the fly as part of the ArrayDisplay code. Controls, File Explorer, ROT objects, UI Automation, Windows Message MonitorCompiled code: Accessing AutoIt variables, DotNet.au3 UDF, Using C# and VB codeShell menus: The Context menu, The Favorites menu. Shell related: Control Panel, System Image ListsGraphics related: Rubik's Cube, OpenGL without external libraries, Navigating in an image, Non-rectangular selectionsListView controls: Colors and fonts, Multi-line header, Multi-line items, Checkboxes and icons, Incremental searchListView controls: Virtual ListViews, Editing cells, Data display functions Link to comment Share on other sites More sharing options...
argumentum Posted April 8, 2021 Share Posted April 8, 2021 2 minutes ago, LarsJ said: But it should certainly not be performed on the fly as part of the ArrayDisplay code. ...unless a cancel button is provided in a SplashGui if more than say, 1 sec. passes by. That way you can eat your cake and have it too. ...or disable the sorting if more than 1,000 entries. This is just to see the array. Should not be an overkill. ( my 2 cents ) Is there a way to sort the array in ASM ?. The problem is not loading the array. That is fast in virtual listview. The time consumption is the sorting as script code. Follow the link to my code contribution ( and other things too ). FAQ - Please Read Before Posting. Link to comment Share on other sites More sharing options...
LarsJ Posted April 8, 2021 Share Posted April 8, 2021 My starting point for using a virtual listview in ArrayDisplay at all is that once ArrayDisplay is opened, all the code must be lightning fast. Ie. that e.g. all sort indexes must be calculated in advance as in ArrayDisplay2.au3. And that all other time-consuming code can be calculated in advance. Otherwise you can just as well keep the good old slow ArrayDisplay, which with a little good will can handle 10,000 rows. But 10,000 rows and 10 columns is not much compared to an AutoIt array which can hold 16 million elements. Controls, File Explorer, ROT objects, UI Automation, Windows Message MonitorCompiled code: Accessing AutoIt variables, DotNet.au3 UDF, Using C# and VB codeShell menus: The Context menu, The Favorites menu. Shell related: Control Panel, System Image ListsGraphics related: Rubik's Cube, OpenGL without external libraries, Navigating in an image, Non-rectangular selectionsListView controls: Colors and fonts, Multi-line header, Multi-line items, Checkboxes and icons, Incremental searchListView controls: Virtual ListViews, Editing cells, Data display functions Link to comment Share on other sites More sharing options...
jpm Posted April 9, 2021 Share Posted April 9, 2021 Hi, I think that I will reject the transpose when number of rows if more than 100 or LESS as to visualize the info it is needed to use still a lot of horizontal shift perhaps 100 is a litle small but what can be a better value? FrancescoDiMuro 1 Link to comment Share on other sites More sharing options...
pixelsearch Posted April 15, 2021 Author Share Posted April 15, 2021 (edited) @jpm Yesterday afternoon, Nine was kind enough to spend some time doing a neutral test, which confirms what follows : After he created an Array of 30000 rows and 10 columns, he started a timer to calculate exactly how many seconds it took to populate a listview in ArrayDisplay, then how many seconds it took to sort a column. He did it twice, with 2 different versions of ArrayDisplayInternals . Here are the results, on Nine's computer : * With the actual version of ArrayDisplayInternals.au3 (AutoIt 3.3.14.5) : Populating LV : 38s Sort a column : 28s * When he used my last reworked version of ArrayDisplayInternals.au3 (I name it Beta 3.3.15.3-d) : Populating LV : 10.5s Sort a column : 9.5s Which means a gain of 350% (3.5 times faster) for populating, then 300% (3 times faster) for sorting. So Nine's test confirm the speed gain that I already noticed (the results are similar on my computer) and I guess it's same on your computer (Jpm). This is probably the reason why you were interested in the reworked script. I'm joining below this last reworked version in case anyone is interested. I won't rework it anymore as I have nothing to add in it and it's time for me to move over. In case a bug is detected, then we'll try to fix it here. Many thanks Nine & jpm for the time you spent on this ArrayDisplayInternals (beta 3.3.15.3-d).au3 Edited April 15, 2021 by pixelsearch Musashi and argumentum 1 1 Link to comment Share on other sites More sharing options...
jpm Posted April 15, 2021 Share Posted April 15, 2021 perhaps I will integrate it but for the time being I am on the final approach of the Virtual listview (LarsJ proposal) I think you wil like it just test it I think it is fully compatible with the current releases . array range fixed. Cheers ArrayDisplayInternals2.7z pixelsearch, argumentum and Musashi 3 Link to comment Share on other sites More sharing options...
pixelsearch Posted April 15, 2021 Author Share Posted April 15, 2021 Hi jpm I'm really glad to see you have the energy to rework the function and introduce Virtual views in it. It sure will be helpful for users who need to manage many thousands/millions of elements. Concerning the array range, it's not that easy to avoid fatal errors (which happen for example as soon as the user indicates a start row > array last row) but imho this array range checking can wait, so you can totally stay focused on integration of Virtual views in ArrayDisplay. If you're curious and look at the attachment in my previous post, I took away from main script all the array range checking code and placed it in a separate function, so it looks neater now and this is what's left in main code : ; Declare variables & flag to determine if range set Local $iItem_Start, $iItem_End, $iSubItem_Start, $iSubItem_End, $bRange_Flag = False ; Check for range settings $sMsg = __ArrayDisplay_CheckRange($sArrayRange, $iDimension, $iRowCount, $iColCount, _ $iItem_Start, $iItem_End, $iSubItem_Start, $iSubItem_End, $bRange_Flag) ; last 5 ByRef If $sMsg Then MsgBox($MB_TOPMOST, "Array Range >>> " & $sArrayRange & " <<< out of limits", $sMsg) Return SetError(10, 0, 0) EndIf ($sMsg had already been used and declared Local by M23/you before these lines) I hope that several users will test your final work, especially when you'll tell us you're finished and test time has come. Fingers crossed and good luck. FrancescoDiMuro 1 Link to comment Share on other sites More sharing options...
jpm Posted April 16, 2021 Share Posted April 16, 2021 Hi, I havese your Check array range but I decide to not issue a message incase of incoherent value Just avoid being out of range and defining in this case the upper value I remember in the present implementaion that it was intentional to accept greater value to be able not to generate a more comlex script using UBound(($array, ...) -1 just report about what you find in the speed, Thanks Link to comment Share on other sites More sharing options...
pixelsearch Posted April 18, 2021 Author Share Posted April 18, 2021 (edited) Hi jpm Speed is ok for sure, displaying & sorting times are improved. I just checked a bit your Example() function (not the transposed or 1D function until now) and added a couple of lines in ArrayDisplayInternals2.au3 to bring a smoother 1st display (there's no need for the user to see the columns resizing themselves, then the GUI resizing itself), this seems to work fine : Case -7 ; $WM_SETFOCUS ; shouldn't it be $NM_SETFOCUS ? If $_g_ArrayDisplay_bFirstFocus Then GUISetState(@SW_HIDE, $_g_ArrayDisplay_hGUI) ; added ... $_g_ArrayDisplay_bFirstFocus = False GUISetState(@SW_SHOW, $_g_ArrayDisplay_hGUI) ; added EndIf Return I'm not really convinced by the fact that all indexes should be prepared in advance if each one takes 1s or less. Imagine there are 10 columns and each index takes 1s to be prepared. This means we're forcing the user to wait 10s more before its virtual view is displayed. Maybe the other option LarsJ explained above could be fine too : On 4/5/2021 at 5:32 PM, LarsJ said: In ArrayDisplay.au3, the sorting is performed on the fly when you click the column header. But the index is saved. The next time you click the same column header, the index doesn't need to be calculated again. This means the user will have to wait 1s only to sort a column (then the index will be saved & reused for a possible descending sort). And nothing is telling us the user needs to sort each and every column. If I understood correctly, we won't be able to sort anything as soon as a range parameter exists : If $sArrayRange Then ContinueLoop ; no sorting when Array range selected Let's hope it will be fine with users, as many scripts got a row 0 contain some information (total of items for example) and the range "1:" is often used in _ArrayDisplay scripts. Anyway, great job jpm, all this new code in ArrayDisplayInternals2.au3 (based on Virtual LV) is impressive. I hope other Dev's and beta testers will help you by testing and share their opinions, ideas etc... Edited April 18, 2021 by pixelsearch Link to comment Share on other sites More sharing options...
LarsJ Posted April 18, 2021 Share Posted April 18, 2021 An array with 2.5 mill. rows and 6 columns must probably also be manageable. It is, after all, a valid array. And then it's important that it's the user who decides which columns to sort if any at all, and that any sorting index can be calculated in advance and loaded from a file or similar. And don't forget that all slow code is simply forbidden. Controls, File Explorer, ROT objects, UI Automation, Windows Message MonitorCompiled code: Accessing AutoIt variables, DotNet.au3 UDF, Using C# and VB codeShell menus: The Context menu, The Favorites menu. Shell related: Control Panel, System Image ListsGraphics related: Rubik's Cube, OpenGL without external libraries, Navigating in an image, Non-rectangular selectionsListView controls: Colors and fonts, Multi-line header, Multi-line items, Checkboxes and icons, Incremental searchListView controls: Virtual ListViews, Editing cells, Data display functions Link to comment Share on other sites More sharing options...
pixelsearch Posted April 18, 2021 Author Share Posted April 18, 2021 (edited) 1 hour ago, LarsJ said: it's important that it's the user who decides which columns to sort if any at all Thank you for this confirmation, that's exactly the personal opinion I expressed. As the array is already prepared before calling _ArrayDisplay, then switching to Virtual Listviews and still having to wait some seconds to display it would be contradictory imho @LarsJ could you please explain why I tried desperately to make a change in Jpm's code and it didn't work ? Please have a look at his last upload above, dated Thursday at 08:30 PM => ArrayDisplayInternals2.7z => ArrayDisplayInternals2.au3 : Line 716 (Case -7 ; $NM_SETFOCUS) to 781 (Return) This Case is only triggered once because of the test "If $_g_ArrayDisplay_bFirstFocus Then..." and the variable becomes False at the end of the function. I tried to move all this block into a separate function outside Func __ArrayDisplay_NotifyHandler() and call it only once, directly from main script, just before or just after having "registered WM_NOTIFY message handler through subclassing" (Note : there's only 1 variable to take care of : $bColDisplay which is declared like this inside the handler function : Local Static $bColDisplay = True) When I do this, then the GUI never have its correct final size and LV doesn't always have its columns correct size either (see pics below). So it appears that this block needs to stay inside the handler function, but why ? If it's called only once and Returns when finished (i.e without calling DefSubclassProc) then why doesn't it give the same results if we move this block into a separate function ? Thanks. Edit 1: this is how it looks when moved into a separate function and the function is called in main code just before Registering the WM_NOTIFY message thru subclassing : Edit 2 : a bit different (LV columns size ok, GUI size still bad) if the function is called from main script just after the Subclassing line : Edit 3 : please also note how Jpm had to add this line 442 in his original code, to hide the GUI temporarily : ; Display and resize dialog GUISetState(@SW_HIDE, $_g_ArrayDisplay_hGUI) ; <=== LINE 442 WinMove($_g_ArrayDisplay_hGUI, "", (@DesktopWidth - $iOrgWidth) / 2, (@DesktopHeight - $iHeight) / 2, $iOrgWidth, $iHeight) GUISetState(@SW_SHOW, $_g_ArrayDisplay_hGUI) He's hiding the GUI when it wasn't even Showed. But without this line, the final display would have been incorrect. So it seems that this Hide/Show GUI has many consequences when using Virtual Listviews, much more consequences than when used with regular ListViews. Edited April 18, 2021 by pixelsearch Link to comment Share on other sites More sharing options...
jpm Posted April 19, 2021 Share Posted April 19, 2021 Hi, it is I have a very hard time to have behavior similar to current release colum sizing was the main problem. so it is first created and modify on the first focus as you notice Your analyse of what it is going is exactly what I face to have an almost successfull display. I was not able to do a better sizing when columns arer seletec with the array range Perhaps LarsJ will find a better implementation ... For the display timing I try to display a ToolTip is the time can take a while. Not sur it was taking much more as in the previous implementation. If you run with scite you get consoleWrite of the different timings Thanks for the feedback pixelsearch 1 Link to comment Share on other sites More sharing options...
pixelsearch Posted April 19, 2021 Author Share Posted April 19, 2021 (edited) Hi Jpm What you did with virtual listview is really great, a 1st display using $NM_SETFOCUS, who would have found that solution to solve the display issue ? Now I found something very different that's creating an issue (easy to solve) Imagine this in ArrayDisplay2-new.au3 Local $iRows = 1, ... Local $aArray = FAS_Random2DArrayAu3($iRows, "sifdtr", "abcdefghijklmnopqrstuvwxyz") ConsoleWrite($aArray[0][0] & @lf) $aArray[0][0] = "abcdefghijklmnopqrstuvwxy" & "abcdefghijklmnopqrstuvwxy" & "123456789012345" ; 25 + 25 + 15 = 65 (string length) $aArray[0][0] &= $aArray[0][0] ; 130 $aArray[0][0] &= $aArray[0][0] ; 260 ; $aArray[0][0] = $aArray[0][0] & "ABCDEFGHIJKLMNOPQRSTUVWXY" ; 285 ConsoleWrite(StringLen($aArray[0][0]) & " " & $aArray[0][0] & @lf) Actually, there is a limitation in ArrayDisplayInternals2.au3 that will display only the first 50 characters of this 260 character string : Case -177 ; $LVN_GETDISPINFOW Local Static $iGetDispInfoW = 0 $iGetDispInfoW += 1 ConsoleWrite("$iGetDispInfoW = " & $iGetDispInfoW & " " & _ "$_g_ArrayDisplay_bFirstFocus = " & $_g_ArrayDisplay_bFirstFocus & @CRLF) Local Static $tText = DllStructCreate("wchar[50]"), $pText = DllStructGetPtr($tText) This is what we can read on msdn : If the structure receives item attributes, pszText is a pointer to a buffer that receives the item text. Note that although the list-view control allows any length string to be stored as item text, only the first 259 TCHARs are displayed. A test I just did shows this : * Regular listview : displays 254 characters maximum in AutoIt * Virtual listview : can display more than 254 characters with the appropriate buffer size. So changing wchar[50] to wchar[254] could at least display the first 254 characters in our virtual listview too. Edit: I got a possible answer to my question above : 17 hours ago, pixelsearch said: So it appears that this block (Case -7 ; $NM_SETFOCUS => line 781 Return) needs to stay inside the handler function, but why ? This could be because $NM_SETFOCUS is triggered immediately when the following line is encountered (I had to add plenty of ConsoleWrite, trying to understand what's happening and when) : GUISetState(@SW_SHOW, $_g_ArrayDisplay_hGUI) So even if the code in $NM_SETFOCUS is triggered only once, trying to place this code in a separate function (outside the handler) followed by GUISetState(@SW_SHOW, ...) this will only bring more problems... not counting the "interaction" between $NM_SETFOCUS and $LVN_GETDISPINFOW, which is called about 2900 times (based on 38 visible rows) until the $NM_SETFOCUS block is finished. Then $_g_ArrayDisplay_bFirstFocus becomes False and $LVN_GETDISPINFOW is still called another 300 times (from 2900 to 3200), this time with $_g_ArrayDisplay_bFirstFocus = False. All this without moving the mouse at all... or you'll end with much more than 3200 calls Edited April 19, 2021 by pixelsearch typo: changed a word "true" to "false" in penultimate sentence 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