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

Tomar tomar@apricot.com
Mon, 09 Aug 2004 23:48:37 -0500


--=-QnFgXJC8brHkTtT8VUJn
Content-Type: text/plain
Content-Transfer-Encoding: quoted-printable

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.

Thanks again,
Tom Larsen



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=
s
> > anyone got any hints on what I should be trying instead?
> >=20
> > Thanks,
> > Tom Larsen
>=20
> 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.
>=20
> 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.
>=20
> Then you need to convert the widget coords into buffer coords (again,
> api exists to do this).
>=20
> Then there is a func that takes coords, and returns a text iter.
>=20
> I think that is how you should be doing it, and am not sure. but it is a
> starting point.
>=20
> --Todd
>=20
> _______________________________________________
> Gtk-sharp-list maillist  -  Gtk-sharp-list@lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/gtk-sharp-list
--=20
Tomar <tomar@apricot.com>

--=-QnFgXJC8brHkTtT8VUJn
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)

iD8DBQBBGFOkKaYNoZecAvQRArhHAJ9+yzOFue96OK/xI00DV4gD7zsSUQCeOXzU
Vw8xrrNcM6jxJnQbg0CkaCw=
=HgAi
-----END PGP SIGNATURE-----

--=-QnFgXJC8brHkTtT8VUJn--