Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!sdd.hp.com!ucsd!ucbvax!ECHO.CANBERRA.EDU.AU!jan From: jan@ECHO.CANBERRA.EDU.AU (Jan Newmarch) Newsgroups: comp.windows.x.motif Subject: Re: Questions from a beginning Motif programmer Message-ID: <9011130308.AA02858@golf.canberra.edu.au> Date: 13 Nov 90 18:08:05 GMT References: <1990Nov12.184753.10051@murdoch.acc.Virginia.EDU> Sender: daemon@ucbvax.BERKELEY.EDU Distribution: inet Organization: The Internet Lines: 41 > > XDrawString(display, main_window, main_gc, 5, 45, "Welcome to Mshell", 17); > XDrawString(display, main_window, main_gc, 5, 65, time_str, > strlen(time_str) - 1); > > XtMainLoop(); /* get and dispatch events */ > -------------------------------------------- > > My question really has to do with the my program's main > window. It seems that the drawable I want to pass to graphics routines > is > > main_window = XtWindow(form); /* main window */ > > is that right? I don't really understand why (although it seems I won't attempt to answer all questions because I don't have time or knowledge about them all. This one looks fairly typical though. In brief, don't try to do Xlib operations on Motif objects. The `form' is for geometry management, so just use it for that. Don't try drawing into it because it wasn't designed for that. The things that you can place text into are labels, text widgets, lists and drawing areas. To place text into a label, use the labelString resource. To place text into a text widget, use the XmTextSetString function. To place things in lists, use the items resource. For none of these do you use the Xlib stuff. The drawing area is yours to play with, and for these you should probably use things like XmDrawString. I would replace the form with a drawing area and retry the rest - maybe some of your other problems would just go away. Hope this little bit helps. +----------------------+---+ Jan Newmarch, Information Science and Engineering, University of Canberra, PO Box 1, Belconnen, Act 2616 Australia. Tel: (Aust) 6-2522422. Fax: (Aust) 6-2522999 ACSnet: jan@ise.canberra.edu.au ARPA: jan%ise.canberra.edu.au@uunet.uu.net UUCP: {uunet,ukc}!munnari!ise.canberra.edu.au!jan JANET: jan%au.edu.canberra.ise@EAN-RELAY +--------------------------+