matt@bacchus.esa.oz (Matt Atterbury) (05/09/91)
[Sorry if this has been fixed in a fix we don't have].
All the manuals I have [O'Reilly and X] say that you should use
XtAppInitialize rather than XtInitialize, so I did. But there is
one thing that XtInitialize does that XtAppInitialize doesn't do,
and that is to set up the [single, static] process context's
defaultAppContext field [this is used extensivley in the Xt
library]. The symptom was that a home-grown widget's translation
table was being 'handled' OK but the action table for it was being
ignored - result: 'Warning: Actions not found:' error messages.
1st Question) is this a problem in XtAppInitialize or in the widget?
The before code I had was:
XtToolkitInitialize();
*** app_context = XtCreateApplicationContext();
display = XtOpenDisplay(app_context, ...);
toplevel = XtAppCreateShell(NULL, ...);
The after code is:
extern XtAppContext _XtDefaultAppContext();
XtToolkitInitialize();
*** app_context = _XtDefaultAppContext();
display = XtOpenDisplay(app_context, ...);
toplevel = XtAppCreateShell(NULL, ...);
_XtDefaultAppContext() will create an app context if there isn't a
default already, and returns the default app context. The actions
problem has gone away. Note that I cannot use XtInitialize since I
am opening a number of displays.
2nd Question) assuming the widget is OK, what is the ideologically
correct way of getting the default app context set
up properly [_XtDefaultAppContext is supposedly an
internal Xt routine - it may go away?]?
Any information/responses welcome. cheers ...
--
-------------------------------------------------------------------------------
Matt Atterbury [matt@bacchus.esa.oz.au] Expert Solutions Australia, Melbourne
UUCP: ...!uunet!munnari!matt@bacchus.esa.oz.au "klaatu barada nikto"
or: ...!uunet!murtoa!bacchus.esa.oz.au!matt "consider this a divorce"
ARPA: matt%bacchus.esa.oz.AU@uunet.UU.NET "life? don't talk to me about life!"swick@athena.mit.EDU (Ralph Swick) (05/09/91)
The symptom was that a home-grown widget's translation
table was being 'handled' OK but the action table for it was being
ignored - result: 'Warning: Actions not found:' error messages.
Is your application (or the home-grown widget) still using XtAddActions
rather than XtAppAddActions? (There's no good reason I can think of
for the widget to be registering actions this way, but it's a thought.)
The "default application context" is useful only for the compatibility
routines in Appendix C of the Xt spec. If you use XtAppInitialize, as
you should, then you must not use any of the appendix C routines in the
following right-hand column:
New Replaces
XtAppMainLoop XtMainLoop
XtAppNextEvent XtNextEvent
XtAppProcessEvent XtProcessEvent
XtAppPeekEvent XtPeekEvent
XtAppPending XtPending
XtAppAddInput XtAddInput
XtAppAddTimeOut XtAddTimeOut
XtAppAddWorkProc XtAddWorkProc
XtAppCreateShell XtCreateApplicationShell
XtAppAddActions XtAddActions
XtAppSetSelectionTimeout XtSetSelectionTimeout
XtAppGetSelectionTimeout XtGetSelectionTimeout