* Use get_group() to retrieve this group and pass it to other radio buttons to assign
* them to this group.
I've given the suggested work-around a try, and have run into a slightly different problem. Instead of having all buttons in the group permently pressed, its starts out as one pressed, however, when I press another button, the first does not become 'un-pressed'. It does eventually become unpressed as i press more buttons though.
Here's the code I'm working from. If anyone can see what I'm doing wrong that'd be great. ty
#include <gtkmm.h>
class MyToolbar : public Gtk::Toolbar
{
public:
MyToolbar()
{
set_toolbar_style( Gtk::TOOLBAR_ICONS );
m_center = new Gtk::RadioToolButton( m_group, Gtk::Stock::JUSTIFY_CENTER );
m_group = m_center->get_group();
m_left = new Gtk::RadioToolButton( m_group, Gtk::Stock::JUSTIFY_LEFT );
m_right = new Gtk::RadioToolButton( m_group, Gtk::Stock::JUSTIFY_RIGHT );
append( *m_center );
append( *m_left );
append( *m_right );
}
private:
Gtk::RadioButtonGroup m_group;
Gtk::RadioToolButton* m_center;
Gtk::RadioToolButton* m_left;
Gtk::RadioToolButton* m_right;
};
class ToolWindow : public Gtk::Window
{
public:
ToolWindow()
{
set_border_width(10);
set_default_size( 300, 200 );
m_vbox.pack_start( m_toolbar, Gtk::PACK_SHRINK );
add( m_vbox );
show_all_children();
}
protected:
Gtk::VBox m_vbox;
MyToolbar m_toolbar;
};
int main( int argc, char* argv[] )
{
Gtk::Main kit(argc, argv);
ToolWindow window;
Gtk::Main::run( window );
return 0;
}