TouchBar.AssignToApp
--------------------

Assigns the TouchBar to be the main one for current app.

| Component | Version | macOS | Windows | Linux | Server | iOS SDK |
|---|---|---|---|---|---|---|
| [TouchBar](component_TouchBar.md) | [6.5](newinversion65.md) | ✅ Yes | ❌ No | ❌ No | ❌ No | ❌ No |

MBS( "TouchBar.AssignToApp"; TouchBarRef ) 

**MBS**( **"TouchBar.AssignToApp";** /\* Assigns the TouchBar to be the main one for current app. \*/  
**$TouchBarRef**) /\* The reference number for the touch bar.e.g. $TouchBar \*/ 

### Parameters

| Parameter | Description | Example |
|---|---|---|
| TouchBarRef | The reference number for the touch bar. | $TouchBar |

### Result

Returns OK or error.

### Description

Assigns the TouchBar to be the main one for current app.  
### Examples

Build App TouchBar:

 #Create a new TouchBar   
Set Variable \[$t ; Value:MBS ( "[TouchBar.Create](TouchBarCreate.md)" )\]  
\#Add two buttons   
Set Variable \[$r ; Value:MBS ( "[TouchBar.AddButton](TouchBarAddButton.md)"; $t ; "AddRecord"; ""; "NSImageNameTouchBarAddTemplate"; "Add"; 0; Get(FileName); "AddRecordTouchBar" )\]  
Set Variable \[$r ; Value:MBS ( "[TouchBar.AddButton](TouchBarAddButton.md)"; $t ; "DeleteRecord"; ""; "NSImageNameTouchBarDeleteTemplate"; "Delete"; 0; Get(FileName); "DeleteRecordTouchBar" )\]  
Set Variable \[$r ; Value:MBS ( "[TouchBar.AddButton](TouchBarAddButton.md)"; $t ; "InfoButton"; ""; TouchBar::MBS ; "Info"; 0; Get(FileName); "InfoTouchBar" )\]  
\#Set which button show by default:   
Set Variable \[$r ; Value:MBS ( "[TouchBar.SetDefaultItemIdentifiers](TouchBarSetDefaultItemIdentifiers.md)"; $t ; "AddRecord¶InfoButton¶NSTouchBarItemIdentifierOtherItemsProxy")\]  
\#Set the primary button:   
Set Variable \[$r ; Value:MBS ( "[TouchBar.SetPrincipalItemIdentifier](TouchBarSetPrincipalItemIdentifier.md)"; $t ; "AddRecord" )\]  
\#Set which buttons can be configured:   
Set Variable \[$r ; Value:MBS ( "[TouchBar.SetCustomizationAllowedItemIdentifiers](TouchBarSetCustomizationAllowedItemIdentifiers.md)"; $t ; "AddRecord¶InfoButton¶DeleteRecord")\]  
\#Set this touch bar to be the app one:   
Set Variable \[$r ; Value:MBS ( "TouchBar.AssignToApp"; $t )\]  
### See also

- [App.ClearTouchBar](AppClearTouchBar.md)
- [TouchBar.AddButton](TouchBarAddButton.md)
- [TouchBar.Create](TouchBarCreate.md)
- [TouchBar.SetCustomizationAllowedItemIdentifiers](TouchBarSetCustomizationAllowedItemIdentifiers.md)
- [TouchBar.SetDefaultItemIdentifiers](TouchBarSetDefaultItemIdentifiers.md)
- [TouchBar.SetPrincipalItemIdentifier](TouchBarSetPrincipalItemIdentifier.md)

### Example Databases

- [Mac only/TouchBar](https://www.mbsplugins.eu/MBS-FileMaker-Plugin-Examples/Mac%20only/TouchBar.shtml#1ScriptAnchor_)

This function checks for a license.

Created 1st November 2016 , last changed 3th November 2016

  
[TouchBar.AddButton](TouchBarAddButton.md) - [TouchBar.AssignToWindow](TouchBarAssignToWindow.md)

[HTML Version](TouchBarAssignToApp.shtml)