Re: Reparent command problem



Hello all,

Since posting this request I had time to go back over my code. I
discovered that I don't need to add the vbox. So removing that line
of code and the reparent line. The code then compiles with no
errors.
I am not sure yet how to close down this posting. But  I do not now
require any assistance on this subject.

regards Mike
On Thursday, 3 April 2014, 10:35, mike lear <mikeofthenight2003 yahoo com> wrote:
Hello,
    I am a newcomer to Gtkmm and this mailing list, I have a question
regarding the use of the reparent command using gtkmm-3.
I am attempting to add several text labels to the MessageDialog. I wish
to position these labels below the dialog-secondary text using a grid
to achieve this. The following snippet of code works but gives the
following warning.
Gtk-WARNING **: Attempting to add a widget with type GtkBox to a container
of type gtkmm__GtkWindow, but the widget is already inside a container of
type GtkBox, please use gtk_widget_reparent()

I understand that the format for the reparent function is
 gtk_widget_reparent(original widget,new widget);

I am trying to reparent the MessageDialog's vertical box with my new one
Every attempt I have made so far has failed...

//Snippet of my code
// The true in Messagedialog is becuse the Message string contains pango markup
Gtk::MessageDialog dialog(*this,Message->c_str(),true,Gtk::MESSAGE_INFO,Gtk::BUTTONS_CLOSE);

    // some text labels that I wish to add to the MessageDialog
    Gtk::Label *label1 = Gtk::manage(new Gtk::Label("some text"));
    Gtk::Label *label2 = Gtk::manage(new Gtk::Label("some more text"));

    // then the box and grid I wish to add
      Gtk::Grid *grid = Gtk::manage(new Gtk::Grid);
     Gtk::Box *vbox = Gtk::manage(new Gtk::Box(Gtk::ORIENTATION_VERTICAL, 0));

    vbox = dialog.get_message_area(); // make vbox the new message area

    // The next line of code is where I have the problem.
    gtk_widget_reparent(???,???);   //What do I place here ?

    add(*vbox);                       // add the new vbox
    vbox->add(*grid);                 // then the grid
    grid->attach(*label,0,2,1,1);     // finally position the labels
    grid->attach(*label,1,2,2,1);

dialog.set_secondary_text("secondary text");

     vbox->show_all();                 // display it
dialog.run();

I would appreciate any pointers on how I can achieve this.
Thank you.

_______________________________________________
gtkmm-list mailing list
gtkmm-list gnome org
https://mail.gnome.org/mailman/listinfo/gtkmm-list




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