X-Git-Url: https://jxself.org/git/?p=super-star-trek.git;a=blobdiff_plain;f=src%2Fxio.c;h=6d604909d1fe150a5444b97c0c950f01d405040d;hp=ea35fb1b9ee266cc2ad7599cbc25d4af5caf986e;hb=e3730bb826efe601fe51626aab064d395733d4c3;hpb=438dc2b2531dd705e44dffc5df9e9bf8a3f4ab85 diff --git a/src/xio.c b/src/xio.c index ea35fb1..6d60490 100644 --- a/src/xio.c +++ b/src/xio.c @@ -56,10 +56,25 @@ static void quit_proc(Widget w, XtPointer client_data, XtPointer call_data) exit (0); } +static void text_append_to(Widget w, String str) +/* append text to a specified text widget */ +{ + XawTextBlock txtblk; + XawTextPosition textend = XawTextGetInsertionPoint(w); + + txtblk.ptr = str; + txtblk.length = strlen(str); + txtblk.firstPos = 0; + txtblk.format = FMT8BIT; + + XawTextReplace(w, textend, textend, &txtblk); +} + static void noargs_proc(Widget w, XtPointer client_data, XtPointer call_data) /* use this for commands that take no arguments */ { /* currently a stub */ + text_append_to(w, XtName(w)); printf("Button %s pressed\n", XtName(w)); }