Use transparency only on the Frame

Are you writing your own components and need help with how to set them up or have questions about the components you are deriving from ? Ask them here.
Post Reply
Intoxx
In need of some credit
In need of some credit
Posts: 3
Joined: Sun Sep 01, 2013 5:40 pm

Use transparency only on the Frame

Post by Intoxx »

Hello, sorry for my English, i use frame (class MainFrame()) in my Program and i use this code :

Code: Select all

    wxColour *blue = new wxColour(2, 28, 45);
    SetBackgroundColour(*blue);

    wxButton *button = new wxButton(this, wxID_ANY, _T("Bouton"));
    wxButton *buttonB = new wxButton(this, wxID_ANY, _T("Bouton2"));
    wxButton *buttonC = new wxButton(this, wxID_ANY, _T("Bouton3"));
    buttonB->Move(150, 0);
    buttonC->Move(100, 55);

    SetTransparent(210);

     
    button->SetTransparent(255);
    buttonB->SetTransparent(255);
    buttonC->SetTransparent(255);
The transparency of the frame is good BUT the three buttons (button, buttonB, buttonC) are also (and i don't want.)

I don't find solution, thank's for your HELP !
Intoxx
User avatar
doublemax
Moderator
Moderator
Posts: 19116
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: Use transparency only on the Frame

Post by doublemax »

Sorry, not possible.
Use the source, Luke!
Intoxx
In need of some credit
In need of some credit
Posts: 3
Joined: Sun Sep 01, 2013 5:40 pm

Re: Use transparency only on the Frame

Post by Intoxx »

Really no alternative? To your knowledge is there another library allows?
User avatar
doublemax
Moderator
Moderator
Posts: 19116
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: Use transparency only on the Frame

Post by doublemax »

Really no alternative?
I had only one idea how to do this, but it's tricky and i'm not even sure it would work: Have two different wxFrames. One with the semitransparent background and on top of that, another "shaped" frame where only the parts where the buttons are, are visible. You'd have synchronize their relative position yourself.
To your knowledge is there another library allows?
Sorry, no idea.
Use the source, Luke!
Intoxx
In need of some credit
In need of some credit
Posts: 3
Joined: Sun Sep 01, 2013 5:40 pm

Re: Use transparency only on the Frame

Post by Intoxx »

I will try, thank's, this is good idea but a frame "Shaped" can have a transparent background? (RGB) I mean, is that the second frame that I would put above may have several controls while having an invisible background? (I look at the examples on the web now).

Thank's for your help men
User avatar
doublemax
Moderator
Moderator
Posts: 19116
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: Use transparency only on the Frame

Post by doublemax »

With a "shaped" frame (check the "shaped" sample), you can turn turn individual pixels on or off (1-bit mask). You'd have to create a mask where only the areas covered by the buttons are "active", the rest would be invisible. These would then "hover" over the semi-transparent background.

But even with this tricks it's not possible to have individual alpha values for each pixel.
Use the source, Luke!
Post Reply