Article View: comp.windows.x.pex
Article #167Re: Drawing into DrawingArea widget
From: Stefan Schwarz
Date: Fri, 06 Nov 1992 09:54
Date: Fri, 06 Nov 1992 09:54
58 lines
2776 bytes
2776 bytes
kiki@bass.bu.edu (Keith Baccki) writes: > Hello, I'm working with DEC PHIGS ver. 2.3A on a >DECstation 5000/133 with PXG+ hardware. I am writing code >that is half PHIGS and half Motif, and I am having trouble >drawing non-PHIGS graphics into an initialized Drawing Area >widget. Sounds pretty idiotic, but I've even had more experienced >X coders look at my code and shrug there shoulders. Anyway, >here's the basic structure: > application shell widget > / \ > / \ > PHIGS output widget Form Dialog > \ > \ > Drawing Area > Drawing something into the Drawing Area should be a >trivial task, but nonetheless the following pieces of code >do NOTHING in the window: > XtSetArg(...); /* bunch of these... NOTE: height = 650 */ > /* width = 400 */ > ionwindow =XmCreateFormDialog(toplevelshell,"ionwindow",arglist,6); > XtManageChild(ionwindow); > XtSetArg(...); /* Few more... NOTE: requested height = 460 */ > /* " width = 400 */ > iondrawable = XmCreateDrawingArea(ionwindow,"iondrawable",arglist,4); > XtManageChild(iondrawable); > gcvalues.foreground = BlackPixel(display,DefaultScreen(display)); > gcvalues.background = WhitePixel(display,DefaultScreen(display)); > gc = XCreateGC(display,XtWindow(iondrawable),GCForeground | GCBackground, &gcvalues); > XFillRectangle(display,XtWindow(iondrawable),gc,(Position)50,(Position)50,(Dimension)200,(Dimension)200); > XDrawLine(display,XtWindow(iondrawable),gc,(Position) >100,(Position) 100,(Position) 300,(Position) 150); > XFlush(display); Be aware between the difference of managing a widget and creating the corresponding window. Only after mapping the window is visible and it makes sense to do some output. And further, XtWindow(widget) in the code above could return 0, because the window doesn't exist at this time. So, draw only in case of expose-events or wait until you receive a map-notify for the drawing area. Stefan -- __ Stefan Schwarz University of the armed forces Laboratory for graphical data processing W-8014 Neubiberg, FRG --
Technical Details
Message-ID:
<stefans.721043640@bauv106>Path:
arc1-ca.pugleaf.net!sparky!uunet!spool.mu.edu!sol.ctr.columbia.edu!ira.uka.de!math.fu-berlin.de!informatik.tu-muenchen.de!LRZnews!bauv106!bauv106!stefansReferences:
<100607@bu.edu>Show Full Headers
Complete Article Headers
Newsgroups: comp.windows.x.pex Path: arc1-ca.pugleaf.net!sparky!uunet!spool.mu.edu!sol.ctr.columbia.edu!ira.uka.de!math.fu-berlin.de!informatik.tu-muenchen.de!LRZnews!bauv106!bauv106!stefans From: stefans@bauv106.bauv.unibw-muenchen.de (Stefan Schwarz) Subject: Re: Drawing into DrawingArea widget Message-ID: <stefans.721043640@bauv106> Organization: Universitaet der Bundeswehr Muenchen (Germany) References: <100607@bu.edu> Date: Fri, 6 Nov 1992 09:54:00 GMT Lines: 53