[ Previous | Next | Contents | Glossary | Home | Search ]
AIX Version 4.3 General Programming Concepts: Writing and Debugging Programs

sm_cmd_opt (SMIT Dialog/Selector Command Option) Object Class

Each object in a dialog except the dialog header object normally corresponds to a flag, option, or attribute of the command that the dialog performs. One or more of these objects is created for each SMIT dialog; a ghost dialog can have no associated dialog command option objects. Each selector screen is composed of one selector header object and one selector command option object.

Note: When coding an object in this object class, set unused empty strings to "" (double-quotation marks) and unused integer fields to 0 .

The dialog command option object and the selector command option object are both sm_cmd_opt objects. The descriptors for the sm_cmd_opt object class and their functions are:

id The ID or name of the object. The id of the associated dialog or selector header object can be used as a fast path to this and other dialog objects in the dialog. The value of id is a string with a maximum length of 64 characters. All dialog objects that appear in one dialog must have the same ID. Also, IDs should be unique to your application and unique within the particular SMIT database used.
id_seq_num The position of this item in relation to other items on the dialog; sm_cmd_opt objects in a dialog are sorted on this string field. The value of id_seq_num is a string with a maximum length of 16 characters. When this object is part of a dialog screen, the string "0" is not a valid value for this field. When this object is part of a selector screen, the id_seq_num descriptor must be set to 0.
disc_field_name A string that should match one of the name fields in the output of the cmd_to_discover command in the associated dialog header. The value of disc_field_name is a string with a maximum length of 64 characters.

The value of the disc_field_name descriptor can be defined using the raw or cooked name from a preceding selector instead of the cmd_to_discover command in the associated header object. If the descriptor is defined with input from a preceding selector, it must be set to either "_rawname" or "_cookedname" , or to the corresponding sm_name_hdr.cooked_field_name value or sm_name_hdr.raw_field_name value if this was used to redefine the default name.

name The string that appears on the dialog or selector screen as the field name. It is the visual questioning or prompting part of the object, a natural language description of a flag, option or parameter of the command specified in the cmd_to_exec field of the associated dialog header object. The value of name is a string with a maximum length of 1024 characters.
name_msg_file The file name (not the full path name) that is the Message Facility catalog for the string, name. The value of name_msg_file is a string with a maximum length of 1024 characters. Message catalogs required by an application program can be developed with the Message Facility. Set to "" (empty string) if not used.
name_msg_set The Message Facility set ID for the string, name. The value of name_msg_set is an integer. Set to 0 if not used.
name_msg_id The Message Facility message ID for the string, name. The value of name_msg_id is an integer. Set to 0 if not used.
op_type The type of auxiliary operation supported for this field. The value of op_type is a string. Valid values are:

"" or "n" - This is the default case. No auxiliary operations (list or ring selection) are supported for this field.

"l" - List selection operation provided. A pop-up window displays a list of items produced by running the command in the cmd_to_list field of this object when the user selects the F4=List function of the SMIT interface.

"r" - Ring selection operation provided. The string in the disp_values or aix_values field is interpreted as a comma-delimited set of valid entries. The user can tab or backtab through these values to make a selection. Also, the F4=List interface function can be used in this case, since SMIT will transform the ring into a list as needed.

The values "N" , "L" , and "R" can be used as op_type values just as the lowercase values "n" , "l" , and "r" . However, with the uppercase values, if the cmd_to_exec command is run and returns with an exit value of 0 , then the corresponding entry field will be cleared to an empty string.

entry_type The type of value required by the entry field. The value of entry_type is a string. Valid values are:

"" or "n" - No entry; the current value cannot be modified via direct type-in. The field is informational only.

"t" - Text entry; alphanumeric input can be entered.

"#" - Numeric entry; only the numeric characters 0 , 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 , or 9 can be entered. A - (minus sign) or + (plus sign) can be entered as the first character.

"x" - Hex entry; hexadecimal input only can be entered.

"f" - File entry; a file name should be entered.

"r" - Raw text entry; alphanumeric input can be entered. Leading and trailing spaces are considered significant and are not stripped off the field.

entry_size Limits the number of characters the user can type in the entry field. The value of entry_size is an integer. A value of 0 defaults to the maximum allowed value size.
required Defines if a command field must be sent to the cmd_to_exec command defined in the associated dialog header object. The value of required is a string. If the object is part of a selector screen, the required field should normally be set to "" (empty string). If the object is part of a dialog screen, valid values are:

"" or "n" - No; the option is added to the command string in the cmd_to_exec command only if the user changes the initially-displayed value. This is the default case.

"y" - Yes; the value of the prefix field and the value of the entry field are always sent to the cmd_to_exec command.

