Programming Guide |
Displays a window at a given position
int sm_jwindow(char *screen_name);
screen_name
- The screen to open as a window.
screen_name
uses the same format as a Panther control string that invokes a screen as a stacked or sibling window. Use a single ampersand (&
) to specify a stacked window and a double ampersand (&&
) to specify a sibling window. If no ampersand is included, the screen opens as a stacked window. The string can also specify viewport parameters.For information on control string options, refer to Chapter 18, "Programming Control Strings," in Application Development Guide.
sm_jwindow
displays a screen as a window by calling sm_r_window. You can also callsm_r_window
or one of its variants directly. Refer tosm_r_window
for information on how Panther finds the screen to display.To display a screen as a form, use sm_jform. To close the window programmatically, call sm_jclose or sm_close_window.
#include <smdefs.h>
/* This could be a control function attached to the
* XMIT key. Here we have completed entering data
* on the second of several security screens. If
* the user entered "bypass" into the login, he
* bypasses the other security screens, and the
* "welcome" screen is displayed. If the user
* login is incorrect, the current window is
* closed, and the user is back at the initial
* screen (below). Otherwise, the next security
* window is displayed. */int getlogin(jptr)
char *jptr;
{
char password[10];
sm_n_getfield(password, "password");
/* check if "bypass" has been entered into
* login */
if (strcmp(password, "bypass"))
sm_jform("welcome");
/* check if login is valid */
else if (check_password(password))
{
/*close current (2nd) login window */
sm_jclose();
sm_femsg(0, "Please reenter login");
}
else
sm_jwindow("login3");
return (0);
}
sm_jclose, sm_jform, sm_window