Go to: Synopsis. Return value. MEL examples.
 
addCustomPrefsTab (string $tabCreateFn, string $frameCreateFn, string $updateFn, string $holdStateFn, string $setOptVarToDefaultFn, string $title, string $name) 
	 
None
| Variable Name | Variable Type | Description | 
|---|---|---|
| $tabCreateFn | string | The callback function to create the tab. | 
| $frameCreateFn | string | The callback function to create the frame layout of the tab. | 
| $updateFn | string | The callback function to update UI elements when option vars changed. | 
| $holdStateFn | string | The callback function to save or restore the preference setting of the tab. | 
| $setOptVarToDefaultFn | string | The callback function to set option vars to default values. | 
| $title | string | The title of the tab. | 
| $name | string | The name of the tab. | 
	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();
		if ($mode == "save") {
			optionVar -sv "exampleWordsHold" `optionVar -q exampleWords`;
		} else if ($mode == "restore") {
			optionVar -sv "exampleWords" `optionVar -q exampleWordsHold`;
		} else {//	 "remove"
		//	 Remove the temporary option vars so they don't get saved out
			optionVar -remove "exampleWordsHold";
		}
		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");