Re: [lazarus] Some questions about TForm.Height

2005-10-20 Thread lazarus . mramirez
Hi.

 minus title bar height. Actually, in Lazarus TForm.Height is equal to
 TForm.ClientHeight in Delphi.

The CLX (QT) form in delphi had a similar problem,
I need it to simulate MDI forms with independent windows/forms,
and need it to known the height of title bar...

 So, ones more - I can't find any info about that. This problem is very

If it's not posible to calculate a title bar*s height in GNU/Linux,
due to the different windows managers, why don't CREATE YOUR OWN
TITLE BAR WITH YOUR OWN HEIGHT ?

Let me explain, if is possible to create not title forms in GNU/Linux
windows managers, then a workaround could be to create a form with no
titlebar, and then emulate your own titlebar
with your own custom close, minimize, maximize (zoom) buttons,
where you can obtain the height of the bar...


 *Best regards, Alexey.*

Cheers.

[EMAIL PROTECTED]


_
 To unsubscribe: mail [EMAIL PROTECTED] with
unsubscribe as the Subject
   archives at http://www.lazarus.freepascal.org/mailarchives


Re: [lazarus] Some questions about TForm.Height

2005-10-20 Thread Tim Laurent

If it's not posible to calculate a title bar*s height in GNU/Linux,


due to the different windows managers, why don't CREATE YOUR OWN
TITLE BAR WITH YOUR OWN HEIGHT ?



What about creating a window *without* a title bar first, then adding a 
title bar to it and interpret the height difference as the height of the 
title bar? I think this could even be done offscreen and Lazarus could 
do that during startup ...


_
To unsubscribe: mail [EMAIL PROTECTED] with
   unsubscribe as the Subject
  archives at http://www.lazarus.freepascal.org/mailarchives


Re: [lazarus] Some questions about TForm.Height

2005-10-20 Thread Alex Smirnov




Hi, friends!

For Win32 I can use GetSystemMetrics in this case. So in Windows it
works. But in Linux (Gnome/GTK) GetSystemMetrics is seems to be not
realized jet - this function presents, code can be compiled, but
GetSystemMetrics returns some strange and illegal values.

So code, that is working in Windows will not work in Linux(Gnome/GTK).

But I think that there MUST BE an information about Title Bar height in
Gnome/GTK. So the question is HOW can we get this information using
Gnome or GTK API. Is there any Gnome or GTK guru to help?  :-) 

Regards. Alexey




Re: [lazarus] Some questions about TForm.Height

2005-10-20 Thread Bram Kuijvenhoven

Tim Laurent wrote:
What about creating a window *without* a title bar first, then adding a 
title bar to it and interpret the height difference as the height of the 
title bar? I think this could even be done offscreen and Lazarus could 
do that during startup ...


Lol :) You must be kidding :)

Please read where this thread started with: the problem is the actual window 
height (i.e. the height including the title bar) can't be determined. 
Furthermore, the title bar size cannot be determined (i.e., for some 
OSes/window managers).

Regards,

Bram

_
To unsubscribe: mail [EMAIL PROTECTED] with
   unsubscribe as the Subject
  archives at http://www.lazarus.freepascal.org/mailarchives


Re: [lazarus] Some questions about TForm.Height

2005-10-20 Thread dannym
Hi,

Am Donnerstag, den 20.10.2005, 22:49 +0400 schrieb Alex Smirnov:
 Hi, friends!
 
 For Win32 I can use GetSystemMetrics in this case. So in Windows it
 works. But in Linux (Gnome/GTK) GetSystemMetrics is seems to be not
 realized jet - this function presents, code can be compiled, but
 GetSystemMetrics returns some strange and illegal values.
 
 So code, that is working in Windows will not work in Linux(Gnome/GTK).
 
 But I think that there MUST BE an information about Title Bar height
 in Gnome/GTK. So the question is HOW can we get this information using
 Gnome or GTK API. Is there any Gnome or GTK guru to help?  :-) 

Note that depending on the presence of a window frame is bad. The frame
(and thus the frame size / orientation) can change while the application
is running (every time the user switches to another window theme). It
can also change depending on the window title, or window flags, or when
you change the display resolution, or start another window manager (i.e.
terminate the current one) while the application is running. Maybe the
window itself is animating (opening/closing animation) and thus the
window frame (and thus the size) changes rapidly. Maybe the window is
minimized/hidden and has no frame yet. Maybe it is docked within windows
of other applications (i.e. tabs) - they have one common frame. Maybe
it is running on a small display and hence nothing has window frames at
all. Maybe the window frame (and frame size) changes depending on if the
window is maximized or not.

gtk does not provide a way to determine the current frame extents.

That said, it is possible to find out the current frame extents, via
xlib, if the window manager cooperates. 
 
http://standards.freedesktop.org/wm-spec/wm-spec-1.4.html#id2511948

_NET_FRAME_EXTENTS, left, right, top, bottom, CARDINAL[4]/32

via the gdk xlib interface:

  unsigned long* extents;

  extents = NULL;

  if (gdk_property_get (w-window,
gdk_atom_intern (_NET_FRAME_EXTENTS, FALSE),
gdk_atom_intern (CARDINAL, FALSE),
0,
sizeof(unsigned long) * 4,
FALSE,
NULL,
NULL,
NULL,
(guchar**) extents
  )  extents) {
printf(%d %d %d %d\n, extents[0], extents[1], extents[2],
extents[3]);
XFree (extents);
  }

you can get it with the normal Xlib function too, which is
XGetWindowProperty, but I'm way too tired to find out how to call that
right now :)

There are xlib bindings for fpc, so it shouldn't be hard to get it
working.

