Recent

Author Topic: Bug in TBCPanel?  (Read 16062 times)

HeDiBo

  • New Member
  • *
  • Posts: 44
Bug in TBCPanel?
« on: September 25, 2012, 03:07:44 pm »
This is the situation:
The main form contains a TBCPanel with a gradient (Background.Style=bbsGradient). On top of this panel is placed another TBCPanel, Background.Style=bbsColor, Background.ColorOpacity=0.

In stead of showing the color of the underlying TBCPanel, the new panel shows the color of the main form. Which is pretty useless, as you can imagine. A sample project is attached.

Any ideas?

Regards,
Dick

Kind regards ;-}
Dick

circular

  • Hero Member
  • *****
  • Posts: 3074
    • Personal webpage
Re: Bug in TBCPanel?
« Reply #1 on: September 25, 2012, 04:20:22 pm »
I suppose TBCPanel is not a transparent control. So the opacity cannot really be used.

You need to use a TBGRAGraphicControl to have full support of transparency.
Conscience is the debugger of the mind

HeDiBo

  • New Member
  • *
  • Posts: 44
Re: Bug in TBCPanel?
« Reply #2 on: September 25, 2012, 05:33:05 pm »
I suppose TBCPanel is not a transparent control.

If TBCPanel is not a transparent control, what should Background.ColorOpacity=0 accomplish?
And what should Background.Style=bbsClear do?

If I change the color of the main form, the panel changes its color too %). If Background.ColorOpacity = 127, the main form's color shines thru :o. I think that proves that it was meant to be able to be transparent. If it were not transparent, how else would it get its changing color?

The problem is probably using the wrong property. I.e. using the Owner property, where the Parent property should be used.
Kind regards ;-}
Dick

circular

  • Hero Member
  • *****
  • Posts: 3074
    • Personal webpage
Re: Bug in TBCPanel?
« Reply #3 on: September 25, 2012, 05:36:20 pm »
Maybe Dibo can help with that.
Conscience is the debugger of the mind

HeDiBo

  • New Member
  • *
  • Posts: 44
Re: Bug in TBCPanel?
« Reply #4 on: September 25, 2012, 05:44:24 pm »
Thank you for your reply. We'll await DiBo's comment then.
By the way, I immensely appreciate all the work you do for the BGRA project. :)
Kind regards ;-}
Dick

Dibo

  • Hero Member
  • *****
  • Posts: 1046
Re: Bug in TBCPanel?
« Reply #5 on: September 25, 2012, 06:28:14 pm »
BCPanel is not transparent, because it inherit from lazarus TCustomControl and this kind of control don't have transparent (I think this is OS limit)
BCPanel.Background property has opacity and bsClear property because this property class is a part of BGRA Controls framework which is used by other controls from this package (like BCButton, BCLabel etc). So for now opacity doesn't work in BCPanel, but maybe will work in future (when it appear in TCustomControl )

HeDiBo

  • New Member
  • *
  • Posts: 44
Re: Bug in TBCPanel?
« Reply #6 on: September 26, 2012, 12:54:04 pm »
@Dibo:
The color of the main form does show in a TBCPanel with Background.Style=bbsClear. That means it's at least partly transparent. Is that just a fluke, or is that by design?

By the way: great work on these BGRA controls 8-)

« Last Edit: September 26, 2012, 01:19:35 pm by HeDiBo »
Kind regards ;-}
Dick

HeDiBo

  • New Member
  • *
  • Posts: 44
Another bug in TBCPanel?
« Reply #7 on: September 26, 2012, 01:34:11 pm »
This is another problem with transparency.
When a TBCPanel is placed on top of other controls, and has rounded corners (e.g. Rounding.RoundX and Y = 30), the underlying controls do not show in the corners, rather the color of the form shows, making this setup almost useless.
Have a look at the attached project.
Kind regards ;-}
Dick

circular

  • Hero Member
  • *****
  • Posts: 3074
    • Personal webpage
Re: Bug in TBCPanel?
« Reply #8 on: September 26, 2012, 02:41:16 pm »
Well no, not almost useless. It can be useful for a nice design.

Oh but when testing it, the background under the panel is not filled correctly. See screenshot.

Maybe it would be useful to add a "backgroundundercolor" property, until tranparency is handled, and that would fill to replace the transparent background.
Conscience is the debugger of the mind

HeDiBo

  • New Member
  • *
  • Posts: 44
