Efo74 Posted May 24, 2020 Share Posted May 24, 2020 Hi, I want to migrate to the GUIListViewEx library but I'm having problems applying colors for a column. Example 1 is done without the library (but that's how I want it). In example 2, in addition to missing the color for the column, the white grid on the table is also missing. Can someone help me ? Thank You . Ex1.au3 Ex2.au3 :rolleyes: Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted May 24, 2020 Moderators Share Posted May 24, 2020 Efo74, Please post about problem with any of my UDFs in the UDF thread - I am certain to see it then. Here is your script working with the UDF: expandcollapse popup#include <GuiConstantsEx.au3> #include <WindowsConstants.au3> #include "GUIListViewEx.au3" #include <Array.au3> Global $lw_col2 = "0xCECBCE" Global $lw_col1 = "0xAAAAAA" Global $alw_colors = _ReturnColors_Array() $hGUI = GUICreate("Test", 470, 300, -1, -1, BitOR($WS_SYSMENU, $WS_CAPTION, $WS_POPUP, $WS_POPUPWINDOW, $WS_BORDER, $WS_CLIPSIBLINGS)) Global $lw_frm_Test1 = GUICtrlCreateListView("", 10, 10, 450, 270) ; Set Ext Styles like this, not in the creation call _GUICtrlListView_SetExtendedListViewStyle($lw_frm_Test1, BitOR($WS_EX_CLIENTEDGE, $LVS_EX_GRIDLINES, $LVS_EX_FULLROWSELECT)) _GUICtrlListView_AddColumn($lw_frm_Test1, "COL1", 80) ;0 _GUICtrlListView_AddColumn($lw_frm_Test1, "COL2", 320) ;1 _GUICtrlListView_AddColumn($lw_frm_Test1, "*", 17) ;2 _GUICtrlListView_SetBkColor($lw_frm_Test1, Dec(StringTrimLeft($lw_col1, 2))) GUICtrlSetFont($lw_frm_Test1, 11, 800, 1) Local $aRecord[10][3] For $i = 0 To 9 For $j = 0 To 2 $aRecord[$i][$j] = $i & " - " & $j Next Next $iListviewIndex_lw_Example = _GUIListViewEx_Init($lw_frm_Test1, "", 0, 0xFFFFFF, False, 32 + 512) ;if 32+512 program crash _GUIListViewEx_SetEditStatus($iListviewIndex_lw_Example, 1, 1) _GUIListViewEx_EditWidth($iListviewIndex_lw_Example, 400) For $i = 0 To UBound($aRecord) - 1 $sRecord = $aRecord[$i][0] & "|" & $aRecord[$i][1] & "|" ; Use UDF function to add items _GUIListViewEx_InsertSpec($iListviewIndex_lw_Example, -1, $sRecord) Next ; Get current colour array for the ListView - that way we know it is the right size Global $aLVCol = _GUIListViewEx_ReturnArray($iListviewIndex_lw_Example, 2) ; Now set the colours we want For $i = 0 To UBound($aLVCol) - 1 ; Colour alternate lines If Mod($i,2) Then $aLVCol[$i][0] = ";" & $lw_col1 $aLVCol[$i][1] = ";" & $lw_col1 Else $aLVCol[$i][0] = ";" & $lw_col2 $aLVCol[$i][1] = ";" & $lw_col2 EndIf ; Add solid block with selected colour $aLVCol[$i][2] = ";0x" & Hex($alw_colors[$i], 6) Next ; And load it _GUIListViewEx_LoadColour($iListviewIndex_lw_Example, $aLVCol) ; When using colours, this must come BEFORE the GUISetState call _GUIListViewEx_MsgRegister() GUISetState() While True Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit EndSwitch $vRet = _GUIListViewEx_EventMonitor(0) ; Use combos to change EditMode Switch @extended Case 0 ; No event detected Case 1 If $vRet = "" Then MsgBox($MB_SYSTEMMODAL, "Edit", "Edit aborted" & @CRLF) Else _ArrayDisplay($vRet, "ListView " & _GUIListViewEx_GetActive() & " content edited", Default, 8) EndIf Case 2 If $vRet = "" Then MsgBox($MB_SYSTEMMODAL, "Header edit", "Header edit aborted" & @CRLF) Else _ArrayDisplay($vRet, "ListView " & _GUIListViewEx_GetActive() & " header edited", Default, 8) EndIf Case 3 MsgBox($MB_SYSTEMMODAL, "Sorted", "ListView: " & $vRet & @CRLF) Case 4 ToolTip("") MsgBox($MB_SYSTEMMODAL, "Dragged", "From : To" & @CRLF & $vRet & @CRLF) EndSwitch WEnd ;************************************************************************************************************************************** Func _ReturnColors_Array() ;************************************************************************************************************************************** Local $aColors_Func[21] = [$COLOR_AQUA, $COLOR_BLACK, $COLOR_BLUE, $COLOR_CREAM, $COLOR_FUCHSIA, $COLOR_GRAY, $COLOR_GREEN, $COLOR_LIME, $COLOR_MAROON, $COLOR_MEDBLUE, $COLOR_MEDGRAY, _ $COLOR_MONEYGREEN, $COLOR_NAVY, $COLOR_OLIVE, $COLOR_PURPLE, $COLOR_RED, $COLOR_SILVER, $COLOR_SKYBLUE, $COLOR_TEAL, $COLOR_WHITE, $COLOR_YELLOW] Return $aColors_Func EndFunc ;==>_ReturnColors_Array I have added a few comments. Please ask if you have any questions. 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...
Efo74 Posted May 24, 2020 Author Share Posted May 24, 2020 Thank you so much for your truly valuable and very quick help. :rolleyes: Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted May 24, 2020 Moderators Share Posted May 24, 2020 Efo74. Delighted i could help. 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...
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