| sidebar_position | 4 |
|---|
A <WindowClass> in skin.xml binds a FrameworkService controller to a non-blocking workspace window. WindowClass panels exist only for the current session. Restart is required after any change to the script files.
classfactory.xml— declares the script ascategory="FrameworkService"(see classfactory.xml).skin/skin.xml—<WindowClass controller="Name">— references the registered controller name and binds a<Form>as the window content.scriptname.js—Host.Objects.registerObject(this, "Name")— registers the controller as a named host object ininitialize().
<ScriptClass
classID="{XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX}"
category="FrameworkService"
name="My Window Service"
sourceFile="scriptname.js"
functionName="createInstance"/><WindowClasses>
<WindowClass name="MyPanel"
title="My Panel"
controller="MyControllerName"
form.name="MyForm"
command.category="MyCategory" command.name="My Panel"/>
</WindowClasses>
<Forms>
<Form name="MyForm">
</Form>
</Forms>- The
command.categoryandcommand.nameattributes on<WindowClass>register it as a command in Studio Pro. It can be assigned in the Keyboard Shortcuts menu or launched via Find Command (Ctrl/Cmd + K). - The
controllerattribute must match the string passed toHost.Objects.registerObject(). - See Skin Reference - WindowClass for all attributes.
function MyController()
{
this.interfaces = [
Host.Interfaces.IComponent // Required for controller lifecycle
]
this.initialize = function(ctx)
{
Host.Objects.registerObject(this, "MyControllerName") // Must match controller="..." in WindowClass
}
this.terminate = function()
{
try { Host.Objects.unregisterObject("MyControllerName") } catch(e) {}
}
}
// Function name matches classfactory.xml functionName
function createInstance() {
return new MyController()
}See Marker Creator for a full working example.