Path: utzoo!utgpu!news-server.csri.toronto.edu!rutgers!apple!agate!darkstar!ucscc.UCSC.EDU!chucko From: chucko@ucscc.UCSC.EDU (30502000) Newsgroups: comp.windows.x.motif Subject: Writing Motif widgets Message-ID: <8938@darkstar.ucsc.edu> Date: 14 Nov 90 16:19:10 GMT Sender: usenet@darkstar.ucsc.edu Reply-To: chucko@ucscc.UCSC.EDU () Followup-To: chucko@ucscc.ucsc.edu Distribution: usa Organization: University of California, Santa Cruz CATS Lines: 68 creating new widgets for the OSF/Motif Toolkit 1. Has anyone written a widget that builds on the Motif widget hierarchy? 2. How is this done? Usually users do not have source code for the Motif widget set. The system libraries only contain include files. We notice Athena widgets connect the widget inheritance hierarchy by including the ancestor's --P.h file in the child's --P.h file. In Motif, however, --P.h files do not do this. Perhaps they did this in the --.c file, but when We tried that it led to another problem (below). Problem: I worked through some examples in Volume 4 of O'Reilly & Assoc. and I was successful at creating a child widget in the Simple, Label, Command hierarchy. However, we are using the Motif toolkit so we would like any widgets we add to have the Motif look and feel. I attempted to clone a (Motif) widget under the pushbutton using HPs X11 V3 and their version of Motif (an incomplete 1.0 i think). I started with PushB.h and PushBP.h and a .c file i copied from a model in Volume 4 of O'Reilly & Assoc. I did not modify the .h files. I included XmP.h and PushBP.h in the .c file. I modified the .c file as follows: ------------------------------ #define SuperClass ((xmLabelWidgetClass) &xmLabelClassRec) XmPushButtonClassRec xmPushButtonClassRec = { { (WidgetClass) SuperClass, /* superclass */ "XmPushButton", /* class_name */ sizeof(XmPushButtonRec), /* size */ NULL, /* class_initialize */ . . } /* for public consumption */ WidgetClass xmPushButtonWidgetClass = (WidgetClass) &xmPushButtonClassRec; ------------------------------ I got the following compile errors: cc: "PushBP.h", line 63: error 1000: Unexpected symbol: "XmLabelClassPart". cc: "PushBP.h", line 68: error 1000: Unexpected symbol: "xmPushButtonClassRec". cc: "PushBP.h", line 98: error 1000: Unexpected symbol: "XmLabelPart". cc: "PushB.c", line 64: error 1000: Unexpected symbol: "xmPushButtonClassRec". If I include LabelP.h in the .c file I get the following compile errors: cc: "PushB.c", line 64: error 1603: Incompatible operands: & operator. cc: "PushB.c", line 64: error 1527: Incompatible types in cast. cc: "PushB.c", line 64: error 1521: Incorrect initialization. The line 64 is: (WidgetClass) SuperClass, /* superclass */ (in class structure) Any clues? Sincerely, Stuck in Monterey with the widget blues again. Charles Stein & Christina Shaw Naval Oceanographic & Atmospheric Research Lab. noarlw\!stein@uunet.uu.net -or- chucko@ucscc.ucsc.edu