Path: utzoo!mnetor!uunet!husc6!bloom-beacon!athena.mit.edu!kit From: kit@athena.mit.edu (Chris D. Peterson) Newsgroups: comp.windows.x Subject: Re: question about the Viewport widget Message-ID: <3999@bloom-beacon.MIT.EDU> Date: 24 Mar 88 18:38:17 GMT References: <6563@ubvax.UB.Com> Sender: daemon@bloom-beacon.MIT.EDU Reply-To: kit@athena.mit.edu (Chris D. Peterson) Organization: Massachusetts Institute of Technology Lines: 57 >How do I get the windowID of the child window? I have seen this question more than once so I am posting the answer. The viewport was designed to take allow scrolling of a child widget, this child widget can be anything, a label, buttonbox, anything. But it does not exist until you create it, the viewport widget only creates itself and the scrollbars, it does not create the widget that is to be scrolled. If you want to put graphics into a window that is scrolled then you probabally want to instanciate a core widget that is the managed child of the viewport widget, the the window that you will draw into will be the XtWindow(corewidget). Source code to follow. No guarentee on this folks, I have not tried to compile this, but it is the general idea, hope this helps. Chris Peterson Project Athena Systems Development Net: kit@athena.mit.edu Phone: (617) 253 - 1326 USMail: MIT - Room E40-342C 77 Massachusetts Ave. Cambridge, MA 02139 DISCLAIMER: I work for Athena, but I don't talk for them, they can do that for themselves. This is my opinion, so only I have to like it. ------------------------------------------------------------ #include #include #include #include #include main(argc,argv) int argc; char ** argv; { Widget top_shell, viewport, graph_widget; Window graph_window; top_shell = XtInitialize("topshell", "XTools", NULL, 0, &argc, argv ); viewport = XtCreateManagedWidget("viewport", viewportWidgetClass, top_shell, NULL, 0); graph_widget = XtCreateManagedWidget("label", widgetClass, viewport, NULL, 0); graph_window = XtWindow(graph_widget); /* Wonderful Graphics stuff. */ }