Widgets and ChildAnchors
| Chapter 10. TextView |

## Widgets and ChildAnchors

You can embed widgets, such as `Gtk::Button`s, in the text. Each such child widget needs a `ChildAnchor`. ChildAnchors are associated with `iterators`. For instance, to create a child anchor at a particular position, use `Gtk::TextBuffer::create_child_anchor()`:

    Glib::RefPtr<Gtk::TextChildAnchor> refAnchor =
        refBuffer->create_child_anchor(iter);

Then, to add a widget at that position, use `Gtk::TextView::add_child_at_anchor()`:

    m_TextView.add_child_at_anchor(m_Button, refAnchor);

Reference

Chapter 10. TextView |  | Examples