Custom ListBox, mouse help


suppose I’ve this class:

[code]class Foo :
public ListBox,
public ListBoxModel
Foo(const String& componentName) : ListBox(componentName, NULL)
setModel((ListBoxModel *)this); // NOT SURE IF THIS IS CORRECT

	int getNumRows();
	void paintListBoxItem(int rowNumber, Graphics& g, int width, int height, bool rowIsSelected);
	void mouseDown(const MouseEvent& e);
	void mouseDoubleClick(const MouseEvent& e);

I’ve miss something about how things works.
If I don’t add setModel() , mouse function are catched, but paint doesn’t works, and I think this is normal because no model is assigned so is assumed that nothing should be drawn.
With setModel(), paint works (of course), but mouse is not catched up.
Why ?

Thanks, Lude.

That should work fine.

But normal mouse events don’t go to your ListBox - they land on the row components inside it. Either use the mouse callbacks provided by the model, or write a custom row component to catch them.

Ok, listBoxItemDoubleClicked and listBoxItemClicked, it works, and I must admit that was not too difficult.
Thank you for your time.