GUI hangs

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
manik_sheeri
Posts: 53
Joined: Tue May 19, 2009 12:18 am

GUI hangs

Post by manik_sheeri »

I am running a program that first displays some gui like TabControl with tabs and some buttons.
After sometime , I remove these GUI elements using "remove()" call.
But immediately after that, I again create new tabcontrol and some buttons.
But this time I see that the GUI seems to be hanged. I can see the GUI elements but I cant see the button press or tab change whenever I try to do by pressing mouse left-lick.

Could you please tell whats the problem?
CuteAlien
Admin
Posts: 9721
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Post by CuteAlien »

Sorry, we need code to be able to reproduce the problem. It sounds like some focus problem, for example you might have accidentally left an invisible element on top or something like that. Or it could be any other problem in your code or even in engine code. But we can't really help unless you post code.
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
r5ive
Posts: 20
Joined: Wed Jun 18, 2008 5:42 pm
Location: Berlin

Post by r5ive »

hi,

i have kind of the same problem. when i try to remove gui elements the gui freezes.

here my code:

Code: Select all

	core::list<gui::IGUIElement*>::ConstIterator it = window->getChildren().begin();
	for (; it != window->getChildren().end(); ++it) {
		window->removeChild((*it));
	}
EDIT: i found out, that this for loop is not terminating. does the iterator maybe screws it all up? when i leave "window->removeChild((*it));" out, the iterator runs fine.

EDIT: i solved the problem using the following code:

Code: Select all

	while( window->getChildren().getSize() != 0 ) {
		core::list<gui::IGUIElement*>::ConstIterator it = window->getChildren().begin();
		window->removeChild((*it));
	}
is this the best way to handle the problem?

thanks for your help
r5ive
sudi
Posts: 1686
Joined: Fri Aug 26, 2005 8:38 pm

Post by sudi »

i would say it is. the other way would be filling a second list with the iterators and then removing them from the list which is much more complicated.
We're programmers. Programmers are, in their hearts, architects, and the first thing they want to do when they get to a site is to bulldoze the place flat and build something grand. We're not excited by renovation:tinkering,improving,planting flower beds.
r5ive
Posts: 20
Joined: Wed Jun 18, 2008 5:42 pm
Location: Berlin

Post by r5ive »

ok, thank you!
Post Reply