Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!usc!cs.utexas.edu!csc.ti.com!ti-csl!m2.csc.ti.com!tilde.csc.ti.com!axis!axis!ctim From: ctim@aaet.csc.ti.com (Craig Timmerman) Newsgroups: comp.windows.x.motif Subject: Re: Need help with Ulowell MotifC++ bindings Message-ID: Date: 17 May 91 22:11:53 GMT References: <15457@arctic.nprdc.navy.mil> Sender: news@axis.dsg.ti.com (System News Administ) Organization: Texas Instruments Incorporated, Austin, TX Lines: 55 In-Reply-To: apple@nprdc.navy.mil's message of 17 May 91 01:10:15 GMT > I need some help with the Ulowell C++ bindings for Motif. > > My problem is that I can not pass a object (XMObject) as a argument > to a function that is in another source file. > > here is a short fragment of what I'm trying to do > > > > ----- main.cc > . > void CreateMainMenu( XMForm * ); > // I've also tried, void CreateMainMenu( XMObject * ); > > void main (unsigned int argc, char **argv) > { > XMApplicationShell topLevel ("topLevel", &argc, argv ); > XMForm mainWindow (&topLevel, "mainWindow" ); > CreateMainMenu( &mainWindow ); > } > > ----- menus.cc > > void > CreateMainMenu( XMForm * parent ) > { > XMString string ( "test" ); > XMLabel label ( parent, "label", &string ); > label.Manage(); > } > > The mainWindow is displayed but I get a message "Destroying Widget ..", > and the label is never displayed I'm assuming you are using the latest version of the Lowell bindings (the version that works with Motif 1.1). In this version I believe that the destructor for the object calls XtDestroyWidget. In your case the label object goes out of scope at the end of CreateMainMenu and therefore its associated widget will be destroyed before it is ever displayed. This would explain the message you see and why it would work if you move the creation of the label into main--it wouldn't go out of scope there. Try explicitly creating the label using new, and don't delete it. Your problem should go away. > PS: I'd love to hear from anyone else who is using / trying to use > these bindings. I have used the first version of the bindings, and may use them again in the future. -- ---------------------------------------------------------------------- Craig Timmerman email: ctim@aaet.csc.ti.com Texas Instruments Austin, TX ----------------------------------------------------------------------