rajgopal@lhotse.cs.unc.edu (Suresh Rajgopal) (09/24/88)
I am a new entry into 'X world', and this might be a trivial question to some people, but here goes: I am running X.11VR2 on a Sun-3/110(monochrome) and I am using the Xt tool kit with the X11 library and some of the Athena Widgets in Xaw/ My question: Is there anyway I can use any of the available widgets to draw lines/arcs between two points in a parent widget (a Form widget)? I have been trying to use the raw X-11 calls, for the same but with not much success. Here is a portion of the relevant code: --------------------------------------------------------------------- XtRealizeWidget(toplevel); /* Realizing the root widget and its children*/ w = XtWindow(form); /* Yields the Window #, of the Form Widget*/ gc = XCreateGC(dpy,w,0,NULL); /* Create Graphics Context */ XDrawLine(dpy,w,gc,25,110,50,110); /* Draw the line */ XtMainLoop(); ------------------------------------------------------ 'form' is a child of 'toplevel'. I would like the line drawn to be as simple as possible (i.e with all default attributes if possible) I am not interested in a different Line Style,Line Width etc. Are there certain GC values which do not take defaults? Well, the problem with this code is that it does nothing. I mean the widgets get displayed, but the line is not drawn. Does some 'expose widget' procedure have to be invoked to display parts of a widget generated via X-11 primitive calls? I do not read this newsgroup normally, so I would appreciate it if your replies were e-mailed directly to me Thanks -Suresh Suresh Rajgopal rajgopal@dopey.cs.unc.edu uunet!mcnc!unc!rajgopal
swick@ATHENA.MIT.EDU (Ralph R. Swick) (09/26/88)
The principal error in your code is that you are not waiting for the window to be mapped before drawing on it. The best way to accomplish this is to move all your drawing code into the Expose procedure of a new widget.