[comp.windows.x] Gadgets and illegal Xt functions

doyle@b11.ingr.com (Doyle Davidson) (11/09/90)

I was debugging a Motif application that uses gadgets
that suddenly core dumps when built under Motif 1.1
(I personally never say it run under 1.0)

I discovered that the error was due to the use of
XtDisplay() and passing it a PushButtonGadget.

Further investigation reveals that the XtDisplay() macro
is redefined in <Xm/XmP.h> to handle gadgets but the application
was not including this file.  I didn't think an application 
needed too.

So my questions are:
    1) Should I be including XmP.h in my application?
	(Obviously yes, but am I SUPPOSED to?)
    2) Should that macro (and potentially others) have been in Xm.h instead?
    3) Won't it still blow up if I call the libXt function instead?

Doyle
------------------------------------------------------------------
Doyle C. Davidson              |
Intergraph Corp.               |  These comments are...
Workstation Graphics Standards |
1 Madison Industrial Park      |
Huntsville, AL 35806           |
(205) 730-2000                 |         X-clusively my own.
                               |
..!uunet!ingr!doyle            |
------------------------------------------------------------------

sydorow@bisco.kodak.com (Steve Sydorowicz) (11/09/90)

doyle@b11.ingr.com (Doyle Davidson) writes:
>I discovered that the error was due to the use of
>XtDisplay() and passing it a PushButtonGadget.
>
> [ small amount deleted ]
>
>So my questions are:
>    1) Should I be including XmP.h in my application?
>        (Obviously yes, but am I SUPPOSED to?)
>    2) Should that macro (and potentially others) have been in Xm.h instead?
>    3) Won't it still blow up if I call the libXt function instead?

Motif 1.1 is geared more towards the R4 Intrinsics. In R4, there are some
changes/additions to some of the functions/macros. In the particular case
you've mentioned, what you want to use is XtDisplayOfObject() which will
work with widgets *and* gadgets. Another example is XtWindowOfObject().
You should not need to include a "P".h file. For more help, check an Xt
manual (if you can get your hands on one) and pay attention to Section
12.5 "Widget Arguments to Intrinsics Routines."

Good luck

-- 
--------------------------------------------------------------------------------
Stephen J. Sydorowicz				Azatar Computer Systems
sydorow@bisco.kodak.com				(716)726-5636
		Opinions expressed are "mine and mine alone."