alternate way to achieve tab view effect?

Hey all, I am desgining a HUD style app (the semi transparent black window) and I don’t want to have to use the traditional aqua tab view as it doesn’t suit the design. Is there a way to achieve the same effect as a tab view using a couple of buttons or change the tab view so the tabs are custom images? Thanks

  • Hendo

Hi Hendo,

I have seen a (kind off :wink: ) of HUD style tab view subclass here:

Edit: Sorry - my mistake - there are all kinds of custom subclasses in this framework, but unfortunately no NSTabView

hmmm…judging by the screen that tab view looks just like a regular one except the image is graphite instead of aqua…which is something i think the HUD does automatically.

EDIT: I think my best bet is just to subclass NSTabView
Could anyone give me an example of a subclassed tab view?

Oooops - silly me. Sorry it was a little late last night and I hadn’t checked this example thorroughly :wink:
Here an other piece of code I found in my links. It deals with different Tab styles - maybe this one will help you a little?


cool, that’s pretty nice but it has things I don’t need like close buttons and stuff like that and I don’t know Obj-C well enough to edit them out. I really like Matt Gemmells source code, it was so easy to implement, all there was was images one .h files and one .m file.

If anyone knows how to modify the PSMTabBarControl posted by Dom above, please let me know how

EDIT: IF your too lazy but would be able to show me how to do this correctly that would be of huge help!
I’ve decided to try and subclass NSSegmentedControl instead of the tab view. In this article:
it shows you what you need to do. Whats going on is he is also subclassing NSControl to work better for making custom controls via subclassing. He posted the code required but didn’t really say where any of the code goes…what i did it created the .h and .m files for the cutom NSControl, and put the code in the .h file but that came up with some 13 errors and 9 warnings;)

Any ideas how to implement his technique properly?

P.S. Once i get that working I think I know how to subclass the segemented view properly.

While I’m usually a supporter of subclassing, this sounds like an awful lot of work for something so simple as this. If you’re only trying to change the look of the tabs, and not the tab view’s border itself, you can easily achieve this effect using an NSMatrix.

  1. Set up a matrix with button cells that have the look and feel of your tabs. Set the cells to Type:Square Button, Behavior:Toggle and the matrix will handle the selection/de-selection of the cells for you.

  2. Create a tab view and set it to tabless and it’s border style to whatever style you want.

  3. Control-drag from the matrix to the tab view. In the Connections pane in the inspector window, select “takeSelectedTabViewItemFromSender:” and click connect.

Now, the tab view will automatically select the tab item at the same index as the selected cell in the matrix. Just make sure you have the same number of tabs as you do cells in your matrix.

hey, thanks, hopefully it will work!

jobu, this won’t work because once you make a tab view “tabless” it changes it to an NSView therefore not having the same actions in the inspector.

You sure about that? How sure? Try connecting it to the TAB VIEW, not one of it’s tab view items. You’ll probably need to turn on ‘Outline View’ instead of ‘Icon View’ in the instances pane. This is done by clicking on the small icon just above the right scroll bar in the window… the one with the dots and lines on it. Turn icon view back on by clicking on the one with four boxes in it. Once in outline view, navigate through the object hierarchy and find the tab view and the matrix, then drag from the matrix to the tab view as outlined above.

ah! That worked perfectly! Thanks so much!