Tooltips in tablemodel doesn't update

Hi there,

I have a problem with tooltips in tablemodel that are driving me ‘loca’

I have a table model that is working fine. Each row/column has a diferent label with diferent tooltips.

The problem is that if for example I’m in cell 1-4 and go to the one below (1-5), the tooltip doesn’t change (it shows me the 1-4 one), if i carry on going down it doesn’t update neither, allways shows the 1-4 tooltip… unless I take the mouse out of the datatable and put it back again. In that case if I go directly to the 1-5, it shows the proper tooltip.

That’s a little bit annoying because if i want to see the tooltips of a complete column i have to make jumps in&out my table.

The weird thing is that that behavior is only when i go through a column. If I move the mouse through the cells of a row, it works fine!!!

That’s how i set the tooltip…

Component* ProductStatusTableModel::refreshComponentForCell(int rowNumber, int columnId, bool isRowSelected, Component* existingComponentToUpdate)
{
if(ProductDatabase::Self()->GetDisplayItemCount() > 0)
{
/* other columns …*/
if(columnId==3)
{
if(existingComponentToUpdate)
deleteAndZero(existingComponentToUpdate);
Label *pLabel;
String latestLocalVersion;

			ProductData* pData = ProductDatabase::Self()->GetDisplayItemAtRow(rowNumber);
			pData->GetLocalVersionNumberAndStringLatest(latestLocalVersion);
			pLabel = new Label(T("local"), latestLocalVersion);
			pLabel->setTooltip(pData->GetProductVersionInformationString());
			pLabel->setColour(Label::backgroundColourId, Colours::black);

			return pLabel;
	}

/* other columns …*/
}

Help please!!
A

Sounds strange. Have you tried just using TableListBoxModel::getCellTooltip() instead?

Hi Jules,

I tried to make my Table as similar as the one you have in the juce example.

So I use the paintCell method for “// This is overloaded from TableListBoxModel, and must paint any cells that aren’t using custom components.” like Strings
and refreshComponentForCell method for “// This is overloaded from TableListBoxModel, and must update any custom components that we’re using” like 2 customized buttons
and also implemented the getCellTooltip…

Actually, I added this getCellTooltip implementation in your TableDemo.cpp just in case other bit of my code was affecting to the tooltip thing, but the same thing happens :frowning:

	const String getCellTooltip (int rowNumber, int columnId)
	{
		String ret = "";
		ret += rowNumber;
		ret += "-";
		ret += columnId;
		
		return ret;
	}

Do you have a clue of what can be wrong?

Gracias!
A

Ok, thanks, it was just a minor problem - the tip window wasn’t repainting unless its size changed - so it’s only because your example strings were all exactly the same length that you noticed. I’ve fixed it now.

YEY!!
That was it! Thank you :slight_smile:

A