Re: Toggle button which enables GtkTextTag



I guess that to obtain this behaviour you have to connect to
keypresses and for each new entered character you have to
apply the tag(s).


On Thu, Nov 15, 2012 at 9:22 PM, Vlasov Vitaly <vnigtha gmail com> wrote:

  Here is my code: http://pastebin.com/ycbnmxw0

It's work on selection, but don't work as switch for "bold mode". Please
help me. What i need to do?

p.s. If you know applications that got same behavior, tell me about it.
I was searched in pidgin, but his source too big.

Ð ÐÑ., 08/11/2012 Ð 00:10 +0400, Vlasov Vitaly ÐÐÑÐÑ:
I created TextView with TextBuffer with TextTagTable, filled by my
TextTag's and ToggleButton.

With ToggleButton i want enable "mytag" mode. Button must work as like
in LibreOffice Writer. When i activate "bold mode" printing text will be
bold. And, if i disable "bold mode" printing text will be not tagged.

So, my pseudo-code ToggleButton activate callback:

GtkTextIter start;
GtkTextIter end;

gint cursor_offset;

if(buffer_has_selection)
{
  ... working code
}
else /* Enable my_tag mode here */
{
  if(button_is_active)
  {
   g_object_get(text_buff, "cursor-position", &cursor_offset, NULL);
   gtk_text_buffer_get_iter_at_offset(text_buff, &start, cursor_offset);
   gtk_text_buffer_apply_tag_by_name(text_buff, "mytag", &start, &end);
  }
}

It does not work. Printing text still untagged.
I am on right way?
How to make this button?



_______________________________________________
gtk-app-devel-list mailing list
gtk-app-devel-list gnome org
https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]