dotgnu-pnet
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: [Pnet-developers] Controls: when to create a handle ?


From: Neil Cawse
Subject: RE: [Pnet-developers] Controls: when to create a handle ?
Date: Fri, 11 Feb 2005 11:43:07 -0500

> 
> Hi folks,
> I'm currently hunting another layouting bug in Control.cs. After more
than
> a day I've finally found the cause: PerformLayout immediateley returns
> when no handle (toolkitWindow) was created.
> 
> So my question is: when should a handle be created ?
> 

This is a bit rusty in my mind but we always try defer creating the
handle until we have to. The reason for this is that once the handle is
created, we have to then send all characteristic changes of the control
through to the underlying operating system window. This makes
performance poor.

We only have to create the handle when CreateHandle() is called or the
control itself becomes visible. If we are finding problems just because
the handle isn't created, we need to redo that path of the logic.

When the operating system receives from us, for example a size change
command, it then calls back to us the "size change" event. We then have
various layout logic that happens through this code path. This is where
things fall down because if the handle is not created, that logic is not
being called and still needs to happen.

The slow part is not our internal layout logic but rather the slowness
comes in from dealing with windows that are already created - so I would
add checks into things like SetBoundsCore(..) and call the necessary
code even when the handle is not created.

You need to do a little testing to make sure that you are in fact
creating the handle as late as possible - you will see a big performance
hit if we regress and create the handles too early.

Hope this helps.

Regards
Neil


reply via email to

[Prev in Thread] Current Thread [Next in Thread]