Topics   All   MacOS (Only)   Windows (Only)   Linux (Only, Not)   iOS (Only, Not)  
Components   Crossplatform Mac & Win   Server   Client   Old   Deprecated   Guides   Examples   Videos
New in version: 12.2   12.3   12.4   12.5   13.0   13.1   13.2   13.3   13.4   13.5    Statistic    FMM    Blog  

TouchBar.AssignToWindow

Assigns the TouchBar to be the one used with the given window.

Component Version macOS Windows Linux Server iOS SDK
TouchBar 6.5 ✅ Yes ❌ No ❌ No ❌ No ❌ No
MBS( "TouchBar.AssignToWindow"; TouchBarRef; WindowRef )   More

Parameters

Parameter Description Example
TouchBarRef The reference number for the touch bar. $TouchBar
WindowRef Window Reference is the unique OS level window ID. You can obtain this by using the Window.FindByTitle or Window.FindByIndex functions. Pass zero to access the frontmost window. 0

Result

Returns OK or error.

Description

Assigns the TouchBar to be the one used with the given window.

Examples

Build TouchBar for Window:

#Create a new TouchBar
Set Variable [$t; Value:MBS( "TouchBar.Create" )]
#Add two buttons
Set Variable [$r; Value:MBS( "TouchBar.AddButton"; $t; "PrevRecord"; ""; "NSImageNameTouchBarGoBackTemplate"; "Previous"; 0; Get(FileName); "PrevRecordTouchBar" )]
Set Variable [$r; Value:MBS( "TouchBar.AddButton"; $t; "NextRecord"; ""; "NSImageNameTouchBarGoForwardTemplate"; "Previous"; 0; Get(FileName); "NextRecordTouchBar" )]
#Set which button show by default:
Set Variable [$r; Value:MBS( "TouchBar.SetDefaultItemIdentifiers"; $t; "PrevRecord¶NextRecord¶NSTouchBarItemIdentifierOtherItemsProxy")]
#Set the primary button:
Set Variable [$r; Value:MBS( "TouchBar.SetPrincipalItemIdentifier"; $t; "NextRecord" )]
#Set which buttons can be configured:
Set Variable [$r; Value:MBS( "TouchBar.SetCustomizationAllowedItemIdentifiers"; $t; "PrevRecord¶NextRecord")]
#Assign touchbar to current window:
Set Variable [$r; Value:MBS( "TouchBar.AssignToWindow"; $t; 0 )]

See also

Example Databases

This function checks for a license.

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


TouchBar.AssignToApp - TouchBar.Available

💬 Ask a question or report a problem