[lazarus] A Bug, a feature or am i just stupid (Dialogpositions)
nc-gaertnma at netcologne.de
Mon Sep 29 08:26:06 EDT 2003
On Sun, 28 Sep 2003 15:26:23 +0200
Tobi <lazarus at bick-online.de> wrote:
> im using Lazarus CVS(today, about 12:00) version and FPC 1.0.10.
> I have a dialog (fsnormal, podefault, wsnormal, bsdialog)
> and i want to save the position of the window (left and top).
> Saving is no problem, i use OnHide, OnClose and OnDestroy.
> OnChangeBounds works till i hide - show the window. See below.
> I restore Left and Top
> - looks like that the buttons, notebook, ... are placed somewhere
> - the window stays in podesign
> screenshot: http://www.bick-online.de/download/scr1.png
Can you send a small example?
> Override Create
> - restore old position - works fine
> - restore last position
> - nothing happens
> - window stays on "Override create" position
Windowmanagers can only be asked to move a window, often they ignore it.
gtk2 has some improvements for this.
> - use left:100, top:100
> - move to 200, 200
> - hide - show
> - you see the window comes back at 100, 100 and then moves to 200,
> 200- again hide - show without moving
> - restore at 200, 200
> - move to 300, 300
> - the same. window comes at 200, 200 and ........
The LCL asks the gtk-interface, which asks the gtk, which asks X, which asks
the windowmanager. This works asynchronous. What you see is the answer of
> - see OnActivate
> - but worse when you move the window. is it called when you move?
Depends on the windowmanager. Most of the times: no.
> - i can see that left and top change
> - hide - show
> - looks like OnChangeBounds is called with
> position from "Override create"
> - useless for me
> So, what is it?
> How to save - restore a window position?
In OnCreate, or after the 'inherited' in the overriden constructor.
More information about the Lazarus