Main page Reference Manual

Extending x-4gl

Interface functions

These functions control the look and feel of the user interface objects of Power-4gl, and are expected to be modified by the programmer to integrate Power-4gl with the individual system. These functions must be present in the system, typically in a module called "interf.4gl". A default set of interface functions is supplied which the programmer can alter to fit his/her particular needs.

Keymap

Converts an integer keyboard key code to a logical name, as used in Power-4gl. Keyboard mapping is thus contained in one function which the programmer can easily modify by assigning appropriate keyboard values (i.e. "f8") to logical values (i.e. "exit").

1 parameters:
Keycode: An integer value representing a keyboard key code (as produced by fgl_lastkey).

1 return value:
Logical value: A string containing a logical keyboard name. The logical values used by Power-4gl functions, and their standard purposes are as follows:
'exit' = Exit without change or action.
'accept' = Perform operation and exit.
'enter' = Enter into a list item or next field in an input form.
'help' = Open the appropriate help window.
'insert' = Insert a new pick-list row.
'delete' = Delete a pick-list row.
'filter' = Edit the search criteria for a pick-list or report.
'refresh' = Refresh the current window data.
'toggle' = View report list/coversheet. Mark/unmark pick-list rows.
'search' = In an input field, open an appropriate pick-list.
'other' = Other operations, perhaps a menu offering some possibilities.
'tab' = Move far left.
'sh-tab' = Move far right.
'up' = Move up.
'down' = Move down.
'left' = Move left.
'right' = Move right.
'prevpage' = Page upward.
'nextpage' = Page downward.
'home' = First page of a list.
'end' = Last page of a list.
'print' = Output the current list to a printer (pipe).
'file' = Output the current list to a file.
'prtscr' = Print screen to a pipe.
'opsys' = Call up an operating system shell.

Disp

Display text of a logical type with an appropriate attribute. Power-4gl uses these definitions to display text of types such as titles, listings and messages. Display attributes are thus contained in one function which the programmer can easily modify by assigning appropriate display attributes (i.e. "bold") to logical display types (i.e. "title").

4 parameters:
Text: The text to be displayed.
Type: The logical display type of the text. The logical types used by Power-4gl functions, and their standard purposes are as follows:
'list' = Normal list line (pick-list lines, menu items, report lines etc.)
'listcurr' = The current list line, i.e. the cursor.
'listmark' = A marked list line (used in pick-lists).
'listcurrmark' = The current list line which has also been marked.
'listinact' = An inactive list line (used in menus).
'titlefirst' = The first title line of a window, i.e. the window label.
'title' = A middle title line or header.
'titlelast' = The last title line or header (usually underlined).
'message' = Messages or prompts.
'error' = Error messages.
Row: The window row which the text is to be displayed at.
Column: The window column which the text is to be displayed at.

Transl

Converts a value using a specified translation method, reducing translations and conversions to a single function.

2 parameters:
Method: Character string identifying the translation or conversion method.
Value: The value to be converted.

1 return value:
Value: The converted value.

Getdefprinter

Obtain the name of the default printer.

1 return value:
Printer name: A string containing the logical name of the default printer.

Getprinter

Search for a printer. This function typically calls a pick-list containing a selection of available printers and returns a selected printer along with configuration values.

2 parameters:
Printer name: The currently selected printer name (if any).
Output width: The expected width of the printed output (number of characters).

12 return value:
Printer name: The newly selected printer name.
Pipe: String containing the output pipe description.
Page length: The page length of the appropriate page setup (number of lines).
Page width: The page width of the appropriate page setup (number of characters).
Setup: The page setup escape sequence.
Reset: Character sequence between pages.
Bold: Sequence that produces bold output.
Nonbold: Sequence that ends bold output.
Underline: Sequence that produces underlined output.
Nonunderline: Sequence that ends underlined output.
Italic: Sequence that produces italic output.
Nonitalic: Sequence that ends underlined output.

Checkprinter

Validate a printer name and return configuration values.

2 parameters:
Printer name: The currently selected printer name (if any).
Output width: The expected width of the printed output (number of characters).

13 return value:
Printer name: The newly selected printer name.
Pipe: String containing the output pipe description.
Page length: The page length of the appropriate page setup (number of lines).
Page width: The page width of the appropriate page setup (number of characters).
Setup: The page setup escape sequence.
Reset: Character sequence between pages.
Bold: Sequence that produces bold output.
Nonbold: Sequence that ends bold output.
Underline: Sequence that produces underlined output.
Nonunderline: Sequence that ends underlined output.
Italic: Sequence that produces italic output.
Nonitalic: Sequence that ends underlined output.
Valid: True if the printer is valid, otherwise false.

Progerr

Handle a program error without program termination. Typically, the function displays error information, possibly notifying the system administrator via email, before continuing.

3 parameters:
Location: Character string identifying where in the program the error occurred.
Status: An integer status code, e.g. sqlca.sqlcode.
Message: Additional comments or messages.

Progerrq

Handle a program error and terminate the program. Typically, the function notifies the system administrator via email before terminating the program as gracefully as possible.

3 parameters:
Location: Character string identifying where in the program the error occurred.
Status: An integer status code, e.g. sqlca.sqlcode.
Message: Additional comments or messages.


Power-4gl manual main page