2017-03-10 17:50:23 +11:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								## Class: TouchBarSegmentedControl
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								>  Create a segmented control (a button group) where one button has a selected state
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2018-04-09 17:58:10 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								Process: [Main ](../tutorial/application-architecture.md#main-and-renderer-processes )
							 
						 
					
						
							
								
									
										
										
										
											2017-03-10 17:50:23 +11:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2017-03-17 10:38:15 -07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								### `new TouchBarSegmentedControl(options)` _Experimental_
  
						 
					
						
							
								
									
										
										
										
											2017-03-10 17:50:23 +11:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								*  `options`  Object 
						 
					
						
							
								
									
										
										
										
											2017-11-28 18:15:15 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								  *  `segmentStyle`  String (optional) - Style of the segments:
							 
						 
					
						
							
								
									
										
										
										
											2017-03-30 12:06:33 -07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    *  `automatic`  - Default. The appearance of the segmented control is
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								      automatically determined based on the type of window in which the control
							 
						 
					
						
							
								
									
										
										
										
											2019-08-01 16:59:26 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								      is displayed and the position within the window. Maps to `NSSegmentStyleAutomatic` .
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    *  `rounded`  - The control is displayed using the rounded style. Maps to `NSSegmentStyleRounded` .
							 
						 
					
						
							
								
									
										
										
										
											2017-03-30 12:06:33 -07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    *  `textured-rounded`  - The control is displayed using the textured rounded
							 
						 
					
						
							
								
									
										
										
										
											2019-08-01 16:59:26 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								      style. Maps to `NSSegmentStyleTexturedRounded` .
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    *  `round-rect`  - The control is displayed using the round rect style. Maps to `NSSegmentStyleRoundRect` .
							 
						 
					
						
							
								
									
										
										
										
											2017-03-30 12:06:33 -07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    *  `textured-square`  - The control is displayed using the textured square
							 
						 
					
						
							
								
									
										
										
										
											2019-08-01 16:59:26 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								      style. Maps to `NSSegmentStyleTexturedSquare` .
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    *  `capsule`  - The control is displayed using the capsule style. Maps to `NSSegmentStyleCapsule` .
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    *  `small-square`  - The control is displayed using the small square style. Maps to `NSSegmentStyleSmallSquare` .
							 
						 
					
						
							
								
									
										
										
										
											2017-03-30 12:06:33 -07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    *  `separated`  - The segments in the control are displayed very close to each
							 
						 
					
						
							
								
									
										
										
										
											2019-08-01 16:59:26 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								      other but not touching. Maps to `NSSegmentStyleSeparated` .
							 
						 
					
						
							
								
									
										
										
										
											2017-11-28 18:15:15 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								  *  `mode`  String (optional) - The selection mode of the control:
							 
						 
					
						
							
								
									
										
										
										
											2019-08-01 16:59:26 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    *  `single`  - Default. One item selected at a time, selecting one deselects the previously selected item. Maps to `NSSegmentSwitchTrackingSelectOne` .
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    *  `multiple`  - Multiple items can be selected at a time. Maps to `NSSegmentSwitchTrackingSelectAny` .
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    *  `buttons`  - Make the segments act as buttons, each segment can be pressed and released but never marked as active. Maps to `NSSegmentSwitchTrackingMomentary` .
							 
						 
					
						
							
								
									
										
										
										
											2017-05-04 14:15:48 -07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								  *  `segments`  [SegmentedControlSegment[]](structures/segmented-control-segment.md) - An array of segments to place in this control.
							 
						 
					
						
							
								
									
										
										
										
											2019-08-01 16:59:26 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								  *  `selectedIndex`  Integer (optional) - The index of the currently selected segment, will update automatically with user interaction. When the mode is `multiple`  it will be the last selected item.
							 
						 
					
						
							
								
									
										
										
										
											2019-07-25 11:30:42 -07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								  *  `change`  Function (optional) - Called when the user selects a new segment.
							 
						 
					
						
							
								
									
										
										
										
											2017-05-04 14:15:48 -07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    *  `selectedIndex`  Integer - The index of the segment the user selected.
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    *  `isSelected`  Boolean - Whether as a result of user selection the segment is selected or not.
							 
						 
					
						
							
								
									
										
										
										
											2017-03-10 17:50:23 +11:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								### Instance Properties
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								The following properties are available on instances of `TouchBarSegmentedControl` :
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								#### `touchBarSegmentedControl.segmentStyle`
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2017-11-29 11:38:35 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								A `String`  representing the controls current segment style. Updating this value immediately updates the control
							 
						 
					
						
							
								
									
										
										
										
											2017-03-10 17:50:23 +11:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								in the touch bar.
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								#### `touchBarSegmentedControl.segments`
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2017-11-29 11:58:24 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								A `SegmentedControlSegment[]`  array representing the segments in this control. Updating this value immediately
							 
						 
					
						
							
								
									
										
										
										
											2017-11-29 11:38:35 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								updates the control in the touch bar. Updating deep properties inside this array **does not update the touch bar** .
							 
						 
					
						
							
								
									
										
										
										
											2017-03-10 17:50:23 +11:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								#### `touchBarSegmentedControl.selectedIndex`
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2017-11-29 11:58:24 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								An `Integer`  representing the currently selected segment. Changing this value immediately updates the control
							 
						 
					
						
							
								
									
										
										
										
											2017-11-29 11:38:35 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								in the touch bar. User interaction with the touch bar will update this value automatically.