SnpMoveTabbedPalette.jsx
Summary
Shows how to place a TabbedPalette in Bridge in a custom location via scripting.
See:
Class Summary
|
SnpMoveTabbedPalette |
Shows how to place a TabbedPalette in Bridge in a custom location via scripting. |
function SnpMoveTabbedPalette()
{
this.requiredContext = "\tExecute against Bridge main engine.\nBridge must be running";
$.level = 1;
this.paletteRefs = null;
}
SnpMoveTabbedPalette.prototype.run = function()
{
var retval = true;
if(!this.canRun())
{
retval = false;
return retval;
}
var lastWorkspace = app.document.workspace;
app.document.resetToDefaultWorkspace();
var scriptPalette = new TabbedPalette( app.document, "SnpMoveTabbedPalette", "SnpMovePaletteTab", "script", "left", "top");
scriptPalette.content.onResize = function()
{
var b = this.bounds;
pnl.bounds = b;
this.layout.resize(true);
scriptPalette.content.layout.layout(true);
}
var pnl = scriptPalette.content.add("panel", undefined , "");
pnl.alignChildren = ["center", "fill"];
var mainBtnGp = pnl.add("group");
mainBtnGp.orientation = "column";
var titleGp = mainBtnGp.add("group");
titleGp.alignment = ["fill", "fill"];
var title = titleGp.add("statictext", undefined, "SnpMoveTabbedPalette");
var g = title.graphics;
g.font = ScriptUI.newFont ("Arial", 20);
var gp1 = mainBtnGp.add("group");
gp1.orientation = "row";
ulBtn = gp1.add("button", undefined, "Upper Left");
urBtn = gp1.add("button", undefined, "Upper Right");
gp2 = mainBtnGp.add("group");
cBtn = gp2.add("button", undefined, "Center");
gp3 = mainBtnGp.add("group");
llBtn = gp3.add("button", undefined, "Lower Left");
lrBtn = gp3.add("button", undefined, "Lower Right");
removeBtn = mainBtnGp.add("button", undefined, "Remove Palette");
removeBtn.alignment = ["fill", "fill"];
scriptPalette.content.layout.layout(true);
versionCheck();
removeBtn.onClick = function()
{
scriptPalette.remove();
app.document.setWorkspace(lastWorkspace.id);
}
ulBtn.onClick = function()
{
scriptPalette.setLocation("left", "top");
}
urBtn.onClick = function()
{
scriptPalette.setLocation("right", "top");
}
cBtn.onClick = function()
{
scriptPalette.setLocation("center", "middle");
}
llBtn.onClick = function()
{
scriptPalette.setLocation("left", "bottom");
}
lrBtn.onClick = function()
{
scriptPalette.setLocation("right", "bottom");
}
function versionCheck()
{
var v = app.version.split(".");
if (v[0] < 2 || (v[0] == 2 && v[1] < 1))
{
ulBtn.enabled = false;
urBtn.enabled = false;
llBtn.enabled = false;
lrBtn.enabled = false;
cBtn.enabled = false;
var errTxt = mainBtnGp.add("statictext", undefined, "Bridge 2.1 or above is required to move TabbedPalettes");
var gfx = errTxt.graphics;
gfx.font = ScriptUI.newFont ("Arial", ScriptUI.FontStyle.ITALIC, 10);
scriptPalette.content.layout.layout(true);
}
}
return retval;
}
SnpMoveTabbedPalette.prototype.canRun = function()
{
if(BridgeTalk.appName == "bridge")
{
return true;
}
$.writeln("ERROR:: Cannot run SnpMoveTabbedPalette");
$.writeln(this.requiredContext);
return false;
}
if(typeof(SnpMoveTabbedPalette_unitTest) == "undefined") {
new SnpMoveTabbedPalette().run();
}
http://www.adobe.com/devnet/bridge
Documentation generated by
JSDoc on Tue Apr 27 10:21:34 2010