Closing a TabControl (GUI) problem

You are an experienced programmer and have a problem with the engine, shaders, or advanced effects? Here you'll get answers.
No questions about C++ programming or topics which are answered in the tutorials!
Post Reply
aghaster
Posts: 2
Joined: Sun Jul 25, 2004 9:25 pm
Location: Quebec, Canada
Contact:

Closing a TabControl (GUI) problem

Post by aghaster »

Hi there
I am making my main menu and i got a serious problem with TabControls.
All other GUI elements have an "x" button included which allows to close it.
But there's none with the tabControl one. I use a button to open up my tabcontrol which i want to use for my settings, here's the code :

Code: Select all

				if (id == 102) // Settings
				{
					tabctrl = guienv->addTabControl(core::rect<int>(100,100,540,380),
					0, true, true);
					videoTab = tabctrl->addTab(L"Video");
					inputTab = tabctrl->addTab(L"Input");
					soundTab = tabctrl->addTab(L"Sound");
					x1 = guienv->addButton(core::rect<int>(420,5,435,20), videoTab, 1, L"x");
					x2 = guienv->addButton(core::rect<int>(420,5,435,20), inputTab, 1, L"x");
					x3 = guienv->addButton(core::rect<int>(420,5,435,20), soundTab, 1, L"x");
					return true;
				}

this opens a tabcontrols with 3 tabs, and in each of them there's a "x" button of my own.

the only thing i need is a part of code my "x" buttons to close the tabcontrol so i can come back to my main menu.
I tried using the remove(); and the removeChildren(); functions, calling them to delete the 3 buttons, the 3 tabs and the tabcontrol, it compiles, but i get a "unhandled exception" when i try to quit the tabcontrol with my "x" buttons. Anybody can help? just tell me what would be the right way to delete the tabcontrol without getting any "unhandled exception" (which i think is caused by ressources that haven't been destroyed).

any help would be great, thanks
Midnight
Posts: 1772
Joined: Fri Jul 02, 2004 2:37 pm
Location: Wonderland

Post by Midnight »

well I can't explain the error but if you look at the meshviewer demo...

They have a button that will ->remove() if the window already exists if you rewrite it to say that it will remove it without creating a new one it seems like it would work.

There may be a bug with putting the close button on the tab window itself I'm not smart enough to know why that won't work.

if you have trouble understanding what the meshviewer toolbar tabcontrol button does try moving the window to the other side of the screen and pressing it...or change the editbox text from 1.0 to anything else and then press it....you'll notice that what it does is destroy the old window and makes a new one at the same time.

I'm just rambling..peace

edit:::
one thing I just thought of...I usually get those types of errors when I forget to close the program before recompiling it....make sure it's not something stupid like that 8)


also from the code I can see it doesn't appear that you have the tabcontrol in a window...if it's not in a window then you wouldn't be able to remove it...would you?
Post Reply