×

Discussion Board

Results 1 to 11 of 11
  1. #1
    Registered User
    Join Date
    Feb 2008
    Posts
    33

    Portrait to Landscape change when applicaiton is in Background

    Hi,

    In my application, I am displaying the pop up of access points. If I select a WLAN Access point, framework shows a wait bar as "Searching WLAN network" and then pops up a dialog with available WLAN access points.

    Now if I change from Portrait to Landscape and vice versa, only the WLAN Access point dialog shown by the Framework is getting changed to landscape. My application is not changing its layout.

    I investigated on this, my HandleForegroundEventL is getting hit qith 0 means my application is going into background when WLAN access point dialog is shown on the screen.

    In my HandleResourceChange the only event I am getting is related to Windows fading like KEikMessageWindowsFadeChange.

    Is there any way I can handle this?
    Thanks for your help.

  2. #2
    Registered User
    Join Date
    Jun 2006
    Location
    India
    Posts
    1,043

    Re: Portrait to Landscape change when applicaiton is in Background

    Hi,
    You need to implement HandleResourceChangeL( TInt aType ) in your AppUi and delegate it to your view classes also.
    something like
    void CYourAppUi::HandleResourceChangeL( TInt aType )
    {
    CAknViewAppUi::HandleResourceChangeL( aType );

    if ( aType == KEikDynamicLayoutVariantSwitch )
    {
    if ( ClientRect().Width() != 360 )
    {
    StatusPane()->SwitchLayoutL(R_AVKON_WIDESCREEN_PANE_LAYOUT_USUAL_FLAT );
    }
    else
    {
    StatusPane()->SwitchLayoutL(R_AVKON_WIDESCREEN_PANE_LAYOUT_USUAL );
    }

    if ( iView->Id() == TUid::Uid( EYourMainViewId ) )
    {
    CYourMainView* view = static_cast<CYourMainView*>( iView );
    view->HandleLayoutSwitch();
    }
    }
    Maximus
    S60 Developer
    Impossible is nothing

  3. #3
    Registered User
    Join Date
    Feb 2008
    Posts
    33

    Re: Portrait to Landscape change when applicaiton is in Background

    Thanks for your response.

    I have alreday implemented HandleResourceChangeL function. But in normal scenarios, when the layout is changed, I am getting the event as KEikDynamicLayoutVariantSwitch. And Portrait to landscape is working fine.

    The problem is coming only when Framework generated Access point dialog is in front. In that case, in my HandleResourceChange function I am getting on windows fading events.
    Because my application is moving into background.

    How can I handle this?
    Thanks once again.

  4. #4
    Registered User
    Join Date
    Jun 2006
    Location
    India
    Posts
    1,043

    Re: Portrait to Landscape change when applicaiton is in Background

    Hi,
    Have you checked what event you are getting? I am not sure if your application is in background whether your HandleResourceChange will be called properly or not.
    Maximus
    S60 Developer
    Impossible is nothing

  5. #5
    Registered User
    Join Date
    Feb 2008
    Posts
    33

    Re: Portrait to Landscape change when applicaiton is in Background

    Yes,

    I am getting only three events always:

    KEikMessageWindowsFadeChange,
    KEikMessageFadeAllWindows,
    KEikMessageUnfadeWindows

    Yeah, actually thats what my doubt is. When that WLAN access point dialog is coming, when the application is going into background?
    HandleForegroundEventL of my AppUi is getting the parameter as 0.

    I have checked the behavior in Browser. There it is working fine.

    Do I need to tell Window server that my application should get all events even when it is in background?
    If yes, how? :-)

  6. #6
    Registered User
    Join Date
    Dec 2005
    Posts
    1,236

    Re: Portrait to Landscape change when applicaiton is in Background

    Hi,

    Correct me if I am wrong you have launched your access point dialog and then you have changed the resolution. You expect your applicaiton to change the resolution too

    Probable solutions could be
    1. In your HandleForegroundL you could get the application rectangle and change the resolution accordingly( Use AknLayoutUtils::LayoutMetrics( AknLayoutUtils::EApplicationWindow, TRect());

    2. Listen for the layout change event and change your resolution. There are two things here
    a. I am not sure whether we could listen for the layout change event in the background
    b. Even if we are able to listen and try to change the resolution the draws on the window are invalid when the window is not in the foreground so only option left is opton a.

    Good luck.
    Regards,
    Sriky

  7. #7
    Registered User
    Join Date
    Feb 2008
    Posts
    33

    Re: Portrait to Landscape change when applicaiton is in Background

    Thanks for your response.

    Yes I have launched my access point dialog. In that I selected a WLAN access point, and after that Framework is showing "Searching For WLAN Network" wait bar and then a new Dialog containing all the available WLAN Access points.

    So when this new Dialog with only WLAN access points is coming( which is launched by the Framework), my application is not getting the Layout change event as it is in background now.

    And I am using the same API, but I am using AknLayoutUtils::EMainPane. I will try once again with EApplicationWindow also.

    And thats the actual problem that I am not getting the layout change events when my application is in background.

    Any way to get the events in background also?
    Thanks

  8. #8
    Registered User
    Join Date
    Dec 2005
    Posts
    1,236

    Re: Portrait to Landscape change when applicaiton is in Background

    Hi vishal,

    As I said it would not help you even if you get the events in the background as all your layout changes will result in DrawNow() calls which would be invalid because your window is not in foreground.
    Regards,
    Sriky

  9. #9
    Regular Contributor
    Join Date
    May 2006
    Posts
    271

    Re: Portrait to Landscape change when applicaiton is in Background

    hi all,
    If application is foreground how we get events of landscape and portrait(i think landscape and portrait means device changes of co-ordinates 240x320 to 320x240).
    Regards,
    Sriramadasu.

  10. #10
    Registered User
    Join Date
    Feb 2008
    Posts
    33

    Re: Portrait to Landscape change when applicaiton is in Background

    Hi Sriky,

    I think that I can handle. Whenever I will get Layout change event, using BringToForeground function in TApaTask, I can bring my application in Foreground and then do layout changes. I am not sure it will work or not, but I can give a try if i get the event properly

  11. #11
    Registered User
    Join Date
    Feb 2008
    Posts
    33

    Re: Portrait to Landscape change when applicaiton is in Background

    Hi Ramdas,

    You just need to override the HandleResourceChangeL function in AppUI. Framework will give you the call back in that with KEikDynamicLayoutVariantSwitch event.

Similar Threads

  1. Replies: 8
    Last Post: 2008-09-25, 10:01
  2. How to change grid's background color
    By ludylu in forum Symbian User Interface
    Replies: 1
    Last Post: 2008-03-19, 05:12
  3. E61/E62 Portrait, Landscape
    By viktor_m in forum Symbian
    Replies: 5
    Last Post: 2007-02-21, 15:02
  4. change Background image Nokia
    By MaaD in forum Symbian User Interface
    Replies: 0
    Last Post: 2003-07-02, 10:17

Posting Permissions

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