How do I remove GUI button?

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
klikli234
Posts: 97
Joined: Tue Sep 07, 2010 10:52 am

How do I remove GUI button?

Post by klikli234 »

I create game interface,How do I remove all button and background after click begin buttom.
Thanks!
RaverGames
Posts: 17
Joined: Sat Sep 25, 2010 8:54 am

Post by RaverGames »

Hello

Code: Select all

	
if(Button->isPressed()) // if Button is Pressed
{
       Button->drop(); // drop Button
}
RaverGames
Sylence
Posts: 725
Joined: Sat Mar 03, 2007 9:01 pm
Location: Germany
Contact:

Post by Sylence »

don't drop() it unless you grab() it before...

the method you are looking for is remove()
Software documentation is like sex. If it's good you want more. If it's bad it's better than nothing.
klikli234
Posts: 97
Joined: Tue Sep 07, 2010 10:52 am

Post by klikli234 »

Sylence wrote:don't drop() it unless you grab() it before...

the method you are looking for is remove()
sorry,I can't understand.

Code: Select all

IGUIEnvironment* env = device->getGUIEnvironment();

env->addButton(rect<s32>(10,240,110,240 + 32), 0, GUI_ID_START_BUTTON,L"Start", L"begin");
I add button like above code.

now , begin interface is useless after I click the button, than load 3d game frames.

sorry, my english is not good
no_response
Posts: 26
Joined: Fri Aug 20, 2010 11:07 am
Location: Bulgaria

Post by no_response »

do like

Code: Select all

IGUIEnvironment* env = device->getGUIEnvironment();

IGUIButton* but = env->addButton(rect<s32>(10,240,110,240 + 32), 0, GUI_ID_START_BUTTON,L"Start", L"begin"); 
and when you want to remove the button, do

Code: Select all

but->remove()
klikli234
Posts: 97
Joined: Tue Sep 07, 2010 10:52 am

Post by klikli234 »

no_response wrote:do like

Code: Select all

IGUIEnvironment* env = device->getGUIEnvironment();

IGUIButton* but = env->addButton(rect<s32>(10,240,110,240 + 32), 0, GUI_ID_START_BUTTON,L"Start", L"begin"); 
and when you want to remove the button, do

Code: Select all

but->remove()
thank you very much
suresh kumar
Posts: 13
Joined: Fri Mar 11, 2011 7:06 am

Post by suresh kumar »

can any one tell me how to add button listeners and receiving events
?
The Journey is more important than the destination...
CuteAlien
Admin
Posts: 9734
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Post by CuteAlien »

suresh kumar wrote:can any one tell me how to add button listeners and receiving events
?
Please check the examples, especially 05.UserInterface.
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
sudi
Posts: 1686
Joined: Fri Aug 26, 2005 8:38 pm

Post by sudi »

suresh kumar wrote:can any one tell me how to add button listeners and receiving events
?
Check this
http://irrlicht.sourceforge.net/phpBB2/ ... p?p=246120
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.
Post Reply