Closed GoogleCodeExporter closed 8 years ago
See Button.resizeToContents()... If you need more room, call
Button.setMargins(t,l,b,r) ... If you need something more customized, override
Button.resizeToContents().
A lot of Widgets have resizeToContents or resizeToWidth.
Original comment by joshua_l...@hotmail.com
on 13 May 2012 at 2:16
The code is:
void Button::resizeToContents()
{
int w = getFont()->getTextWidth(getText()) +
getMargin(SIDE_LEFT) + getMargin(SIDE_RIGHT);
int h = getFont()->getLineHeight() +
getMargin(SIDE_TOP) + getMargin(SIDE_BOTTOM);
setSize(w,h);
}
Original comment by josh.lar...@gmail.com
on 13 May 2012 at 3:15
Thanks for the nice answer and the fact it is implemented nicely :)
Original comment by kovarex
on 19 May 2012 at 8:36
Original issue reported on code.google.com by
kovarex
on 13 May 2012 at 11:51