Jump to content

i would like to change the color of the text or background of a GUICtrlCreateListView single cell


DrPickles
 Share

Recommended Posts

I have taken a working example of a 1d GUICtrlCreateListView and tried to make it a 2d. I have looked at the GUIListViewEx.au3 and _GUIListViewEx.au3 example "GLVEx_Example_6.au3" and i am having a hard time separating out all the functions. if some one can give me an example where i can target cells using array style coordinates "backgound_color($listApps, 0,1)' or some such, that would be much appreciated.

single cell 2d highlight or text color.au3

Link to comment
Share on other sites

#include <GUIConstantsEx.au3>
#include <MsgBoxConstants.au3>
#include <Array.au3>
#include "GUIListViewEx.au3"

Global $aColArray[70][1]

$hGUI = GUICreate("Test", 500, 500)

$listApps = GUICtrlCreateListView("Items|test", 10, 10, 400, 400, $LVS_SHOWSELALWAYS)
For $i = 0 To 69
    GUICtrlCreateListViewItem("Item " & $i & "|test " & $i, $listApps)
    If StringinStr($i, "7") Then
        $aColArray[$i][0] = "0xFF0000;"
    Else
        $aColArray[$i][0] = ";"
    EndIf
Next

$arrayList = _GUIListViewEx_ReadToArray($listApps)

_ArrayDisplay($arrayList, "Items", Default)
_ArrayDisplay($aColArray, "Colours", Default)

$lvIndex = _GUIListViewEx_Init($listApps, $arrayList, "", "", "", 32)

_GUIListViewEx_LoadColour($lvIndex, $aColArray)

_GUIListViewEx_MsgRegister()

GUISetState()

While 1
    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
            Exit
    EndSwitch
WEnd

 

Edited by Melba23
Added code tags
Link to comment
Share on other sites

  • Moderators

DrPickles,

If you check the return from the _GUIListViewEx_LoadColour function you will see that it gives you 0 with @error set to 3  and @extended to 1. According to the function header this means: Array not correct size for LV.

Basically you have a ListView with 2 columns, but a colour array with only one - so change this line and all will be well:

Global $aColArray[70][2]

M23

P.S. When you post code in future please use Code tags - see here how to do it.  Then you get a scrolling box and syntax colouring as you can see above now I have added the tags. Thanks in advance for your cooperation.

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png 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 columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...