Image Buttons

For help with general CEGUI usage:
- Questions about the usage of CEGUI and its features, if not explained in the documentation.
- Problems with the CMAKE configuration or problems occuring during the build process/compilation.
- Errors or unexpected behaviour.

Moderators: CEGUI MVP, CEGUI Team

User avatar
CrazyEddie
CEGUI Project Lead
Posts: 6760
Joined: Wed Jan 12, 2005 12:06
Location: England
Contact:

Postby CrazyEddie » Wed Nov 05, 2008 14:31

Hi,

Glad you have something working now.

There is an ImageButton for TaharezLook. The initial I is capitalised though, so "TaharezLook/ImageButton" is what you maybe needed.

Since you have it working with the standard button, obviously you're free to carry on with that :)

CE.

dave2041
Just popping in
Just popping in
Posts: 3
Joined: Sun Jan 10, 2010 11:16

Re: Image Buttons

Postby dave2041 » Sun Jan 10, 2010 11:21

I didn't want to open a new thread as this one is relevent, my problem is that i want to use the button that we created in the tutorial however i can't seem to get the subscribe event syntax correct.

Code: Select all

   pChatContentBox = (CEGUI::MultiLineEditbox*)m_pChatWnd->getChild("ChatContentBox");
   CEGUI::PushButton* pExitButton = (CEGUI::PushButton*)m_pMainWnd->getChild("ExitButton_Game");
   pExitButton->subscribeEvent(CEGUI::PushButton::EventClicked, CEGUI::Event::Subscriber(&GameState::onExitButtonGame, this));

   pQuestPanel = (CEGUI::MultiLineEditbox*)m_pQuestWnd->getChild("QuestPanel");
   m_pQuestWnd->subscribeEvent(CEGUI::FrameWindow::EventCloseClicked, CEGUI::Event::Subscriber(&GameState::onQuestExitButton, this));

   CEGUI::Window *w = CEGUI::WindowManager::getSingleton().loadWindowLayout( "fireballBtn.layout" );
   m_pMainWnd->addChildWindow( w );
   w->setPosition( CEGUI::UVector2( CEGUI::UDim(0.0f,-32.0f), CEGUI::UDim(1.0f,-10.0f) ) );
   w->setVisible( true );
            -------------w->subscribtEvent(CEGUI::PushButton???--------------


there doesn't seem to be a CEGUI::ImageButton::EventClicked or something similar, any ideas (its probably really basic, just kinda starting out with cegui :)

User avatar
CrazyEddie
CEGUI Project Lead
Posts: 6760
Joined: Wed Jan 12, 2005 12:06
Location: England
Contact:

Re: Image Buttons

Postby CrazyEddie » Sun Jan 10, 2010 12:11

Hi,

The main way to go here is to get an understanding of how we produce some of these various types within CEGUI. For example, looking in the scheme file for TaharezLook, we have the following lines:

Code: Select all

<FalagardMapping WindowType="TaharezLook/Button"      TargetType="CEGUI/PushButton"  Renderer="Falagard/Button"       LookNFeel="TaharezLook/Button" />
...
<FalagardMapping WindowType="TaharezLook/ImageButton" TargetType="CEGUI/PushButton"  Renderer="Falagard/Button"       LookNFeel="TaharezLook/ImageButton" />

The key information in these lines is the TargetType attribute - in this case CEGUI/PushButton. Now, this is the concrete Window based class that is being used, and this is what provides the event functionality. So, to conclude... In this case you still use CEGUI::PushButton, since this is the core type that the specific types are being bound to. Or to put it another way, "TaharezLook/Button" and "TaharezLook/ImageButton" are just skins over the same old PushButton type.

HTH

CE.

dave2041
Just popping in
Just popping in
Posts: 3
Joined: Sun Jan 10, 2010 11:16

Re: Image Buttons

Postby dave2041 » Sun Jan 10, 2010 12:31

Ty sir that made sense, however i believe i tryed that and got the following error:

Code: Select all

error C2661: 'CEGUI::SubscriberSlot::SubscriberSlot' : no overloaded function takes 2 arguments


So i tryed to clear things up a little but got the same error :S :

Code: Select all

   m_pw = CEGUI::WindowManager::getSingleton().loadWindowLayout( "fireballBtn.layout" );
   m_pMainWnd->addChildWindow( m_pw );
   CEGUI::PushButton* pFireball = (CEGUI::PushButton*)m_pMainWnd->getChild("fireballBtn");

   m_pw->setPosition( CEGUI::UVector2( CEGUI::UDim(0.5f,-32.0f), CEGUI::UDim(1.0f,-10.0f) ) );
   m_pw->setVisible( true );
   pFireball->subscribeEvent(CEGUI::PushButton::EventClicked, CEGUI::Event::Subscriber(&GameState::fireBall, this));

User avatar
CrazyEddie
CEGUI Project Lead
Posts: 6760
Joined: Wed Jan 12, 2005 12:06
Location: England
Contact:

Re: Image Buttons

Postby CrazyEddie » Sun Jan 10, 2010 20:52

Ummm, ok.

What is the full function signature for GameState::fireball - it has to match 'bool function(const CEGUI::EventArgs&)' - and is the 'this' in the subscribe line an instance of GameState?

CE.

dave2041
Just popping in
Just popping in
Posts: 3
Joined: Sun Jan 10, 2010 11:16

Re: Image Buttons

Postby dave2041 » Sun Jan 10, 2010 23:40

Ty for your patience. This is what i needed to understand. Works beautifully


Return to “Help”

Who is online

Users browsing this forum: Majestic-12 [Bot] and 15 guests