[Gtk-sharp-list] textview
Michael Hutchinson
m.j.hutchinson at gmail.com
Mon Sep 1 11:48:49 EDT 2008
On Mon, Sep 1, 2008 at 11:04 AM, Darwin Reynoso <monouser at gmail.com> wrote:
> Hi,
> can someone please show me how to do translate this to gtk#
>
> update_statusbar(GtkTextBuffer *buffer,
> GtkStatusbar *statusbar)
> {
UpdateStatusbar (Gtk.TextBuffer buffer, Gtk.Statusbar statusbar)
> gchar *msg;
string msg;
> gint row, col;
int row, col;
> GtkTextIter iter;
Gtk.TextIter iter;
> gtk_statusbar_pop(statusbar, 0);
statusbar.Pop (0);
> gtk_text_buffer_get_iter_at_mark(buffer,
> &iter, gtk_text_buffer_get_insert(buffer));
iter = buffer.GetIterAtMark (buffer.InsertMark);
> row = gtk_text_iter_get_line(&iter);
row = iter.Line;
> col = gtk_text_iter_get_line_offset(&iter);
col = iter.LineOffset;
> msg = g_strdup_printf("Col %d Ln %d", col+1, row+1);
msg = string.Format ("Col {0} Ln {1}", col+1, row+1)
> gtk_statusbar_push(statusbar, 0, msg);
statusbar.Push (0, msg);
> g_free(msg);
//the GC handles this automatically
> }
>
> i need to get the line and col number of a textview
> _______________________________________________
> Gtk-sharp-list maillist - Gtk-sharp-list at lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/gtk-sharp-list
>
Or in short form:
UpdateStatusbar (Gtk.TextBuffer buffer, Gtk.Statusbar statusbar)
{
statusbar.Pop (0);
Gtk.TextIter iter = buffer.GetIterAtMark (buffer.InsertMark);
string msg = string.Format ("Col {0} Ln {1}", iter.Line + 1,
iter.LineOffset + 1);
statusbar.Push (0, msg);
}
--
Michael Hutchinson
http://mjhutchinson.com
More information about the Gtk-sharp-list
mailing list