[comp.windows.x.motif] XmPushButton translations

aw@cellar.bae.bellcore.com (Andrew Wason) (07/24/90)

[Sparc 1+, SunOS 4.1, ICS Motif 1.0, X11R4 server]

I'm having trouble specifying translations for the XmPushButton widget.
If I specify them as #augment or #override, they instead seem to #replace
the PushButtons default translations.  Here's a simple example
using Mri from the Widget Creation Library (wcl):

  Mri.wcChildren:         but
  *but.wcClass:           xmPushButtonWidgetClass
  *but.labelString:       Push Me
  *but.activateCallback:  WcSetValueCB(*but.labelString:  Activate!)
  *but.translations:      #augment \n\
                          <Key>a: WcSetValueACT("*but.labelString:    Action!")

When I type 'a' in the button, its label correctly changes to "Action!",
but the buttons default translations are gone. Btn1Down does not Arm()
the button and Btn1Up does not Activate() and Disarm().
It doesn't matter what translations I specify, the default translations
go away.  Even this causes the problem:

  *but.translations:      #augment

The problem isn't limited to wcl, I'm just using wcl as an example
because it is concise.

Has anyone else seen this or am I doing something wrong?

Thanks,
Andrew

--------------------------------------------------------------------------------
Andrew Wason                                        Bell Communications Research
aw@cellar.bae.bellcore.com                          Piscataway, NJ
bellcore!cellar!aw

daniel@osf (Daniel Dardailler) (07/24/90)

From article <4bc78cb1.20b6d@apollo.HP.COM>, by aw@cellar.bae.bellcore.com (Andrew Wason):
> 
> [Sparc 1+, SunOS 4.1, ICS Motif 1.0, X11R4 server]
> 
> I'm having trouble specifying translations for the XmPushButton widget.
> If I specify them as #augment or #override, they instead seem to #replace
> the PushButtons default translations.  Here's a simple example
> ...
> Has anyone else seen this or am I doing something wrong?


This was a bug, it's fixed in 1.1.








        Daniel Dardailler          |          OSF/Motif Team  
     Open Software Foundation      |      Email : daniel@osf.org           
       11 Cambridge Center         |      Phone : (617) 621 8840    
       CAMBRIDGE, MA 02142         |      Fax   : (617) 621 0584

jeff@aspect.UUCP (Jeff Rosler) (07/24/90)

>I'm having trouble specifying translations for the XmPushButton widget.
>If I specify them as #augment or #override, they instead seem to #replace
>the PushButtons default translations.  Here's a simple example
>using Mri from the Widget Creation Library (wcl):
>...

You're not doing anything wrong.  You just encountered a nasty bug with
translations.  This bug is not limited to the PushButton widget class,
either.  I posted a response to another question about this last week and
have sent a defect report.  I only posted on motif-talk@osf.org because
that is where the question originated.  In the future, I'll make sure I
post to this group also.

The problem is in the Initialize method of the XmPushButton widget.  If
a translation resource is specified for the widget, neither the Primitive
nor the PushButton translations are merged with your specific translations.
I don't know if this is fixed for 1.1 or not.  The only work around that I
can suggest is to specify the default translations as part of your translation
table.  A list of the default translations for the PushButton widget can
be found in the Motif Reference Manual.

Jeff Rosler
Aspect Telecommunications
1730 Fox Drive
San Jose, CA  95131-2312
uunet!aspect!jeff
(408) 441-2420

gabe@hpcvlx.cv.hp.com (Gabe Begeddov) (07/25/90)

   / hpcvlx:comp.windows.x.motif / daniel@osf (Daniel Dardailler) /  6:24 am  Jul 24, 1990 /
   From article <4bc78cb1.20b6d@apollo.HP.COM>, by aw@cellar.bae.bellcore.com (Andrew Wason):
   > 
   > [Sparc 1+, SunOS 4.1, ICS Motif 1.0, X11R4 server]
   > 
   > I'm having trouble specifying translations for the XmPushButton widget.
   > If I specify them as #augment or #override, they instead seem to #replace
   > the PushButtons default translations.  Here's a simple example
   > ...
   > Has anyone else seen this or am I doing something wrong?
   
   
   This was a bug, it's fixed in 1.1.
   
It's not a bug, it's a feature :-). Unfortunately, I think this feature is 
still in 1.1. The problem is that the PushButton is schizophrenic. It has
a different translation personality depending on it's context (whether it's
in a pulldown or popup menu or not). This information can only be 
ascertained in the initialize routine (as currently structured) and is 
unavailable at the time that the resource list is processed. What motif 
does is to leave the translations null and set them in the initialize 
routine. If the translations have been set by the client and/or user then
the code assumes that a complete table will be provided. 

           Daniel Dardailler          |          OSF/Motif Team  
        Open Software Foundation      |      Email : daniel@osf.org           
          11 Cambridge Center         |      Phone : (617) 621 8840    
          CAMBRIDGE, MA 02142         |      Fax   : (617) 621 0584
   ----------
   
Gabe Beged-Dov   
HP Interface Technology Operation
Corvallis, Oregon
   
   
   

jeff@aspect.UUCP (Jeff Rosler) (07/31/90)

>   > 
>   > [Sparc 1+, SunOS 4.1, ICS Motif 1.0, X11R4 server]
>   > 
>   > I'm having trouble specifying translations for the XmPushButton widget.
>   > If I specify them as #augment or #override, they instead seem to #replace
>   > the PushButtons default translations.  Here's a simple example
>   > ...
>   > Has anyone else seen this or am I doing something wrong?
>   
>   
>   This was a bug, it's fixed in 1.1.
>   
>It's not a bug, it's a feature :-). Unfortunately, I think this feature is 
>still in 1.1. The problem is that the PushButton is schizophrenic. It has
>a different translation personality depending on it's context (whether it's
>in a pulldown or popup menu or not). This information can only be 
>ascertained in the initialize routine (as currently structured) and is 
>unavailable at the time that the resource list is processed. What motif 
>does is to leave the translations null and set them in the initialize 
>routine. If the translations have been set by the client and/or user then
>the code assumes that a complete table will be provided. 


How is this a feature?  Why is it the case that a widget doesn't want
to override its translations if it's superclass or the client has
specified some other translations.  What is wrong with using
XtOverrideTranslations() or XtAugmentTranslations() to set the
translations in the Initialize method?

This "feature" is used in many Motif widget classes (not just PushButton).
Is there some reason why?  Different translation tables can still be
added with the appropriate Intrinsics routine.  It is not necessary
to set the translation manager translations directly or not set them
if some translations have alreadly been specified.  Is there some
underlying assumption I am missing that mandates this behavior?


Jeff Rosler
Aspect Telecommunications
1730 Fox Drive
San Jose, CA  95131-2312
uunet!aspect!jeff
(408) 441-2420