Bug in changing colours of columns in ListIconGadget?

Just starting out? Need help? Post your questions and find answers here.
User avatar
marcoagpinto
Addict
Addict
Posts: 947
Joined: Sun Mar 10, 2013 3:01 pm
Location: Portugal
Contact:

Bug in changing colours of columns in ListIconGadget?

Post by marcoagpinto »

Hello!

If after creating a ListIconGadget I use:

Code: Select all

      SetGadgetItemColor(#PANEL_BOX_AUTOCORRECT,#PB_All,#PB_Gadget_FrontColor,$999999,0)
      SetGadgetItemColor(#PANEL_BOX_AUTOCORRECT,#PB_All,#PB_Gadget_FrontColor,#Red,1)
      SetGadgetItemColor(#PANEL_BOX_AUTOCORRECT,#PB_All,#PB_Gadget_FrontColor,#GreenDark,2)
The added lines won't respect the colours.

They will only respect the colours if after adding lines I use the above commands.

Is this a bug?

Thanks!
User avatar
Bisonte
Addict
Addict
Posts: 1232
Joined: Tue Oct 09, 2007 2:15 am

Re: Bug in changing colours of columns in ListIconGadget?

Post by Bisonte »

Who said that this will define all rows and/or columns ?

#PB_ALL is -1, so it will max work with the last/actual row...
PureBasic 6.10 LTS (Windows x86/x64) | Windows10 Pro x64 | Asus TUF X570 Gaming Plus | R9 5900X | 64GB RAM | GeForce RTX 3080 TI iChill X4 | HAF XF Evo | build by vannicom​​
English is not my native language... (I often use DeepL to translate my texts.)
User avatar
marcoagpinto
Addict
Addict
Posts: 947
Joined: Sun Mar 10, 2013 3:01 pm
Location: Portugal
Contact:

Re: Bug in changing colours of columns in ListIconGadget?

Post by marcoagpinto »

@Bisonte:

Is there a way for all lines in columns?

Thanks!
User avatar
Bisonte
Addict
Addict
Posts: 1232
Joined: Tue Oct 09, 2007 2:15 am

Re: Bug in changing colours of columns in ListIconGadget?

Post by Bisonte »

Only AFTER adding items...

like this :

Code: Select all

EnableExplicit

Procedure.i SetAllItemsColor(Gadget, ColorType, Array ColumnColor.l(1))
  
  Protected i, j, MaxCol, MaxItem
  
  If IsGadget(Gadget)
    
    If GadgetType(Gadget) = #PB_GadgetType_ListIcon
      
      MaxItem = CountGadgetItems(Gadget)
      MaxCol  = ArraySize(ColumnColor())
      
      Debug MaxCol
      Debug MaxItem
      
      For i= 0 To MaxItem
        If i < MaxItem
          For j = 0 To MaxCol
            SetGadgetItemColor(Gadget, i, ColorType, ColumnColor(j), j)
          Next j
        EndIf
      Next i
      
    EndIf
    
  EndIf
  
EndProcedure

Define i, Dim Cols.l(2), Event

Cols(0) = #Blue
Cols(1) = #Red
Cols(2) = #Green

OpenWindow(0, 0, 0, 640, 480, "Test", #PB_Window_ScreenCentered|#PB_Window_SystemMenu)

ListIconGadget(1, 10, 10, 600, 300, "Col0", 120)
AddGadgetColumn(1, 1, "Col1", 120)
AddGadgetColumn(1, 2, "Col2", 120)

For i = 0 To 20
  AddGadgetItem(1, i,  "Col 0 - " + Str(i) + #LF$ + "Col 1 - " + Str(i) + #LF$ + "Col 2 - " + Str(i) + #LF$)
Next i

SetAllItemsColor(1, #PB_Gadget_BackColor, Cols())

Repeat
  Event = WaitWindowEvent()
  
  Select Event
    Case #PB_Event_CloseWindow
      Break
  EndSelect
  
ForEver
PureBasic 6.10 LTS (Windows x86/x64) | Windows10 Pro x64 | Asus TUF X570 Gaming Plus | R9 5900X | 64GB RAM | GeForce RTX 3080 TI iChill X4 | HAF XF Evo | build by vannicom​​
English is not my native language... (I often use DeepL to translate my texts.)
Post Reply