Motif 1.2 porting to Open Motif 2.x

Motif 1.2 porting to Open Motif 2.x

Post by Chris Beut » Wed, 16 Sep 2009 09:08:23


Apologies if this has come up before.

We're porting some 15 year old code which ran on DEC UNIX
(Motif 1.2 code base) to Red Hat Linux V5.3. Current version
of Open Motif looks like 2.x.

In one of the applications, we depend upon getting a selection
event from an XmToggleButton widget, and we check the event to
see what keys were pressed along with the left mouse button
(Button 1). We do one behavior with just a normal selection,
another if the Shift Key has been pressed while pressing the
button, or another action if the Control Key has been pressed.

In going to Motif 2.x, we cannot get a selection event from
the CTRL+ MB1 actions - in fact, the selection won't take
place. Some google searching shows that Motif 2.0 changed
the behavior of CTRL + MB1 to just change the focus, and not
do a selection, in order to be more compatible with Windows
behavior.

So the question for the community is, can I restore the 1.2
behavior for CTRL+MB1 by altering some other setting on
the system?

Thanks,
Chris
 
 
 

Motif 1.2 porting to Open Motif 2.x

Post by Bill » Wed, 16 Sep 2009 19:45:40

Perhaps:

static char ToggleTrans2[] =
"c<Btn1Down>: ArmAndActivate()\n";
static XtTranslations toggleTable2 = NULL;

static void override_toggle_translation(Widget w)
{
if (!toggleTable2) toggleTable2 = XtParseTranslationTable
(ToggleTrans2);
XtOverrideTranslations(w, toggleTable2);
}


then when you make a new toggle button:

w = XtCreateManagedWidget(name, xmToggleButtonWidgetClass, parent,
args, n);
override_toggle_translation(w);


(this is extracted from some code -- hopefully I got the relevant
portions).

 
 
 

Motif 1.2 porting to Open Motif 2.x

Post by Chris Beut » Thu, 17 Sep 2009 08:18:43

Many thanks, Bill, that worked like a champ.

Regards,
Chris