![]() | ![]() | Programming Guide |
Closes the current window
int sm_close_window( void );
- 0 Success.
sm_close_windowcloses a screen opened as a window bysm_r_window,sm_r_at_cur, or one of their variants.
sm_close_windowerases the currently open window and restores the screen to its state before the window opened. If LDB processing is active,sm_lstorewrites data from the named fields to the LDB; otherwise, all window data is lost. If the closed window was spawned by another one, Panther makes the parent window the current one and restores the cursor to its last position in that window.Panther automatically calls
sm_close_windowwhen you close a form withsm_jclose.sm_jclosecallssm_jformto pop the form stack and callssm_close_windowto empty the form's window stack.Note:
sm_close_windowdoes not close the base screen in a window stack—that is, the active form. To close the active form, callsm_jclose.
#include <smdefs.h>
#include <smkeys.h>
/* In a validation function, if the field contains a */
/* special value, open up a window to prompt for a */
/* second value and save it in another field. */
int validate (field, data, occur, bits)
char *data;
int field, occur, bits;
{
char buf[256];
if (bits & VALIDED)
return 0;
if (strcmp(data, "other") == 0)
{
sm_r_at_cur ("getsecval");
if (sm_input (IN_DATA) != EXIT)
sm_getfield (buf, 1);
else
buf[0] = 0;
sm_close_window ();
sm_n_putfield ("secval", buf);
}
return 0;
}