transparent TabControl

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
Post Reply
loic.lopez
Posts: 2
Joined: Mon May 29, 2017 7:49 pm

transparent TabControl

Post by loic.lopez »

Hi,

i have used this code to make my tab control transparent :

for (irr::s32 i=0; i < irr::gui::EGDC_COUNT; ++i)
{
irr::video::SColor col = this->skin->getColor((irr::gui::EGUI_DEFAULT_COLOR)i);
col.set(0, 0, 0, 0);
this->skin->setColor((irr::gui::EGUI_DEFAULT_COLOR)i, col);
}

but checkboxes are also transparent how i can do ?

EDIT 1:
Or it is possible to make custom checkbox with a texture for exemple ?

Thanks for reply.
MartinVee
Posts: 139
Joined: Tue Aug 02, 2016 3:38 pm
Location: Québec, Canada

Re: transparent TabControl

Post by MartinVee »

Are you only trying to display the tabs of a tab control with a transparent color, but not all the other GUI controls?

Have you tried :

Code: Select all

 
 
  for(int i = 0; i < TabControl->getTabcount()-1; i++)
  {
    TabControl->getTab(i)->setBackgroundColor(irr::video::SColor(0,0,0,0));
  }
 
 
loic.lopez
Posts: 2
Joined: Mon May 29, 2017 7:49 pm

Re: transparent TabControl

Post by loic.lopez »

yes i have tried but with no result :

There remains an apparent border

Image

https://www.noelshack.com/2017-22-1496132881-menu.png
CuteAlien
Admin
Posts: 9628
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Re: transparent TabControl

Post by CuteAlien »

Hm, there are some more options to disable background drawing in Irrlicht svn trunk (aka what will be Irrlicht 1.9), but it seems I forgot IGUITabControl (added features for IGUITab and IGUICheckBox, but not this one yet...).

But try only setting EGDC_3D_HIGH_LIGHT and EGDC_3D_DARK_SHADOW instead of all skin-colors. Those seem to be used by tab-control but not by checkbox as far as I can see on a quick check.

Otherwise your easiest option is probably to copy the code of CGUITabControl.cpp/.h, rename the class and then use your own modified tab-control where you kick out the lines which do the background drawing.
IRC: #irrlicht on irc.libera.chat
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
MartinVee
Posts: 139
Joined: Tue Aug 02, 2016 3:38 pm
Location: Québec, Canada

Re: transparent TabControl

Post by MartinVee »

Hum. I thought that was weird, but then I looked at the code and it made sense.

Technically, this prevents each tab from being drawn :

Code: Select all

 
  for(int i = 0; i < TabControl->getTabcount()-1; i++)
  {
    IGUITab * currentTab = TabControl->getTab(i);
    currentTab->setBackgroundColor(irr::video::SColor(0,0,0,0));
    currentTab->setDrawBackground(false);
  }
 
But that tab control itself is drawing something on the screen, and there's no exposed property/method to affect this.

I'd recommend, as CuteAlien said, to reimplement the tab control's drawing. I'm not sure you need to copy the entire class, though. You could simply derive a class from CGUITabControl, and override the draw() method. Copy the draw() method, and get rid of all the drawing that happens inside. Okay, I suck at inheritance. This won't work (see below). Do exactly as CuteAlien said.
Last edited by MartinVee on Tue May 30, 2017 5:34 pm, edited 1 time in total.
CuteAlien
Admin
Posts: 9628
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Re: transparent TabControl

Post by CuteAlien »

You can't derive from implementation classes - only from interfaces. But copy-paste works well in this case :-)
IRC: #irrlicht on irc.libera.chat
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
MartinVee
Posts: 139
Joined: Tue Aug 02, 2016 3:38 pm
Location: Québec, Canada

Re: transparent TabControl

Post by MartinVee »

Ah, yes, you're right, of course, silly me. I've been working with C for the last 10 years, so I'm still a bit rusted on inheritance.
CuteAlien
Admin
Posts: 9628
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Re: transparent TabControl

Post by CuteAlien »

Just checked it some more. When you create a new tab-control you can pass 2 parameters to addTabControl: fillbackground and border. The first is disabled by default, but the second isn't. So you can disable that one to get rid of some lines.

With svn-trunk version of Irrlicht you can also then additionally disable background drawing for each tab.

There seems to be one special case - when there are no tabs at all. In that case it draws some bright background as palceholder.
Also you can use your own skin and overload draw3DTabBody to change the drawing to the tab-area background (but no control over tab-button-bar).
IRC: #irrlicht on irc.libera.chat
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
Post Reply