[Gtk-sharp-list] Text Under Pointer in a Gtk.TextView

Todd Berman tberman@off.net
Mon, 09 Aug 2004 12:05:23 -0400


On Mon, 2004-08-09 at 01:50 -0500, Tomar wrote:
> Is there a better than brute force way of getting "the word" under the
> point for the Gtk.TextView?  At the moment the best shot I think I have
> of figuring this is out a brute force, word by word by point test which
> isn't all that appealing.  Has anyone tried and solved this before?  Has
> anyone got any hints on what I should be trying instead?
> 
> Thanks,
> Tom Larsen

Yes, but its nasty. I dont have the exact calls here, but let me try to
give an overview of what you are looking for.

First you need to grab the mouse coords, and check to make sure they are
inside the textview. Not just the textview though, but the textview's
TEXT_WINDOW GdkWindow. There is some nice textview api for getting the
proper window.

Then you need to convert the widget coords into buffer coords (again,
api exists to do this).

Then there is a func that takes coords, and returns a text iter.

I think that is how you should be doing it, and am not sure. but it is a
starting point.

--Todd