Hope that helps.

 Regards. Alexey

cheers,
   Danny


_
 To unsubscribe: mail [EMAIL PROTECTED] with
unsubscribe as the Subject
   archives at http://www.lazarus.freepascal.org/mailarchives


Re: [lazarus] Some questions about TForm.Height

2005-10-19 Thread Alex Smirnov




Dear Friends!

Ones more I ask you for some help. Help me please to understand how can
I get real height of any form window created by Lazarus? The matter is
trhat TForm.Height returns not a total Form height, but Form height
minus title bar height. Actually, in Lazarus TForm.Height is equal to
TForm.ClientHeight in Delphi.

So, ones more - I can't find any info about that. This problem is very
important for me.

Best regards, Alexey.




Re: [lazarus] Some questions about TForm.Height

2005-10-19 Thread Micha Nelissen
On Wed, 19 Oct 2005 22:07:15 +0400
Alex Smirnov [EMAIL PROTECTED] wrote:

 *Dear Friends!*
 
 Ones more I ask you for some help. Help me please to understand how can 
 I get real height of any form window created by Lazarus? The matter is 
 trhat TForm.Height returns not a total Form height, but Form height 
 minus title bar height. Actually, in Lazarus TForm.Height is equal to 
 TForm.ClientHeight in Delphi.
 
 So, ones more - I can't find any info about that. This problem is very 
 important for me.

Can you explain why you need the complete height ?

Micha

_
 To unsubscribe: mail [EMAIL PROTECTED] with
unsubscribe as the Subject
   archives at http://www.lazarus.freepascal.org/mailarchives


Re: [lazarus] Some questions about TForm.Height

2005-10-19 Thread Vincent Snijders

Alex Smirnov wrote:

*Dear Friends!*

Ones more I ask you for some help. Help me please to understand how can 
I get real height of any form window created by Lazarus? The matter is 
trhat TForm.Height returns not a total Form height, but Form height 
minus title bar height.


Yes, that is correct and by design. It is maybe historical, but it 
is/was very difficult to create a form with a given total size, if you 
can't get the size of the title bar (with gtk).


Actually, in Lazarus TForm.Height is equal to 
TForm.ClientHeight in Delphi.


In Lazarus TForm.ClientHeight doesn't include the space for the menubar, 
so if you have a menubar TForm.ClientHeightTForm.Height.




So, ones more - I can't find any info about that. This problem is very 
important for me.


*Best regards, Alexey.*


Best regards,
Vincent

_
To unsubscribe: mail [EMAIL PROTECTED] with
   unsubscribe as the Subject
  archives at http://www.lazarus.freepascal.org/mailarchives


Re: [lazarus] Some questions about TForm.Height

2005-10-19 Thread Tim Laurent



Can you explain why you need the complete height ?

 

Well you may want to position a window relative to other windows, for 
example - like a playlist window that is part of a media player but can 
be positioned seperately. Or you may want to center a window on the 
screen ...



_
To unsubscribe: mail [EMAIL PROTECTED] with
   unsubscribe as the Subject
  archives at http://www.lazarus.freepascal.org/mailarchives


Re: [lazarus] Some questions about TForm.Height

2005-10-19 Thread Michael Van Canneyt


On Wed, 19 Oct 2005, Andrew Haines wrote:

 Michael Van Canneyt wrote:
 
  
  
  Since Lazarus cannot offer a method to get the title bar height on all
  platforms
  (notably Linux/Unix), the most sensible thing to do is to make
  Height=ClientHeight...
  
  
  
 This is not entirely correct. It is possible to get these values through the
 window manager hints.

For FVWM, ICEwm etc ? 

You can try, but you are dependent on the goodwill of the window manager, no ?

Michael.

_
 To unsubscribe: mail [EMAIL PROTECTED] with
unsubscribe as the Subject
   archives at http://www.lazarus.freepascal.org/mailarchives


Re: [lazarus] Some questions about TForm.Height

2005-10-19 Thread Andrew Haines

Michael Van Canneyt wrote:


On Wed, 19 Oct 2005, Andrew Haines wrote:

 


Michael Van Canneyt wrote:

   


Since Lazarus cannot offer a method to get the title bar height on all
platforms
(notably Linux/Unix), the most sensible thing to do is to make
Height=ClientHeight...



 


This is not entirely correct. It is possible to get these values through the
window manager hints.
   



For FVWM, ICEwm etc ? 


You can try, but you are dependent on the goodwill of the window manager, no ?
 

Yes that's true. Any window manager that conforms to the freedesktop.org 
1.3 standard will work though.


Andrew

_
To unsubscribe: mail [EMAIL PROTECTED] with
   unsubscribe as the Subject
  archives at http://www.lazarus.freepascal.org/mailarchives


Re: [lazarus] Some questions about TForm.Height

2005-10-19 Thread Alex Smirnov




Thank you for your help.  :-)


  
Can you explain why you need the complete height ?
  

As I told you - I need to work with 3 windows. 1st is top window (like
Lazarus main window). 2nd and 3rd must be placed under that window. So,
I do:

F2ndWindow.Left:=1;  
   
F2ndWindow.Top:=F1stWindow.Top+F1stWindow.Height;

F3rdWindow.Left:=F2ndWindow.Left+F2ndWindow.Wight; 
F3Window.Top :=F1stWindow.Top+F1stWindow.Height;

Im Delphi all is correctly calculated. In Lazarus both F3rdWindow.Left
and F3rdWindow.Top are calculated wrong.

So. How can I obtain titlebar height (both in WIndows and in Linux) to
get a real height of my window?


Best regards. Alexey.