addCustomPrefsTab (string $tabCreateFn, string $frameCreateFn, string $updateFn, string $holdStateFn, string $setOptVarToDefaultFn, string $title, string $name)
なし
| 変数名 | 変数タイプ | 説明 |
|---|---|---|
| $tabCreateFn | string | タブを作成するためのコールバック関数。 |
| $frameCreateFn | string | タブのフレーム レイアウトを作成するためのコールバック関数。 |
| $updateFn | string | オプションが変更されたときに UI 要素を更新するためのコールバック関数。 |
| $holdStateFn | string | タブの基本設定を保存または復元するためのコールバック関数。 |
| $setOptVarToDefaultFn | string | オプションを既定値に設定するためのコールバック関数。 |
| $title | string | タブのタイトル。 |
| $name | string | タブの名前。 |
global proc prefsUpdateExample()
{
global string $gPreferenceWindow;
setParent $gPreferenceWindow;
string $parent = "prefExample";
if (`columnLayout -q -numberOfChildren $parent` == 0) {
return;
}
setParent $parent;
textField -e -text `optionVar -q exampleWords` words;
}
global proc exampleFieldChanged()
{
global string $gPreferenceWindow;
if (`window -exists $gPreferenceWindow`) {
setParent prefExample;
if (`textField -exists words`) {
optionVar -sv exampleWords `textField -q -text words`;
}
}
}
global proc prefsHoldCurrentStateExample(string $mode)
{
exampleFieldChanged();
string $prefOptionVars[] = { "exampleWords" };
prefsHoldOptionVars($prefOptionVars, $mode);
global string $gPreferenceWindow;
if (`window -exists $gPreferenceWindow`) {
setParent prefExample;
if (`textField -exists words`) {
textField -e -text `optionVar -q exampleWords` words;
}
}
}
global proc prefsCreateExample()
{
global string $gPreferenceWindow;
setParent $gPreferenceWindow;
string $parent = "prefExample";
// Check to see if this has been created already.
//
if (`columnLayout -q -numberOfChildren $parent` > 0) {
return;
}
// Create the UI
//
setParent $parent;
setUITemplate -pushTemplate prefsTemplate;
// This is used to force the width to fill the window
separator -style "none" -h 1;
string $textContent = "Hello, world!";
if (`optionVar -exists exampleWords`) {
$textContent = `optionVar -q exampleWords`;
}
textField
-text $textContent
-changeCommand exampleFieldChanged
words;
setUITemplate -popTemplate;
exampleFieldChanged();
prefsUpdateExample();
}
global proc prefsFrameLayoutCreateExample()
{
frameLayout -labelVisible false -borderVisible false -marginWidth 10 -marginHeight 10;
columnLayout -adj true prefExample;
}
global proc prefsSetOptVarToDefault()
{
optionVar -sv exampleWords "Hello, world!";
}
// register the new tab
addCustomPrefsTab("prefsCreateExample",
"prefsFrameLayoutCreateExample",
"prefsUpdateExample",
"prefsHoldCurrentStateExample",
"prefsSetOptVarToDefault",
"Example Configuration",
" Example");
// unregister the tab
deleteCustomPrefsTab("prefsCreateExample");