define an event for a QuickGUI::Image

rekotc

18-07-2010 20:59:05

i've a list of QuickGUI::Image and i want to know if it's possible to define an even so that when i click on an pic i can get the image name and put it into a text area, the image name was defined using the imgDescriptor and the image_imageName attribute.

thanks! :)

rekotc

18-07-2010 21:23:28

ok with this code i get the name of the widget:

const QuickGUI::MouseEventArgs& mouseEventArgs = dynamic_cast<const QuickGUI::MouseEventArgs&>(args);

QuickGUI::Widget* wd = mouseEventArgs.widget;
Ogre::String stringa = wd->getName();


i guess now i simply have to put the String in my textArea! :)

rekotc

18-07-2010 21:47:58

i tried with

charName->clearText();
charName->addText("test");


where charName is a TextArea, but i cant see the word "test" in the textArea..

kungfoomasta

19-07-2010 18:27:05

Hm, that should work. I wonder what the default font is. Can you try adding text with a specified font? What about trying the setText API, does it display text then?

rekotc

19-07-2010 23:08:24

the default font is micross.12, anyway i solved it :D...using setText :
segments.push_back(QuickGUI::TextSegment("micross.12",QuickGUI::ColourValue::Black,name));
charName->setText( segments );


it works if i use segments, while it doesnt with String, im wondering why...anyway im happy thanks:D