Re: [gtk-list] Getting the selection from GtkText





Anders Melchiorsen wrote:
> 
> Isn't there a simple way to get the selection from a GtkText widget? I
> am thinking of something with an interface as simple as
> gtk_editable_select_region() but I cannot seem to find anything?

If you want to know whether there is a active selection in the widget
use
--
  guint      has_selection : 1;
--
from GtkEditable (GtkText "inherits" from GtkEditable).

The start and end position of the selection (if there is one) can be
accessed via
--
  guint      selection_start_pos;
  guint      selection_end_pos;
--
also from GtkEditable.

Try something like: 
--
GTK_EDITABLE (my_text_widget)->has_selection
GTK_EDITABLE (my_text_widget)->selection_start_pos
GTK_EDITABLE (my_text_widget)->selection_end_pos
--

hope this helps (and is correct :),
Andreas



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