ListBox item



I just wondering if there is an easier way to get a listbox row from mouse position?
The code I worked out is as follow but seems a bit “overdressed” for that job:

void mouseMove(const MouseEvent &e)        
         Component *undermouse = dynamic_cast <Component*> (e.source.getComponentUnderMouse());

	if (undermouse != 0)
		ListBox *list = dynamic_cast <ListBox*> (undermouse->findParentComponentOfClass ((ListBox*) 0));
		if (list != 0)
			Point <int> source;
			source.setXY(e.x, e.y);
			Point <int> target = undermouse->relativePositionToOtherComponent(list, source);
			setProgressBarText(String(list->getRowContainingPosition(target.getX(), target.getY())));



Erm, ListBox::getRowContainingPosition() perhaps?


I use getRowContainingPosition() in my code but the x,y coordinates coming from the mouselistener callback
are not always generated by the listbox because the nested ListBoxRowComponents seem to send their own coordinates if you move
the mouse over around it. Therefore I should do this coordinates conversion, shouldn’t I?