[lazarus] Device Contexts

Marc Weustink weus at quicknet.nl
Thu Mar 9 13:47:12 EST 2000


At 17:17 09-03-2000 +0000, you wrote:
>I just noticed what could be a problem with the
>current device context implementation.
>
>As I see it when a TWinControl or descendent
>is created a TDeviceContext is added to the
>DeviceContexts list.

No, a devicecontext is added the moment you ask for it (GetDC)

>This is the windows equivalent
>of a private DC defined in the window flags, the DC
>value allocated is just index in this list.

This list is only a way to keep track of devicecontext's, a DC is only a 
pointer to the TDeviceContect.

>However in GetDC there is no checking of the window
>flags for private DC and it just creates a new DC with
>default values. I can't see this is a limitation of gtk as
>we are already are storing the pointers to the GC in the
>the TDeviceContext.

The moment the DeviceContext was implemented, there were no flags. Even now 
it is not fully implemented. So I created a DC for every call to GetDC.

>Ther are many times when you need to call GetDC
>just to get a mapping of the hWnd to the DC.

I looked at the Delphi/Windows implementation a bit, but every time you do 
a GetDC, you get a different DC (of the same window). I have to admit that 
I should have looked at the meaning of a privete DC


>Does GetDC need fixing? or am I missing something here.

For now... don't think so. There are more important things. (or have you 
found something not working because of this)

Marc







More information about the Lazarus mailing list