Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / lazarus / 2003-09

A Bug, a feature or am i just stupid (Dialog positions)

5 messages · 3 people ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Tobi

Hi,

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.

OnCreate:
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

Override Create
- restore old position - works fine

OnShow
- restore last position
- nothing happens
- window stays on "Override create" position

OnActivate
- 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 ........

OnPaint
- see OnActivate
- but worse when you move the window. is it called when you move?

OnChangeBounds
- 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?

Reply by email

Tobi
to Tobi

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Tony wrote
-Tony

Hmm, so it is a bug. Do you know where i can find docs about how the lcl works? Maybe i can correct it. Its annoying.

Tobi
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.3 (GNU/Linux)

iD8DBQE/eAT5th8vPPjlAHURArprAJ0c2jTz+z4RoRgmzq6wnBG8Ru4fSgCfYi3T AbkkTZH3VSFFTKeLmWaykZI=
=Fi+M
-----END PGP SIGNATURE-----

Reply by email

Mattias Gaertner
to Tobi: im using Lazarus CVS(today, about 12:00) version and FPC 1.0.10. I have a dialog…
Show quoted text 14 lines
Hi, 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. OnCreate: 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?

Show quoted text 7 lines
Override Create - restore old position - works fine OnShow - 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.

Show quoted text 9 lines
OnActivate - 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 gtk/X/wm.

OnPaint - see OnActivate - but worse when you move the window. is it called when you move?

Depends on the windowmanager. Most of the times: no.

Show quoted text 9 lines
OnChangeBounds - 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.

Mattias

Reply by email

Tobi
to Tobi: im using Lazarus CVS(today, about 12:00) version and FPC 1.0.10. I have a dialog…

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Mattias Gaertner wrote
Can you send a small example?

http://www.bick-online.de/download/testapp.tar.gz

I've seen a TODO in "Listview - Columnwidth" in the GTK interface. I need the width. I dont want to rearange all windows/column each time i start my app. I want to continue where i stopped.

I "solved" the problem with the window position. But i cant solve that. Where can i find infos on how to implement that in the GTK interface? I dont know where to start. Looks like its in gtklistviewcallback.inc, listcolumn.inc and gtkobject.inc. And now? What is HDN_ITEMCLICK, LVN_COLUMNCLICK, .....?

Yes, i didn't RTFM. (If there is one)

Thx anyway

Tobi
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.3 (GNU/Linux)

iD8DBQE/eHqfth8vPPjlAHURAlhKAKDNETxquvunkKBDitMyjFH98sNmuACfRHU0 hgXMQHjyxK7ZFBPJuOwFebM=
=KMgn
-----END PGP SIGNATURE-----

Reply by email

Tony
to Tobi: im using Lazarus CVS(today, about 12:00) version and FPC 1.0.10. I have a dialog…
Tobi wrote 8 lines
Hi, 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.

I can't get certain window positions to function right, personally. I have one user of CBT who reports that even though I set the form to poscreencenter it displays half-off the right side of the screen...

So I'll put my input that yes, I've had many problems with window position, without even trying to move and restore it.

-Tony

Reply by email