text_edit_dialog_c
status.i4.v = text_edit_dialog_c(title.i1a.r, top_row.i4.v,
left_column.i4.v, text.i1a.r,
num_rows.i4.v, num_columns.i4.v,
num_lines.i4.v, num_chars.i4.v,
edit_existing.i4.v,
reformat_text.s.r, help_info.s.r,
user_key_func.f.v, user_key_data.g.v,
language_func.f.v, options.u4.v)
This routine will create a window for editing a block of text.
It can be used to edit an existing block of text, or it can be
initialized completely blank to create a new block of text.
If existing text is to be edited, it can be reformatted by this
routine to conform to the requested row and column format.
title window title (A value of NULL may be passed for
this argument if no title is desired.)
top_row top row of window (use WMNGR_CENTER for centering
or WINDOW_xxx_COORD macros in macro for special
positioning)
left_column left column of window (use WMNGR_CENTER for centering
or WINDOW_xxx_COORD macros in macro for special
positioning)
text returned text
num_rows number of rows of text
num_columns number of characters per row
num_lines number of lines of input to be displayed at a
time (If a value of zero is passed for this
argument, the number of rows will be used.)
num_chars number of characters of input to be displayed at a
time (This argument is presently ignored.)
edit_existing edit type flag
(TRUE -> display the passed text and edit it,
FALSE -> start with an empty window)
reformat_text text reformatting information
(structure of type WINDOW_TEXT_FORMAT)
(If a value of NULL is passed, the text will
be left in its present format. If the previous
format information is passed in this structure,
end of line spaces will be stripped before
reformatting the text to the present window.)
help_info help callback information
(structure of type HELP_CALLBACK_DATA)
(default is NULL)
user_key_func function to be executed upon each key press
(function called as follows:
done.i4.v = user_key_func(wid.i2.v, key_data.s.r,
user_key_data.g.v,
edit_data.s.r,
edit_made.i4.v)
("key_data" is a structure of type TEXT_CURSOR_DATA)
("edit_data" is a structure of type CNS_EDIT_DATA)
(Valid return values include: CNS_EDIT_CONTINUE,
CNS_EDIT_DONT_PROCESS, CNS_EDIT_POST_PROCESS, and
CNS_EDIT_ADD_LINE.))
(default is NULL)
user_key_data data to be passed to "user_key_func" (default is NULL)
language_func function to be executed upon a language sensitive
help command (ctrl e)
(function called as follows:
language_func(wid.i2.v, row.i4.v, column.i4.v,
text_color.i4.v))
(A value of NULL can be passed for this argument.)
options edit options
(EDIT_OPT_NONE -> no options selected)
This function returns status values as follows:
TRUE text was successfully modified
FALSE text was not changed
CBS_INVARG invalid number of rows or columns passed
CBS_WINDOW_TOO_BIG window won't fit on the screen
CBS_MEMFAIL dynamic memory allocation failure
CBS_ABORT user aborted input (no text changed)
This function requires the following include files:
cnsparam_h, cns_data_structs_h, cbslib_h, macro_h, acnet_errors_h
Related functions:
text_edit_window_c, cns_edit, window_edit_c, inptxt(_c),
input_string_dialog_c, winput(_c), window_input_value(_c),
dialog_setup_c, window_restore_hint_c
C/C++ usage:
static char title[] = "Title";
char text[NUM_ROWS*NUM_COLUMNS];
int status;
int top_row = WMNGR_CENTER;
int left_column = WMNGR_CENTER;
int num_rows = NUM_ROWS;
int num_columns = NUM_COLUMNS;
int num_lines = NUM_ROWS;
int num_chars = NUM_COLUMNS;
int edit_existing = TRUE;
unsigned int options = EDIT_OPT_NONE;
WINDOW_TEXT_FORMAT *reformat_text = (WINDOW_TEXT_FORMAT *) NULL;
HELP_CALLBACK_DATA *help_info = (HELP_CALLBACK_DATA *) NULL;
int user_key_func(short window_id, TEXT_CURSOR_DATA *key_data,
void *user_key_data);
void *user_key_data = (void *) NULL;
void language_func(short window_id, int row, int column,
int text_color);
status = text_edit_dialog_c(title,top_row,left_column,text,
num_rows,num_columns,num_lines,
num_chars,edit_existing,reformat_text,
help_info,user_key_func,user_key_data,
language_func,options);