« python - my way or the highway | Main | A modern API for Cocoa »

The lameness of NSSegmentedControl

If you have an NSSegmentedControl on a pallete with some images in it, you are bound for trouble. The problem is, that the image data of each cell isn't encoded along with the rest of the cell information. Rather the cell encodes the pathname of the image. That sounds good at first, because you don't end up with a lot of duplicate images. This is bad, because it is the absolute path of the image:
       <string>/Library/Developer/Palettes/XXXInterfacePalette.palette/Contents/Resources/FormSel_5.tiff</string>
       <dict>
               <key>$class</key>
               <dict>
                       <key>CF$UID</key>
                       <integer>30</integer>
               </dict>
               <key>NSSegmentItemDisabled</key>
               <true/>
               <key>NSSegmentItemImage</key>
               <dict>
                       <key>CF$UID</key>
                       <integer>37</integer>
               </dict>
               <key>NSSegmentItemLabel</key>
               <dict>
                       <key>CF$UID</key>
                       <integer>29</integer>
               </dict>
               <key>NSSegmentItemTag</key>
               <integer>2</integer>
               <key>NSSegmentItemWidth</key>
               <real>27</real>
       </dict>
Obviously in a deployment scenario your image will not be found, if the palette isn't there.

About

This page contains a single entry from the blog posted on July 27, 2007 12:48 PM.

The previous post in this blog was python - my way or the highway.

The next post in this blog is A modern API for Cocoa.

Many more can be found on the main index page or by looking through the archives.

Powered by
Movable Type 4.25