Moderators Melba23 Posted February 6, 2016 Moderators Share Posted February 6, 2016 error471, When looking at how to implement the "reset default colouring" option you requested, I looked at several options and went with the easiest to implement - after all you have to leave something for the coder to do for themselves! To do what you require, you will have to reset both text and field to default using ";" and then reset the required background using _GUIListViewEx_ReturnArray to get the current setting. Something like this: ; Get current colours $aColArray = _GUIListViewEx_ReturnArray($iLV_Index, 2) ; Reset default for both text and field _GUIListViewEx_SetColour($iLV_Index, ";", $iRow, $iCol) ; Extract current colours $aSplit = StringSplit($aColArray[$iRow][$iCol], ";") ; Create required setting $sColSet = $aSplit[1] & ";" ; If text $sColSet = ";" & $aSplit[2] ; If field ; And now reset the colour to be retained _GUIListViewEx_SetColour($iLV_Index, $sColSet, $iRow, $iCol) I have incorporated this method into the example I will release with the new UDF later today so you can see it in action. 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...
error471 Posted February 6, 2016 Author Share Posted February 6, 2016 (edited) Thank you Melba23. Your support is awesome. I have two questions: I created a button, which adds - in my special case 7 - columns at the end of the listview and calculates their correct (following day) dates in the header. Now, I am trying to "copy/paste" the content of the last 7 days into the newly created columns. I haven't found a function/command besides _GUIListViewEx_InsertSpec, which seems to be only for adding rows. Is there a function/comman - which I have overseen - that adds data into a specific cell? And something less important: Is GUIListViewEx capable to show gridlines as in the following example? https://www.autoitscript.com/autoit3/docs/libfunctions/_GUICtrlListView_GetExtendedListViewStyle.htm Edited February 7, 2016 by error471 Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted February 7, 2016 Moderators Share Posted February 7, 2016 error471, Did you look in the Current function list within the UDF? expandcollapse popup; #CURRENT# ========================================================================================================== ; _GUIListViewEx_Init: Enables UDF functions for the ListView and sets various flags ; _GUIListViewEx_Close: Disables all UDF functions for the specified ListView and clears all memory used ; _GUIListViewEx_SetActive: Set specified ListView as active for UDF functions ; _GUIListViewEx_GetActive: Get index number of active ListView for UDF functions ; _GUIListViewEx_ReadToArray: Creates an array from the current ListView content to be loaded in _Init function ; _GUIListViewEx_ReturnArray: Returns an array of the current content, checkbox state, colour of the ListView ; _GUIListViewEx_SaveListView: Saves ListView headers, content, checkbox state, colour data to file ; _GUIListViewEx_LoadListView: Loads ListView headers, content, checkbox state, colour data from file ; _GUIListViewEx_Insert: Inserts data in row below selected row in active ListView ; _GUIListViewEx_InsertSpec: Inserts data in specified row in specified ListView ; _GUIListViewEx_Delete: Deletes selected row(s) in active ListView ; _GUIListViewEx_DeleteSpec: Deletes specified row(s) in specified ListView ; _GUIListViewEx_Up: Moves selected row(s) in active ListView up 1 row ; _GUIListViewEx_Down: Moves selected row(s) in active ListView down 1 row ; _GUIListViewEx_InsertCol: Inserts blank column to right of selected column in active ListView ; _GUIListViewEx_InsertColSpec: Inserts specified blank column in specified ListView ; _GUIListViewEx_DeleteCol: Deletes selected column in active ListView ; _GUIListViewEx_DeleteColSpec: Deletes specified column in specified ListView ; _GUIListViewEx_EditOnClick: Allow edit of ListView items in user-defined columns when doubleclicked ; _GUIListViewEx_EditItem: Manual edit of specified ListView item ; _GUIListViewEx_ChangeItem: Programatic change of specified ListView item ; _GUIListViewEx_EditHeader: Allow edit of ListView headers ; _GUIListViewEx_EditWidth: Set required widths for column edit/combo when editing ; _GUIListViewEx_ComboData: Use combo and set data to edit item in defined column ; _GUIListViewEx_DragEvent: Returns index of ListView(s) involved in a drag-drop event ; _GUIListViewEx_SetColour: Sets text and/or back colour for a user colour enabled ListView ; _GUIListViewEx_LoadColour: Uses array to set text and back colour for a user colour enabled ListView ; _GUIListViewEx_ContextPos: Returns LV index and row/col of last right click ; _GUIListViewEx_ToolTipInit: Defines column(s) which will display a tooltip when clicked ; _GUIListViewEx_ToolTipShow: Show tooltips with item content when defined columns clicked ; _GUIListViewEx_MsgRegister: Registers Windows messages required for the UDF ; _GUIListViewEx_WM_NOTIFY_Handler: Windows message handler for WM_NOTIFY - needed for all UDF functions ; _GUIListViewEx_WM_MOUSEMOVE_Handler: Windows message handler for WM_MOUSEMOVE - needed for drag ; _GUIListViewEx_WM_LBUTTONUP_Handler: Windows message handler for WM_LBUTTONUP - needed for drag ; _GUIListViewEx_WM_SYSCOMMAND_Handler: Windows message handler for WM_SYSCOMMAND - speeds GUI closure when editing ; ==================================================================================================================== "_GUIListViewEx_ChangeItem: Programatic change of specified ListView item" would seem to be the function you need. As to the gridlines - just add the relevant style to the ListView when you create it - the UDF does not care one way or the other. 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...
error471 Posted February 7, 2016 Author Share Posted February 7, 2016 (edited) Thank you Melba23. I have overlooked the function. It is integrated into my project now. But the gridlines still make some trouble. I used _GUICtrlListView_SetExtendedListViewStyle($cLV_1, $LVS_EX_GRIDLINES) which showed gridlines, but broke the colour assignment function. This $cLV_1 = GUICtrlCreateListView("", 172, 6, 792, 483, $LVS_SINGLESEL+$LVS_EX_GRIDLINES) makes no change at all. Edited February 7, 2016 by error471 Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted February 7, 2016 Moderators Share Posted February 7, 2016 error471, Glad that function worked - I put it in the UDF for exactly that reason. You MUST have the $LVS_EX_FULLROWSELECT extended style to get the UDF to work - perhaps I should add that to the UDF requirements (although it is set by default for native ListViews) as if you do not use that style then you cannot detect the column on which you perform a left/right/double-click which breaks nearly all the UDF functions. Adding further extended styles (e.g. $LVS_EX_GRIDLINES) in the manner you have done overwrites the default setting and so removes $LVS_EX_FULLROWSELECT from the applied styles - see the Setting Styles tutorial in the Wiki to understand why. What you need to use is this: _GUICtrlListView_SetExtendedListViewStyle($cLV_1, BitOR($LVS_EX_FULLROWSELECT, $LVS_EX_GRIDLINES)) as I use in the example. And adding an extended style to a normal style as you have done ($LVS_SINGLESEL + $LVS_EX_GRIDLINES) is wrong on 2 counts: Normal and extended styles are entirely separate, which is why you use separate parameters to set them. All styles, both normal and extended) should be compounded using BitOR and not simple addition (see the above-linked tutorial to understand why). Clearer now? 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...
error471 Posted February 7, 2016 Author Share Posted February 7, 2016 (edited) Thank you M23. I understand the styles now. Unfortunately I have a new and very serious problem with the speed of the UDF now. As I mentioned a few posts before I have created a function, which adds 7 new columns and sets the column-header in a date-format according to the last columns (date-)header (for example: 07.02.2016). Already slow, but so far so good. Another function follows, which copy-pastes the content of the last week into the prior created 7 columns. It works too, but the problem gets heavier. I am intending to have 365 columns (each per day) and maybe 30-40 rows. The problem is the extreme slowness of the UDF if there are more than - lets say - 30-40 columns and 20-25 rows. The UDF seems to redraw the whole table after every single insert. With already 30 rows and 7 columns and like 0,5-3 seconds redrawing-time for each insert, I can almost boil an egg. Every column and every row makes it slower and slower. Is there a way to inhibit redrawing and force it manually at the end? Like another ChangeItem function without redrawing? Or is it maybe a completely different, a more general problem? expandcollapse popupCase $cCDuplicate $aHdrs = _GUIListViewEx_ReturnArray($iLVIndex_1, 4) ;_ArrayDisplay($aHdrs,"Array") ;MsgBox(0, "Info", UBound($aHdrs)-1) ;===deleting unnecessary rows=== For $i = 0 To UBound($aHdrs)-8 _ArrayDelete($aHdrs, 0) ;_ArrayDisplay($aHdrs,"Array") Next ;MsgBox(0, "Info", "Finished!") ;_ArrayDisplay($aHdrs,"Array") $aData = _GUIListViewEx_ReturnArray($iLVIndex_1, 3) ;_ArrayDisplay($aData,"Array") ;MsgBox(0, "Info", UBound($aData)-1) ;====deleting unnecessary columns=== For $i = 0 To UBound($aData,2)-8 _ArrayColDelete($aData, 0) ;_ArrayDisplay($aData,"Array") Next ;MsgBox(0, "Info", "Finished!") ;_ArrayDisplay($aData,"Array") For $i = 0 To 6 ;======add columns and calculate the date in the header====== $sDatum = $aHdrs[$i] ;MsgBox(0,"Gelesen", $sDatum) $sDatum = StringSplit($sDatum,".") $sDatum_UK = $sDatum[3] & "/" & $sDatum[2] & "/" & StringRight($sDatum[1],2) ;MsgBox(0,"",$sDatum & @crlf & $sDatum_UK) $iBerechnetesDatum = _DateAdd('d', 7, $sDatum_UK) $aDate = StringSplit($iBerechnetesDatum,"/") $sDate_New = $aDate[3] & "." & $aDate[2] & ".20" & StringRight($aDate[1],2) ;MsgBox(0,"",$sDate & @crlf & $sDate_New) _GUIListViewEx_InsertColSpec($iLVIndex_1,-1,$sDate_New,70) ;================================================== ;====Insert data of last 7 days into the new columns======== ;MsgBox(0,"Info", UBound($aData)-1) $xData = _GUIListViewEx_ReturnArray($iLVIndex_1, 3) ;MsgBox(0,"Info", UBound($xData,2)-1) For $j = 1 To UBound($aData)-1 _GUIListViewEx_ChangeItem($iLVIndex_1, $j-1,UBound($xData,2)-1, $aData[$j][UBound($aData,2)-7+$i]) ;_GUIListViewEx_ChangeItem($iLV_Index, $iRow, $iCol, $vValue) Next Next Edited February 7, 2016 by error471 Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted February 8, 2016 Moderators Share Posted February 8, 2016 (edited) error471, Quote serious problem with the speed of the UDF I am not at all surprised to hear that. With the number of cells you are using (~15,000), you are asking a lot of the UDF to manage everything - remember that the UDF is running AutoIt code which, although powerful and flexible, has never been renowned for speed, and the functions in the array library which are fundamental to its operation are not the fastest either. Try placing your multiple insert code inside a _GUICtrlListView_Begin/EndUpdate pairing - that should help as it will only redraw after the inserts have taken place - but you may have problems with the existing instances of those commands within the __GUIListViewEx_ReWriteLV function. I will see if I can come up with an override function to prevent redraws until specified by the user. However I must ask: why are you keeping an entire year's worth of data in a single ListView? Why not break it down into months, which would reduce the problem by (literally) an order of magnitude? You could always use a tab structure to hold a ListView for each of the months which would make navigation really easy - although adding a week's data at a time would require a certain finesse. If you wanted to go down that route I would be happy to offer any advice I could. Other than that I cannot really offer any help (and certainly no promise) to speed up the UDF - it does what it does. And you have asked for a fair amount of functionality to be added, most of which (the colour code) is complex (i.e. slow) and operates on every single cell after many of the available operations. M23 Edit: I might be able to speed up the redraw in some cases - I am investigating further. Edit 2: Looks promising - stay tuned. Edited February 8, 2016 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 Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted February 8, 2016 Moderators Share Posted February 8, 2016 (edited) error471, Try this new version - I have added a function _GUIListViewEx_AllowReDraw which prevents redrawing during multiple _GUIListViewEx_ChangeItem calls but forces a redraw when redrawing is re-enabled. The required syntax looks like this: ; Recommended as user needs to know something is happening while the items are loaded but not seen SplashTextOn("Hi", "Loading") ; Prevent redrawing _GUIListViewEx_AllowReDraw($iLVIndex_1, False) ; Loop through the multiple _ChangeItem calls For $i = 1 To 7 For $j = 1 To 7 _GUIListViewEx_ChangeItem($iLVIndex_1, $i, $j, "New Item " & $i & " - " & $j) Next Next ; Reallow redrawing and force a redraw to update the ListView after the changes _GUIListViewEx_AllowReDraw($iLVIndex_1, True) ; Clear the splash screen SplashOff() And here is the new file: <snip> Let me know what you think. M23 Edit: I have further tweaked the code to speed up the redraw when _GUIListViewEx_SetColour is used - only the affected row is redrawn rather than the whole ListView. I am now looking into whether this trick can be used for other functions too. Edited February 11, 2016 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 Link to comment Share on other sites More sharing options...
error471 Posted February 8, 2016 Author Share Posted February 8, 2016 Thank you M23. I would like to try it now, but _GUIListViewEx_AllowReDraw is an undefined function. I think the new GUIListViewEx_Mod.au3 is missing here. Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted February 8, 2016 Moderators Share Posted February 8, 2016 error471, Sorry - uploaded the example and not the UDF. Please try again now. And here is a quick and dirty example of the tabbed version I mentioned - note that each month has the correct number of days/columns. Try adding at least 8 lines to a ListView using "Ins" and then press "Change": expandcollapse popup#include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <AutoItConstants.au3> #include <StaticConstants.au3> #include <UpDownConstants.au3> #include <EditConstants.au3> #include <File.au3> #include <Misc.au3> #include <String.au3> #include <Array.au3> #include <Date.au3> #include "GUIListViewEx_Mod.au3" Global $iYellow = "0xFFFF00", _ $iLtBlue = "0xCCCCFF", _ $iGreen = "0x00FF00", _ $iBlack = "0x000000", _ $iRed = "0xFF0000", _ $iBlue = "0x0000FF", _ $iWhite = "0xFFFFFF" Global $mContextmenu Global $mWhtTxt, $mYelTxt, $mBluTxt, $mGrnTxt, $mBlkTxt Global $mWhtFld, $mRedFld, $mBluFld, $mGrnFld, $mBlkFld Global $mDefTxt, $mDefFld, $mDefBoth Global $sRet Global $aLV[12], $aLVIndex[12] $hGUI = GUICreate("Tabbed ListView Example", 1000, 485) ; Create tab $cTab = GUICtrlCreateTab(10, 10, 980, 300) For $i = 0 To 11 GUICtrlCreateTabItem("Month " & $i + 1) ; Create ListView $aLV[$i] = GUICtrlCreateListView("", 20, 35, 960, 260, BitOR($LVS_SINGLESEL, $LVS_SHOWSELALWAYS)) _GUICtrlListView_SetExtendedListViewStyle($aLV[$i], $LVS_EX_FULLROWSELECT) For $j = 1 To _DateDaysInMonth(@YEAR, $i + 1) _GUICtrlListView_AddColumn($aLV[$i], $j, 100) Next ; Initiate ListView - edit on click all columns - user colours $aLVIndex[$i] = _GUIListViewEx_Init($aLV[$i], "", 0, 0, True, 2 + 32) Next GUICtrlCreateTabItem("") ; Create initial context menu _GUIListViewEx_SetActive($aLVIndex[0]) _CreateContextMenu(0) ; Create buttons for LH ListView GUICtrlCreateGroup("", 10, 300, 480, 175) GUICtrlCreateLabel("Up/Down", 25, 320, 80, 20, $SS_CENTER) $cUp = GUICtrlCreateButton("Up", 25, 340, 80, 30) $cDown = GUICtrlCreateButton("Down", 25, 380, 80, 30) GUICtrlCreateLabel("Ins/Del", 150, 320, 80, 20, $SS_CENTER) $cIns = GUICtrlCreateButton("Ins", 150, 340, 80, 30) $cDel = GUICtrlCreateButton("Del", 150, 380, 80, 30) GUICtrlCreateLabel("Change", 275, 320, 80, 20, $SS_CENTER) $cChange = GUICtrlCreateButton("Change", 275, 340, 80, 30) $cExit = GUICtrlCreateButton("Exit", 910, 430, 80, 30) ; If colours used then this function must be run BEFORE GUISetState _GUIListViewEx_MsgRegister() GUISetState() ;_ArrayDisplay($aLVIndex, "", Default, 8) While 1 $iMsg = GUIGetMsg() Switch $iMsg Case $GUI_EVENT_CLOSE, $cExit Exit Case $cUp _GUIListViewEx_Up() Case $cDown _GUIListViewEx_Down() Case $cIns ; Insert row _GUIListViewEx_Insert("New Row") Case $cDel ; Delete row _GUIListViewEx_Delete() Case $cChange ; Recommended as user needs to know something is happening while the items are loaded but not seen SplashTextOn("Hi", "Loading") $iIndex = _GUIListViewEx_GetActive() ; Prevent redrawing _GUIListViewEx_AllowReDraw($iIndex, False) ; Loop through the multiple _ChangeItem calls For $i = 1 To 7 For $j = 1 To 7 _GUIListViewEx_ChangeItem($iIndex, $i, $j, "New Item " & $i & " - " & $j) ConsoleWrite(@error & @CRLF) Next Next ; Reallow redrawing and force a redraw to update the ListView after the changes _GUIListViewEx_AllowReDraw($iIndex, True) ; Clear the splash screen SplashOff() Case $mWhtTxt To $mDefBoth ; Check context menu items _SetColour($iMsg) Case $cTab $iIndex = GUICtrlRead($cTab) _GUIListViewEx_SetActive($aLVIndex[$iIndex]) _CreateContextMenu($iIndex) EndSwitch ; Allow edit on double click $aRet = _GUIListViewEx_EditOnClick() WEnd Func _CreateContextMenu($iIndex) ; Delete previous menu GUICtrlDelete($mContextmenu) ; Create context menu for native ListView $mContextmenu = GUICtrlCreateContextMenu($aLV[$iIndex]) $mWhtTxt = GUICtrlCreateMenuItem("White text", $mContextmenu) $mYelTxt = GUICtrlCreateMenuItem("Yellow text", $mContextmenu) $mBluTxt = GUICtrlCreateMenuItem("Blue text", $mContextmenu) $mGrnTxt = GUICtrlCreateMenuItem("Green text", $mContextmenu) $mBlkTxt = GUICtrlCreateMenuItem("Black text", $mContextmenu) GUICtrlCreateMenuItem("", $mContextmenu) $mWhtFld = GUICtrlCreateMenuItem("White field", $mContextmenu) $mRedFld = GUICtrlCreateMenuItem("Red field", $mContextmenu) $mBluFld = GUICtrlCreateMenuItem("Blue field", $mContextmenu) $mGrnFld = GUICtrlCreateMenuItem("Green field", $mContextmenu) $mBlkFld = GUICtrlCreateMenuItem("Black field", $mContextmenu) GUICtrlCreateMenuItem("", $mContextmenu) $mDefTxt = GUICtrlCreateMenuItem("Default txt", $mContextmenu) $mDefFld = GUICtrlCreateMenuItem("Default field", $mContextmenu) $mDefBoth = GUICtrlCreateMenuItem("Default both", $mContextmenu) EndFunc Func _SetColour($iCID) ; Get information on where last right click occurred within ListView Local $aContext = _GUIListViewEx_ContextPos() ; Set new colour required Local $sColSet = "", $aColArray, $aSplit, $fDef = False Switch $iCID Case $mWhtTxt $sColSet = $iWhite & ";" ; Text colour followed by ";" Case $mYelTxt $sColSet = $iYellow & ";" Case $mBluTxt $sColSet = $iLtBlue & ";" Case $mGrnTxt $sColSet = $iGreen & ";" Case $mBlkTxt $sColSet = $iBlack & ";" Case $mWhtFld $sColSet = ";" & $iWhite ; Field colour preceded by ";" Case $mRedFld $sColSet = ";" & $iRed Case $mBluFld $sColSet = ";" & $iBlue Case $mGrnFld $sColSet = ";" & $iGreen Case $mBlkFld $sColSet = ";" & $iBlack Case $mDefTxt ; Get current colours $aColArray = _GUIListViewEx_ReturnArray($aContext[0], 2) ; Extract current colours $aSplit = StringSplit($aColArray[$aContext[1]][$aContext[2]], ";") ; Create required setting $sColSet = ";" & $aSplit[2] ; Set default flag $fDef = True Case $mDefFld $aColArray = _GUIListViewEx_ReturnArray($aContext[0], 2) $aSplit = StringSplit($aColArray[$aContext[1]][$aContext[2]], ";") $sColSet = $aSplit[1] & ";" $fDef = True Case $mDefBoth $sColSet = ";" EndSwitch If $sColSet Then ; Reset to default if needed If $fDef Then _GUIListViewEx_SetColour($aContext[0], ";", $aContext[1], $aContext[2]) EndIf ; Set required item colour _GUIListViewEx_SetColour($aContext[0], $sColSet, $aContext[1], $aContext[2]) EndIf EndFunc How does that seem? Worth pursuing? It would mean developing the "Change" code to cope with moving to the next month, but I do not see that as too difficult to manage. 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...
error471 Posted February 8, 2016 Author Share Posted February 8, 2016 I still can't find the modded UDF. Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted February 8, 2016 Moderators Share Posted February 8, 2016 error471, Hmmm, the forum seems to have rejected my first attempt to re-upload the file. However, it seems to have worked this time, so try 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 Link to comment Share on other sites More sharing options...
error471 Posted February 8, 2016 Author Share Posted February 8, 2016 It works faster now, but according to your function description in the UDF _GUIListViewEx_AllowReDraw prevents ListView redrawing during multiple _GUIListViewEx_ChangeItem calls. Does that mean redrawing within _GUIListViewEx_InsertColSpec is still allowed? If so, it would explain the persisting slowness, when a column is added. Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted February 8, 2016 Moderators Share Posted February 8, 2016 (edited) error471, I will see what I can do. Did you look at the tabbed example? Using that would prevent the need to add columns at all. M23 Edit: With a few small tweaks I think I will be able to make the function prevent redrawing for all the Insert/Delete functions - which will allow using them in loops to run faster. Edited February 8, 2016 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 Link to comment Share on other sites More sharing options...
error471 Posted February 8, 2016 Author Share Posted February 8, 2016 Yes, I looked at it, and it is definetely a thinkable option. But at his point I think the tabbed option will could be a bit userunfriendly for my colleagues, because they actually work with endless excel tables and are used to that handling. Additionally I must admit, I am also not aware how to manage save/load- or an analysis function with tabs. If the actual program design fails in practice, the tabbed version could be the next best option. Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted February 8, 2016 Moderators Share Posted February 8, 2016 error471, I understand. I will continue to work on speeding up the UDF where I can. But be aware that I am away on a residential course for most of this week and as a result I will not have a huge amount of time to spend on the task - so please be patient. 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...
error471 Posted February 8, 2016 Author Share Posted February 8, 2016 I am glad that you can support me anyway, no matter how long it takes. Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted February 11, 2016 Moderators Share Posted February 11, 2016 (edited) error471, I found a little time during my course (which was excellent, BTW) and I have produced this new version which has an amended function - _GUIListViewEx_BlockReDraw - which allows you to use multiple Insert/Delete (both rows and columns) as well as ItemChange calls without redrawing the ListView after each call. The required syntax (True/False) has been reversed from the earlier _GUIListViewEx_AllowReDraw version (as the name of the function suggests) - so take care when writing your test script: M23 Edited June 2, 2016 by Melba23 Beta code removed mLipok 1 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...
error471 Posted February 11, 2016 Author Share Posted February 11, 2016 (edited) Implemented it. It works fast and flawless. Your UDF has a very big potential... Together with the MPDF.au3 UDF I see endless possibilities... You may laugh, but I am close to ged rid of using Excel for some timewasting, repeating tasks. Edited February 11, 2016 by error471 Link to comment Share on other sites More sharing options...
error471 Posted February 11, 2016 Author Share Posted February 11, 2016 I found a possible bug. When I load a lvs-file with _GUIListViewEx_LoadListView the saved colors are not loaded. To do so, I have to force a reload with _GUIListViewEx_BlockReDraw($iLVIndex_1, False), which - of course - delays. Everyhing else seems to work properly. 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