Difference between revisions of "Command Dialog Formatting"

From The Foundry MODO SDK wiki
Jump to: navigation, search
(Created page with "The DialogFormatting() method allows a command to apply some customized formatting to the controls in the dialog. Specifically, it allows the order of the controls (as genera...")
 
 
Line 1: Line 1:
The DialogFormatting() method allows a command to apply some customized formatting to the controls in the dialog.  Specifically, it allows the order of the controls (as generated from the command's arguments) to be changed, dividers to be inserted (with or without a label), and edit fields to be ganged.
+
The DialogFormatting() method allows a command to apply some customized formatting to its controls in a command dialog.  Specifically, it allows the order of the controls (as generated from the command's arguments) to be changed, dividers to be inserted (with or without a label), and edit fields to be ganged.
  
 
Formatting is returned as a string, with each argument presented by its index.  For example, this string would return the default ordering of a five argument command:
 
Formatting is returned as a string, with each argument presented by its index.  For example, this string would return the default ordering of a five argument command:

Latest revision as of 20:51, 9 October 2019

The DialogFormatting() method allows a command to apply some customized formatting to its controls in a command dialog. Specifically, it allows the order of the controls (as generated from the command's arguments) to be changed, dividers to be inserted (with or without a label), and edit fields to be ganged.

Formatting is returned as a string, with each argument presented by its index. For example, this string would return the default ordering of a five argument command:

"0 1 2 3 4"

Each argument is separated by a space. To swap the position of arguments 2 and 3 in the dialog, you'd just swap them in the string. Being able to re-order arguments is useful if you have added a new argument to your command that should be placed earlier in the dialog, but you don't want to change the argument order due to the risk of breaking scripts that may rely on the original ordering.

"0 1 3 2 4"

To gang related controls together, you wrap them in curly braces. This example gangs the second and third arguments.

"0 1 {2 3} 4"

To insert a divider, use a dash.

"0 1 2 3 - 4"

To name a divider, add the string (preferably as a message table lookup, which will automatically be decoded by the command dialog) inside of square braces immediately after the dash.

Any argument not included in the string will be omitted from the dialog. This can be used as an alternative to the HIDDEN argument flag. The command dialog will not open if all arguments are hidden, and the command will simply fail if any of those arguments are required and not set.