[lazarus] GTK team: please specify!

Mattias Gaertner nc-gaertnma at netcologne.de
Sun Nov 2 10:32:30 EST 2003


On Sun, 2 Nov 2003 17:38:01 +0100 (CET)
Michael.VanCanneyt at wisa.be wrote:

> 
> 
> On Sun, 2 Nov 2003, Mattias Gaertner wrote:
> 
> > On Sun, 2 Nov 2003 17:22:10 +0100 (CET)
> > Michael.VanCanneyt at wisa.be wrote:
> > 
> > > 
> > > 
> > > On Sun, 2 Nov 2003, Mattias Gaertner wrote:
> > > 
> > > > On Sun, 2 Nov 2003 15:03:10 +0100
> > > > Mattias Gaertner <nc-gaertnma at netcologne.de> wrote:
> > > > 
> > > > > > The WinAPI specifies that GetDC(GetDesktopWindow()) should
> > > > > > return a device context of the screen. We can use this DC to
> > > > > > draw on.
> > > > > 
> > > > > Very funny. ;)
> > > > > What has the winapi to do with the gtk?
> > > > > We need the window DC without clipping and we need an event to
> > > > > know, when the gtk has finished painting everything. And during
> > > > > moving we have to paint as well.
> > > > > When we got this, we can omit the paint on every message and we
> > > > > can omit the designer widgets, because the rest is already
> > > > > implemented. This solution would be very near to my initial wish
> > > > > in a former mail. I will do some experiments... 
> > > > 
> > > > Ok. Maybe I found the solution.
> > > > Now to the LCL.
> > > > 
> > > > GetDC will just return the "normal" device context for a window.
> > > > Under gtk this is without the child windows (they are clipped away).
> > > > 
> > > > The designer needs a DC with childs. Something like GetRawDC or
> > > > GetWholeDC or GetDCForWholeWindow or GetDesignerDC or ... . I guess
> > > > under win32api this is already the default, so you have little to
> > > > do. If not, how does win32api calls it?
> > > 
> > > Maybe a stupid suggestion, but why don't you draw all that on the form
> > > window/canvas ?  All widgets/controls must always be somewhere on the 
> > > form. Also, if you move widgets over parent boundaries (which can
> > > happen) the designer handles can still be drawn, since their
> > > coordinates are relative to the form window, not relative to the
> > > parent.
> > 
> > Because I didn't know the trick to get a device context for this, the
> > gtk interface was young and unflexible and the message queue unordered.
> > Now, I know the trick and the gtk interface has everything we need. Now
> > I will do it. 
> > Because this was always my goal, the designer needs only little changes
> > for this. 
> 
> Sorry, I don't quite get the answer:  you will draw on the form canvas or
> not ? 

No. The form canvas uses a standard DC. And this DC provided by the gtk has
clipped the child gdkwindows away. 

 
> And why do you need the DC ? You could just as well use the canvas methods
> ? I don't know about Lazarus, but Form.Canvas is an existing property in
> Delphi. It would make the code also 100% portable, without need for
> backend changes. After all, Canvas is just a Delphi wrapper around a DC,
> so why not use it ?

Of course the designer uses a canvas to paint. It will simply work like
this:

DesignerCanvas:=TCanvas.Create;
DesignerCanvas.Handle:=GetDesignerDC(Form.Handle);
.. paint ..


Mattias






More information about the Lazarus mailing list