Page 1 of 1

GUI hangs

Posted: Thu Aug 06, 2009 12:02 pm
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?

Posted: Thu Aug 06, 2009 2:04 pm
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.

Posted: Thu Oct 29, 2009 12:56 am
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

Posted: Thu Oct 29, 2009 1:33 am
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.

Posted: Thu Oct 29, 2009 2:12 am
by r5ive
ok, thank you!