SetGadgetItemColor()

Syntax

SetGadgetItemColor(#Gadget, Item, ColorType, Color [, Column])
Description
Changes the color attribute specified by 'ColorType' of the given #Gadget item. RGB() can be used to get a valid color value. If a gadget item has no color set for a specific ColorType, the item will be drawn using the Color that was set for the whole gadget. To remove the custom color, set the 'Color' parameter to -1.

If the 'Item' parameter is set to -1, the color will be applied to the given 'Column' in all gadget items. If the 'Column' parameter is set to -1, the color will be applied to all columns of the given Item.

The following values are possible for the ColorType parameter:
  #PB_Gadget_FrontColor     : Item text
  #PB_Gadget_BackColor      : Item background
This command is supported by the following gadgets:

- ListIconGadget()
- TreeGadget()

Note: With activated Windows XP style the color settings will probably be ignored or overwritten by the style.

Example:
  If OpenWindow(0, 0, 0, 300, 300, "SetGadgetItemColor", #PB_Window_SystemMenu | #PB_Window_ScreenCentered) And CreateGadgetList(WindowID(0))
    ListIconGadget(0, 10, 10, 280, 280, "Column 0", 100)
    AddGadgetColumn(0, 1, "Column 1", 100)
    For i = 1 To 10
      AddGadgetItem(0, -1, "Text 1"+Chr(10)+"Text 2")
    Next 
        
    SetGadgetItemColor(0, -1, #PB_Gadget_FrontColor, $0000FF,  1)
    SetGadgetItemColor(0,  3, #PB_Gadget_BackColor,  $00FFFF, -1)    
    SetGadgetItemColor(0,  9, #PB_Gadget_BackColor,  $FFFF00,  1)    
    Repeat
    Until WaitWindowEvent() = #PB_Event_CloseWindow
  EndIf

Supported OS

Windows, Linux

<- SetGadgetItemAttribute() - Gadget Index - SetGadgetItemData() ->