Go to: Synopsis. Flags. Return value. MEL examples.
panelHistory [-back] [-clear] [-defineTemplate string] [-edit] [-exists] [-forward] [-historyDepth int] [-isEmpty] [-query] [-suspend boolean] [-targetPane string] [-useTemplate string] [-wrap]
[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.
back, clear, defineTemplate, edit, exists, forward, historyDepth, isEmpty, query, suspend, targetPane, useTemplate, wrap
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
|
The name of the panelHistory object created, or the queried value.
// 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;
}
}