×

Discussion Board

Results 1 to 2 of 2

Hybrid View

  1. #1
    Registered User
    Join Date
    Dec 2007
    Posts
    21

    Landscape and Potrait mode!

    Hi everyone!
    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:

    void MyContainer::HandleResourceChange(TInt aType)
    {
    if (aType == KEikDynamicLayoutVariantSwitch)
    {
    TRect rect = iEikonEnv->EikAppUi()->ClientRect();
    AknLayoutUtils::LayoutMetricsRect(AknLayoutUtils::EMainPane, rect);
    SetRect(rect);
    }
    CCoeControl::HandleResourceChange(aType);
    }

    void MyContainer::SizeChanged()
    {
    TPoint point(0,0);
    if(iConnectionSettingsListBox)
    {
    iConnectionSettingsListBox->SetPosition(point);
    iConnectionSettingsListBox->SetSize(iEikonEnv->EikAppUi()->ClientRect().Size());
    iConnectionSettingsListBox->ListBox()->SetPosition(point);
    iConnectionSettingsListBox->ListBox()->SetSize(iEikonEnv->EikAppUi()->ClientRect().Size());
    }
    if(iUserSettingsListBox)
    {
    iUserSettingsListBox->SetPosition(point);
    iUserSettingsListBox->SetSize(iEikonEnv->EikAppUi()->ClientRect().Size());
    iUserSettingsListBox->ListBox()->SetPosition(point);
    iUserSettingsListBox->ListBox()->SetSize(iEikonEnv->EikAppUi()->ClientRect().Size());
    }
    if(iAboutLabel)
    {
    iAboutLabel->SetPosition(point);
    iAboutLabel->SetSize(iEikonEnv->EikAppUi()->ClientRect().Size());
    }
    if(iBgContext)
    {
    TRect rect(point, iEikonEnv->EikAppUi()->ClientRect().Size());
    iBgContext->SetRect(rect);
    }
    }

    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

    Best Regards!

  2. #2
    Registered User
    Join Date
    Dec 2007
    Posts
    21

    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).

Similar Threads

  1. How can I set the phone to Landscape mode for all apps?
    By marquk in forum Symbian User Interface
    Replies: 0
    Last Post: 2007-09-16, 01:44
  2. Replies: 2
    Last Post: 2006-10-05, 04:17
  3. Landscape to potrait switching in E60 have little problem
    By shahzadamin in forum Symbian User Interface
    Replies: 1
    Last Post: 2006-10-04, 09:56

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×