Custom rating image?

Is there any way to change the image of the NSLevelIndicator set to Rating? I need to make it so its white stars and the unselected ones are the white dots.

Is there anyway I could do it through a call method if you couldn’t find it in Interface Builder, because I was googling it and it said through obj-c its possible (and apparently easy) plus it automatically creates the dots for you.

it is easy :wink:

call method “setImage:” of (call method “cell” of myLevelIndicator) with parameter newStarImage


See also: NSLevelIndicatorCell Class Reference

Dominik, would that have to go inside a certain handler? and BRuce, ok, i looked at it, how to I apply it?(that is if Dominiks doesn’t work:P)

no - I have tried it in the level indicators awakeFromNib - this worked for me:

on awake from nib theObject
set newStar to (load image “whitestar.png”)
call method “setImage:” of (call method “cell” of theObject) with parameter newStar
end awake from nib

Nice one Dom! Is there anyway to make the whole levelindicator bigger through a call method? My star images are a little bigger and don’t really fit :wink:

you can resize it with applescript:

set bounds of myLevelIndicator to {…} (does not scale the stars)

nice, I’ll giv’r a whirl

EDIT- k 2 things.

  1. I havn’t worked with bounds before how would I set them to fit my image?
  2. Does that piece of code that sets the bounds have to be in a certain handler?

nevermind i got it to work!