Page 1 of 1

Set a value for a Button

Posted: Mon Nov 28, 2011 17:32
by matt
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

Re: Set a value for a Button

Posted: Mon Nov 28, 2011 17:52
by Jamarr
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

Re: Set a value for a Button

Posted: Tue Nov 29, 2011 10:38
by matt
Thanx Jamarr, it works perfectly with Window::setUserData() / Window::getUserData() !


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