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

s.baus s.baus86 at gmx.net
Tue Jan 17 20:23:01 UTC 2012


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.


More information about the Gtk-sharp-list mailing list