[Lazarus] WMPaint

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

[Lazarus] WMPaint

Free Pascal - Lazarus mailing list
procedure TCustomControl.WMPaint(var Message: TLMPaint);
begin
   if (csDestroying in ComponentState) or (not HandleAllocated) then exit;
   Include(FControlState, csCustomPaint);
   inherited WMPaint(Message);
   Exclude(FControlState, csCustomPaint);
end;

Maybe use try-finally here for Exclude?


--
Regards,
Alexey

--
_______________________________________________
Lazarus mailing list
[hidden email]
http://lists.lazarus-ide.org/listinfo/lazarus
Reply | Threaded
Open this post in threaded view
|

Re: [Lazarus] WMPaint

Free Pascal - Lazarus mailing list
Just curious:

What use is altering a local variable (i.e. FControlState) when you are
calling an inherited code?

I mean, shouldn't you alter ControlState (I am assuming it exist in the
'inherited')?

On 2017-04-30 19:06, Alexey via Lazarus wrote:

> procedure TCustomControl.WMPaint(var Message: TLMPaint);
> begin
>   if (csDestroying in ComponentState) or (not HandleAllocated) then exit;
>   Include(FControlState, csCustomPaint);
>   inherited WMPaint(Message);
>   Exclude(FControlState, csCustomPaint);
> end;
>
> Maybe use try-finally here for Exclude?
>
>

--
_______________________________________________
Lazarus mailing list
[hidden email]
http://lists.lazarus-ide.org/listinfo/lazarus
Reply | Threaded
Open this post in threaded view
|

Re: [Lazarus] WMPaint

Free Pascal - Lazarus mailing list
In reply to this post by Free Pascal - Lazarus mailing list
On Sun, 30 Apr 2017 19:06:18 +0300
Alexey via Lazarus <[hidden email]> wrote:

> procedure TCustomControl.WMPaint(var Message: TLMPaint);
> begin
>    if (csDestroying in ComponentState) or (not HandleAllocated) then exit;
>    Include(FControlState, csCustomPaint);
>    inherited WMPaint(Message);
>    Exclude(FControlState, csCustomPaint);
> end;
>
> Maybe use try-finally here for Exclude?

I don't know any case where this would help.

Mattias
--
_______________________________________________
Lazarus mailing list
[hidden email]
http://lists.lazarus-ide.org/listinfo/lazarus