sfsag@sal-sun26.usc.edu (Sysfact) (10/29/89)
Subject: Translation Table Function Manipulation 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(): InsertChar(ourstructure, widget, event) How can this be accomplished? -- can we use an action table and include the parameter somehow?? Reason for need: When user types a character, we want to be told about this event (either insert or delete) so we can update some variables in our structure. This routine will be done while managing multiple hosts and multiple users. Thanks Ahead of Time, Bob Skertic and David Spears reply to: skertic@girtab spears@girtab sfsag@castor
swick@ATHENA.MIT.EDU (Ralph R. Swick) (11/01/89)
> We would like to pass our structure into a Translation Table Function > in addition to the widget name and event. There is no method provided by the Intrinsics (i.e. by Core) to store arbitrary client data in a widget instance. The easiest way to accomplish this is by using the Context Management facilities in Xlib. See XSaveContext, XFindContext (section 10.12 of Scheifler, Gettys, Newman). Those routines were intended for exactly this purpose (though in a much older prototype of Xt) and the sample implementation of Xt still uses them in places. You could also implement your own associative memory mechanism using the widget id. > Reason for need: When user types a character, we want to be told about > this event (either insert or delete) so we can update some variables in > our structure. I don't see yet what you plan to do to be notified about the event; you must still rely on the widget to provide changeNotify callbacks, or you must add your own action procedure to the translation table, or (less desirable) register an event handler and do your work in parallel with the translation manager.
kit@EXPO.LCS.MIT.EDU (Chris D. Peterson) (11/28/89)
> 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(): 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 Net: kit@expo.lcs.mit.edu Phone: (617) 253 - 9608 Address: MIT - Room NE43-213