[comp.windows.x] Problem using Text Widget

km@emory.uucp (Ken Mandelberg) (01/19/89)

In proposing a fix to the xgdb warning message:

     "X Toolkit Warning: No type converter registered 
                for 'String' to 'EditMode' conversion"

Ken Marks (gatech!mcdchg!richsun!ken) notes that the error
comes from the sequence:

    XtSetArg (fileArgs[0], XtNfile, filename);
    src = XtDiskSourceCreate(parent, fileArgs, 1);

Which preceeds the creation of the Text Widget in the
original code :

    XtSetArg (fileArgs[0], XtNtextOptions, scrollVertical);
    XtSetArg (fileArgs[1], XtNtextSource, src);
    XtSetArg (fileArgs[2], XtNtextSink, sink);
   return XtCreateManagedWidget("disk", textWidgetClass, parent, fileArgs, XtNumber (fileArgs));


His solution was to move the XtCreatedManagedWidget up ahead of
the XtDiskSourceCreate and call it without supplying a src or sink.
The src and sink are later passed to the previously created
text_widget with XtSetValues.

While this solution works for him, and it does not work for
me. When I run it on a Sun 3, I get a segment violation in the
XtSetValues.

The Athena Widget documentation says that the src and sink need
to be supplied at creation time of the Text Widget, which perhaps
is the reason it fails for me. It does not explain why it works
for him.


There are no examples of using XtDiskSourceCreate in the
core distribution. What is the correct order in using 
XtDiskSourceCreate and XtCreateManagedWidget, and how do you 
avoid the type converter warning if DiskSource is first?
-- 
Ken Mandelberg      | km@mathcs.emory.edu          PREFERRED
Emory University    | {decvax,gatech}!emory!km     UUCP 
Dept of Math and CS | km@emory.bitnet              NON-DOMAIN BITNET  
Atlanta, GA 30322   | Phone: (404) 727-7963

swick@ATHENA.MIT.EDU (Ralph R. Swick) (01/20/89)

>The Athena Widget documentation says that the src and sink need
>to be supplied at creation time of the Text Widget,

It's just possible that the documentation lies.  You should be able
to create a Text widget without a source and/or sink as long as
you provide both before the widget is realized.  If you provide them
via XtSetValues, you'll have to provide both source and sink in
the same call (i.e. SetValues will fail if either source or sink
is missing).