(another) enablement problem


#1

I haven’t tracked to the bottom of this, but I’ve been having a problem enabling a tab within a tab.

In the Parent tab’s visibilityChanged() routine, I call setEnabled(false),if the tab is no longer visible. Similarly, I call setEnabled(true), when the tab becomes visible again. When I setEnabled(true), the components on the child tab component show, but are all disabled.

If, on the other hand, I first do a getCurrentContentComponent() to locate the subtab, set the subtab to be enabled, and then enable the parent tab, the subtab seems to enable properly.

Has anyone else seen this behavior?

As an aside, all this enabling and disabling has come about because each tab has a large number of controls on it, and it used to be that each tab was destroyed when it went out of view (juce 1.28), but now the tabs all constructed and their visibility is controlled by juce. For situations like this, I’d really like to see a “disableComponentWhenNotNeeded” flag added to the addTab() routine, to tell juce that hidden tabs should just be invisible, but also disabled.


#2

If the components all think they’re disabled but their parent isn’t, then you must have called their setEnabled() methods, otherwise they just inherit the parent’s state…

Are you sure it’s not just that they need a repaint to make them show their new state?


#3

[quote=“jules”]
Are you sure it’s not just that they need a repaint to make them show their new state?[/quote]

I don’t think that’s the issue, because if it were, switching the order in which components are enabled wouldn’t yeild different results, would it?

I’d love to dig deeper into this issue, but I’m cripped by the fact that I can’t step into juce code from my project on my mac, even though I have the juce project set up as a subproject. When I step into juce code, the debugger shows the stack correctly, but the code shown isn’t juce code, but my own.

What does that indicate? That the juce debug project I’m running doesn’t contain the right debug symbols?


#4

The order might make some difference - the way that enablement recurses down to all the child components makes the whole thing a bit more tricky than it seems at first.

Debugging always seems to work ok for me, though you’ve got to have the juce project open in xcode. Or maybe you’re linking to a release build of juce?


#5