Page 1 of 1

transparent TabControl

Posted: Mon May 29, 2017 7:52 pm
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.

Re: transparent TabControl

Posted: Mon May 29, 2017 8:29 pm
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));
  }
 
 

Re: transparent TabControl

Posted: Tue May 30, 2017 8:30 am
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

Re: transparent TabControl

Posted: Tue May 30, 2017 10:07 am
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.

Re: transparent TabControl

Posted: Tue May 30, 2017 1:09 pm
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.

Re: transparent TabControl

Posted: Tue May 30, 2017 3:43 pm
by CuteAlien
You can't derive from implementation classes - only from interfaces. But copy-paste works well in this case :-)

Re: transparent TabControl

Posted: Tue May 30, 2017 5:27 pm
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.

Re: transparent TabControl

Posted: Sun Jun 04, 2017 6:36 pm
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).