Re: Tags in Textview
- From: mike lear <mikeofthenight2003 yahoo com>
- To: Ian Martin <martin_id vodafone co nz>, "gtkmm-list gnome org" <gtkmm-list gnome org>
- Subject: Re: Tags in Textview
- Date: Wed, 30 Jul 2014 07:34:41 -0700
Hi Ian,
Thanks for the info it has made it a lot clearer.
Cheers Mike Lear
On Wednesday, 30 July 2014, 11:08, Ian Martin <martin_id vodafone co nz> wrote:
HI Mike,
Text Tags are applied to the TextBuffer, once the text is loaded
into it. I use the Gtk::TextBuffer::create_tag() function, so the
tag is created and added to the textbuffer immediately, which
seems more convenient than constructing the tag and then adding it
to the buffer separately.
some sample code:
Gtk::TextView* AView = Gtk::manage(new Gtk::TextView());
Glib::RefPtr< Gtk::TextBuffer > ABuff =
AView->get_buffer();
Glib::RefPtr<Gtk::TextBuffer::Tag> refTagBold =
ABuff->create_tag();
refTagBold->property_weight() = Pango::WEIGHT_ULTRABOLD;
//set the text in the buffer, and identify what you want to
apply a tag to; then:
Gtk::TextBuffer::iterator start_it =
ABuff->get_iter_at_offset(start_of_highlight);
Gtk::TextBuffer::iterator end_it =
ABuff->get_iter_at_offset(end_of_highlight);
ABuff->apply_tag(refTagBold, start_it, end_it);
Ian.
On 25/07/14 18:20, mike lear wrote:
Hello,
As a fairly newcomer to gtkmm.
I wonder if someone could point me in the use of tags in a
textview window.
I have a vector of strings that I wish to show in column
form, similar to say
the unix ls command.
I have examined the Textview::Tagtable in Dev help but I
am still not sure
how to place these tags in the intended buffer.
Thankyou
Mike Lear
_______________________________________________
gtkmm-list mailing list
gtkmm-list gnome org
https://mail.gnome.org/mailman/listinfo/gtkmm-list
_______________________________________________
gtkmm-list mailing list
gtkmm-list gnome orghttps://mail.gnome.org/mailman/listinfo/gtkmm-list
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]