home *** CD-ROM | disk | FTP | other *** search
- #include "Wimp.h"
- #include "WimpSWIs.h"
-
- #include <stdio.h>
- #include "string.h"
-
-
- extern void Icon_SetInteger(window_handle w, icon_handle i, int value)
- /*
- * Sets the given icon's text to hold the number in "value". (and redraws icon)
- * If unable to set the text (incorrect icon type), it returns quietly
- */
- {
- icon_block istate;
- char temp[16];
-
- Wimp_GetIconState(w, i, &istate);
- if (istate.flags.value & (icon_TEXT | icon_INDIRECTED))
- {
- /* Indirected text icon, so set text field - ensure no buffer overflow */
- sprintf(temp, "%d", value);
- strncpy(istate.data.indirecttext.buffer, temp,
- istate.data.indirecttext.bufflen - 1);
- istate.data.indirecttext.buffer[istate.data.indirecttext.bufflen-1] = 0;
-
- Wimp_SetIconState(w, i, 0, 0);
- }
- }
-