Anybody know what's the use of addTab?

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
tjuhzj
Posts: 44
Joined: Mon Mar 27, 2006 7:00 am

Anybody know what's the use of addTab?

Post by tjuhzj »

Hi,everybody!

I am not able to make sense of the usage of addTab()? when i add a tab on the screen , there is no element displayed!! Originally, I wrongly thought it would like the JPanel in java.

Code: Select all

gui::IGUITab* tabContainer = guienv->addTab(core::rect<s32>(50,10,210,180));
anybody could make clear this problem? thank you in advance.
________
V10
Last edited by tjuhzj on Fri Feb 25, 2011 4:38 am, edited 1 time in total.
Saku
Posts: 158
Joined: Wed Jan 05, 2005 8:48 am
Location: Denmark

Post by Saku »

Try looking through the examples included in irrlicht. Especially the Mesh Viewer example, that should give you a good idea of how they're used.
Call me Wice, Miami Wice!
tjuhzj
Posts: 44
Joined: Mon Mar 27, 2006 7:00 am

err...

Post by tjuhzj »

I am afraid you misunderstand my question. :wink:

There are two version addTab(); What i means is IGUIEnvironment->addTab() but not IGUITabControl->addTab();


Thanks anyway!:-)
________
V8
Last edited by tjuhzj on Fri Feb 25, 2011 4:38 am, edited 1 time in total.
vitek
Bug Slayer
Posts: 3919
Joined: Mon Jan 16, 2006 10:52 am
Location: Corvallis, OR

Post by vitek »

RTFM; From IGUIEnvironment.h...

Code: Select all

//! Adds tab to the environment. 
/**  You can use this element to group other elements. This is not used for creating tabs on tab controls,
 please use IGUITabControl::addTab() for this instead.
 \param rectangle is the position of the tab.
 \param parent is the parent item of the element. E.g. a window. Set it to 0 to place the tab directly in the environment.
 \param id is a s32 to identify the tab. */
virtual IGUITab* addTab(const core::rect<s32>& rectangle, IGUIElement* parent=0, s32 id=-1) = 0;
Then look at the source code. From IGUITabControl.h...

Code: Select all

//! A tab, onto which other gui elements could be added.
class IGUITab : public IGUIElement
{
public:

   //! constructor
   IGUITab(IGUIEnvironment* environment, IGUIElement* parent, s32 id, core::rect<s32> rectangle)
      : IGUIElement(EGUIET_TAB, environment, parent, id, rectangle) {}

   //! destructor
   virtual ~IGUITab() {};

   //! Returns number of tab if in tabcontrol.
   /** Can be accessed later IGUITabControl::getTab() by this number. */
   virtual s32 getNumber() = 0;

   //! sets if the tab should draw its background
   virtual void setDrawBackground(bool draw=true) = 0;

   //! sets the color of the background, if it should be drawn.
   virtual void setBackgroundColor(video::SColor c) = 0;
};
A tab is just an empty container for other gui controls. If you want to make it visible, you have to tell it so by calling setDrawBackground() and maybe setBackgroundColor().

Travis
Post Reply