Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / lazarus / 2017-04

WMPaint

3 messages · 3 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Alexey
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

Reply by email

ListMember
to Alexey

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')?

Alexey wrote 11 lines
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?

Reply by email

Mattias Gaertner
to Alexey: procedure TCustomControl.WMPaint(var Message: TLMPaint); begin if (csDestroying in…
Show quoted text 9 lines
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

Reply by email