Discussion Board

Results 1 to 10 of 10
  1. #1
    Registered User Dipakbaviskar's Avatar
    Join Date
    Dec 2004
    Posts
    42
    Hi,

    My application supports only portrait mode, which I specified in
    BaseConstructL(EAppOrientationPortrait) in AppUi class.

    I want to show up dialog when users switch from portrait to landscape mode.

    I tried to used CAknAppUiBase::Orientation() function in HandleResourceChangeL function , But it gives me orientation of Application which is portrait.

    How I detect the orientation of device when the orientation is changed from Portrait to Landscape.

    Best Regards,
    Dipak

  2. #2
    Registered User mayur_24's Avatar
    Join Date
    Jun 2004
    Location
    SymbianLand
    Posts
    762
    You would get a notification when the screen orientation changes in
    Code:
    void HandleScreenDeviceChangedL();
    So just implement this in your appui class.
    --Mayur.

  3. #3
    Registered User Dipakbaviskar's Avatar
    Join Date
    Dec 2004
    Posts
    42
    Hi Mayur,

    Thank you very much for quick reply.

    I don’t have a problem with notification of change orientation, But i want to check device current orientation i.e. whether device is in portrait or landscape Mode.

    Regards,
    Dipak

  4. #4
    Registered User vin2ktalks's Avatar
    Join Date
    Jul 2005
    Location
    Bengaluru, India
    Posts
    747
    Check these API with SDK Help:

    Code:
    TAppUiOrientation CAknAppUiBase::Orientation()
    CAknAppUiBase::SetOrientationL  (  TAppUiOrientation  aOrientation   )
    You can call these function directly from your AppUi class.

  5. #5
    Registered User Dipakbaviskar's Avatar
    Join Date
    Dec 2004
    Posts
    42
    Hi,

    I dont want to support Landscape mode for my application, so i define it in
    BaseConstructL(EAppOrientationPortrait) like this.


    The problem is when orientation is changed, HandleResourceChangeL() is called twise which gives me value for aType as

    aType = KEikMessageUnfadeWindows in first call.

    aType = KeikMessageWindowsFadeChange in second call.


    Above as I set that application supports only EappOrientationPortrait forcefully in BaseConstructL() function,

    due to that I didnt get the aType value which is define in akndef.h except KEikMessageWindowsFadeChange.

    When device orientation changed from portrait to landscape i have to show global dialog to inform user that application not support landscape mode.

    AknAppUiBase::Orientation() gives only application orientation, which is always return me EappOrientationPortrait.

    Is their any interface through which I get the event of Screen Orientation changed and API for getting current orientation the device have rather than my application ?

    Regards,
    Dipak

  6. #6
    Registered User gybrown's Avatar
    Join Date
    Aug 2006
    Posts
    10
    Consider using GetScreenModeSizeAndRotation:

    CWsScreenDevice* screen = CCoeEnv::Static()->ScreenDevice();
    if (screen)
    {
    TInt mode = screen->CurrentScreenMode();
    TPixelsTwipsAndRotation sizeAndRotation;
    screen->GetScreenModeSizeAndRotation(mode, sizeAndRotation);
    // now check sizeAndRotation.iRotation

  7. #7
    Registered User jack.dr's Avatar
    Join Date
    Mar 2009
    Posts
    3
    hi deepak,

    im also facing the same problem as u faced.i want to display message to user when the device switches from portrait to lanscape mode.

    and im trying the following code in HandleResourceChangeL( TInt aType ) method in AppUi class


    if ( aType == KEikDynamicLayoutVariantSwitch )
    {
    if ( iLandscapeContainer )
    {
    TRect rect;
    AknLayoutUtils::LayoutMetricsRect( AknLayoutUtils::EMainPane, rect );
    iLandscapeContainer->SetRect( rect );
    iLandscapeContainer->HandleResourceChange( aType );
    }
    }

    but im not getting the result what exactly i want. can u pls help me out.

    Thanks and Regards
    jack

  8. #8
    Nokia Developer Champion savaj's Avatar
    Join Date
    Oct 2007
    Location
    જુનાગઢ - India
    Posts
    3,034
    Hi jack,

    What u r not getting?? Orientation?? Read post 6, u will get answer from there.

  9. #9
    Registered User jack.dr's Avatar
    Join Date
    Mar 2009
    Posts
    3
    hi savaj, thank you very much 4 u r reply.
    actually my application is switching orientation between Portrait and Landscape mode in N95.i have added a image in Portrait mode to full screen(240*320).i dun hava problem with dat.when the device switches from Portrait mode to Landscape mode(320*240) the image is not fixing to screen completely. i.e the left side of the image is becoming white and the bottom part of the image is not visible.

    Regards
    jack

  10. #10
    Regular Contributor netlover's Avatar
    Join Date
    Mar 2003
    Posts
    434
    Quote Originally Posted by Dipakbaviskar View Post
    Hi,

    My application supports only portrait mode, which I specified in
    BaseConstructL(EAppOrientationPortrait) in AppUi class.

    I want to show up dialog when users switch from portrait to landscape mode.

    I tried to used CAknAppUiBase::Orientation() function in HandleResourceChangeL function , But it gives me orientation of Application which is portrait.

    How I detect the orientation of device when the orientation is changed from Portrait to Landscape.

    Best Regards,
    Dipak
    TBool ScreenState()
    {
    TRect rect( iAppView1->ClientRect());
    if( rect.iBr.iX < rect.iBr.iY ) // Portrait
    {
    return ETrue;
    }
    else
    {
    return EFalse;
    }
    }
    www.faxinwen.com 发新闻
    阅读分享__移动与互联网

Similar Threads

  1. Detect Any Kink of Mobile Device
    By agawad in forum Mobile Java Networking & Messaging & Security
    Replies: 0
    Last Post: 2006-09-22, 18:07
  2. How to detect Mobile device model in J2ME?
    By hikaroute in forum Mobile Java Tools & SDKs
    Replies: 1
    Last Post: 2006-01-10, 16:04
  3. Bluetooth Security: What exactly is an untrusted device?
    By rahulmcs in forum Bluetooth Technology
    Replies: 1
    Last Post: 2005-12-02, 06:26
  4. Detect a device
    By gerardo.rossi in forum Symbian Networking & Messaging (Closed)
    Replies: 0
    Last Post: 2005-01-20, 20:38
  5. Making my 6230 detect as a mass storage device?
    By TreyPocca in forum PC Suite API and PC Connectivity SDK
    Replies: 1
    Last Post: 2005-01-13, 19:01

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Nokia Developer aims to help you create apps and publish them so you can connect with users around the world.

京ICP备05048969号  © Copyright Nokia 2013 All rights reserved