![]() |
CCP4i: Graphical User Interface |
Documentation for Programmers | |
CreateLine |
![]() ![]() ![]() |
CreateLine - create a line in an interface window
CreateLine line_id ?keywords?
Keywords:
label label_text
widget variable_name
message message_text
help help_target
format format_mode format_layout
toggle_display controlVar status control_value_list
bitmap_button bitmap_name
button button_text
Create a line in the open task window folder (see CreateTaskWindow and OpenFolder) or an open window (see OpenWindow) and return the id of the line line_id. All remaining arguments are optional but take the form of a keyword followed by one or more arguments (the number is defined for each keyword). In addition, some keywords can have subkeywords which always begin with the minus character (e.g. the -width subkeyword to widget).
ERRORS
This command is fairly tolerant of bad input (e.g. misspelled keywords) but is unlikely to give you a meaningful warning message. It will be obvious there is a problem when you look at what is displayed. My most common mistake is failure to define the variable_name associated with the widget keyword in the taskname.def file.
MESSAGE TEXT
For the benefit of users who are used to running a program without the interface, the message text should include the name of the program keyword that the parameter relates to. The message text is not helpful if it repeats what is already stated in the labels.
USING TOGGLE_DISPLAY
It is a good thing to use toggle_display to hide any lines which are definitely not relevant to the task the user is trying to perform. Also, a line may take two or more different forms dependent on some parameter: to implement this it is necessary to define two or more versions of the line and hide the version(s) which are not required.
The control variable for toggle_display is usually a menu (I have never used anything else). The control variable should usually either be in the protocol section of the task window, or in the same folder and above the line to be toggled.
It is also possible to have a line which changes form dependent on some parameter within the line. For example (in CCP4i v1.0) in the DM task interface the first line at the top of the window is dependent on the phase combination scheme. Look for PHASE_COMB in the file $CCP4I_top/tasks/dm.tcl to see how this works. Note that the parameter PHASE_COMB controls not only the form of the line that it appears in, but also another line in the first folder.