Re: Bug in TBCPanel?
« Reply #9 on: September 26, 2012, 03:07:13 pm »
Well no, not almost useless. It can be useful for a nice design.
With useless, I only meant the rounding effect. Not the whole panel of course.

It's only nice with rounding, if the panel happens to be directly placed on the form. A panel placed on another panel, for instance, will not give the desired effect, unless the underlying panel has the same color as the form.

I do not like the "backgroundundercolor" property. You have to remember to change it if the underlying control changes color. Sometimes you may not know what the color is (eg. if the panel is placed on a constantly changing image), a movie for instance.

I cannot reproduce the error you show, If the panel is placed on the form, the rounding goes OK. Check my test project.
« Last Edit: September 26, 2012, 03:10:01 pm by HeDiBo »
Kind regards ;-}
Dick

circular

  • Hero Member
  • *****
  • Posts: 3074
    • Personal webpage
Re: Bug in TBCPanel?
« Reply #10 on: September 26, 2012, 03:38:52 pm »
Well no, not almost useless. It can be useful for a nice design.
With useless, I only meant the rounding effect. Not the whole panel of course.
I meant the rounding is still useful.

Quote
It's only nice with rounding, if the panel happens to be directly placed on the form. A panel placed on another panel, for instance, will not give the desired effect, unless the underlying panel has the same color as the form.

I do not like the "backgroundundercolor" property.
This solves the problem.

Quote
You have to remember to change it if the underlying control changes color.
That's a better solution than having a random background color.

Quote
Sometimes you may not know what the color is (eg. if the panel is placed on a constantly changing image), a movie for instance.
You'll have to be reasonable.
Conscience is the debugger of the mind

HeDiBo

  • New Member
  • *
  • Posts: 44
Re: Bug in TBCPanel?
« Reply #11 on: September 26, 2012, 05:10:57 pm »
You'll have to be reasonable.

You're right. A better example would be a panel overlapping two other panels, each with a different color. Unless you think the "backgroundundercolor" property should have 4 values, one for each corner. And even then, if the color in the underlying panel at one of the corners is not solid, you still have a problem.

So, I still think there should be real transparency.

A very good solution is to specify transparency in the "skin". Have a look at these AlphaControls http://www.alphaskins.com/dwnld.php. In these controls if you give the panel (class TsPanel) a skin "CHECKBOX" the panel is totally transparent.

This may be a thing to consider: in order to implement themes, it is a good idea to make the skinning properties dynamically loadable at run time. To see how powerful that is, download the demo program from the same web page. In "Visible Components" select "Panels". Then in the "SkinSection" drop down box, select CHECKBOX. Notice that the groupbox and one of the panels become transparent.

Kind regards ;-}
Dick

circular

  • Hero Member
  • *****
  • Posts: 3074
    • Personal webpage
Re: Bug in TBCPanel?
« Reply #12 on: September 26, 2012, 06:11:47 pm »
I did not mean that there should be transparency. The "BackgroundUnderColor" could go with "BackgroundUnderFill" boolean, so that it could be deactivated if transparency is implemented, and in the meantime would allow TBCPanel to be used with round corners for example.

The AlphaControls you are talking about work only under Windows, right ?

Just tested, AlphaControls are amazing.
« Last Edit: September 26, 2012, 06:17:50 pm by circular »
Conscience is the debugger of the mind

Dibo

  • Hero Member
  • *****
  • Posts: 1046
Re: Bug in TBCPanel?
« Reply #13 on: September 26, 2012, 07:17:39 pm »
I always wanted create set of controls based not on "programmatically drawing", but on "sliced" PNG pictures (like TBGRAImageButton created by lainz from BGRA Controls package). This should give a similar effect like AlphaControls. The only limitation in that kind of controls is your imagination and of course photoshop / gimp skills ;) . But there is no time. I must wait for project where I will need this solutions (this same was with BGRA Controls)

HeDiBo

  • New Member
  • *
  • Posts: 44
AlphaControl vs sliced png images
« Reply #14 on: September 26, 2012, 08:33:51 pm »
I always wanted create set of controls based not on "programmatically drawing", but on "sliced" PNG pictures (like TBGRAImageButton created by lainz from BGRA Controls package). This should give a similar effect like AlphaControls.

Please, Dibo, have a look at the demo program of AlphaControls on a Windows machine (http://www.alphaskins.com/sfiles/askindemo.zip). Shouldn't take more than a couple of minutes from your valuable time. Then you get an idea, why sliced png images (whatever they may be :-\) is only part of the solution.
Kind regards ;-}
Dick