Path: utzoo!utgpu!news-server.csri.toronto.edu!rutgers!maverick.ksu.ksu.edu!deimos.cis.ksu.edu!mccall.com!tp From: tp@mccall.com (Terry Poot) Newsgroups: comp.windows.x Subject: DECwindows (XUI) novice question Message-ID: <1990Oct18.180103@mccall.com> Date: 18 Oct 90 23:01:03 GMT Reply-To: tp@mccall.com (Terry Poot) Organization: The McCall Pattern Co., Manhattan, KS, USA Lines: 53 I'm starting to feel real stupid, because I'm sure what we want to do is doable, but after reading the docs, I don't know how. I'll try to keep this breif. (Apologies if my terminology is off, I'm new to this, and I'm not the programmer actually doing this, I'm helping him). We are trying to convert an application from VWS to DECwindows. We grabbed some sample code that comes with DECwindows, and have managed to do a pretty good job of making it work using Xlib (making it fast enough will be a chore, and comes later). We saved one feature of our application for last. The application used 2 windows, one the terminal emulator it was run from and one a graphics window. It toggled back and forth between these under program control. My thought was to use the toolkit. We would combine the application windows into one window, using widgets to implement the different functions. The command window widget appears to do exactly what we want in handling the terminal window. I figured we would use a window widget (since that is the only one that supports graphics) as our graphics window. Now the problem: the only callback in the window widget is an expose callback. This would be fine for a static graphic display, but this is an _interactive_ graphics application. The user can grab objects and move them, or select them and then by hitting various keyboard keys, he does various operations on them (for the curious, the application places pattern pieces on a printing plate). I have no idea how to accomplish this. When I was reading the introductory docs, I assumed that when it said the window widget supports graphics, that meant I would have full access to pointer, button, and keyboard events, as well as things like leave and enter window and expose. But the only one it seems to give me is expose. Now I know I could get the window id from the widget and draw on it with Xlib. I don't know if that is supported (i.e. would I somehow subvert the toolkit by doing it). What I can't see any way of doing is getting events that occur in the graphics window. I've read the guide to writing DECwindows applications (skipping the sections on widgets irrelevant to our application), and looked up the window widget in the toolkit routines reference manual. What am I missing? Please don't _just_ tell me what book to buy (though such hints are also appreciated), this is a small town, and I don't have time to order it and wait for it to arrive before solving this problem). Bonus question (assuming the above problem is solvable): how do I manage which widget controls the keyboard? I'd like the command window to give the focus back to the graphics window any time the user hits return, and I'd also like the graphics window to be able to give the focus to the command window (though that is less essential). I don't want the user to have to click on the graphics window to move the focus, since that click would likely have meaning to our application (depending on where he did it). Thanks very much in advance for any help. -- Terry Poot The McCall Pattern Company (uucp: ...!rutgers!ksuvax1!mccall!tp) 615 McCall Road (800)255-2762, in KS (913)776-4041 Manhattan, KS 66502, USA