home *** CD-ROM | disk | FTP | other *** search
/ Acorn User 4 / AUCD4.iso / acorn / riscos / releases / oslib / examples / Examples / p3-023 < prev    next >
Text File  |  1994-03-24  |  709b  |  31 lines

  1. #include <string.h>
  2.  
  3. #include "os.h"
  4. #include "wimp.h"
  5.  
  6. os_error *write_icon (wimp_w w, wimp_i i, char *buffer, char *string)
  7.  
  8. {  os_error *error = NULL;
  9.    wimp_caret caret;
  10.  
  11.    strcpy (buffer, string);
  12.       /*assume that these are 0-terminated, rather than 13 as in BASIC*/
  13.  
  14.    if ((error = xwimp_get_caret_position (&caret)) != NULL)
  15.       goto finish;
  16.  
  17.    if (w == caret.w && i == caret.i)
  18.    {  int len = strlen (buffer);
  19.  
  20.       if ((error = xwimp_set_caret_position (caret.w, caret.i,
  21.             caret.pos.x, caret.pos.y, -1, MIN (caret.index, len))) != NULL)
  22.          goto finish;
  23.    }
  24.  
  25.    if ((error = xwimp_set_icon_state (w, i, NONE, NONE)) != NULL)
  26.       goto finish;
  27.  
  28. finish:
  29.    return error;
  30. }
  31.