From: rlb7h@rlbsun.ee.Virginia.EDU (Robert L. Blackburn)
Subject: Re: CascadeButton translations & actions
Originator: rlb7h@rlbsun.ee.Virginia.EDU
Organization: University of Virginia
Date: Wed, 22 Jul 1992 23:28:35 GMT

In article <DRAND.92Jul21135346@spinner.osf.org> drand@spinner.osf.org (Douglas Rand) writes:

> In article <1992Jul20.214746.7146@murdoch.acc.Virginia.EDU> rlb7h@rlbsun.ee.Virginia.EDU (Robert L. Blackburn) writes:
> 
>>    [original question deleted]
> 
> I'm not answering via email.  This is all stuff that is of interest
> to general Motif and X Intrinsics programming folks.
> 

Ok.  Asking for a personal response was selfish.  I'll admit that.

> The event name is <BtnUp>,  the action is Activate.  The syntax is
> "<BtnUp>: Activate()" which tells the translation manager to run 
> the Activate action on the BtnUp event (any button up,  any modifiers).
> 
> The actions are documented per widget  (see XmCascadeButton, etc in 
> the OSF/Motif Programmer's Reference).
> 
> Now Cascade has no Activate() action,  it's parent Label has no 
> Activate() action and Primitive has no Activate() action.  Therefore
> you get the warning.
> 
> As a last thing.  I strongly recommend that you reconsider what 
> you're doing.  As someone with some familiarity with the menu code,
> I can tell you that you're going to regret this.  Really regret it.
> 
> 
> 
> --
> Douglas S. Rand <drand@osf.org>		OSF/Motif Dev.
> Snail:         11 Cambridge Center,  Cambridge,  MA  02142
> Disclaimer:    I don't know if OSF agrees with me... let's vote on it.
> Amateur Radio: KC1KJ
> 
I believe that the event is whatever I want to make it.  Iff [sic] I want to
override the default action on a ButtonUp event, then <BtnUp> is the event.

Mr. Rand is kind enough to pointed out that there is no "Activate" action
defined for XmCascadeButtons (hence my inability to find an appropriate
permutation of that name).  [The "OSF/Motif Reference Guide" on my desk merely
lists the actions for which there are translations for the widget in question.
I have not been able to find where it states that actions are limited in scope
to a particular type of widget.  I also note that XtAddActions has no
parameter to specify the type of widget for which the action is to be defined.
Perhaps I need a new manual?]

At any rate, "Activate" does not appear to be the action name I want (which I
also indicated in my original post).  As I originally stated, "Activate" is
the PushButton action I wish to emulate.  To infer from Mr. Rand's response,
there is no predefined action for CascadeButtons equivalent to PushButton's
"Activate".

Further investigation has revealed that creating a translation from my event
to "MenuShellPopdownDone" seems to take care of making the menu go away quite
nicely (what I thought might have been "Disarm").

The "Reference Guide" seems to indicate that CascadeButtons have both activate
and cascade callback lists.  I will be quite disappointed in OSF (or in my
Reference Guide) if it is, indeed, dangerous to actually call the functions in
the activate callback list.

So, to restate my question: I wish to call the functions in a CascadeButton's
activate callback list (and make the menu structure go away (popdown)).  It
appears that I will have to construct a translation to a new action to do so
(my previous case 2) something on the order of:

    XtActionsRec
	actions_list[] = { { "CascadeButtonActivate",
			     (XtActionProc) <proc_name> } };
    XtAddActions( actions_list, XtNumber( actions_list ) );
    XtParseTranslationTable( "<event>:	CascadeButtonActivate(), 
					MenuShellPopdownDone()" );

I assume that there is already a function in the motif library that I can fill
in for <proc_name>, one which calls the functions in the activate callback
list of the [CascadeButton] widget in which the event occured.  Does anyone
know the name of this function?  If it does not exist in the library, has
anyone written it or know what it should look like?

Thanks for whatever info you can provide.
-- 
Robert L. Blackburn			      Dept. of  Electrical Engineering
Assistant Professor			      Thornton Hall, Univ. of Virginia
804-924-6079				      Charlottesville, Virginia  22903
blackburn@virginia.edu
Newsgroups: comp.windows.x.motif