Go to: Synopsis. Return value. Flags. MEL examples.
panelHistory [-back] [-clear] [-defineTemplate string] [-exists] [-forward] [-historyDepth int] [-isEmpty] [-suspend boolean] [-targetPane string] [-useTemplate string] [-wrap boolean]
[name]
panelHistory is undoable, queryable, and editable.
This command creates a panel history object. The object is targeted on a
particular paneLayout and thereafter notes changes in panel configurations
within that paneLayout, building up a history list. The list can be stepped
through backwards or forwards.
string | The name of the panelHistory object created. |
In query mode, return type is based on queried flag.
back, clear, defineTemplate, exists, forward, historyDepth, isEmpty, suspend, targetPane, useTemplate, wrap
Long name (short name) |
Argument types |
Properties |
|
-back(-b)
|
|
|
|
Go back one level on the history list.
|
|
-clear(-cl)
|
|
|
|
-defineTemplate(-dt)
|
string
|
|
|
Puts the command in a mode where any other flags and arguments are
parsed and added to the command template specified in the argument.
They will be used as default arguments in any subsequent
invocations of the command when templateName is set as the
current template.
|
|
-exists(-ex)
|
|
|
|
Returns whether the
specified object exists or not. Other flags are ignored.
|
|
-forward(-f)
|
|
|
|
Go forward one level on the history list.
|
|
-historyDepth(-hd)
|
int
|
|
|
Specifies how many levels of history are maintained.
|
|
-isEmpty(-ie)
|
|
|
|
Returns true if there is currently no panel history.
|
|
-suspend(-s)
|
boolean
|
|
|
Specifies whether to suspend or resume updates to the panel history.
Useful for chunking a number of changes into one history event.
|
|
-targetPane(-tp)
|
string
|
|
|
Specifies which paneLayout the history will be maintained for.
|
|
-useTemplate(-ut)
|
string
|
|
|
Forces the command to use a command template other than
the current one.
|
|
-wrap(-w)
|
boolean
|
|
|
Specifies whether the history will wrap at the end and
beginning. This value is true by default.
|
|
Flag can appear in Create mode of command
|
Flag can appear in Edit mode of command
|
Flag can appear in Query mode of command
|
Flag can be used more than once in a command.
|
// Create a window containing a pane layout. The window also contains
// an option menu for changing the layout configuration and two buttons
// for stepping through the configuration history.
//
string $window = `window -title "panelHistory Example"`;
string $form = `formLayout`;
// Create the option menu for panel configuration.
//
string $configuration = `optionMenuGrp -label "Configuration"
-columnWidth2 100 150`;
string $single, $stacked, $sideBySide, $four;
$single = `menuItem -label "Single"`;
$stacked = `menuItem -label "2 Stacked"`;
$sideBySide = `menuItem -label "2 Side by Side"`;
$four = `menuItem -label "Four"`;
// Create the buttons for stepping through configuration history.
//
string $history = `rowLayout -numberOfColumns 3
-columnWidth3 100 75 75
-columnAttach 2 "both" 0 -columnAttach 3 "both" 0`;
text -label "History";
string $backBtn = `button -label "Back"`;
string $forwardBtn = `button -label "Forward"`;
setParent ..;
// Create the pane layout.
//
string $frame = `frameLayout -labelVisible false`;
string $panes = `paneLayout`;
text -label "Pane 1";
text -label "Pane 2";
text -label "Pane 3";
text -label "Pane 4";
// Set up the attachments.
//
formLayout -edit
-attachForm $configuration "top" 5
-attachForm $configuration "left" 5
-attachControl $history "top" 5 $configuration
-attachForm $history "left" 5
-attachForm $history "right" 5
-attachControl $frame "top" 5 $history
-attachForm $frame "left" 5
-attachForm $frame "right" 5
-attachForm $frame "bottom" 5
$form;
// Create the panel history object.
//
string $panelHistory = `panelHistory -targetPane $panes`;
// Attach a command to the option menu to change the panel layout
// configuration accordingly.
//
optionMenuGrp -edit
-changeCommand ("ExampleUpdatePaneLayout " + $configuration + " " + $panes)
$configuration;
// Attach commands to the buttons for stepping through the configuration
// history. The commands should also update the value of the option menu.
//
button -edit
-command ("panelHistory -edit -back $panelHistory; "
+ "ExampleUpdateConfiguration " + $configuration + " " + $panes)
$backBtn;
button -edit
-command ("panelHistory -edit -forward $panelHistory; "
+ "ExampleUpdateConfiguration " + $configuration + " " + $panes)
$forwardBtn;
showWindow $window;
// Call this procedure whenever the option menu's configuration value
// changes. This procedure will update the configuration of the
// pane layout to reflect the change.
//
proc ExampleUpdatePaneLayout(string $optionMenuGrp, string $paneLayout)
{
if ("" == $optionMenuGrp || "" == $paneLayout) return;
string $value = `optionMenuGrp -query -value $optionMenuGrp`;
if ("Single" == $value) {
paneLayout -edit -configuration "single" $paneLayout;
} else if ("2 Stacked" == $value) {
paneLayout -edit -configuration "horizontal2" $paneLayout;
} else if ("2 Side by Side" == $value) {
paneLayout -edit -configuration "vertical2" $paneLayout;
} else if ("Four" == $value) {
paneLayout -edit -configuration "quad" $paneLayout;
}
}
// Call this procedure whenever the panel configuration changes due to
// stepping through the panel history (ie. pressing either the "Forward"
// or "Back" buttons. This procedure will update the value of the
// option menu to reflect the new pane layout configuration.
//
proc ExampleUpdateConfiguration(string $optionMenuGrp, string $paneLayout)
{
if ("" == $optionMenuGrp || "" == $paneLayout) return;
string $configuration = `paneLayout -query -configuration $paneLayout`;
if ("single" == $configuration) {
optionMenuGrp -edit -value "Single" $optionMenuGrp;
} else if ("horizontal2" == $configuration) {
optionMenuGrp -edit -value "2 Stacked" $optionMenuGrp;
} else if ("vertical2" == $configuration) {
optionMenuGrp -edit -value "2 Side by Side" $optionMenuGrp;
} else if ("quad" == $configuration) {
optionMenuGrp -edit -value "Four" $optionMenuGrp;
}
}