Uli's Web Site
[ Zathras.de - Uli's Web Site ]
Other Sites: Stories
Pix
Abi 2000
Stargate: Resurgence
Lost? Site Map!
 
 
     home | blog | moose | programming | articles >> blog

 Blog Topics
 
 Archive
 

15 Most Recent [RSS]

 Less work through Xcode and shell scripts
2011-12-16 @600
 
 iTunesCantComplain released
2011-10-28 @954
 
 Dennis Ritchie deceased
2011-10-13 @359
 
 Thank you, Steve.
2011-10-06 @374
 
 Cocoa Text System everywhere...
2011-03-27 @788
 
 Blog migration
2011-01-29 @520
 
 All you need to know about the Mac keyboard
2010-08-09 @488
 
 Review: Sherlock
2010-07-31 @978
 
 Playing with Objective C on Debian
2010-05-08 @456
 
 Fruit vs. Obst
2010-05-08 @439
 
 Mixed-language ambiguity
2010-04-15 @994
 
 Uli's 12:07 AM Law
2010-04-12 @881
 
 Uli's 1:24 AM Law
2010-04-12 @874
 
 Uli's 6:28 AM Law
2010-04-12 @869
 
 Uli's 3:57 PM Law
2010-04-12 @867
 

More...

Dangerous NSTabViews...

I recently had quite some fun figuring out the source of a bug in the Moose. See, since I like to be flexible in re-arranging my GUI elements and e.g. move them to another window, I usually show the window for a GUI element using [[theUIElement window] makeKeyAndOrderFront: self]. This works just fine, right until your UI element lives in a tab view. Because as soon as the tab view changes to another tab, it removes the view of the previous tab from the window, to prevent it from being displayed. This in turn causes the -window method to return nil, which means your -makeKeyAndOrderFront: message isn't sent.

Now, you might be wondering why NSTabView removes its tab views and doesn't just use setHidden:? Well, the problem is that setHidden: was introduced in Mac OS X 10.3. Before that, the only way to hide a view was to take it out of its superview (or, if you don't happen to be NSTabView, you could just use a tabless and borderless NSTabView with your item on one tab and an empty second tab and switch between those).

So, watch out for this if you want to do the smart thing and allow for moving UI items.

Oh, and thanks to my trusty beta tester William M. Smith for not only reporting this bug, but also unknowingly pointing me at the solution. You rock!

 
Created: 2005-07-31 @629 Last change: 2005-07-31 @637 | Home | Admin | Edit
© Copyright 2003-2024 by M. Uli Kusterer, all rights reserved.