ListBox backgroundClicked doesnt work

Hey guys

I have a standard class which looks as follows:

class StoryListBox2 : public ListBox, public ListBoxModel {

Nothing drastic has been changed, although I have defined my own listBoxItemClicked function. My problem is I am struggling to get the class to register when I have clicked off of all the rows. The function backgroundClicked() actually does nothing on my side. Is there something I’m forgetting? And a note for Jules, why does backgroundClicked() work on double clicks?

Basically what I want to do is when a user has a row selected and they click on some blank space, I want all rows to deselect.

Please assist.

Go into the code in juce_ListBox.cpp, and search for the bit of code that actually calls backgroundClicked(). Put in a breakpoint, debug it, and trace into the call, to see why it’s not hitting your code. Normally when you trace through like this, the reason why it’s failing becomes blindingly obvious.

Placed a breakpoint in this function

void mouseUp (const MouseEvent&) { if (owner.getModel() != 0) owner.getModel()->backgroundClicked(); }

Yet it actually doesn’t get called whatsoever.

Then you must be clicking on one of the rows. Are some of your rows blank?

I’m actually trying to click on the space at the end of the rows where there is nothing.

ok, there’s something not working there. I’ll sort it out, but you could just use the ListBox’s mouseUp callback to catch the event in the meantime.