How can I make a button with a set size

For help with anything that CEGUI doesn't offer straight out-of-the-box, e.g.:
- Implementation of new features, such as new Core classes, widgets, WindowRenderers, etc. ...
- Modification of any existing features for specific purposes
- Integration of CEGUI in new engines or frameworks and writing of new plugins (Renderer, Parser, ...) or modules

Moderators: CEGUI MVP, CEGUI Team

SamBarham
Just popping in
Just popping in
Posts: 5
Joined: Tue Oct 17, 2006 03:46

How can I make a button with a set size

Postby SamBarham » Wed Oct 25, 2006 21:59

I have a bunch of buttons, each on uses an image in the imageset that is 100 pixels square. When I create the buttons (through Lua, not that that matters), I wnat the buttons to always be 100 pixels square (no stretching for anything). It seems to me taht it should be possible in this case to not need to call setSize() for each button, and just have them use the size of their image to define the size of the button, but I have no idea how to do this.

Any suggestions?

User avatar
CrazyEddie
CEGUI Project Lead
Posts: 6760
Joined: Wed Jan 12, 2005 12:06
Location: England
Contact:

Postby CrazyEddie » Thu Oct 26, 2006 13:39

For sizing a button to an arbitrary image, the required support is not there at moment; at least not in an ideal way (though I have made a note of an idea related to this).

However, since you know that the button needs to be 100 pixels, you can actually create a 'skin' for the button that defaults to that size. You do this by using a "Property" specifier element in the LookNFeel XML file. So in that button WidgetLook you would just have something like:

Code: Select all

<Property name="UnifiedSize" value="{{0,100},{0,100}}" />


This would make all the buttons start life as 100 pixels square.

HTH

CE.


Return to “Modifications / Integrations / Customisations”

Who is online

Users browsing this forum: No registered users and 14 guests