Suggestion: Transparent container

Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #51525
    mol
    Participant
    'Jeremy©JTECH' wrote:
    I always find myself wanting is a simple, transparent container. Grouping several controls together in a single, invisible parent

    A groupbox is not an option?

    http://stackoverflow.com/questions/8927802/transparent-group-box

    #51526
    TCount
    Participant
    'Jeremy©JTECH' wrote:

    It would be great! :a3:

    #51527
    Jeremy©JTECH
    Participant
    'mol' wrote:

    A groupbox is not an option?

    http://stackoverflow…arent-group-box

    Can the border on TGroupBox be made invisible? Either way, TPanel can also work, it just seems like overkill. It also doesn't work well with Alpha Controls, which is why I often have to use TsPanel with a CHECKBOX SkinSection. Even then, there are still issues.

    #51528
    mol
    Participant
    'Jeremy©JTECH' wrote:
    Can the border on TGroupBox be made invisible?

    I would think so. You could derive your own groupbox and override the paint method (untested):

    Code:
    type
    tBorderless=class(TGroupbox)
    protected
    procedure Paint; Override;
    end;

    procedure tBorderless.Paint;
    var
    R: TRect;
    begin
    with Canvas do
    begin
    R := ClientRect;
    Brush.Color := Color;
    FillRect(R);
    end;
    end;

    #51529
    Jeremy©JTECH
    Participant
    'mol' wrote:

    I would think so. You could derive your own groupbox and override the paint method (untested):

    You could do much the same with practically any TWinControl descendent, no? Also, the code you posted will overwrite the group box's client area, the opposite of transparent. Simply NOT painting anything can work (if I remember right), but I also recall this introducing certain visual artifacts.

    You don't even have to derive your own component to make a TPanel transparent, but as I mentioned before, it doesn't always play nicely with Alpha Controls. It just makes sense (to me) to have a standard, lightweight, invisible component that does nothing more than group other child controls together for alignment, sizing, and other similar layout purposes.

    Another common thing I like to do is nest a TFrame inside another TFrame or TForm (it helps organize and compartmentalize really complicated forms/frames that otherwise would have thousands of lines of code in them). However, in order to get a nested child frame to be partially transparent, I have to add a TsFrameAdapter and set its SkinSection to CHECKBOX. Wouldn't a new TRANSPARENT setting make more sense (and be more obvious to new users)?

    #51530
    mol
    Participant
    'Jeremy©JTECH' wrote:
    the code you posted will overwrite the group box's client area

    Well, you wanted to get rid of the border… 😉

    Here's another approach which should work: http://delphidabbler.com/tips/74

    Quote:
    Wouldn't a new TRANSPARENT setting make more sense

    Don't know; I hardly ever work with transparency. If I recall correctly, there are always problems associated with TWinControls and transparency. What happens if you put those on a semi-transparent TFrame? Isn't the painting too much of a hassle?

    -Uwe

    #51531
    Jeremy©JTECH
    Participant
    'mol' wrote:

    Well, you wanted to get rid of the border… 😉

    Here's another approach which should work: http://delphidabbler.com/tips/74

    Lol true… thanks for the link too. I might have to dabble with making my own control at some point.

    Quote:

    Don't know; I hardly ever work with transparency. If I recall correctly, there are always problems associated with TWinControls and transparency. What happens if you put those on a semi-transparent TFrame? Isn't the painting too much of a hassle?

    -Uwe

    You're probably right (the article you linked indicates as much), but somehow the people behind AC have already got it working pretty well. I've found a few little issues over the years, but most or all of them have been resolved by the AC developers. The image I posted in my first post highlights a new issue I found, but that should be fixable as well.

    They have already done the hard work of making transparency work, so why not wrap that functionality in a more lightweight component that doesn't carry all the extra TPanel/TsPanel baggage? AC gives us these beautifully skinned forms and panels, which only increases my desire to embed transparent frames and panels within them.

    #51553
    Support
    Keymaster

    Hello

    TRANSPARENT skin section will be added in the version 9.

    This skin section will be internal and will work even if skin haven't such section.

Viewing 8 posts - 1 through 8 (of 8 total)
  • You must be logged in to reply to this topic.