@begin(header)
author: ackerman@ics.uci.edu
show_author: ShowNone
author_organization: MIT
node_expert: ackerman=ag@ics.uci.edu
expiration_date: 06/25/93
last_modifier: ackerman=ag@ics.uci.edu
last_mod_date: 09/09/91
mod_num: 2
@end(header)
@begin(Q)
We would like to pass our structure into a Translation Table Function
in addition to the widget name and event.  As an example, insert-char():
@end(Q)

@begin(A)
The problem of accessing program data from an action routine is an
annoying one, to which there is no "clean" solution.  I tend to use
the X Context manager to work around the problem by assigining data to
the window of a widget, and then retreiving this data from the action
routine, since I have the widget (and window) ID in the action routine
I can associate unique data with each widget in my application.

The Context manager is described in Scheifler, Gettys and Newman in
section 10.12.

						Chris D. Peterson     
						MIT X Consortium 
@end(A)

@begin(Q)
I would like to use the params argument of an Xt action procedure to
pass a pointer to a structure.  Is this possible?
@end(Q)

@begin(A)
Well, the argument is declared to be a list of Strings, and Strings
are expected to be character pointers, but in principle you could
cast any kind of pointer you wanted and include it in the list.

However, the translation table parser only understands how to generate
character strings params so the only way you could invoke an action
procedure with a different type of pointer is to call it directly in
your own code.

When translations were initially designed, some thought was given
to using full argument descriptors so that other types of action
parameters could be specified but the idea was dropped in favor
of simplicitly.

There are several ways to associate your structure pointer with
the widget id, if you really need to access dynamic data from within
the action procedure.
@end(A)

@begin(Q)
In R3, is there a cleaner way to get the time stamp (rather than setting
a property and getting the property notify?  
@end(Q)

@begin(A)
Here is one.

Rather than using the callback proceedure for the widget define your
own global action routine (see XtAppAddActions) and bind it to your 
widget via a translation.  One of the parameters passed to an action
routine is the event.  Thus your application will have the event.

One caution when using this method is that in configurable programs
you may not be able to assume the type of event that activates the
proceedure (The user can modify the translation table to suit his/her
tastes).  Be sure to check the "type" field in the event, so that you
are getting the right structure element out of the Event's Union.


						Chris D. Peterson     
						MIT X Consortium 

Editor's note:  In R4, you can do a XtLastTimestampProcessed call.
@end(A)






