Color in Popup Menu

Shane,
Can you suggest a way to display a color in the popup menu next to text?

I found pickup color Script Library and an example on http://piyocast.com/as/asinyaye
Its pretty cool but has a dialog built in and is not open to editing otherwise i would attempt to insert into the dialog toolkit.

I am looking to have several fields display at once and one of them be a popup menu with choose color.

Any advice would be appreciated as always!
Thanks
Dean

I’m not sure what the best approach would be in ASObjC. Why don’t you send an email to Takaaki and ask him how he did it? It’s probably covered in his blog somewhere.

I just did a quick look around, and it is covered:

http://piyocast.com/as/archives/category/color

It’s a matter of creating suitable views.

I meant to thank you sooner as always! Which example were you referring to on that page?

It’s the part where he creates a view and fills it with a colored bezier.

@ShaneStanley

I am close but am getting the following error

-[NSMenu superview]: unrecognized selector sent to instance 0x600004c67700

I’m working on adding the color popup menu adding to your Dialog Toolkit and this is the portion hanging me up…

`on createColorPopupMainThread:theArg
	log "begining createColorPopupMainThread"
	set {rgbList, theLeft, theBottom, theWidth, defaultValue} to theArg as list
	set aColMax to 255
	---set aMenu to |NSMenu|
	set theColorPopup to current application's NSMenu's alloc()'s init()

	repeat with i from 1 to ((length of rgbList) / 2)
		log i
		log ((length of rgbList) / 2)
		log "tsarting items"
		set colorRGB to item i of rgbList
		log colorRGB
		--set colorName to item (i + 1) of rgbList
		set colorName to "Test"
	
		copy colorRGB to {r1, g1, b1}
	
		my makeNSColorFromRGBAval(r1, g1, b1, aColMax, aColMax)
		log "makeNSColorFromRGBAval works"
		my makeNSImageWithFilledWithColor(32, 15, aColor)
		log "made NSIMage"
	
		set aListName to colorName as string
	
		set aMenuItem to (current application's NSMenuItem's alloc()'s initWithTitle:aListName action:"actionHandler:" keyEquivalent:"")
		log "made it past NSMenuitem"
		(aMenuItem's setImage:anImage)
		(aMenuItem's setEnabled:true)
	
		(theColorPopup's addItem:aMenuItem)
	end repeat
	log "out of repeat"
	---theColorPopup's selectItemWithTitle:defaultValue
	set my handlerResult to {theColorPopup, theBottom + 26}
end createColorPopupMainThread:

`

Let me know if you want to see the full code. Any advice as always is appreciated!
Dean

The error is telling you that you’re calling the superview method on a menu. That’s not happening in the code you posted.