SOLVED Label::setEditable(true) breaks another label in a different component

I’ve encountered an odd problem with Label::setEditable(). I have a main component with a number of child components. Each child component has its own set of labels, some of which are class members, and some of which are dynamically created via OwnedArray::add().

I have a situation wherein I created a set of labels in one component class, with setEditable(true), which were all working until I added (in a completely separate component class) code calling setEditable(true) on a label stored in the OwnedArray of the other class. I’m confused as to how the label stored in a different component class causes this problem, even if it was dynamically created using OwnedArray::add(new Label).

The problem goes away when I comment out the setEditable(true) statement for that label. It’s also worth noting that the label causing the problem works correctly (can be edited) and behaves as I would expect it to.


UPDATE: I decided to create a stripped down code example to illustrate the problem, but was unable to reproduce it in the simplified code. So there must be some other problem in my original code. I’m looking into that now. But if anyone has an idea of what might be going on, something that would help focus my debugging efforts, I’m all ears…

SOLUTION: Another component was grabbing keyboard focus from within a timer callback. This made it appear as though the label was not editable. Altering the timer callback fixed the problem. Apologies for failing to discover this prior to creating the original post.

1 Like