[comp.windows.x.motif] Translations, problem with.

bni@modulex.dk (Bent Nielsen) (02/13/91)

Hi netlanders,

Can anyone help me with a translation problem.

I am running X11R4 patchlevel 18 and Motif 1.1 on DECstation 2100
and 3100.

I want the following actions on a widget:

1) when button 1 is pressed
2) when button 1 is pressed and moved
3) when button 1 is released
4) when button 1 is pressed two or more time (double click)
5) when button 1 is released two or more time (double click)
6) and all motions

Actions 1, 2, 3 and 6 is working when I use the following translation:

static char defaultTranslations[] =
	"\043override\n\
	<Btn1Down>:	ButtonDown()\n\
	<Btn1Motion>:	ButtonMotion()\n\
	<Btn1Up>:	ButtonUp()\n\
	<Motion>:	ButtonMotionAll()\n\
	";

but when I use the translation shown below only action 1, 4 and 5 is working
correctly.

Unless I press button 1 outside the widget and then release it inside,
action 3 and 6 isn't working. (I will get action 3 when releasing and
action 6 is then working).

Action 2 will never work.

static char defaultTranslations[] =
	"\043override\n\
	<Btn1Down>:	ButtonDown()\n\
	<Btn1Motion>:	ButtonMotion()\n\
	<Btn1Up>:	ButtonUp()\n\
	<Btn1Down>(2+):	ButtonDoubleClickDown()\n\
	<Btn1Up>(2+):	ButtonDoubleClickUp()\n\
	<Motion>:	ButtonMotionAll()\n\
	";

I know about event handlers, but I would like to use translations instead,
if that's possible.

--
Bent Nielsen		<bni@modulex.dk>
A/S MODULEX		Phone:    +45 44 53 30 11
Lyskaer 15		Telefax:  +45 44 53 30 74
DK-2730 Herlev
Denmark

gabe@hpcvlx.cv.hp.com (Gabe Begeddov) (02/16/91)

    / hpcvlx:comp.windows.x.motif / bni@modulex.dk (Bent Nielsen) / 10:51 am  Feb 12, 1991 /
    
These are features of the TM when using multiclick and event sequences.
See Appendix B in the intrinsics manual for examples.  Basically,
you cannot use any sequence that is a non-initial subsequence of 
another that is already being matched. This is the case with Btn1Up vs.
the multiclick specs for btn1.  In addition, motion events will be
swallowed by the TM when matching an event sequence.