I have I window. In this window I want two buttons. One will be a plug and the other is just normal.
I do the following
plug.cc
#include <gtkmm.h>
#include <gtkmm/plug.h>
class PlugButton : public Gtk::Plug{
public:
PlugButton(){add(button); id = get_id();}
int id;
Gtk::Button button{"Plug Button"};
}
main.cc
Gtk::HBox box;
Gtk::Button button{"Normal Button"};
Gtk::Socket socket;// I have included gtkmm/socket.h
PlugButton plug;
box.pack_start(button);
box.pack_end(socket);
socket.add_id(plug.id);
window.add(box);
window.show_all_children();
This compiles but I get
gtk_socket_add_id: assertion '_gtk_widget_get_anchored (GTK_WIDGET (socket))' failed
How can I embed the instance of Gtk::Plug in the socket?
As written in documentation:
So your code should be: