Page 1 of 1

Need workaround SetGadgetItemColor with ListViewGadget

Posted: Thu Feb 07, 2013 11:16 am
by ozak
I found the workaround for the ListIconGadget, but is there a similar for the ListViewGadget?

Thanks in advance

:)

Re: Workaround for SetGadgetItemText problem with ListViewGa

Posted: Thu Feb 07, 2013 11:32 am
by wilbert
Can you give a code example of the problem ?
When I try SetGadgetIemText with a ListViewGadget (PB 5.10b7) it seems to work fine :?

Re: Workaround for SetGadgetItemText problem with ListViewGa

Posted: Thu Feb 07, 2013 11:40 am
by ozak
Sorry. I mean the color of an item ;)

Code: Select all

OpenWindow(0,100,100,640,480,"Test")
ListViewGadget(0,0,0,640,480)
For i=1 To 10
  AddGadgetItem(0,-1,"Test"+Str(i))
Next
SetGadgetItemColor(0,2,#PB_Gadget_FrontColor,RGB(Random(255), Random(255), Random(255)),0)
Repeat
Until WaitWindowEvent()=#PB_Event_CloseWindow

Re: Need workaround SetGadgetItemColor with ListViewGadget

Posted: Thu Feb 07, 2013 12:09 pm
by wilbert
This is not supported.

The only thing you can do is use alternating row colors.
PB 5.10b7 example ...

Code: Select all

OpenWindow(0,100,100,640,480,"Test")
ListViewGadget(0,0,0,640,480)
CocoaMessage(0, GadgetID(0), "setUsesAlternatingRowBackgroundColors:", #YES)
For i=1 To 10
  AddGadgetItem(0,-1,"Test"+Str(i))
Next
Repeat
Until WaitWindowEvent()=#PB_Event_CloseWindow

Re: Need workaround SetGadgetItemColor with ListViewGadget

Posted: Fri Feb 08, 2013 11:01 am
by ozak
No workaround using CocoaMessage? I tried searching the Apple docs but no luck so far

Re: Need workaround SetGadgetItemColor with ListViewGadget

Posted: Tue Aug 29, 2017 6:40 pm
by Shardik
ozak wrote:No workaround using CocoaMessage? I tried searching the Apple docs but no luck so far
You may try this workaround which allows you to change text and back color of single rows.