Article View: comp.sys.sgi.graphics
Article #107motif text widgets
From: LANGER STEVEN C
Date: Wed, 13 Jan 1993 04:09
Date: Wed, 13 Jan 1993 04:09
66 lines
2478 bytes
2478 bytes
Hi folks;
Another question, this time on text widgets. I have a dialog with
several one line text widgets attached to it. To the right of each
text widget is a button. When the button is pressed, I want new text to show
up in the assocaited text widget.
________________________________________________
|
| text1 b1
|
| text2 b2
|
|
the code fragment is
{
dialog = XmCreateDialogShell (toplevel, ...
form = XmCreateForm (dialog, ...
text1 = XmCreateTextWidget (form, attach upper left
b1 = XmCreatePushButton (form, attach to right of text widget
XtAddCallback (b1, XmNactivateCallback, cbfunc, "b1");
XtManageChild (form);
XtManageChild (dialog);
}
void cbfunc (Widget w, XtPointer data, XtPointer dummy)
{
char *text;
char str[]="here i am";
if (strcasecmp(data, "b1") == 0)
{
temp = XtMalloc (sizeof(str));
temp[sizeof(str)] = 0 ; /* null terminator */
XmTextSetString (w, text);
XtFree (text);
}
}
This is my adaptation of Heller's example 15-2 file browser.c
program. The cbfunc is based on read_file.
The dialog is created and the default text is drawn, but when the b1
is pressed, I get a core dump and dbx zeros in on the
XmTextSetString call.
Any ideas on how to beat this?
--thanks in advance, steve
--
Steve Langer sglanger@argo.acs.oakland.edu (VMS)
Oakland University sglanger@vela.acs.oakland.edu (Ultrix)
---------------------------------------------------------------------------
Standard disclaimers apply. In addition, the author makes no guarantees,
concerning the grammatical accuracy of his writing. Therefore, any ^B's, ^C's,
midword character additions/deletions and other non-sense which occurs (after
the work leaves the author's decade old text editor via his decade old Amiga,
struggles through a local 1200 baud Merit server to be further mauled via the
remote VAX mail servers) is someone elses problem - namely yours.
---------------------------------------------------------------------------
Technical Details
Message-ID:
<1993Jan13.040941.4854@vela.acs.oakland.edu>Path:
arc1-ca.pugleaf.net!sparky!uunet!zaphod.mps.ohio-state.edu!magnus.acs.ohio-state.edu!usenet.ins.cwru.edu!agate!dog.ee.lbl.gov!news!vela!sglangerShow Full Headers
Complete Article Headers
Newsgroups: comp.sys.sgi.graphics Path: arc1-ca.pugleaf.net!sparky!uunet!zaphod.mps.ohio-state.edu!magnus.acs.ohio-state.edu!usenet.ins.cwru.edu!agate!dog.ee.lbl.gov!news!vela!sglanger From: sglanger@vela.acs.oakland.edu (LANGER STEVEN C) Subject: motif text widgets Message-ID: <1993Jan13.040941.4854@vela.acs.oakland.edu> Organization: Oakland University, Rochester MI. Distribution: na Date: Wed, 13 Jan 1993 04:09:41 GMT Lines: 66