Re: [gtkmm] switching styles impossible?



> It would be a lot easier if you showed the exact code you are having
> problems with. I can't make it segfault here.

The most important parts of my code look (much) like this:
int main(int argc, char **argv)
{   
   Gtk::Main m(&argc, &argv);
   mainwindow *mymainwindow = manage(new mainwindow());
   m.run()
}

class mainwindow : public mainwindow_glade
{   
        friend class mainwindow_glade;
        ...
        void on_startbutton_clicked();
        ...
public:
        mainwindow();
}        

void mainwindow::on_startbutton_clicked()
{
     Style *t = Style::create();
     t->set_fg(GTK_STATE_NORMAL, Gdk_Color("blue"));
     startbutton->set_style(*t); // SEGFAULTing here
     ...
}
and the constructor of the base class mainwindow_glade
looks about this:
mainwindow_glade::mainwindow_glade() : Gtk::Window(GTK_WINDOW_TOPLEVEL)
{   
   Gtk::Window *mainwindow = this;
   ...
   Gtk::Button *startbutton = manage(new class Gtk::Button("Start"));
   Style *s = Style::create();
   s->set_fg(GTK_STATE_NORMAL, Gdk_Color("green"));
   startbutton->set_style(*s); // this works fine
   startbutton->show();
   mainwindow->show();
}
 
That's it. Somewhere in there must be a bug. Maybe you know it?
Thanks in advance,
bye,
Michael.

  



-- 
GMX - Die Kommunikationsplattform im Internet.
http://www.gmx.net




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]