• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Pressable Button
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Pressable Button


  • Subject: Re: Pressable Button
  • From: "Gerriet M. Denkmann" <email@hidden>
  • Date: Thu, 18 Dec 2008 12:47:32 +0700


Following Peters advice:
Consider using a single-segment NSSegmentedControl. It has this behavior built-in.

I am not completely satisfied: I want the NSOnState shown as done in an NSButton with buttonType = NSOnOffButton and bezelStyle = NSTexturedSquareBezelStyle.

In the header file I found a method:
[ segmentedControl setSegmentStyle: NSSegmentStyleSmallSquare ];
which has not yet found its way into the documentation, and which comes closer to what I want:

Specifially: the NSOnState should look indented with a black background.


And there should be almost no space wasted left and right of the image or titel.

The wasted space was avoided with:
[ segmentedControl setLabel: name forSegment: 0 ];
[ segmentedControl sizeToFit ];
NSRect frame = [segmentedControl frame];
float nw = frame.size.width * 5.0 / 6.0 - 15.0 ; // very ugly hack, but I don't know anything better
nw = ceil(nw);
[ segmentedControl setWidth: nw forSegment: 0 ];
[ segmentedControl sizeToFit ];



Also: a segmented control with an image has a lower height than one with text. Which also reports a height of 24, but looks definitely higher.

This crazyness stopped, once I stopped using: //[ segmentedControl setFont: [ NSFont labelFontOfSize: 0.0 ] ];


Kind regards,

Gerriet.

_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


References: 
 >Pressable Button (From: "Gerriet M. Denkmann" <email@hidden>)
 >Re: Pressable Button (From: Stéphane Sudre <email@hidden>)

  • Prev by Date: Re: Sorting a bound NSTableView programatically
  • Next by Date: Re: Thread ID in crash log
  • Previous by thread: Re: Pressable Button
  • Next by thread: Re: Pressable Button
  • Index(es):
    • Date
    • Thread