Need workaround SetGadgetItemColor with ListViewGadget

Mac OSX specific forum
ozak
New User
New User
Posts: 4
Joined: Wed Jun 21, 2006 11:03 am

Need workaround SetGadgetItemColor with ListViewGadget

Post by ozak »

I found the workaround for the ListIconGadget, but is there a similar for the ListViewGadget?

Thanks in advance

:)
Last edited by ozak on Thu Feb 07, 2013 11:42 am, edited 2 times in total.
wilbert
PureBasic Expert
PureBasic Expert
Posts: 3870
Joined: Sun Aug 08, 2004 5:21 am
Location: Netherlands

Re: Workaround for SetGadgetItemText problem with ListViewGa

Post 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 :?
ozak
New User
New User
Posts: 4
Joined: Wed Jun 21, 2006 11:03 am

Re: Workaround for SetGadgetItemText problem with ListViewGa

Post 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
wilbert
PureBasic Expert
PureBasic Expert
Posts: 3870
Joined: Sun Aug 08, 2004 5:21 am
Location: Netherlands

Re: Need workaround SetGadgetItemColor with ListViewGadget

Post 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
ozak
New User
New User
Posts: 4
Joined: Wed Jun 21, 2006 11:03 am

Re: Need workaround SetGadgetItemColor with ListViewGadget

Post by ozak »

No workaround using CocoaMessage? I tried searching the Apple docs but no luck so far
User avatar
Shardik
Addict
Addict
Posts: 1989
Joined: Thu Apr 21, 2005 2:38 pm
Location: Germany

Re: Need workaround SetGadgetItemColor with ListViewGadget

Post 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.
Post Reply