Close button on a framewindow

For help with anything that CEGUI doesn't offer straight out-of-the-box, e.g.:
- Implementation of new features, such as new Core classes, widgets, WindowRenderers, etc. ...
- Modification of any existing features for specific purposes
- Integration of CEGUI in new engines or frameworks and writing of new plugins (Renderer, Parser, ...) or modules

Moderators: CEGUI MVP, CEGUI Team

User avatar
wuack
Just popping in
Just popping in
Posts: 11
Joined: Thu Oct 27, 2005 02:16
Location: West Virginia, US
Contact:

Close button on a framewindow

Postby wuack » Fri Oct 28, 2005 10:03

I would appreciate it much, if someone could help me with this X-looking button on the framewindow called Close Button.

Excuse my ignorance here, :oops: but the close button seems not to close anything. I found out that the CloseButtonEnabled property is only to hide or show the button. How do i get the button to actually close the window. I can't really call an event to handle it, since it doesn't have a name.

I'm hoping there's something really easy that i just dont know about :D. I figure it should be a common feature to deal with, but i failed to find the solution in the forum. It might just have been my ignorance's fault again.:D
thanks

User avatar
lindquist
CEGUI Team (Retired)
Posts: 770
Joined: Mon Jan 24, 2005 21:20
Location: Copenhagen, Denmark

Re: Close button on a framewindow

Postby lindquist » Fri Oct 28, 2005 12:43

Subscribe to the "CloseClicked" event of the FrameWindow and do what you feel the button should do in that handler :)

HTH

User avatar
dsmirnov
Just popping in
Just popping in
Posts: 7
Joined: Thu Oct 13, 2005 11:38

Re: Close button on a framewindow

Postby dsmirnov » Fri Oct 28, 2005 12:45

Greetings.

This is really easy stuff.
To handle close window button (as any other button) you need to subscribe window event.

Like this example:
[size=x-small][color=0000CC][font=Arial]
using namespace CEGUI;

Window* someWindow = WindowManager::getSingleton().getWindow("SomeWindow");

someWindow->
subscribeEvent(FrameWindow::EventCloseClicked, Event::Subscriber(&AuroraGUI::handleCloseButton, this));
[/font][/color][/size]

This "handleCloseButton" function will do everything you need on pressing close window button.

I'm using following code to handle all windows close buttons:
[size=x-small][color=0000CC][font=Arial]
bool AuroraGUI::handleCloseButton(const CEGUI::EventArgs& e)
{
static_cast<const CEGUI::WindowEventArgs&>(e).window->hide();

return true;
}
[/font][/color][/size]

User avatar
wuack
Just popping in
Just popping in
Posts: 11
Joined: Thu Oct 27, 2005 02:16
Location: West Virginia, US
Contact:

Re: Close button on a framewindow

Postby wuack » Fri Oct 28, 2005 14:30

Thanks a lot,

love love love the replies :D.

User avatar
wuack
Just popping in
Just popping in
Posts: 11
Joined: Thu Oct 27, 2005 02:16
Location: West Virginia, US
Contact:

Re: Close button on a framewindow

Postby wuack » Sat Nov 05, 2005 19:42

:( when i t coded as suggested and got compilation error. here's that code segment:

wmgr.getWindow((CEGUI::utf8*)"Demo8/CodeWindow") ->subscribeEvent( CEGUI::FrameWindow::EventCloseClicked,
CEGUI::Event::Subscriber(&GuiApplication::handleCloseButton, this));

and here's the error,
error C2027: use of undefined type 'FrameWindow'

i can't make any sense of why FrameWindow is undefined Type. :(.

Thanks for the help.


Return to “Modifications / Integrations / Customisations”

Who is online

Users browsing this forum: No registered users and 2 guests