[comp.windows.x] 3 Q's about Toolkit Keyboard Translations

dave@romano.cs.wisc.edu (Dave Cohrs) (07/23/89)

These aren't all specific to the Text widget, that's just where I was
playing with them.  These are general Translation manager questions.

Question 1:

Yesterday I decided I wanted to make the Text widget more like emacs
in the way it understood characters.  Well, I wasn't too ambitous
so I decided I'd just do things I could redefine using

*Text.Translations: #override

and came across a few anomolies.  From reading the Toolkit section
on translations, I added the following to my resources:

*Text.Translations: #override \
	Ctrl<Key>X,<Key>u: unkill()\n\
	Ctrl<Key>X,<Key>i: insert-file()

(yes, I know this allows ^X ^U to work too, but I don't care for this
example)  and WOW! when I typed ^X u, it unkilled the text I had just
killed.

This had a really strange side-effect.  I could no longer type
"u"s or "i"s (shifted, controled, whatever).  From my understanding of
"#override", my new translations should have been prepended to the
translation list (basically), which means that entering a "u" or an
"i" that isn't preceeded by a ^X should have been handled by the
standard
	<Key>: insert-char

translation that's part of the Text widget.  Nope.  It no longer
worked for these two keys.

Here's the question...

Why isn't the "^X u" and "u" case covered by the "more specific before
less specific" rule of translations?

BTW -- I was able to make this work by saying the following instead:

*Text.Translations: #override \
	Ctrl<Key>X,<Key>u: unkill()\n\
	Ctrl<Key>X,<Key>i: insert-file()\n\
	<Key>i: insert-char() \n\
	<Key>u: insert-char()


Questions 2:

This is Text widget specific.  I wanted to define CTRL(SPACE) to set a
mark, and CTRL(W) to cut the text between mark and dot.  Nope.  No can
do.  The select-*() and extend-*() functions look at the position of the
*MOUSE*, even if the event that caused these functions to be executed
was a *KEYBOARD* event.  Nowhere in the Text widget doc does it say
these functions have to be executed from the mouse.  Dumb dumb dumb!

Why do select-*() not care about the type of event that caused them?


Question 3:

On a lark, I thought I'd play around with double clicking too.  I
was able to re-assign double clicked mouse buttons just fine, but
am not able, no matter what I try, to define a double pressed key.
The translation section in the Toolkit document doesn't say you
can only double press mouse buttons.  I tried assigning a double
pressed Function-key 2 to perform some function (let's call it
"translation") with:

    <Key>(2)F2: translation()

and the translation was ignored.  When I did:
    <Key>F2(2): translation()

I got a syntax error, so the former appears to be the right way to say
what I want.  How do you do a *real* double pressed key?  The
translation (which does work)

    <Key>F2,<Key>F2: translation()

Does not have the same semantics as:

    <Btn1Down>(2): translation()

does for mouse presses.

thanks for any info,

dave cohrs
--
Dave Cohrs
+1 608 262-6617                        UW-Madison Computer Sciences Department
dave@cs.wisc.edu                       ...!{harvard,rutgers,ucbvax}!uwvax!dave