Character User Interface Programming
Total Page:16
File Type:pdf, Size:1020Kb
Character User Interface Programming 0890424-000 February 1997 The operating system name has been changed to PowerMAX OSTM Copyright 1997 by Concurrent Computer Corporation. All rights reserved. This publication or any part thereof is intended for use with Concurrent products by Concurrent personnel, customers, and end–users. It may not be repro- duced in any form without the written permission of the publisher. This document is based on copyrighted documentation from Novell, Inc. and is reproduced with permission. The information contained in this document is believed to be correct at the time of publication. It is subject to change without notice. Concurrent Computer Corporation makes no warranties, expressed or implied, concerning the infor- mation contained in this document. To report an error or comment on a specific portion of the manual, photocopy the page in question and mark the cor- rection or comment on the copy. Mail the copy (and any additional comments) to Concurrent Computer Corporation, 2101 W. Cypress Creek Road, Ft. Lauderdale, FL 33309–1892. Mark the envelope “Attention: Publications Department.” This publication may not be reproduced for any other reason in any form without written permission of the publisher. UNIX is a registered trademark, licensed exclusively by X/Open Company Ltd.. PowerMAX OS is a trademark of Concurrent Computer Corporation. Other products mentioned in this document are trademarks, registered trademarks or trade names of the manufactures or marketers of the products with which the marks or names are associated.. Printed in U. S. A. Revision History: Level: Effective With: Original Release -- July 1994 000 Secure/Power UNIX r1.1 Preface Introduction The Character User Interface Programming is for application developers who want to develop a menu- and form-based interface that operates on ASCII character terminals run- ning on UNIX® System V Release 4.2 and later. Existing applications can be adapted to a character user interface front-end, and new applications can be designed from the start to take advantage of the screen management capabilities of FMLI and ETI. FMLI is a high-level programmer interface for creating menus, forms, and text frames that enforce a well-defined look and feel policy. An application developer, having defined frames (menus, forms, and text) in files, is free from having to program their display and user interactions. The shell-like language is processed by an interpreter and allows the developer to specify menu and form placement. FMLI allows application developers to customize specific applications easily and quickly without writing in C language code. ETI is a set of screen management library subroutines (built on curses) that promote fast development of application programs that manipulate windows, panels, menus, and forms. ETI also includes functions to define help, error and other types of messages, and to dis- play, and change messages quickly and easily. It is a C language toolkit used to build user interfaces for applications. ETI allows the developer to design a unique/customized user interface. This guide tells you how to use the Form and Menu Language Interpreter (FMLI) and the Extended Terminal Interface (ETI) software development tools to write such user inter- faces for your applications. It assumes the reader has a working knowledge of UNIX Sys- tem V, shell programming, and/or C Language programming. NOTE This guide is not intended to be an introduction to UNIX System V, UNIX System shell programming, or C Language program- ming. For an introduction to shell programming and C Language programming, see “Referenced Publications” on page -vi. Who This Guide Is For This guide is written for programmers developing UNIX System V applications with interfaces that operate on display devices using only standard characters. A working knowledge of the UNIX system and shell programming is assumed. (See the UNIX Sys- tem V User's Guide for detailed information on these topics.) iii Character User Interface Programming Scope of Manual Chapter 1 through Chapter 4 describe the Form and Menu Language, and tell how to use it to write descriptions of the forms, menus, and text frames that make up your user inter- face. These chapters explain how you can make best use of the screen management capa- bilities that FMLI provides for you, and how you can customize the default appearance and functionality of a user interface written with FMLI. Chapter 5 through Chapter 13 describe the Extended Terminal Interface, and tell how to use it to write screen management programs on a UNIX system. These chapters explain how to use the high-level library routines to build panels, menus and forms. They also describe how these routines relate to low-level curses routines and the terminfo data- base. Syntax Notation The following typographical conventions are used in this guide: • The logical values “true” and “false” are represented in the text by the words TRUE and FALSE, shown in all capital letters. Boolean descriptors must evaluate to either TRUE or FALSE, where - FALSE means the literal word “false,” irrespective of case, or a non- zero return code. - TRUE means any value other than those defined for FALSE. • Literal elements of computer input and output, including user input, pro- gram code, UNIX system command names, FMLI command and built-in utility names, and other elements of the Form and Menu Language are shown in constant-width typeface. • Substitutable elements of command lines and of elements of the Form and Menu Language are shown in italic typeface. • Comments in a screen display—that is, text that is not computer output but is an aside from the author to the reader—are shown in italic typeface, as in the following example: . command interaction . Press ENTER to continue • Named keys are shown in a representation of a hard key. This includes keys such as ESCAPE or DEL, and the function keys F1 through F8. • Alternative keystroke sequences are also shown in a hard key representa- tion. For example, the alternative keystroke sequence for the named key iv Preface DEL is CTRL-x. That means the user must hold down the CTRL key while pressing x. Longer alternative keystroke sequences are shown as a sequence of hard key repre- sentations. For example, the alternative keystroke sequence for the named key F3 is CTRL-f 3. That means the user must hold down CTRL while pressing f, then press 3. • Screen labels for function keys are also shown as hard key representations. For example, when a menu is the active frame on the screen, function key F1 has the screen label HELP. • Depending on the keyboard being used, the carriage-return key may be called ENTER, RETURN, or something else. Throughout this guide the ENTER key is used to represent the carriage-return key. However, if a keyboard only has a RETURN key, use it or CTRL-m instead. • When command syntax is described, the following notation conventions are used (especially in the FMLI manual pages in section 1F): - Literal elements of a command (including command names them- selves) are shown in constant-width typeface. - Substitutable arguments to commands are shown in italic typeface. - Square brackets ([]) around an argument indicate that the argument is optional. - Ellipses (. .) are used to show that the previous argument may be repeated. • In program text, the major ETI data types appear in uppercase. They are WINDOW A rectangular area of the screen treated as a unit PANEL A window with relations of depth to other windows so that regions hid- den behind other windows are invisible ITEM A character string consisting of a name and an optional description MENU A screen display that presents a set of items from which the user chooses one or more, depending on the type of menu FIELD An m x n block of form character positions that ETI functions can manipulate as a unit FORM A collection of one or more pages of fields FIELDTYPE A field attribute that determines what kind of data may occupy the field • Every ETI function is introduced with a SYNOPSIS. The first line of the SYNOPSIS proper describes the routine, while the following lines describe its arguments. On each line, the type of the return value or arguments pre- cedes their names. As an example, consider v Character User Interface Programming SYNOPSIS int set_menu_win (menu, window) MENU * menu; WINDOW * window; This says that the function set_menu_win returns a value of type int and that it takes two arguments, menu and window. The argument menu is of type MENU * (pointer to a menu), while the argument window is of type WINDOW * (pointer to a window). • The terms window, panel, menu, and form are often shorthand for the phrases window pointer, panel pointer, menu pointer, and form pointer, respectively. All ETI routines pass or return pointers to these objects, not the objects themselves. Referenced Publications The following publications are referenced in this document: 0890428 User's Guide 0891019 Concurrent C Reference Manual vi Contents Chapter 1 Introduction to FMLI Introduction . 1-1 What Is FMLI? . 1-1 Screen Layout. 1-2 Frames . 1-5 Programming with FMLI. 1-5 Frame Definition Files . 1-6 Menu Frames. 1-6 Single-column and Multi-column Menus . 1-6 Single-select and Multi-select Menus . 1-6 Form Frames . 1-7 Multi-line and Scrollable Fields. 1-7 Multi-page Forms. 1-7 Validating Field Values . 1-7 Choices Menu . 1-7 Text Frames . 1-8 Application Level Definition Files . 1-8 Initialization File . 1-8 Commands File . 1-8 Alias File . 1-8 Terminal Independence. 1-9 Recovering after Abnormal Termination. 1-9 Internationalization Support . 1-10 An Example Application . 1-10 Writing an Internationalized Application . 1-12 Using an FMLI Application.