[Gtk-sharp-list] textbuffer text as string with markup.
jmauster
evan.arnold at gmail.com
Sat Jun 13 13:03:29 EDT 2009
Hi guys,
I know it's silly to reply to my own text, but now that I've done some more
research, I think I should clarify the problem. Sorry if seeing this in your
inbox again is annoying.
I have a treeview and a textview with some simple markup being done like so:
protected virtual void OnBoldActionActivated (object sender,
System.EventArgs e)
{
TextIter startIter;
TextIter stopIter;
TextBuffer buffer = textNote.Buffer;
if (buffer.GetSelectionBounds(out startIter, out stopIter)) {
buffer.ApplyTag("bold", startIter, stopIter);
}
}
As some point, I create a data object like so:
TestObject testObj = new TestObj(textNote.Buffer.Text);
And the model for my treeview is a List<TestObject>.
The render method is written like this:
TestObject testObj = (TestObject) model.GetValue(iter, 0);
(cell as Gtk.CellRendererText).Markup = testObj.Text;
however - somewhere in there my markup is getting lost.
Any feedback would be very much appreciated! I know this has to be a pretty
basic question - so even a few pointers in the right direction would be very
well awesome!
Thanks,
jmauster wrote:
>
> Hi,
>
> Let's say I have a TextView called textNote. And let's say that there are
> some tags that have been applied (bold, italics).
>
> When I use this code in an eventhandler:
>
> string text = textNote.Buffer.Text;
> textNote.Buffer.Text = string.Empty;
> textNote.Buffer.Text = text;
>
> I end up losing the markup. Why is that? How can I preserve the markup in
> a string?
>
> Thanks,
>
> Evan
>
--
View this message in context: http://www.nabble.com/textbuffer-text-as-string-with-markup.-tp23991021p24014354.html
Sent from the Mono - Gtk# mailing list archive at Nabble.com.
More information about the Gtk-sharp-list
mailing list