Re: [gtkmm] some help needed for a standard process



While my experience in this area actually comes from perl-gtk2, this may
actually help.  When using the FileSelection widget, I just do a
show_all, and attach signals to the ok and cancel button, both of which
actually destroy the widget.

When using a plain Dialog (like for warning message) I use run, but when
I return from the run(), I still have to destroy the widget.

So perhaps you still need to destroy the widget.

On Thu, 2004-03-18 at 17:03, Andreas B. Thun wrote:
> Thx, Carl!
> 
> Actually, the ctor of FileSelection creates the Gtk::FileSelection:
> m_Dialog = new Gtk::FileSelection(title);
> 
> What is my problem?
> 
> 
> 
> FileSelection::FileSelection(const string& title)
> {
>    m_Dialog = new Gtk::FileSelection(title);
>    m_Dialog->set_transient_for(*this);
>    m_Dialog->set_select_multiple(false);
>    m_Dialog->hide_fileop_buttons();
>    m_Dialog->set_filename("constraints.dat");
> 
>    int response = m_Dialog->run();
>    switch(response)
>    {
>      case(Gtk::RESPONSE_OK):
>      {
>        m_selectedFile = string(m_Dialog->get_filename());
>        break;
>      }
>      case(Gtk::RESPONSE_CANCEL):
>      {
>        m_selectedFile = "";
>        break;
>      }
>    }
> }
> 
> 
> > Suggestion:  this seems like it would be better as has-a instead of
> > is-a.  Let FileSelection::ctor create the Gtk::FileSelection. 
> > getSelectedFile() can hook up the signals to destroy the Gtk::FileSel at
> > the appropriate time, and then call the run() on the filesel.  It can
> > also hook up the signal to grab the filename to be returned after run()
> > is done.
> > 
> > 
> > 
> 
> 
> _______________________________________________
> gtkmm-list mailing list
> gtkmm-list gnome org
> http://mail.gnome.org/mailman/listinfo/gtkmm-list




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