Hi
I have been using this piece of code for a while in an awakeFromNib(), which colours specific
menu items in a pop up button red, this works great, what id like to now do is also have some specific menu items show
as green at the same time, so say at the moment “A”, “D”, “F” all show as red, I would also like
to show B" & “C” at the same time as green, can this be done by adding to this code? if so how can
it be done, any help welcome, thank you.
script AppDelegate
property parent : class "NSObject"
property theWindow : missing value
property NZEnvOffSetChoice : missing value
on awakeFromNib()
set listOffsetCodes to {"Templates", "A", "B","C","D","E","F","G"}
try
NZEnvOffSetChoice's removeAllItems()
end try
NZEnvOffSetChoice's addItemsWithTitles:listOffsetCodes
repeat with i from 1 to (count listOffsetCodes)
set menuItemValue to item i of listOffsetCodes
(NZEnvOffSetChoice's addItemWithTitle:menuItemValue)
if menuItemValue is in {"A", "D", "F"} then
set currentMenuItem to NZEnvOffSetChoice's lastItem()
set stringAttributes to current application's NSDictionary's dictionaryWithObjectsAndKeys_(current application's NSColor's redColor(), current application's NSForegroundColorAttributeName, current application's NSFont's systemFontOfSize:12, current application's NSFontAttributeName, missing value)
set attributedString to (current application's NSAttributedString's alloc()'s initWithString:menuItemValue attributes:stringAttributes)
(currentMenuItem's setAttributedTitle:attributedString)
end if
end repeat
end awakeFromNib
end script
cheers