Components All New MacOS Windows Linux iOS
Examples Mac & Win Server Client Guides Statistic FMM Blog Deprecated Old

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