I have a TCustomControl
descendant and I've been looking at TGrid
as an example. In its Mouse, ScrollBar, and keyboard events, when deciding whether to call Invalidate()
, they use these:
HandleAllocated
ParentForm.ActiveControl = Self
(csDesigning in ComponentState)
ParentForm.Designer.Modified
Now, what are the rules of when you can and should not use these tests to allow Invalidate
to be called? Is that the correct way of saying it?
Why is the Handle
disappearing and not dealt with some other way?
Please tell me about IDesigner
, as I've never used it before.
Last, is their a time when the user uses the component and the Handle
is not available for use also?
I see the point of making an object after TCustomControl
that tests all events in the messages with:
If HandleAllocated and (ParentForm.ActiveControl = Self) and (csDesigning in ComponentState)
I'm guessing here, but why not override Invalidate()
and invoke inherited Invalidate;
if a Handle
is there, as the Canvas
needs a Handle
. This might be seen late but stabilizes code.