Writes text into a word wrapped text widgetint sm_ww_write(int field_number, char *buffer, int offset);int sm_n_ww_write(char *field_name, char *buffer, int offset);
- Specifies the field to receive the contents of
buffer. The field must be a multiline text widget whose
word_wrapproperty is set to
- A pointer to a null-terminated buffer that contains the text to write.
- The offset into the word wrap field at which to start writing. Supply a value of 0 to start writing at the beginning of the field. If supplied value is greater than the field's total length, Panther recalculates the value of
offsetto the field's length + 1; the contents of
bufferare thereby appended to the end of the field.
buffertext into the specified word wrap field—that is, a multiline text widget whose Word Wrap property is set to Yes.
sm_ww_writewraps at the end of words and leaves a space at the end of each line. If a word is equal to or longer than the length of the field,
sm_ww_writebreaks the word one character before the end of the field, appends a space, and wraps the rest of the word on the next line.
If you try to copy data that is too large for the field to hold,
sm_ww_writetruncates the excess text. If the field's original contents exceeds the amount of text in
buffer, the leftover text remains in the field. To avoid this, first clear the field with sm_clear_array or one of its variants before calling
/* this procedure reads text from a filestream and
* reads each line into a word wrapped field. It uses
* sm_ww_write to reformat the file text so that it
* wraps within the field.
vars str, last_char, wwErr, err, fileStream
/* get file stream sent from previous dialog */
receive DATA fileStream
err = 0
while (err == 0)
str = sm_fio_gets(fileStream, 255)
/* check for error condition like EOF */
if (str != "")
last_char = sm_n_ww_length("comments")
/* if writing to empty array */
if (last_char = 0)
wwErr = sm_n_ww_write("comments", str, last_char)
/* otherwise add space after last char before write*/
wwErr = sm_n_ww_write("comments", " ", last_char)
wwErr = sm_n_ww_write("comments", str, last_char + 1)
err = sm_fio_error()
sm_clear_array, sm_ww_length, sm_ww_read