[lazarus] GTK team: please specify!

Mattias Gaertner nc-gaertnma at netcologne.de
Fri Oct 31 10:50:36 EST 2003


On Fri, 31 Oct 2003 16:37:48 +0100
"Marc Weustink" <marc.weustink at cuperus.nl> wrote:

> + From: Mattias Gaertner [mailto:nc-gaertnma at netcologne.de]
> + Sent: vrijdag 31 oktober 2003 16:22
> +
> + On Fri, 31 Oct 2003 15:57:32 +0100
> + "Marc Weustink" <marc.weustink at cuperus.nl> wrote:
> +
> + > From your example:
> + > Icon at 50,50.
> + > DC of groupbox at 30,30
> + >
> + > Suggestion:
> + >
> + > hwnd := GetWindowFromDC(GroupboxDC)
> + > P := Point(50, 50)
> + > MapWindowPoints(Form.Handle, hwnd, @P, 1)
> + >
> + > Now P should have the coords relative to the GroupBoxDC
> +
> + ok.
> + For optimization, I think, we should add a new interface
> + function, which use as default these 3 lines. For example function
> + MapWindowDCPositionToScreen(DC: HDC; const DCPosition: TPoint; var
> + ScreenPosition: TPoint): boolean;
> 
> Ehm... my lines calculate the position relative to the form, not the
> screen.
> (or at leasdt that was what I had in mind).
> 
> + The gtk will override it.
> 
> Why ?
> 
> GetWindowFromDC and MapWindowPoints are already widgetset dependant
> functions.

MapWindowPoints needs to calculate the screen coords of both handles to
create the diff (at least O(n)). The designer needs this function on some
forms several thousand times per draw. Therefore I implemented the
TDesignerDeviceContext, which cashes the positions. This accelerates some
forms by factor 2. So, the calculation of the diff should be doable by the
designer.


Mattias






More information about the Lazarus mailing list