What is this MouseButtonClick happen?

zzzgundum2003

13-10-2013 12:31:27

First , this is my code.

void EraofPowers::drawTopBar(void)
{
MyGUI::StaticImagePtr topBar = myGUI->createWidget<MyGUI::StaticImage>("StaticImage", MyGUI::IntCoord(), MyGUI::Align::Default, "Main");
topBar->setSize(winWidth, 36);
topBar->setPosition(0, 0);
topBar->setImageTexture("top_bar.png");
}

void EraofPowers::drawTimeButtons(int x, int y)
{
MyGUI::StaticImagePtr pauseButton = myGUI->createWidget<MyGUI::StaticImage>("StaticImage", x, y, 32, 32, MyGUI::Align::Default, "Main");
pauseButton->setImageTexture("faster_button.png");
pauseButton->eventMouseButtonClick = MyGUI::newDelegate(this, &EraofPowers::onTimeSpeedButtonClick);
}

void EraofPowers::onTimeSpeedButtonClick(MyGUI::Widget* _sender)
{
timeText->setCaption("OOOOOOOOOOOOOOO");
}


There is nothing happen when I click the image.
[attachment=1]1.jpg[/attachment]

but when I change the image outside the top bar, the click was detected, why?
And how should do that the click can be detected when the image is inside the topbar?
MyGUI::StaticImagePtr pauseButton = myGUI->createWidget<MyGUI::StaticImage>("StaticImage", x, 50, 32, 32, MyGUI::Align::Default, "Main");
[attachment=0]2.jpg[/attachment]