[Gtk-sharp-list] Treeview Tooltip for each Row

Nicolas Krzywinski opensource at site7even.de
Tue Jan 17 23:10:41 UTC 2012


Hi Sven,

I ran into the exact same problem and found out how to solve it, try:

	int binX;
	int binY;
	trvMainCuesheet.ConvertWidgetToBinWindowCoords(args.X, args.Y, out binX, out binY);

and then something like..

	if (trvMainCuesheet.GetPathAtPos (binX, binY, out path, out col) && trvMainCuesheet.Model.GetIter (out iter, path))
	{
	    YourType YourVar = (YourType)trvMainCuesheet.Model.GetValue (iter, 0);
		...
	}

Good luck!
Nicolas


Am 17.01.2012, 21:23 Uhr, schrieb s.baus <s.baus86 at gmx.net>:

> Hello everybody,
>
> I'm currently working on an application, that can read out text files and
> make cuesheets out of them (more information on
> http://sourceforge.net/projects/audiocuesheet/
> http://sourceforge.net/projects/audiocuesheet/ ).
>
> For this, I use a treeview (named "trvMainCuesheet" )with a data model
> behind it called "lsCuesheetData".
>
> Now I need to have some tooltip for some rows (if there are errors, and so
> on). The tooltip text is stored inside the data model in a not seen column.
>
> Now use the following code, to view the tooltip:
>
> public void prepareTreeViewMainCuesheet()
> 	{
> 		try
> 		{
> 			this.lsCuesheetData = new
> ListStore(typeof(Track),typeof(int),typeof(string),typeof(string),typeof(string),typeof(string),typeof(string),typeof(Gdk.Pixbuf),typeof(string));
> 			
> [...]
> 				
> 			this.trvMainCuesheet.Model = lsCuesheetData;
>
> 			this.trvMainCuesheet.HasTooltip = true;
> 			this.trvMainCuesheet.QueryTooltip += queryTooltipTrvMainCuesheet;
> 		}
> 		catch(Exception)
> 		{
> 			throw new NotImplementedException();
> 		}
> 	}
>
> private void queryTooltipTrvMainCuesheet(object o, QueryTooltipArgs args)
> 	{
> 		try
> 		{
> 			TreePath tp;
> 			TreeIter ti;
> 			this.trvMainCuesheet.GetPathAtPos(args.X,args.Y,out tp);
> 			if (tp != null)
> 			{
> 				this.lsCuesheetData.GetIter(out ti,tp);
> 				if (this.lsCuesheetData.GetValue(ti,8) != null)
> 				{
> 					args.Tooltip.Text = this.lsCuesheetData.GetValue(ti,8).ToString();
> 					args.RetVal = true;
> 				}
> 			}
> 		}
> 		catch(Exception)
> 		{
> 			throw new NotImplementedException();
> 		}
> 	}
>
> My problem is, that I see the tooltip from the row above the one I should
> see the tooltip at. I could find out, that this is because in
> "trvMainCuesheet" I enabled the "HeadersVisible" option (because the headers
> describe the data inside).
>
> So, how can I get around this problem?
>
> Thanks for every help I get ;).
> Greetings
> Sven
>
> --
> View this message in context: http://mono.1490590.n4.nabble.com/Treeview-Tooltip-for-each-Row-tp4304618p4304618.html
> Sent from the Mono - Gtk# mailing list archive at Nabble.com.
> _______________________________________________
> Gtk-sharp-list maillist  -  Gtk-sharp-list at lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/gtk-sharp-list
>


-- 
Erstellt mit Operas revolutionärem E-Mail-Modul: http://www.opera.com/mail/


More information about the Gtk-sharp-list mailing list