Set a value for a Button

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

matt
Not too shy to talk
Not too shy to talk
Posts: 37
Joined: Tue Nov 08, 2011 16:00

Set a value for a Button

Postby matt » Mon Nov 28, 2011 17:32

Hello!

I have an array of buttons, and I'd like to catch some values of these buttons when I click on them.
And I'd like to change these values sometimes so they are not static.

I've looked in the properties list of a the button class(http://cegui.org.uk/static/WindowsLookProperties.html#ID) to find something like "value" for the buttons, but it seems that it doesn't exist.

Is their a good mean to give a value (let say an int or a float) for each button?

Thanx for your help

Jamarr
CEGUI MVP
CEGUI MVP
Posts: 812
Joined: Tue Jun 03, 2008 23:59
Location: USA

Re: Set a value for a Button

Postby Jamarr » Mon Nov 28, 2011 17:52

There are many different ways you can approach this.

Normally, I think that people use the Window::setUserData() / Window::getUserData() approach.

If you really want to use a Property you can create your own Property object and add a property to a class via the Window::addProperty() method.

As an alternative approach you could create your own hashtable to store a key:value pair, using the object pointer as the key.

HTH
If somebody helps you by replying to your thread, upvote him/her as a thanks! Make sure to include your CEGUI.log and everything you tried when posting! And remember that we are not magicians!

matt
Not too shy to talk
Not too shy to talk
Posts: 37
Joined: Tue Nov 08, 2011 16:00

Re: Set a value for a Button

Postby matt » Tue Nov 29, 2011 10:38

Thanx Jamarr, it works perfectly with Window::setUserData() / Window::getUserData() !


P.S. I can't find the "solved" button? :?


Return to “Help”

Who is online

Users browsing this forum: No registered users and 6 guests