Landscape and Potrait mode!
I just found a weird problem when using a specific theme on my N95 and swithcing between landscape and potrait mode. The theme I was using has transperent Highlightnig (i.e in a listbox the selected item is shown with this UI compontent). As it seems when scrolling down i my listbox the background skin and the area around the scrollbar is not redrawn correctly. The highlighet color remains on the background and around the scrollbar. This happens only the first time if that container hasn't been drawn previously and the switching between landscape and potriat mode happened in the same view, but different container was shown. Also the problem only occures using that theme.
The code that I use for detecting a switch from landscape and potrait mode is as following:
[SIZE="1"]void MyContainer::HandleResourceChange(TInt aType)
if (aType == KEikDynamicLayoutVariantSwitch)
TRect rect = iEikonEnv->EikAppUi()->ClientRect();
TRect rect(point, iEikonEnv->EikAppUi()->ClientRect().Size());
void MyContainer::Draw( const TRect& /*aRect*/ ) const
CWindowGc& gc = SystemGc();
TRect rect = Rect();
MAknsSkinInstance* skin = AknsUtils::SkinInstance();
MAknsControlContext* cc = AknsDrawUtils::ControlContext(this);
TBool result =AknsDrawUtils::Background(skin, cc, gc, rect);
The UI has one container that owns the window and several containers with subcompontets that are drawn in the window, switching between the containers is done by using tabs. The window owning container supplys a MobSupplyObject with a Background context that it also owns.
I had a simillar problems with the tabs but that was resolved by make sure that all the tabs are on the CAknNavigationControlContainer stack when my views are created (i.e. views that don't have tabs can push the default navigation decorator on the stack to make tabs disappear).
Has anybody experienced simillar problems ? Is there a correct way to handle switching between landscape and potrait mode and using tabs and several containers in a view?
Thanks in advance
Re: Landscape and Potrait mode!
For those that are interested:
It seems the problem occured on more themes then just one, the reason for it was due the fact that CountComponentControl only return one sub control, and ComponentControl(TInt aIndex) only return the sub control that was active (i.e selected tab). I resolved it by making sure that CountComponentControl returns the amount of sub controls that exists and making sure that ComponentControl returns sub controls based by index. (I reused the tab indexes that I defined here).
That way when size is changed due to HandleResourceChange the framework can automatically update all controls even though they are not visibale (this is a assumption, but it solved the problem).