Einhugur macOS Bridge plugin.

NSTouchBar.RegisterForApplication Method

Registers Touch-bar for at application level.

shared RegisterForApplication(
   makeTouchBarHandler as MakeTouchBarDelegate) as EinhugurMacOSBridge.NSTouchBarResponder

Parameters

makeTouchBarHandler
Function you pass into this delegate that will handle creating the Touch Bar each time the macOS went to generate the touch-bar. This parameter may not be nil.

The signature of this function should be SomeFunctionName() as EinhugurMacOSBridge.NSTouchBar.

Returns

EinhugurMacOSBridge.NSTouchBarResponder
Token that you need to store in property on your App class.

Remarks

Your application can have touch-bar for the application and for each window.

Normal place to call this one would be in the Application.Open event.

The NSTouchBarResponder token returned by this method you need to store in property on your App class. When the token is either set to nil or goes out of scope then the Touch Bar will be taken down.

Example use:

Property in your App class:

Private Property responder as EinhugurMacOSBridge.NSTouchBarResponder


In App.Open event:
Sub Open() Handles Open
    responder = EinhugurMacOSBridge.NSTouchBar.RegisterForApplication(addressof CreateTouchBar)
End Sub


In your App class a method to respond to the delegate to setup the Touch Bar:
Private Function CreateTouchBar() as EinhugurMacOSBridge.NSTouchBar
using EinhugurMacOSBridge

// Code here to create and return the Touch Bar

End Function

See Also

NSTouchBar Class