×

Discussion Board

Results 1 to 4 of 4
  1. #1
    Registered User
    Join Date
    Mar 2003
    Posts
    16

    Switch the views

    Hello,

    i have a CEikAppUi instance and few custom views. I want to switch the views when the user tap on the screen. I can not do:

    void CBaseView::HandlePointerEventL(const TPointerEvent& aPointerEvent)
    {
    ....
    iAppUi->SetNewCustomView(iMyViewId);
    ....
    }

    because i delete the current view in the CeikAppUi instance and the application crashes. Is there a way to simulate an menu item selection?

    If i can simulate menu item selection then i can easily switch the views.

    Thank you

  2. #2
    Super Contributor
    Join Date
    May 2005
    Location
    Hyderabad,India
    Posts
    704

    Re: Switch the views

    Hi,

    check multiviews example in SDK.

    regards,
    eswar

  3. #3
    Regular Contributor
    Join Date
    Apr 2006
    Location
    Malaysia
    Posts
    246

    Re: Switch the views

    Maybe you can use code like this. It switch the view when user select menu item. I use it in my program and it's work fine.

    void CYourProgramView1::HandleCommandL(TInt aCommand)
    {
    switch(aCommand)
    {
    case ESwitchToView2:
    {
    AppUi()->ActivateLocalViewL(TUid::Uid(ESypherSMSView2Id));
    break;
    }
    .....
    }
    }


    Hope it can help you. :)

  4. #4
    Regular Contributor
    Join Date
    Jun 2006
    Posts
    57

    Re: Switch the views

    I use this one and it work
    TKeyResponse Ctest_1AppUi::HandleKeyEventL(const TKeyEvent& aKeyEvent,TEventCode aType)
    {
    if (aType == EEventKey)
    {
    if (iTabGroup == NULL)
    {
    return EKeyWasNotConsumed;
    }
    }

    TInt active = iTabGroup->ActiveTabIndex();
    TInt count = iTabGroup->TabCount();

    switch (aKeyEvent.iCode)
    {
    case EKeyLeftArrow:
    if (active > 0)
    {
    // -----------------------------------------------------------------------
    // Change to usual layout
    // -----------------------------------------------------------------------
    TRect cr = ClientRect();
    if (cr.iTl.iY == Kqpn_height_status_pane_idle)
    {
    StatusPane()->SwitchLayoutL(R_AVKON_STATUS_PANE_LAYOUT_USUAL);
    }

    active--;
    iTabGroup->SetActiveTabByIndex(active);
    ActivateLocalViewL(TUid::Uid(iTabGroup->TabIdFromIndex(active)));
    return EKeyWasConsumed;
    }
    break;

    case EKeyRightArrow:
    if((active + 1) < count)
    {
    TRect cr = ClientRect();
    if (cr.iTl.iY == Kqpn_height_status_pane_idle)
    {
    StatusPane()->SwitchLayoutL(R_AVKON_STATUS_PANE_LAYOUT_USUAL);
    }

    active++;
    iTabGroup->SetActiveTabByIndex(active);
    ActivateLocalViewL(TUid::Uid(iTabGroup->TabIdFromIndex(active)));
    return EKeyWasConsumed;
    }
    break;

    default:
    break;
    }

    return EKeyWasNotConsumed;
    }

Similar Threads

  1. Switch views in Series80...
    By GeKI in forum Symbian User Interface
    Replies: 2
    Last Post: 2005-11-02, 10:21
  2. Replies: 1
    Last Post: 2004-06-30, 05:32
  3. Problems with forms and views, help needed!
    By _fox in forum Symbian User Interface
    Replies: 0
    Last Post: 2004-06-29, 16:41
  4. switching views, without using containers
    By s3ni in forum Symbian User Interface
    Replies: 13
    Last Post: 2003-07-23, 05:17
  5. how to switch between views
    By ddhungry in forum Symbian
    Replies: 1
    Last Post: 2002-11-19, 16:07

Posting Permissions

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