Trouble traversing TableListBox cell components


#1

I have a TableListBox containing Components in many of the cells, one of which is a Label. I am trying to set up tab focus traversal, such that hitting tab will bring the Label in the row below into focus.

Component* myTable::refreshComponentForCell (int rowNumber, int columnId, bool isRowSelected, Component* component)
{
    Label* cellLabel = (Label*) component;

    if (cellLabel == nullptr && columnId == kLabelColumn)
    {
        cellLabel = new Label ("cellLabel");
        cellLabel->setExplicitFocusOrder (rowNumber + 1);
        
        return cellLabel;
    }
}

But hitting the tab button just resumes its traversal around the other components on my GUI. If I call

then no traversal happens. Is there something I’m missing here?

Thanks,


#2

This happens with v1.5.3 on Windows. I have written a test application on Mac using the latest version of juce in the repo and behaviour is consistent.


#3

Are you using the git repository, or the Sourceforge download (I think the latter)? JUCE is now at v2.0.18…


#4

See http://www.rawmaterialsoftware.com/viewtopic.php?f=12&t=7660 for details.


#5

2-0-18 from the git repo. I am using 1-5-3 on Windows and the behaviour is the same.

I am really relying on the tab key to increase speed of workflow, so its kind of essential it’s included as a feature. And having the labels contained in TableListBox cells is a massive convenience for sorting, re-ordering and row selection purposes.

Any help appreciated!

Cheers,


#6

OK, so I’ve been experimenting and none of the hacks I’ve tried work/ are elegant enough to warrant implementation. Decided to write my own custom component to circumvent the issue.

Although not essential, tabbing between row/ cell components would be useful feature, especially if the components are intended to be editable.


#7

There are probably ways it could be done neatly using a custom KeyboardFocusTraverser, but would require some tinkering to find out exactly what needs to be done.