[Lazarus] Repainting nested components

Martin Friebe lazarus at mfriebe.de
Wed Jul 2 11:56:35 CEST 2008


Maybe the following may be of help.
http://bugs.freepascal.org/view.php?id=11560

I just spotted in the below
> How to assure, that all nested components will be repainted after
> calling MyPanel.Paint, because actually all components are behind new
I think you should call MyPanel.Invalidate, instead of MyPanel.Paint?  
that should take care of repainting any child-controls.

Best Regards
Martin


Roland Turcan wrote:
> Thanks for you answer.
>
> I am converting one project from Delphi/Kylix to Lazarus and using SVN
> versions of Lazarus with FPC 2.2.0.
>
> This behavior is currently related to i386-linux-gtk. But I am going
> to port it under MacOS too (Carbon).
>
> MG> Some widgetsets use a mixture. That means it depends on the type of widget, what
> MG> technique is used.
>
> Where I can find information of differences among widgets?
>
> TRoland;
>
> <<< 30.6.2008 12:57 - Mattias Gärtner "nc-gaertnma at netcologne.de" >>>
> MG> Zitat von Roland Turcan <konf at rotursoft.sk>:
>
>   
>>> Hello lazarus project!
>>>
>>> How to assure, that all nested components will be repainted after
>>> calling MyPanel.Paint, because actually all components are behind new
>>> rectangle.
>>>       
>
> MG> I'm not sure, if you found a bug or if you misunderstood the concept of event
> MG> based painting and/or clipping.
>
> MG> In general:
> MG> TPanel and TRadioButton are TWinControls and have their own handle. So it is up
> MG> to the widgetset (windows, gtk, carbon, qt, fpgui ...) to control the order and
> MG> how (double buffered, default background, clipping, overlapping) these widgets
> MG> are painted. If they use clipping, then they can paint in any order. They can
> MG> even paint only one of them. If they don't use clipping, then they will first
> MG> paint TPanel and then TRadioButton.
> MG> Some widgetsets use a mixture. That means it depends on the type of widget, what
> MG> technique is used.
>
> MG> What widgetset are you using?
> MG> What effect do you expect and what do you get?
> MG> What lazarus, fpc and OS version are you using?
>
>
>   
>>> procedure TMyPanel.Paint;
>>> var rect :TRect;
>>> begin
>>>   rect := GetClientRect;
>>>   InflateRect(rect,-50,-50);
>>>   Canvas.Brush.Color:= clYellow;
>>>   Canvas.Rectangle(rect);
>>>
>>>   inherited Paint;
>>> end;
>>>
>>> procedure TForm1.FormCreate(Sender: TObject);
>>> var mp:TMyPanel;
>>> begin
>>>   mp := TMyPanel.Create (self);
>>>   with mp do begin
>>>     Parent := self;
>>>     Left := 0;
>>>     Top := 0;
>>>     Width := 200;
>>>     Height := 150;
>>>     Color:= clRed;
>>>   end;
>>>
>>>   with TRadioButton.Create(mp) do begin
>>>     Left:= 10;
>>>     Top := mp.Height div 2;
>>>     Width:=150;
>>>     Caption:= 'Roland';
>>>     Parent := mp;
>>>   end;
>>> end;
>>>
>>> Thanks in advance.
>>>       
>
> MG> Mattias
>
>
>
>
>
>   



More information about the Lazarus mailing list