Jump to content

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


Recommended Posts

Posted

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.au3Fetching info...

Posted (edited)
#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
  • Moderators
Posted

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:

  Reveal hidden contents

 

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
  • Recently Browsing   0 members

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