Rollover effect on text boxes


18-12-2007 13:30:11

With the previous version of quick gui (the 0.97 pre release before the SVN updates), for make a rollover effect on text box i did setTexture("image.png"), but now this option isn't available.
so, since in the forum there's a thread that explain a metod to change for example the texture of a button with the function setSkinComponent(".image.png") i tryed that, but the application crashes when i go over the text box.

this is the trunk of code (i don't remember the exact code...but this is similar...):

textBox = win->createTextBox();
textBox->setText("example text");
textBox->addEventHandler(MOUSE_ENTER, &MyClass::mouseEnter, this);
textBox->addEventHandler(MOUSE_LEAVE, &MyClass::mouseLeave, this);

for the event handlers:

void mouseEnter(const ... &args)

void mouseLeave(const ... &args)

i tryed also to change the entire skin and all goes, but when i go over the text box appear also the text cursor (i don't want it to appear...). if i delete the cursor image for the over status, it crashes...


18-12-2007 17:04:10

... you do realize you're trying to make a text box look like an image, right?

All widgets have certain rules for the images that it accepts. Why would you want a textbox to look like an image? Try making a separate Image Widget at the same location, and hide/show each, to get the same effect.


18-12-2007 18:47:53

ok, but basically i want to make a rollover effect with the background image of the text box changed like a button, but maintaining the functionalities of the text box (accept text in input)...with setSkinComponent don't go...
like you said, how can i do this effect with an image?i must create the image with the material like in the demo application?


18-12-2007 19:02:21

Ok, that makes more sense now. One thing I overlooked, you shouldn't include the extension as part of the skin component.

setSkinComponent(".someimage") will work, for example. Do not include ".png", ".jpg", ".xyz" extensions.

If you are going to change the skin component, make sure you have defined all needed images. For the textbox:


You can try setting the skin component without having the other required files, but I can't predict the result..


18-12-2007 21:17:27

thank you for the quick reply. i will try to change the skin component both with all images and without and then post the results...

Edit: i've tryed to do the "rollover" with the complete set of images, but when i exit from the window (that contains the text box) with the mouse the application crashes...