| 1 | \section{\module{fl} ---
|
|---|
| 2 | FORMS library for graphical user interfaces}
|
|---|
| 3 |
|
|---|
| 4 | \declaremodule{builtin}{fl}
|
|---|
| 5 | \platform{IRIX}
|
|---|
| 6 | \modulesynopsis{FORMS library for applications with graphical user
|
|---|
| 7 | interfaces.}
|
|---|
| 8 |
|
|---|
| 9 |
|
|---|
| 10 | This module provides an interface to the FORMS Library\index{FORMS
|
|---|
| 11 | Library} by Mark Overmars\index{Overmars, Mark}. The source for the
|
|---|
| 12 | library can be retrieved by anonymous ftp from host
|
|---|
| 13 | \samp{ftp.cs.ruu.nl}, directory \file{SGI/FORMS}. It was last tested
|
|---|
| 14 | with version 2.0b.
|
|---|
| 15 |
|
|---|
| 16 | Most functions are literal translations of their C equivalents,
|
|---|
| 17 | dropping the initial \samp{fl_} from their name. Constants used by
|
|---|
| 18 | the library are defined in module \refmodule[fl-constants]{FL}
|
|---|
| 19 | described below.
|
|---|
| 20 |
|
|---|
| 21 | The creation of objects is a little different in Python than in C:
|
|---|
| 22 | instead of the `current form' maintained by the library to which new
|
|---|
| 23 | FORMS objects are added, all functions that add a FORMS object to a
|
|---|
| 24 | form are methods of the Python object representing the form.
|
|---|
| 25 | Consequently, there are no Python equivalents for the C functions
|
|---|
| 26 | \cfunction{fl_addto_form()} and \cfunction{fl_end_form()}, and the
|
|---|
| 27 | equivalent of \cfunction{fl_bgn_form()} is called
|
|---|
| 28 | \function{fl.make_form()}.
|
|---|
| 29 |
|
|---|
| 30 | Watch out for the somewhat confusing terminology: FORMS uses the word
|
|---|
| 31 | \dfn{object} for the buttons, sliders etc. that you can place in a form.
|
|---|
| 32 | In Python, `object' means any value. The Python interface to FORMS
|
|---|
| 33 | introduces two new Python object types: form objects (representing an
|
|---|
| 34 | entire form) and FORMS objects (representing one button, slider etc.).
|
|---|
| 35 | Hopefully this isn't too confusing.
|
|---|
| 36 |
|
|---|
| 37 | There are no `free objects' in the Python interface to FORMS, nor is
|
|---|
| 38 | there an easy way to add object classes written in Python. The FORMS
|
|---|
| 39 | interface to GL event handling is available, though, so you can mix
|
|---|
| 40 | FORMS with pure GL windows.
|
|---|
| 41 |
|
|---|
| 42 | \strong{Please note:} importing \module{fl} implies a call to the GL
|
|---|
| 43 | function \cfunction{foreground()} and to the FORMS routine
|
|---|
| 44 | \cfunction{fl_init()}.
|
|---|
| 45 |
|
|---|
| 46 | \subsection{Functions Defined in Module \module{fl}}
|
|---|
| 47 | \nodename{FL Functions}
|
|---|
| 48 |
|
|---|
| 49 | Module \module{fl} defines the following functions. For more
|
|---|
| 50 | information about what they do, see the description of the equivalent
|
|---|
| 51 | C function in the FORMS documentation:
|
|---|
| 52 |
|
|---|
| 53 | \begin{funcdesc}{make_form}{type, width, height}
|
|---|
| 54 | Create a form with given type, width and height. This returns a
|
|---|
| 55 | \dfn{form} object, whose methods are described below.
|
|---|
| 56 | \end{funcdesc}
|
|---|
| 57 |
|
|---|
| 58 | \begin{funcdesc}{do_forms}{}
|
|---|
| 59 | The standard FORMS main loop. Returns a Python object representing
|
|---|
| 60 | the FORMS object needing interaction, or the special value
|
|---|
| 61 | \constant{FL.EVENT}.
|
|---|
| 62 | \end{funcdesc}
|
|---|
| 63 |
|
|---|
| 64 | \begin{funcdesc}{check_forms}{}
|
|---|
| 65 | Check for FORMS events. Returns what \function{do_forms()} above
|
|---|
| 66 | returns, or \code{None} if there is no event that immediately needs
|
|---|
| 67 | interaction.
|
|---|
| 68 | \end{funcdesc}
|
|---|
| 69 |
|
|---|
| 70 | \begin{funcdesc}{set_event_call_back}{function}
|
|---|
| 71 | Set the event callback function.
|
|---|
| 72 | \end{funcdesc}
|
|---|
| 73 |
|
|---|
| 74 | \begin{funcdesc}{set_graphics_mode}{rgbmode, doublebuffering}
|
|---|
| 75 | Set the graphics modes.
|
|---|
| 76 | \end{funcdesc}
|
|---|
| 77 |
|
|---|
| 78 | \begin{funcdesc}{get_rgbmode}{}
|
|---|
| 79 | Return the current rgb mode. This is the value of the C global
|
|---|
| 80 | variable \cdata{fl_rgbmode}.
|
|---|
| 81 | \end{funcdesc}
|
|---|
| 82 |
|
|---|
| 83 | \begin{funcdesc}{show_message}{str1, str2, str3}
|
|---|
| 84 | Show a dialog box with a three-line message and an OK button.
|
|---|
| 85 | \end{funcdesc}
|
|---|
| 86 |
|
|---|
| 87 | \begin{funcdesc}{show_question}{str1, str2, str3}
|
|---|
| 88 | Show a dialog box with a three-line message and YES and NO buttons.
|
|---|
| 89 | It returns \code{1} if the user pressed YES, \code{0} if NO.
|
|---|
| 90 | \end{funcdesc}
|
|---|
| 91 |
|
|---|
| 92 | \begin{funcdesc}{show_choice}{str1, str2, str3, but1\optional{,
|
|---|
| 93 | but2\optional{, but3}}}
|
|---|
| 94 | Show a dialog box with a three-line message and up to three buttons.
|
|---|
| 95 | It returns the number of the button clicked by the user
|
|---|
| 96 | (\code{1}, \code{2} or \code{3}).
|
|---|
| 97 | \end{funcdesc}
|
|---|
| 98 |
|
|---|
| 99 | \begin{funcdesc}{show_input}{prompt, default}
|
|---|
| 100 | Show a dialog box with a one-line prompt message and text field in
|
|---|
| 101 | which the user can enter a string. The second argument is the default
|
|---|
| 102 | input string. It returns the string value as edited by the user.
|
|---|
| 103 | \end{funcdesc}
|
|---|
| 104 |
|
|---|
| 105 | \begin{funcdesc}{show_file_selector}{message, directory, pattern, default}
|
|---|
| 106 | Show a dialog box in which the user can select a file. It returns
|
|---|
| 107 | the absolute filename selected by the user, or \code{None} if the user
|
|---|
| 108 | presses Cancel.
|
|---|
| 109 | \end{funcdesc}
|
|---|
| 110 |
|
|---|
| 111 | \begin{funcdesc}{get_directory}{}
|
|---|
| 112 | \funcline{get_pattern}{}
|
|---|
| 113 | \funcline{get_filename}{}
|
|---|
| 114 | These functions return the directory, pattern and filename (the tail
|
|---|
| 115 | part only) selected by the user in the last
|
|---|
| 116 | \function{show_file_selector()} call.
|
|---|
| 117 | \end{funcdesc}
|
|---|
| 118 |
|
|---|
| 119 | \begin{funcdesc}{qdevice}{dev}
|
|---|
| 120 | \funcline{unqdevice}{dev}
|
|---|
| 121 | \funcline{isqueued}{dev}
|
|---|
| 122 | \funcline{qtest}{}
|
|---|
| 123 | \funcline{qread}{}
|
|---|
| 124 | %\funcline{blkqread}{?}
|
|---|
| 125 | \funcline{qreset}{}
|
|---|
| 126 | \funcline{qenter}{dev, val}
|
|---|
| 127 | \funcline{get_mouse}{}
|
|---|
| 128 | \funcline{tie}{button, valuator1, valuator2}
|
|---|
| 129 | These functions are the FORMS interfaces to the corresponding GL
|
|---|
| 130 | functions. Use these if you want to handle some GL events yourself
|
|---|
| 131 | when using \function{fl.do_events()}. When a GL event is detected that
|
|---|
| 132 | FORMS cannot handle, \function{fl.do_forms()} returns the special value
|
|---|
| 133 | \constant{FL.EVENT} and you should call \function{fl.qread()} to read
|
|---|
| 134 | the event from the queue. Don't use the equivalent GL functions!
|
|---|
| 135 | \end{funcdesc}
|
|---|
| 136 |
|
|---|
| 137 | \begin{funcdesc}{color}{}
|
|---|
| 138 | \funcline{mapcolor}{}
|
|---|
| 139 | \funcline{getmcolor}{}
|
|---|
| 140 | See the description in the FORMS documentation of
|
|---|
| 141 | \cfunction{fl_color()}, \cfunction{fl_mapcolor()} and
|
|---|
| 142 | \cfunction{fl_getmcolor()}.
|
|---|
| 143 | \end{funcdesc}
|
|---|
| 144 |
|
|---|
| 145 | \subsection{Form Objects}
|
|---|
| 146 | \label{form-objects}
|
|---|
| 147 |
|
|---|
| 148 | Form objects (returned by \function{make_form()} above) have the
|
|---|
| 149 | following methods. Each method corresponds to a C function whose
|
|---|
| 150 | name is prefixed with \samp{fl_}; and whose first argument is a form
|
|---|
| 151 | pointer; please refer to the official FORMS documentation for
|
|---|
| 152 | descriptions.
|
|---|
| 153 |
|
|---|
| 154 | All the \method{add_*()} methods return a Python object representing
|
|---|
| 155 | the FORMS object. Methods of FORMS objects are described below. Most
|
|---|
| 156 | kinds of FORMS object also have some methods specific to that kind;
|
|---|
| 157 | these methods are listed here.
|
|---|
| 158 |
|
|---|
| 159 | \begin{flushleft}
|
|---|
| 160 |
|
|---|
| 161 | \begin{methoddesc}[form]{show_form}{placement, bordertype, name}
|
|---|
| 162 | Show the form.
|
|---|
| 163 | \end{methoddesc}
|
|---|
| 164 |
|
|---|
| 165 | \begin{methoddesc}[form]{hide_form}{}
|
|---|
| 166 | Hide the form.
|
|---|
| 167 | \end{methoddesc}
|
|---|
| 168 |
|
|---|
| 169 | \begin{methoddesc}[form]{redraw_form}{}
|
|---|
| 170 | Redraw the form.
|
|---|
| 171 | \end{methoddesc}
|
|---|
| 172 |
|
|---|
| 173 | \begin{methoddesc}[form]{set_form_position}{x, y}
|
|---|
| 174 | Set the form's position.
|
|---|
| 175 | \end{methoddesc}
|
|---|
| 176 |
|
|---|
| 177 | \begin{methoddesc}[form]{freeze_form}{}
|
|---|
| 178 | Freeze the form.
|
|---|
| 179 | \end{methoddesc}
|
|---|
| 180 |
|
|---|
| 181 | \begin{methoddesc}[form]{unfreeze_form}{}
|
|---|
| 182 | Unfreeze the form.
|
|---|
| 183 | \end{methoddesc}
|
|---|
| 184 |
|
|---|
| 185 | \begin{methoddesc}[form]{activate_form}{}
|
|---|
| 186 | Activate the form.
|
|---|
| 187 | \end{methoddesc}
|
|---|
| 188 |
|
|---|
| 189 | \begin{methoddesc}[form]{deactivate_form}{}
|
|---|
| 190 | Deactivate the form.
|
|---|
| 191 | \end{methoddesc}
|
|---|
| 192 |
|
|---|
| 193 | \begin{methoddesc}[form]{bgn_group}{}
|
|---|
| 194 | Begin a new group of objects; return a group object.
|
|---|
| 195 | \end{methoddesc}
|
|---|
| 196 |
|
|---|
| 197 | \begin{methoddesc}[form]{end_group}{}
|
|---|
| 198 | End the current group of objects.
|
|---|
| 199 | \end{methoddesc}
|
|---|
| 200 |
|
|---|
| 201 | \begin{methoddesc}[form]{find_first}{}
|
|---|
| 202 | Find the first object in the form.
|
|---|
| 203 | \end{methoddesc}
|
|---|
| 204 |
|
|---|
| 205 | \begin{methoddesc}[form]{find_last}{}
|
|---|
| 206 | Find the last object in the form.
|
|---|
| 207 | \end{methoddesc}
|
|---|
|
|---|