Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!swrinde!ucsd!ucbvax!bloom-beacon!LARRY.MCRCIM.MCGILL.EDU!mouse From: mouse@LARRY.MCRCIM.MCGILL.EDU Newsgroups: comp.windows.x Subject: Re: Moving window Message-ID: <9011280846.AA04839@Larry.McRCIM.McGill.EDU> Date: 28 Nov 90 08:46:42 GMT Sender: daemon@athena.mit.edu (Mr Background) Organization: The Internet Lines: 38 > I am a new x-window programmer. I am writing an application to > display a window on a specified location on the screen. This should generally be left up to the user and/or the window manager. Some window managers simply do not permit the application program to control the window's location. (Some do. Most are capable of either.) > The followings are my sample codes : > topapp = XtCreateApplicationShell("topapp", topLevelShellWidgetClass, NULL, 0); ... > XMoveWindow(XtDisplay(topapp), DefaultRootWindow(XtDisplay(topapp)), 20, 2); > XtRealizeWidget(topapp); > However, the above codes seem don't work well (the applcation shell > doesn't appear at location (20, 2)). Any thing wrong with my codes? One thing definitely wrong and another thing possibly wrong. Definitely wrong: you're trying to move the wrong window. The XMoveWindow call you've written tries to move the root window, which of course won't do very much. (I am assuming XtDisplay(topapp) does what the name implies: returns the Xlib Display pointer in use.) To move your window, you'd need to call XMoveWindow(XtDisplay(topapp), , 20, 2) where the represents some sort of toolkit or widget incantation to obtain the window in question. I also recall messages on xpert that talk about the window not existing until you realize the widget; this may cause you grief too. Possibly wrong: you're trying to use an Xlib routine on a widget. This is usually the wrong thing to do. (It is right only when no toolkit or widget routine exists to do what you want; I don't know whether that's the case here.) der Mouse old: mcgill-vision!mouse new: mouse@larry.mcrcim.mcgill.edu