When defining a tool, it is possible to show a dialog to the user, asking for additional arguments, using the $PROMPT(filename) command-macro. Free Pascal comes with some dialogs, such as a ’grep’ dialog, a ’cvs checkout’ dialog and a ’cvs check in’ dialog. The files for these dialogs are in the binary directory and have an extension .tdf.
In this section, the file format for the dialog description file is explained. The format of this file resembles a windows .INI file, where each section in the file describes an element (or control) in the dialog. An OK and an Cancel button will be added to the bottom of the dialog, so these should not be specified in the dialog definition.
A special section is the Main section. It describes how the result of the dialog will be passed on the command-line, and the total size of the dialog.
Remark: Keywords that contain a string value, should have the string value enclosed in double quotes as in
Title="Dialog title"
|
The Main section should contain the following keywords:
Size=(59,9)
|
means the dialog is 59 characters wide, and 9 lines high. This size does not include the border of the dialog.
A control placeholder is the name of some control in the dialog, enclosed in percent (%) characters. The name of the control will be replaced with the text, associated with the control. Consider the following example:
CommandLine="-n %l% %v% %i% %w% %searchstr% %filemask%"
|
Here the values associated with the controls named l, i, v, w and searchstr and filemask will be inserted in the command-line string.
The following is an example of a valid main section:
[Main]
Title="GNU Grep" Size=(56,9) CommandLine="-n %l% %v% %i% %w% %searchstr% %filemask%" Default="searchstr" |
After the Main section, a section must be specified for each control that should appear on the dialog. Each section has the name of the control it describes, as in the following example:
[CaseSensitive]
Type=CheckBox Name="~C~ase sensitive" Origin=(2,6) Size=(25,1) Default=On On="-i" |
Each control section must have at least the following keywords associated with it:
Each control has some specific keywords associated with it; they will be described below.
A label (Type=Label) has the following extra keywords associated with it:
Text="~T~ext to find"
|
The T will be highlighted.
A label does not contribute to the text of the command-line, it is for informational and navigational purposes only. The following is an example of a label description section:
[label2]
Type=Label Origin=(2,3) Size=(22,1) Text="File ~m~ask" Link="filemask" |
An edit control (Type=InputLine) allows to enter arbitrary text. The text of the edit control will be pasted in the command-line if it is referenced there. The following keyword can be specified in a inputline control section:
The following is an example of a input line section:
[filemask]
Type=InputLine Origin=(2,4) Size=(22,1) Value="*.pas *.pp *.inc" |
A combo-box control (Type=CheckBox) presents a checkbox which can be in one of two states, on or off. With each of these states, a value can be associated which will be passed on to the command-line. The following keywords can appear in a checkbox type section:
The following is a example of a valid checkbox description:
[i]
Type=CheckBox Name="~C~ase sensitive" Origin=(2,6) Size=(25,1) Default=On On="-i" |
If the checkbox is checked, then the value -i will be added on the command-line of the tool. If it is unchecked, no value will be added.