| TKTESTER(1) | General Commands Manual | TKTESTER(1) |
tktester - test Tk widgets and help design Tk layouts
wm/tktester [ -import ]
Tktester not only tests the tk (2) widget implementation but can help when designing Tk application layouts. Its main window contains the design area where widgets are placed and edited. Most of the commands for creating and moving widgets are located on the control bar just below the design area although a few commands may be found in the menus at the top of the window. Output is sent to the text box below the control bar.
Widget properties may be modified using the config window and widget commands called from the command window.
This is split into four areas:
This contains various file operations as well as a few commands
Files are saved in the form of a list of tk commands. This means that they can easily be imported into programs as part of an array. Files to be loaded must have .f as the top frame with no widgets outside it.
This is the main area of the main window where the widgets are displayed. To select a widget, click on it with mouse button 3, the control bar shows the name and other information about the currently selected widget. Frames themselves can only be selected by clicking on their label, clicking elsewhere on the frame (if there is no widget there) will select the empty cell, any new widget created will be placed here. Once a widget has been selected, you can move it by clicking on the empty destination cell with mouse button 2. Individual widgets can be moved from one frame to another but frames themselves can currently only be moved within the same parent frame. Clicking mouse button 2 on a widget will delete that widget if the Free Delete button on the control bar is on.
This is split into three different menus. To select the different submenus, click on the >> at the end of the menu title.
Data Menu
Position and Formatting Menu
New Menu
Clicking on 'New' will bring up the pack menu, here you can set packing to down or right. This is used when a new widget is created. If the user has not selected an empty cell, the new widget will be placed either below or to the right of the currently selected widget. Clicking on '>>' will scroll the buttons within the menu to the left to allow access to those that might be off screen.
Output and errors are reported here. This box may be hidden by clicking on the grey button located at the bottom of the main window.
This window is opened by clicking on the red button located at the bottom of the main window. To configure a widget's options, the widget must be selected. To modify an option, type the new value required into the relevant entry box and click the 'set' button. Any output (including error messages) returned will be sent to the output box.
There are two template buttons at the bottom of the config window, set as default and save as default. Set will cause each new widget of the same type to be created with the same options as the currently selected widget. This default will not be remembered once tktester has been closed. Save does the same as set except the default is saved so it will be not be lost if tktester is closed.
Default Template Options
By default, each widget with a -text option is set to {%t %i} e.g. button 2. Note: These options only work with default templates, setting the -text option of a specific button to {%t %i} will just cause '%t %i' to be displayed.
This window is opened by clicking on the green button located at the bottom of the main window. To call the commands for a particular widget, the widget must be selected.
The command window is split into two listboxes and one entry box. The first listbox contains all the main commands available for the current widget type. Selecting a command will bring up a list of subcommands (if they exist) in the second listbox as well as displaying any arguments required above the entrybox. To run a command, first select the command (and any subcommand), then enter the required arguments into the entry box and click run. The command, as well as any output, is sent to the output box on the main window. If no output is returned, the output box will display 'ok'.
The file tkwargs/widgets must contain a list of widgets, one per line as follows:
with the fields separated by tabs or spaces. For example:
/appl/wm/tktester
The command window sometimes lists a command more than once. It does not matter which one is used.
In a saved file, any grid commands must put -row and -column options before -rowspan or -columnspan.
Tktester can crash when loading a file if it is not in the correct format.
At the moment, tktester can only load, save and use tk commands where the widget names adhere to the format .abv[n] where abv is the abreviation for the widget type e.g. b for buttons, sb for scrollbars etc and n is an optional number. It would be better to allow users to have more meaningful names such as .f.fmenu. Implementing this would also make it possible to load in commands written outside of tktester for testing or modification purposes.
This would more clearly show which rows and columns widgets were in (especially when widgets are spanning more than one). Also could be used to select individual rows and columns more explicity and maybe for multiple selections.