Re: Colorful buttons of different shapes

Christiaan Hofman <[email protected]>
Newsgroups gmane.comp.macosx.devel
Message-ID <[email protected]>
On Apr 13, 2010, at 14:00, Abhijeet Singh wrote:

> Hi,I am porting my Win32 application to Mac. I am new to Cocoa. In my Windows Win32 application I have a window in that there is a 3 X 8 matrix of 24 buttons. Buttons are labeled as 124. Each button has 3 states.Unused  Round shape green color (Default state)Selected  Square shape orange color (User selects a button)Used  Round Shape red color (User save the selection by clicking Save button)In Win32 application I use owner drawn buttons to draw button of different color and shape.I'd be glad if someone could suggest me which control should i use in Cocoa to achieve the same effect. Should I use NSMatrix of buttons? If yes than how can i set color and shape of buttons?Thanks & RegardsAbhijeetDear macosxdev ! Get Yourself a cool, short @in.com Email ID now!

You should indeed use an NSMatrix of NSButtonCells, with settings that of a check button. If you need to customize the way it's drawn you should subclass NSButtonCell and do your customized drawing in drawWithFrame:inRect:ofView:. However, I would not recommend that, UI should be as much as possible standard, so users immediately recognize them and know how to use them. 

Christiaan
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.