[comp.windows.x] How to access the text in Text widget

paul@tredysvr.Tredydev.Unisys.COM (Paul Siu) (10/17/90)

I am a little unclear about text widget in Motif.  I am trying to figure out
how to access the text widget's text.  I need to access the text because another
program must access it using share memory.  I have look through Dennis Young's
book, and I have look through the Motif reference Guide.  The reference Guide
mentioned that one can access the source text through a resource XmNsource.  I
am not clear on how this can be done.  I only have the motif docs so far, but
nothing I can work with, so I can test or verify anything.  Could someone on
the net answer the following questions.

1. If the source text is in resource, wouldn't it be in a resource file?
   Wouldn't this be a bit slow accessing the drive all the time?  I am still not
   to clear about resource.

2. The reference mentioned that the XmNsource's type is XmTextSource, can
   someone tell me what the structure looks like or where I can look it up?

3. Has anyone play around with sharing the text in a widget with another
   program?  What is your experience.

Thanks.

Paul Siu
paul@tredysvr.Tredydev.Unisys.COM

nazgul@alphalpha.com (Kee Hinckley) (10/18/90)

In article <957@tredysvr.Tredydev.Unisys.COM> paul@tredysvr.Tredydev.Unisys.COM (Paul Siu) writes:
>I am a little unclear about text widget in Motif.  I am trying to figure out
>how to access the text widget's text.  I need to access the text because another
>program must access it using share memory.  I have look through Dennis Young's
You can get it using XtGetValues (XmNvalue). 

>book, and I have look through the Motif reference Guide.  The reference Guide
>mentioned that one can access the source text through a resource XmNsource.  I
I'm not sure this was all documented at 1.0, although it seems to be at 1.1.
This allows two text widgets to share the same underlying data.  You'd have
to read the 1.1 manuals for more detail.

>1. If the source text is in resource, wouldn't it be in a resource file?
>   Wouldn't this be a bit slow accessing the drive all the time?  I am still not
>   to clear about resource.
Get a book on the Intrinsics.  Resources are attributes of a widget, they can
be (but not necessarily are) set from files.  But I'm oversimplifying - you'll
want to read up on the Intrinsics to fully understand it.

>2. The reference mentioned that the XmNsource's type is XmTextSource, can
>   someone tell me what the structure looks like or where I can look it up?
The type is opaque.  There are calls to get and set it.  Thus you can get it
from one text widget and set it in another, but you can't fiddle with it
yourself.

>3. Has anyone play around with sharing the text in a widget with another
>   program?  What is your experience.
No.  But does it *really* have to be another program?  Another window would
be a lot easier.  I don't think that TextSource's are going to help you
with sharing text data between two programs, nor will the XmNvalue item.
I think you'll have to set up a protocol so that when it's changed in
one place you notify the other.

							-kee
-- 
Alphalpha Software, Inc.	|	motif-request@alphalpha.com
nazgul@alphalpha.com		|-----------------------------------
617/646-7703 (voice/fax)	|	Proline BBS: 617/641-3722

I'm not sure which upsets me more; that people are so unwilling to accept
responsibility for their own actions, or that they are so eager to regulate
everyone else's.