To Create a New Control
This section describes the general steps for defining a control and describes how to create various types of controls.
If the control will have a PUSH_ACTION and/or DROP_ACTION, create the action definitions. These are the actions that run when the user clicks the control or drops a file on it.
Create the icon image files for the control.
For information about icon sizes, names, and locations, see "Icon Image Files".
Create a new Front Panel configuration file in:
System-wide: /etc/dt/appconfig/types/language/*.fp
Personal: HomeDirectory/.dt/types/*.fp
Add the control definition to the file.
Save the file.
Choose Restart Workspace Manager from the Workspace menu.
Creating a Control that Runs an Action When Clicked
Use these fields to define the control's behavior:
TYPE: Set to icon
PUSH_ACTION: Specifies the name of the action to be run
For example, the following control, which will be put in the Personal Applications subpanel, runs a game the user has acquired:
CONTROL Ball { TYPE icon CONTAINER_NAME PersAppsSubpanel CONTAINER_TYPE SUBPANEL ICON ball PUSH_ACTION RunBallGame HELP_STRING "Choose this control to play Ball." }
The following control will be located in the upper left corner of the switch. It starts an action named CutDisp.
CONTROL StartCutDisp { TYPE icon CONTAINER_NAME Switch CONTAINER_TYPE SWITCH POSITION_HINTS first ICON cutdisp HELP_STRING "Choose this control to run cutdisp." PUSH_ACTION CutDisp }
Creating a Control that Opens a File
Use these fields to define the control's behavior:
TYPE: Set to file
PUSH_ACTION: Set to Open
There must be an Open action defined for the data type of the file.
For example, the following control will be located on the far right side of the Main Panel. It starts Text Editor with the data file /users/ellen/PhoneList.txt. The Open action for *.txt files is part of the default action database.
CONTROL EditPhoneList { TYPE file FILE_NAME /users/ellen/PhoneList.txt CONTAINER_NAME Top CONTAINER_TYPE BOX POSITION_HINTS last ICON PhoneBook HELP_STRING "This control displays Ellen's phone list." PUSH_ACTION Open }
Creating a Control that Behaves as a Drop Zone
Use the DROP_ACTION field to specify the action that runs when the user drops a file on the control. The action must be capable of accepting a file argument.
Frequently, a control definition includes both a PUSH_ACTION and DROP_ACTION field. You can use the same action for the push and drop action.
For example, the following control, located in the Personal Applications subpanel, runs the X client xwud, which takes a file argument.
CONTROL Run_xwud { CONTAINER_NAME PerAppsSubpanel CONTAINER_TYPE SUBPANEL POSITION_HINTS 2 ICON XwudImage PUSH_ACTION RunXwud DROP_ACTION RunXwud } |
Creating a Control that Monitors a File
Use these fields to define the control's behavior:
TYPE: Specify one of the following values:
icon--use this type if you want to specify a PUSH_ACTION and/or DROP_ACTION for the control.
file--use this type if you want the control, when chosen, to behave like the file when the file's icon is double-clicked in File Manager.