Re: Derived Gtk::Dialog discomforts
- From: Dick Eimers <d eimers marin nl>
- To: gnomemm-list gnome org
- Subject: Re: Derived Gtk::Dialog discomforts
- Date: Wed, 25 Jan 2006 11:07:38 +0100
> [snip]
> > Now for my problem, this works just fine for windows derived from
> > GladeWindow, but there is an issue with GladeDialog as the response id
> > are not returned when clicked on the buttons in the 'action area' and
> > hence I have to add code like the following in every GladeDialog
> > derivative to fix it or wait for run() to return forever..
> >
> > Gtk::Button* button;
> > m_gladexml->get_widget("cancelbutton1", button);
> > button->signal_clicked().connect(
> > sigc::bind(sigc::mem_fun(*this,&SelectGroupAndProjectDialog::response),
> > Gtk::RESPONSE_CANCEL)
> > );
> > //etc. for all buttons..
> >
> > Any idea why this is not transfered from one dialog to another?
>
> This works fine with Glade derived dialogs for me. If you put a simple
> test case online then we can probably find the problem.
It works fine for me too, but only when I use to get_widget_derived
approach. Not when I use the reparent_widget approach implemented in the
GladeDialog class I was talking about in my previous post.
I'll paste the important parts of the GladeDialog, this may clarify how
I transfer properties and the widget-tree from dialogs to allow improved
encapsulation.
//.h
GladeDialog::GladeDialog(const std::string& gladexmlfile,
const std::string& root)
{
//obtain gui spec
try
{
m_gladexml = Gnome::Glade::Xml::create (gladexmlfile, root);
} catch(const Gnome::Glade::XmlError& e)
{
std::cout << "GladeDialog: " << e.what() << std::endl;
}
//adapt some properties and take over widgets
Gtk::Dialog* dialog = 0L; m_gladexml->get_widget(root, dialog);
//Widget ->
{
int width, height;
dialog->get_size_request(width, height);
this->set_size_request(width, height);
}
//Container ->
this->set_border_width(dialog->get_border_width());
//Bin ->
//Window ->
this->set_title(dialog->get_title());
this->set_type_hint(dialog->get_type_hint());
this->set_modal(dialog->get_modal());
{
int width, height;
dialog->get_default_size(width, height);
this->set_default_size(width, height);
}
this->set_resizable(dialog->get_resizable());
this->set_gravity(dialog->get_gravity());
//Dialog
// ..
this->remove(); //remove the one object contained in this 'Bin'
m_gladexml->reparent_widget (dialog->get_child()->get_name(),
*this);
delete dialog;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]