[ROOT] Set the initial position of a TGMainFrame

From: Andreas Zoglauer (zog@mpe.mpg.de)
Date: Fri Jun 07 2002 - 15:45:30 MEST


Hello,

When I start my main GUI window, I want it to appear centered on the
screen.

I know that I can move the position of the window with Move(x, y). For a
class derived from TGMainFrame, it seems however, that the window has
to be mapped to the screen before it can be moved!

To illustrate the behaviour I will look at the "guitest" example of ROOT:

The constructor TestMainFrame closes with the following command sequence
(shortened):

   (...)
   SetWindowName("GuiTest");
   MapSubwindows();
   Resize(GetDefaultSize());
   MapWindow();
}

If I want the window to show up at position (200, 200) I have to alter
this in the following way:

   (...)
   SetWindowName("GuiTest");
   MapSubwindows();
   Resize(GetDefaultSize());
   MapWindow();

   Move(200, 200);
   MapWindow();
}
This has the side effect the the window is shown twice: For a few
milliseconds at position (0,0) (=first MapWindow) and then at (200, 200).

If I skip the first MapWindow() then the gui appears at (0, 0), despite
the move command!

Has anybody an idea how I can get the initial position at (200, 200)
without the first MapWindow()?
I tried SetWMPosition(x, y) but this seemes to have no effect at all.


On the other side, if the class is derived from TGTransientFrame this
miss-behaviour does not show up.


Thanks in advance,
Andreas


Root:   3.03.05
System: SuSE Linux 7.3


----------------------------------------------------------------------
Andreas Zoglauer

MPI fuer extraterrestrische Physik         Phone:    +49/89-30000-3848
Postfach 1312                              Fax:      +49/89-30000-3569
85741 Garching, Germany                    Email:    zog@mpe.mpg.de
----------------------------------------------------------------------



This archive was generated by hypermail 2b29 : Sat Jan 04 2003 - 23:50:56 MET