Programming Guide



sm_jform

Displays a screen as a form

int sm_jform(char *screen_name);

screen_name
The screen to open as a form. This character string uses the same format as a Panther control string that displays a form. This argument can optionally specify the form's position on the physical display, the size of the viewport, and which portion of the form to position in the viewport's top-left corner. For information on control string options, refer to Chapter 18, "Programming Control Strings," in Application Development Guide.

Returns

Description

sm_jform displays the specified screen as a form under Panther control. If you are using your own executive, call sm_r_form or one of its variants to display a form. To display a window under Panther control, use sm_jwindow.

When sm_jform opens a screen as a form, Panther discards the previously displayed form and windows and frees their memory. Panther places the new form on top of the Panther form stack. You can use sm_jclose to close the form, or let Panther handle it—for example, when the user presses the EXIT key.

Because sm_jform calls sm_r_form, refer to sm_r_form for information on other details, such as how Panther finds the screen to display.

The following statement displays myScreen's first row and column at row 0, column 0 of the physical display:

status = sm_jform("myScreen");

The next statement displays the screen at row 20, column 10 of the display:

status = sm_jform("(20,10)myScreen");

This statement display the screen at row 20, column 10 of the physical display in viewport that is 15 rows by 8 columns:

status = sm_jform("(20,10,15,8)myScreen");

A screen can be larger than its viewport. If the viewport does not fit on the physical display where indicated, Panther tries to place it entirely on the display at a different location. If you specify a viewport that is larger than the physical display, the viewport is the size of the physical display. To change the viewport size after the screen is displayed, set the applicable viewport properties.

Example

#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(NULL, "Please reenter login");
}
else
sm_jwindow("login3");
return (0);
}

See Also

sm_r_form, sm_jwindow