![]() | ![]() | Programming Guide |
Opens a window at a given position
int sm_d_window(char *address, int start_line, int start_column);int sm_d_at_cur(char *address);int sm_l_window(int lib_desc, char *name, int start_line, int start_column);int sm_l_at_cur(int lib_desc, char *name);int sm_r_window(char *name, int start_line, int start_column);int sm_r_at_cur(char *name);
address- The address of the screen in memory
lib_desc- Specifies the library in which the window is stored, where
lib_descis an integer library descriptor returned bysm_l_open. You must callsm_l_openbefore you read any screens from a library.name- The name of the window.
start_line, start_column- Specifies the window's top left corner, where
start_lineandstart_columnare zero-based offsets from the physical display's top left corner. Thus, settingstart_lineto 1 starts the window at the screen's second line. If the window does not fit on the display at the specified location, Panther adjusts it as needed.A negative value for
start_linespecifies to clear the current screen before displaying the window. The screen's contents are discarded and cannot be restored.
C only
Use
sm_d_window,sm_l_window, orsm_r_windowto display a screen as a stacked window at the specified line and column. Usesm_d_at_cur,sm_l_at_cur, orsm_r_at_curto display the window at the default position for that platform:
- On GUI platforms such as Windows, the window is positioned relative to the GUI display. For example, in Windows 95, the screen is positioned in the middle of the display; on Motif, it is positioned relative to the base window's status line.
The area of the display that surrounds the window remains visible. However, only the opened window is active, and only its fields are accessible to input and library functions. To change the active window, use
sm_wselect.To display a form use
sm_r_formor one of its variants. Usesm_close_windowto close the window.
When you use
sm_r_window, Panther looks for the named screen in the following places in this order:
- The application's memory-resident list; if found,
sm_d_windowis called to display the screen.- All open libraries; if found,
sm_l_windowis 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_windowdisplays an error message and returns.
You can save processing time by using
sm_d_windowandsm_d_at_curto display screens that are memory-resident. Usebin2cto convert screens from disk files to program data structures that you can compile into your application.A memory-resident screen never changes at runtime and therefore can be made sharable on systems let you share read-only data.
sm_r_windowandsm_r_at_curcan also display memory-resident screens if they are properly installed withsm_formlist. Memory-resident screens are especially useful in applications with a limited number of screens, or in environments with a slow disk.
You can also save processing time with
sm_l_windowandsm_l_at_curto 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 withformlib. Libraries let you distribute a large number of screens with an application, and can improve efficiency by reducing the number of search paths.
/* Bring up a window from a library. */
int ld;
if ((ld = sm_l_open ("myforms")) < 0)
sm_cancel ();
...
sm_l_window (ld, "popup", 5, 22);
...
sm_l_close (ld);
sm_close_window, sm_form
,sm_jwindow
![]()
![]()
![]()
![]()