I would like to save the position and size of my TGMainFrame derived application each time its run so the next time its launched, its size and position can be restored. TGFrame::GetWidth() and TGFrame::GetHeight() seem to work, but the GetX() and GetY() methods always return 0. How do I get positions that I can TGFrame::Move() to?
I’m using win32gdk 3.10/1 on win2k. Thanks
Did you try to use the methods
Yes, I tried GetWMPosition(x,y) - allways returns x=y=-1.
This is likely work around but it works (at least on linux)… After using SetWMPosition(x,y) do Move(x,y) to the same position after MapWindow() of the main frame. I got correct values of x,y
and next time the application was on the same position.
Hi Ed, Ilka,
you can use TVirtualX::TranslateCoordinates method as follows:
Int_t x = 0;
Int_t y = 0;
(-fx,-fy) is main window position
We will add mods to TGMainFrame::GetWMPosition method.
Thanks. Regards. Valeriy
It is just another example that you should describe TVirtualX ASAP.
The mods of TGMainFrame might need a fix or improvement. Please follow this and the TGPopupMenu hot key problem reported by Ed too. Thank you.
I will be absent next week.
I’d like to continue this ancient discussion.
I use TVirtualX::TranslateCoordinates. But it returns wrong position. For example if TGMainFrame is created at the position (100,100), the code
will found it shifted to (fx=106,fy=126). 6 looks like the border width, and 20 looks like the height of window title.
How can I get correct window position?
And another one question. When the TGMainFrame is really painted? It is easy to calculate the shift described above:
Int_t x=100,y=100; // initial position
Int_t fx,fy; // "translated" position of (0,0) point
Int_t dx,dy; // shift to be found
TGMainFrame* main=new TGMainFrame(gClient->GetRoot(),w,h);
dx = -fx - x;
dy = -fy - y;
But there is a problem. TranslateCoordinates always returns (fx=0,fy=0). Why is it so? Does the window actually painted at the moment I call TranslateCoordinates?
I am using root 5.13/04.