Re: align middle button's labels
- From: Kjell Ahlstedt <kjell ahlstedt bredband net>
- To: kiet tran <vietory2g gmail com>
- Cc: gtkmm-list gnome org
- Subject: Re: align middle button's labels
- Date: Wed, 07 Dec 2011 15:30:25 +0100
2011-12-07 02:13, kiet tran skrev:
Hi,
Is there way to align buttons labels to the centre of the button,
where that button has more than 1 line text.
cheers,
Kiet Tran
A Gtk::Button is a Gtk::Bin, and the button's label is its child widget.
Gtk::Button::get_child() (actually the inherited Gtk::Bin::get_child())
returns a pointer to the label.
Then you can use all the methods of the label, e.g. set_line_wrap() and
set_justify().
Example:
Gtk::Label* pLabel = dynamic_cast<Gtk::Label*>(m_button1.get_child());
if (pLabel)
{
pLabel->set_line_wrap(true);
pLabel->set_justify(Gtk::JUSTIFY_CENTER);
}
else
{
??????
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]