[Lazarus] TTabControl (d)evolution

Felipe Monteiro de Carvalho felipemonteiro.carvalho at gmail.com
Mon Aug 1 14:09:43 CEST 2011


On Mon, Aug 1, 2011 at 1:41 PM, Hans-Peter Diettrich
<DrDiettrich1 at aol.com> wrote:
> I couldn't find any code where a TTabControl is painted?

lcl/include/tabcontrol.inc:

procedure TTabControl.Paint;
var
  ARect: TRect;
  TS: TTextStyle;
  Details: TThemedElementDetails;
begin
  //DebugLn(['TTabControl.Paint Bounds=',dbgs(BoundsRect),'
ClientRect=',dbgs(ClientRect),' CientOrigin=',dbgs(ClientOrigin)]);
  // clear only display area since button area is painted by another control
  // draw a frame
  ARect := ClientRect;
  AdjustDisplayRectWithBorder(ARect);

  Details := ThemeServices.GetElementDetails(ttPane);
  ThemeServices.DrawElement(Canvas.Handle, Details, ARect);

  InflateRect(ARect,BorderWidth,BorderWidth);
  Canvas.Frame3d(ARect, BorderWidth, bvRaised);

  if (csDesigning in ComponentState) and (Caption <> '') then
  begin
    ARect:=GetDisplayRect;
    TS := Canvas.TextStyle;
    TS.Alignment:=taCenter;
    TS.Layout:= tlCenter;
    TS.Opaque:= false;
    TS.Clipping:= false;
    Canvas.TextRect(ARect, ARect.Left, ARect.Top, Caption, TS);
  end;
end;

> Instead I found a TCustomTabControl created in the
> TTabControlNoteBookStrings...

Yes, but this control is not rendered to the screen, it is utilized to
call methods from this class.

-- 
Felipe Monteiro de Carvalho




More information about the Lazarus mailing list