"+" - The value of the prefix field and the value of the entry field are always sent to the cmd_to_exec command. The entry field must contain at least one non-blank character. SMIT will not allow the user to run the task until this condition is satisfied.

"?" - Except when empty; the value of the prefix field and the value of the entry field are sent to the cmd_to_exec field unless the entry field is empty.

prefix In the simplest case, defines the flag to send with the entry field value to the cmd_to_exec command defined in the associated dialog header object. The value of prefix is a string with a maximum length of 1024 characters.

The use of this field depends on the setting of the required field, the contents of the prefix field, and the contents of the associated entry field.

Note: If the prefix field is set to -- (dash dash), the contents of the associated entry field is appended to the end of the cmd_to_exec command. If the prefix field is set to --' (dash dash single quotation mark), the contents of the associated entry field is appended to the end of the cmd_to_exec command in single quotes.
cmd_to_list_mode Defines how much of an item from a list should be used. The list is produced by the command specified in this object's cmd_to_list field. The value of cmd_to_list_mode is a string with a maximum length of 1 character. Valid values are:

"" or "a" - Get all fields. This is the default case.

"1" - Get the first field.

"2" - Get the second field.

"r" - Range; running the command string in the cmd_to_list field returns a range (such as 1..99) instead of a list. Ranges are for information only; they are displayed in a list pop-up, but do not change the associated entry field.

cmd_to_list The command string used to get a list of valid values for the value field. The value of cmd_to_list is a string with a maximum length of 1024 characters. This command should output values that are separated by \n (new line) characters.
cmd_to_list_postfix The postfix to interpret and add to the command string specified in the cmd_to_list field of the dialog object. The value of cmd_to_list_postfix is a string with a maximum length of 1024 characters. If the first line starts with # (pound sign) following a space, that entry will be made non-selectable. This is useful for column headings. Subsequent lines that start with a # , optionally preceded by spaces, are treated as a comment and as a continuation of the preceding entry.
multi_select Defines if the user can make multiple selections from a list of valid values produced by the command in the cmd_to_list field of the dialog object. The value of multi_select is a string. Valid values are:

"" - No; a user can select only one value from a list. This is the default case.

"," - Yes; a user can select multiple items from the list. When the command is built, a comma is inserted between each item.

"y" - Yes; a user can select multiple values from the list. When the command is built, the option prefix is inserted once before the string of selected items.

"m" - Yes; a user can select multiple items from the list. When the command is built, the option prefix is inserted before each selected item.

value_index For an option ring, the zero-origin index to the array of disp_value fields. The value_index number indicates the value that is displayed as the default in the entry field to the user. The value of entry_size is an integer.
disp_values The array of valid values in an option ring to be presented to the user. The value of the disp_values fields is a string with a maximum length of 1024 characters. The field values are separated by , (commas) with no spaces preceding or following the commas.
values_msg_file The file name (not the full path name) that is the Message Facility catalog for the values in the disp_values fields, if the values are initialized at development time. The value of the values_msg_file field is a string with a maximum length of 1024 characters. Message catalogs required by an application program can be developed with the Message Facility.
values_msg_set The Message Facility set ID for the values in the disp_values fields. Set to 0 if not used.
values_msg_id The Message Facility message ID for the values in the disp_values fields. Set to 0 if not used.
aix_values If for an option ring, an array of values specified so that each element corresponds to the element in the disp_values array in the same position; use if the natural language values in disp_values are not the actual options to be used for the command. The value of the aix_values field is a string with a maximum length of 1024 characters.
help_msg_id Specifies a Message Facility message set number and message ID number with a comma as the separator or a numeric string equal to a SMIT identifier tag.
help_msg_loc The file name sent as a parameter to the man command for retrieval of help text, or the file name of a file containing help text. The value of help_msg_loc is a string with a maximum length of 1024 characters.
help_msg_base The fully qualified path name of a library that SMIT reads for the file names associated with the correct book.
help_msg_book Contains the string with the value of the name file contained in the file library indicated by help_msg_base.

For information on retrieving SMIT help using the help_msg_id , help_msg_loc , help_msg_base , and help_msg_book fields, see the man pages, softcopy libraries, and message catalog methods located in "Creating SMIT Help Information for a New Task".

Related Information

System Management Interface Tool (SMIT) for Programming.

Understanding SMIT Object Classes.

The smit command.

sm_name_hdr (SMIT Selector Header) Object Class, sm_cmd_hdr (SMIT Dialog Header) Object Class, sm_menu_opt (SMIT Menu) Object Class.

SMIT Example Program.


[ Previous | Next | Contents | Glossary | Home | Search ]