[Lazarus] TTabControl (d)evolution

Hans-Peter Diettrich DrDiettrich1 at aol.com
Tue Aug 2 19:11:25 CEST 2011


Felipe Monteiro de Carvalho schrieb:
> 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
[...]

Only the frame is drawn by the TTabControl, the tabs most probably still 
are painted by the TCustomTabControl.


>> 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.

The rename of TCustomNotebook into TCustomTabControl results in an 
illegal typecast in TTabControl.DrawTab:
   FOnDrawTab(TCustomTabControl(Self),TabIndex,Rect,Active)
with
   TDrawTabEvent = procedure(Control: TCustomTabControl; TabIndex: Integer;
     const Rect: TRect; Active: Boolean) of object;

Here every user code most probably will fail, because TTabControl is no 
more based on TCustomTabControl.

DoDi





More information about the Lazarus mailing list