Focus after Tab change (TabbedComponent)

Hello everyone,

 

I have a question on how to handle focus. Or rather on how not to get focus. Or how to lose it.

I have TabbedComponent. When a tab gets the focus (I click on the tab), the underlying component is shown. For some reason it also automatically gets the focus. In my case that means that my TextEditor gets the focus and the caret/cursor is shown. But I do not want that. I do not want the TextEditor to show the caret unless the user explicitly clicks on it.

What would be the best way to achieve that?

I am running Windows 7 and my application is stand-alone.

void CYourTab::tabSelected()
{
    unfocusAllComponents();
}

Rail

Thanks! Works.