[comp.windows.x] Problems with Athena Text widget

po@cs.utexas.edu (Po Ling Cheung) (11/09/88)

How do you modify the translation table of an asciiString text widget to
disable most of the editing facilites provided by defaultTranslations[]
so that the user can insert and delete characters only from the end of
the current line?  Yet the user should be able to do text selection.

My major problems are to prevent deleting text past current line, and
to disable insertion/deletion at any arbitrary position.

Another question :  Is there any way you can associate some kind of
file input with the text widget so that you can read whatever is entered
into the text widget just like reading from a terminal?

Would someone give me a hint, please ???

Thanx,
  Po

kit@athena.mit.edu (Chris D. Peterson) (11/10/88)

It sounds like what you really want is an "asciiTerminal" widget that acts
like a tty terminal.  We have talked about implementing this, but never
seem to find the time, If anyone out there wants to code it, and give it
to us this would speed up the process.  Perhaps something like this will
appear in the Athena widget set, but I wouldn't count on it being soon.

As far as emulating this behavior in the Athena text widget, I don't think
it is possible to get exactly the behavior that you want.  Although putting
the widget in append-only mode may help.

						Chris D. Peterson     
						Project Athena     
						Systems Development

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

po@cs.utexas.edu (Po Ling Cheung) (11/11/88)

In article <7876@bloom-beacon.MIT.EDU> kit@athena.mit.edu (Chris D. Peterson) 
writes:
>...
>As far as emulating this behavior in the Athena text widget, I don't think
>it is possible to get exactly the behavior that you want.  Although putting
>the widget in append-only mode may help.

Sorry, but you won't be able to delete anything in append-only mode.

The following modification to defaultTranslations[] would allow insertion
and deletion only at the very end of text:

        <Key>Delete:    my-delete() delete-previous-character() \n\
        <Key>Return:    end-of-file() end-of-line() newline()\n\
        <Key>:          end-of-file() end-of-line() insert-char()\n\
        <Btn2Down>:     end-of-file() end-of-line() \
                        insert-selection(PRIMARY, CUT_BUFFER0)\n\

my-delete() repositions the caret to the end of text, 
and checks the last character in the text string; if it is
not to be deleted, my-delete() inserts a blank, so that the next
deletion will not delete the last character we want.

BTW, I think it is easier to emulate an "asciiTerminal" widget with
the HP TextEdit widget using motionVerify and modifyVerify. 
Until HP can come up with a set of widgets that run on R3, I would
have to stick to the Athena widgets.

Does anynoe have more comments on how the two widget sets, Athena and HP, 
compare with each other?


Thanks Chris,
Also thanks to Miles O'Neal for his comments.

  Po