[comp.windows.x] More text widget questions

jlf@earth.cray.COM (John Freeman) (12/23/88)

In all of these, I am using an AsciiDiskWidget to display a file.

Question 1: I would like to select a line with the mouse, 
and figure out what line number that is in the file.  How?

Question 2:  Related to number 1, given a line number in the
file, how do I display that part of the file, ie. linenumber -n 
to linenumber +n?

Question 3: How do I change the source file name?  I want to
display a different file without exiting.  I don't want to 
change (edit) the current file, I want to display a different file.

kit@ATHENA.MIT.EDU (Chris D. Peterson) (12/24/88)

> Question 1: I would like to select a line with the mouse, 
> and figure out what line number that is in the file.  How?

> Question 2:  Related to number 1, given a line number in the
> file, how do I display that part of the file, ie. linenumber -n 
> to linenumber +n?

> Question 3: How do I change the source file name?  I want to
> display a different file without exiting.  I don't want to 
> change (edit) the current file, I want to display a different file.

I shudder to suggest this since the code for xmh is so ugly, but...
xmh does all of these things, perhaps you should take a look at it,
it is on the X tape - clients/xmh.

						Chris D. Peterson     
						MIT X Consortium /
						Project Athena 

Net:	kit@athena.mit.edu		
Phone: (617) 253 - 1326			
USMail: MIT - Room E40-342C		
	77 Massachusetts Ave.		
	Cambridge, MA 02139		

swick@ATHENA.MIT.EDU (Ralph R. Swick) (12/28/88)

     Date:  Thu, 22 Dec 88 17:59:57 CST
     From:  jlf@earth.cray.com (John Freeman)

     In all of these, I am using an AsciiDiskWidget to display a file.

     Question 1: I would like to select a line with the mouse, 
     and figure out what line number that is in the file.  How?

Not supported by Xaw yet.  The basic machinery is in place, however.
XtTextGetInsertionPoint or XtGetValues on XtNinsertPosition will tell
you the character position of the caret, but not the line number.

     Question 2:  Related to number 1, given a line number in the
     file, how do I display that part of the file, ie. linenumber -n 
     to linenumber +n?

Again, not supported by Xaw.  Character positions, yes
(via XtSetValues on XtNdisplayPosition), but not line numbers.

     Question 3: How do I change the source file name?  I want to
     display a different file without exiting.  I don't want to 
     change (edit) the current file, I want to display a different file.

XtDiskSourceCreate followed by XtTextSetSource.  The "proper" way
to accomplish this (XtSetValues on XtNfile) doesn't yet work.

coltoff@PRC.Unisys.COM (Joel Coltoff) (01/25/89)

I'm continuing with my port from R2 to R3 and ran into more text
widget problems.

	XtTextUnsetSelection() does not unhighlight the text.
The widget knows that there is nothing selected and indicates
that by what XtTextGetSelectionPos() gives me but the text
stays in reverse video. Has anyone else had this problem?

	What is the purpose of XtTextSetLastPos()? If I am adding
three lines to the widget do I need to call it after each one?
Does it get called when I'm done adding all three lines? Is there
a way to retreive this value if I need it later?

	XtTextInvalidate() dumps core. Has anyone else noticed this?

Thanks in advance.
-- 
	- Joel
		{psuvax1,sdcrdcf}!burdvax!coltoff	(UUCP)
		coltoff@burdvax.prc.unisys.com		(ARPA)

geek@mit-amt (Chris Schmandt) (01/25/89)

In article <9034@burdvax.PRC.Unisys.COM> coltoff@PRC.Unisys.COM (Joel Coltoff) writes:
>I'm continuing with my port from R2 to R3 and ran into more text
>widget problems.
>
>	XtTextUnsetSelection() does not unhighlight the text.

A bug which I believe is known.
(right Ralph?)

chris