Add Gtk::TextView to Gtk::Grid
Bill Greene via gtkmm-list <[email protected]> Wed, 5 Oct 2022 11:00:05 -0400
| Newsgroups | gmane.comp.gnome.gtkmm |
|---|---|
| Message-ID | <CABUrC_b5T8p5WQpmpnG4B9U9hNx5r9t6N0P6WScwH8GRgfc48w@mail.gmail.com> |
--===============3160588955977048562==
Content-Type: multipart/alternative; boundary="0000000000000df76e05ea4ad76d"
--0000000000000df76e05ea4ad76d
Content-Type: text/plain; charset="UTF-8"
I am trying to add a TextView instance to a Grid. But when I display the
window, it is
empty. The Grid examples I have seen add buttons to the grid and these work
fine
for me. But I don't understand the difference between adding a button and
adding
a TextView. If anyone can help me with this, I would appreciate it.
Here is my sample code (part of the constructor for my window):
set_child(m_grid);
Gtk::TextView tc;
Glib::RefPtr<Gtk::TextBuffer> tb = Gtk::TextBuffer::create();
std::string msg("cell 1,1");
auto it = tb->insert(tb->begin(), msg);
tc.set_buffer(tb);
m_grid.attach(tc, 0, 0);
m_grid.set_visible();
--0000000000000df76e05ea4ad76d
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr">I am trying to add a=C2=A0TextView instance to a Grid. But=
when I display the window, it is<div>empty. The Grid examples I have seen =
add buttons to the grid and these work fine</div><div>for me. But I don'=
;t understand the difference between adding a button and adding</div><div>a=
TextView. If anyone can help me with this, I would=C2=A0appreciate it.</di=
v><div><br></div><div>Here is my sample code (part of the constructor for m=
y window):</div><div><br></div><div>=C2=A0 set_child(m_grid);</div><div>=C2=
=A0 Gtk::TextView tc;<br>=C2=A0 Glib::RefPtr<Gtk::TextBuffer> tb =3D =
Gtk::TextBuffer::create();<br>=C2=A0 std::string msg("cell 1,1");=
<br>=C2=A0 auto it =3D tb->insert(tb->begin(), msg);<br>=C2=A0 tc.set=
_buffer(tb);<br>=C2=A0 m_grid.attach(tc, 0, 0);<br>=C2=A0 m_grid.set_visibl=
e();<br></div><div><br></div></div>
--0000000000000df76e05ea4ad76d--
--===============3160588955977048562==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline
_______________________________________________
gtkmm-list mailing list
[email protected]
https://mail.gnome.org/mailman/listinfo/gtkmm-list
--===============3160588955977048562==--