Programming Guide



sm_jclose

Closes the current window or form

int sm_jclose(void);

Returns

Description

sm_jclose closes the active screen and restores the display to its state before the screen opened. When called for a form, sm_jclose pops the form stack and calls sm_jform to display the screen on the top of the form stack. When called for a window, sm_jclose calls sm_close_window. Panther redisplays the previous window on the window stack and puts the cursor at its last-displayed position.

Example

#include <smdefs.h>

/* This is an example of a control function attached to
* the XMIT key. It validates login and password
* information. If the login and password are
* incorrect, the program proceeds to close three of
* the four "security" windows used for getting a
* user's login and password information, and the
* user may again attempt to enter the information.
* If the password passes, the welcome screen is
* displayed, and the user may proceed.
*/

int complete_login(jptr);
char *jptr;
{
char pass[10];
sm_n_getfield(pass, "password");
/*call routine to validate password*/
if(!check_password(pass))
{
/*close current password window*/
sm_jclose();
/*close 3rd underlying login window*/
sm_jclose();
/*close 2nd underlying login window*/
sm_jclose();
/*in bottom window*/
sm_femsg(0, "Please reenter login and password");
}
else
{
sm_d_msg_line("Welcome to Security Systems, Inc.");
/*open welcome screen*/
sm_jform("Welcome");
}
return (0);
}

See Also

sm_close_window, sm_jform, sm_jwindow