[lazarus] GTK team: please specify!

Mattias Gaertner nc-gaertnma at netcologne.de
Fri Oct 31 08:32:16 EST 2003


On Fri, 31 Oct 2003 12:51:10 +0100
Micha Nelissen <M.Nelissen at student.tue.nl> wrote:

> >>> About TControlSelection.DrawGrabbers:
> >>> FGrabbers[g].Left/Top are holding the position of a grabber relative 
> >>> to the
> >>> client origin of the form.
> >>> The line
> >>> Diff:=DC.FormOrigin;
> >>> gets the DC origin also relative to the form origin.
> >>> Therefore the grabber is painted at FGrabbers[g].Left-Diff.X.
> 
> Indeed. I have fixed the code. 

No.

You changed the Diff, which is absolutely correct. The bug lies somewhere in
the calculation of DC.FormOrigin.
Maybe my lines above were ambigious. An example:
A designer form is at 100,200, has a TGroupBox at 30,30, with a border of
5,5. And there is an non visual component icon at 50,50. These 50,50 is
relative to the client origin of the form. This means the icon should be
drawn at 15,15 in the client area of the groupbox.

Paint messages:
Don't take this example too serious, it is the system that is important.
When the LCL gets a paint message for the groupbox, the designer gets also
the paint message. The paint message DC origin (0,0) is the left,top of the
client area of the groupbox. So, relative to the client area of the form it
is 35,35 = DC.FormOrigin.
So, the icon (at 50,50) is painted at 15,15.

The DC.FormOrigin is calculated in designerprocs.pp
function TDesignerDeviceContext.GetFormOrigin: TPoint;
This function is platform independent. It uses
    FormClientOrig:=FormClientOrigin;
    DCOrig:=DCOrigin;
So, maybe you should test, if these two functions return correct values in
win32. I guess it will be DCOrigin, because it uses GetWindowOrgEx. Probably
we have to replace this call by another interface function, which does not
yet exists.


Mattias






More information about the Lazarus mailing list