Recent

Author Topic: [Solved] - Any suggestions for TTabControl Bug - Workaround?  (Read 2713 times)

zrocker

  • New Member
  • *
  • Posts: 11
[Solved] - Any suggestions for TTabControl Bug - Workaround?
« on: February 04, 2014, 05:10:56 pm »
Reference: http://bugs.freepascal.org/view.php?id=25468

On Win XP and Win 8.1 I see this too - XP gets a black backgound, 8.1 gets a white background.  No amount of dropping panels, notebook pages or other controls to cover up the TTabControl's yucky background color will completely remove it.  You can tweak the border style and edges all you want and you still end up with the TTabControl's color around the border outside of the cover-up controls.

I'm hoping in code, I can set a TTabControl property or some other code to fix this ugliness (esp. when the TTabControl is on a tab of TPageControl page and you switch TPageControl tabs and those tabs that don't have/need TTabControls on them and they look different (look as they should w/o all the crap around the borders like the TTabControl cover-up attempts show)).

Atachments:  01 is basic TTabControl with black client tab area and 02 is basic TTabControl with a TNoteBook aligned to Client and borders set to 0 (all of them).  You can still see part of the TTabControl's black client tab area.
« Last Edit: February 05, 2014, 02:57:55 pm by zrocker »

reinerr

  • New Member
  • *
  • Posts: 37
Re: [Updated] - Any suggestions for TTabControl Bug - Workaround?
« Reply #1 on: February 05, 2014, 02:35:46 am »
I see that bug in whatever version Lazarus I've got on Win 7 64-bit.

I looked at tabcontrol.inc in TTabControl.Paint, which looks something like this (comments added by me):
Code: [Select]
Details := ThemeServices.GetElementDetails(ttPane);  // will set Details.Element = teTab
{ ... some rect code }
ThemeServices.DrawElement(lCanvas.Handle, Details, ARect2);  // will paint the rect using clBackground (black on my comp)

So I think the bug is in DrawElement that should perhaps not be using clBackground but rather something else - like clBtnFace?

Possible change in themes.pas below. On my system it will fill the tab canvas with grey without themes and white with themes.
Code: [Select]
{...TThemeServices.DrawElement...}
    teTab:
      begin
        if Details.Part in [TABP_PANE, TABP_BODY] then
          FillWithColor(ARect, clBtnFace{clBackground}); //rr
      end;

My concern is that the code in themes.pas seems quite old and this would have been noticed before because its so obvious (or is nobody using TTabControl and just using TPageControl).
« Last Edit: February 05, 2014, 02:39:57 am by reinerr »

zrocker

  • New Member
  • *
  • Posts: 11
Re: [Solved] - Any suggestions for TTabControl Bug - Workaround?
« Reply #2 on: February 05, 2014, 02:57:25 pm »
Thanks!!!   :)  That worked perfectly!

reinerr

  • New Member
  • *
  • Posts: 37
Re: [Solved] - Any suggestions for TTabControl Bug - Workaround?
« Reply #3 on: February 06, 2014, 03:48:38 am »
I've added a note in the bug tracker. Its an easy fix so hopefully it will be implemented soon so other people stumbling across this don't waste their time.

nielbuys

  • Newbie
  • Posts: 1
Re: [Solved] - Any suggestions for TTabControl Bug - Workaround?
« Reply #4 on: June 09, 2020, 11:39:41 am »
I know this is a old topic.

But this bug and fix is still valid in the current version 2.0.8

How can I go about it to get this fix into the release.

For people getting to this fix from google.
This fix need to be applied in folder "c:\lazarus\lcl\themes.pas". Not sure if it was needed but I compiled the file "update_allunits.lpr". And when I compiled my project the bug was fixed.

Thanks all

JuhaManninen

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3863
  • I like bugs.
Re: [Solved] - Any suggestions for TTabControl Bug - Workaround?
« Reply #5 on: June 09, 2020, 12:58:14 pm »
I know this is a old topic.
But this bug and fix is still valid in the current version 2.0.8
How can I go about it to get this fix into the release.
If the issue and the fix are valid for Lazarus development version (trunk), please create a patch and upload it to the relevant bug report.
Mostly Lazarus trunk and FPC 3.2 on Manjaro Linux.

 

TinyPortal © 2005-2018