Opens a screen as a formint sm_d_form(char *screen_address);int sm_l_form(int lib_desc, char *screen_name);int sm_r_form(char *screen_name);
- A pointer to the screen's address in memory.
- Specifies the library in which
screen_nameis stored, where
lib_descis an integer returned by sm_l_open. You must call
sm_l_openbefore you read any screens from a library.
- The name of the screen.
sm_formand its variants open a screen as a form. Because these functions do not update the form stack, use them only with your own executive. To open a form while under Panther control, use a control string or sm_jform. To display a screen as a window, use sm_r_window, or one of its variants.
sm_formdisplays the named screen as a form. In so doing, it discards the previously displayed form and its window stack and frees their memory. The screen displays with its upper left-hand corner at the display's upper left position (0,0).
If the function returns an error code of -1 or -2, the previously displayed form remains on display and available for use. Other negative return codes indicate that the display is undefined. The caller should display another form before using screen manager functions.
If the form is stored in a library, you can use
sm_l_formto display it. If the form is memory-resident, you can use
sm_r_formlooks for the form in all possible areas, including the disk.
When you use
sm_r_form, Panther looks for the named screen in the following locations in this order:
- The application's memory-resident list; if found,
sm_d_formis called to display the screen.
- All open libraries; if found,
sm_l_formis called to display the screen.
If the search fails and the supplied file name has no extension, Panther appends the SMFEXTENSION
-specified extension to the file name and repeats the search. If all searches fail,
sm_r_formdisplays an error message and returns.
You can save processing time by using
sm_d_formto display memory-resident screens. Memory-resident screens are useful in applications with a limited number of screens, and in environments with a slow disk. A memory-resident screen never changes at runtime, so it can be made sharable on systems that support sharing read-only data.
sm_r_formcan also display memory-resident screens if they are properly installed with sm_formlist. To create memory-resident screens, use bin2c to convert editable screens from disk files to program data structures that you can compile into your application.
You can also save processing time with
sm_l_formto display screens from a library. A library is a single file that stores screens, JPL modules, and menus. You can assemble a library from individual screen files with formlib. Libraries let you distribute a large number of screens with an application, and can improve efficiency by reducing the number of search paths.
/* If an abort condition exists, read in a special
* form to handle that condition, discarding all
* open windows. */
extern jmp_buf re_init;
if (sm_isabort(ABT_OFF) > 0)
if (sm_message_box("Do you want to continue?", 0,
SM_MB_YESNO, 0) == SM_IDYES)
sm_r_window, sm_r_at_cur, sm_formlist