Questions tagged [nssegmentedcontrol]

An NSSegmentedControl object implements a linear set of two or more segments, each of which functions as a button. It is available in OS X v10.3 and later. It is declared in Apple's AppKit framework

The NSSegmentedControl class uses an NSSegmentedCell class to implement much of the control's functionality. Most methods in NSSegmentedControl are simply cover methods that call the corresponding method in NSSegmentedCell.

The methods of NSSegmentedCell that do not have covers relate to accessing and setting values for tags and tool tips, programmatically setting the key segment, and establishing the mode of the control.

Source: NSSegmentedControl class reference

67 questions
6
votes
1 answer

How to change height of NSSegmentedControl

I'm trying to increase the height of a NSSegmentedControl, beyond the 25px "Regular" control size. I subclassed NSSegmentedCell, I understand that i have 2 methods to work with. - (void)drawSegment:(NSInteger)segment …
Cory
  • 2,212
  • 17
  • 30
6
votes
1 answer

Xcode 4.5 Base Localization and NSSegmentedControl issue

I can't make my NSSegmentedControl change its titles using Base Localization. Xcode generates the files for english and french languages, I translate the titles of each segment, but they remain the same as in the xib file. Same thing for the tool…
berfis
  • 417
  • 3
  • 17
5
votes
1 answer

NSSegmentedControl highlighting with blue tint and single-selection

Is there a documented way for an NSSegmentedControl to use the trackingMode NSSegmentSwitchTrackingSelectOne (i.e. exclusively select one segment in the control) and have it rendered using the blue tint highlighting mode - the one we get…
ATV
  • 3,246
  • 3
  • 18
  • 40
5
votes
3 answers

How to draw segmented control with blue tint like Xcode?

I'm trying to recreate the segmented control used in Xcode where the images are drawn with a blue tint. For example in Interface Builder: So far I have a custom NSSegmentedCell overriding - (void)drawSegment:(NSInteger)segment inFrame:(NSRect)frame…
Mark
  • 5,965
  • 1
  • 37
  • 77
5
votes
1 answer

Keyboard Shortcuts for NSSegmentedControl Button in COCOA Mac Application

In my COCOA Mac Application, there is one NSSegmentedControl Button for Queue ON/OFF functionality. Now I need to provide keyboard shortcut for the same. For example, for Queue ON if already it was Off and vice versa. Is anyone did this type of…
BKN
  • 85
  • 5
4
votes
0 answers

NSSegmentedControl as NSToolbarItems on Big Sur

When using NSSegmentedControl in toolbars (native NSToolbar) with templated NSImage instances the usability has significantly deteriorated on macOS Big Sur. The selected item has an extremely low contrast in the new style used by macOS 11: Before…
ATV
  • 3,246
  • 3
  • 18
  • 40
4
votes
1 answer

Implementing NSSegmentedControl in NSToolbar to control NSTabViewController

In my macOS application, I'm trying to replicate the Photos.app implementation of NSSegmentedControl in NSToolbar to control an NSTabViewController. For reference, here's what that looks like: So, my approach was as follows: Hide the default…
Sam Fischer
  • 1,414
  • 17
  • 32
4
votes
0 answers

How to customize NSSegmentedControl?

Do you have any idea how i can obtain that control subclassing NSSegmentedControl/NSSegmentedControlCell ? I've tried to override some methods from NSSegmentedControlCell, but i'm not even close to obtain what I want. override func…
C-Viorel
  • 1,388
  • 2
  • 17
  • 36
4
votes
2 answers

How to make segmented control with menu like in the Xcode toolbar

I'd like to add a segmented control with menu like in Xcode toolbar to my OS X app. It will switch between three screens and also needs to have some options in each screen in the form of menu. The standard segmented control does not allow "Select…
Alexander B
  • 407
  • 2
  • 16
4
votes
0 answers

NSSegmentedCell Subclass and Custom Geometry/Layout Impossible?

A Tale of Two Subclasses By Ben Stock Prologue I'm in the process of making a really nice looking set of controls which automatically change their appearance depending on the type of window they're used in (e.g. If you drop a button in a normal…
Ben Stock
  • 1,826
  • 1
  • 21
  • 30
4
votes
0 answers

ios segmented control. multiline label with different color for text and tint

I'm currently trying to implement a UISegmentedControl that uses a different text color to the border but also spans over multi lines. I've managed to get both work separately using this question for multiline Two lines of text in a…
TommyBs
  • 8,497
  • 3
  • 26
  • 58
3
votes
3 answers

How to change the selection color of a NSSegmentedControl button

I am trying to find a way to change the color of the selected control button. Is this possible by subclassing the NSSegmentedControl or NSSegmentedCell or any other way? If so, can someone show me the way?
memis
  • 400
  • 2
  • 8
3
votes
1 answer

Equal sized cells in NSSegmentedControl

For my NSSegmentedControl, I use it do display a bar to control a NSTableView. I have code set up to control the size programmatically: for (NSInteger i = 1; i <= numberOfSegments; i++) { CGSize textSize = [[NSString…
Minebomber
  • 1,044
  • 2
  • 10
  • 31
3
votes
2 answers

Programmatically defining NSSegmentedCell

I am a little stumped as to how to instruct a programmatically created NSSegmentedControl to use a subclass instance of an NSSegmentedCell. If I want to use a subclasses NSSegmentedCell on an NSSegmentedControl built using IB it would be as simple…
Hooligancat
  • 3,025
  • 1
  • 35
  • 54
3
votes
0 answers

Using Momentary Tracking with NSSegmentedControl

The documentation for NSSegmentedControl says the following about using NSSegmentSwitchTrackingMomentary mode: A momentary segmented control sends an action when the user clicks a segment, and another action when the user releases the segment.…
Paige DePol
  • 1,093
  • 1
  • 9
  • 22
1
2 3 4 5