[Gtk-sharp-list] Text Under Pointer in a Gtk.TextView
Mon, 09 Aug 2004 23:48:37 -0500
Thanks for the hints. They definitely pointed me to the right places.=20
It appears to boil down to something like this:
this.GdkWindow.GetPointer(out xloc,out yloc,out mask);
TextIter ti =3D this.GetIterAtLocation(xloc,yloc);
Its *close* but only appears to be off by compound tools featured in the
editor. If I figure out the reason for the X offset (the Y/line is
right) then all I need to do to capture the word under the pointer is
move forward to the next whitespace. This is what I needed and
hopefully I can solve this last stumbling block.
On Mon, 2004-08-09 at 11:05, Todd Berman wrote:
> 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? Ha=
> > 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.
> Gtk-sharp-list maillist - Gtkfirstname.lastname@example.org
Content-Type: application/pgp-signature; name=signature.asc
Content-Description: This is a digitally signed message part
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (GNU/Linux)
-----END PGP SIGNATURE-----