×

Discussion Board

Results 1 to 3 of 3
  1. #1
    Registered User
    Join Date
    Mar 2004
    Posts
    21

    how to share data between two views?

    i need one view to use data of another view.If i put the data in CmyAppUi.how to access it in view?

  2. #2
    Super Contributor
    Join Date
    Mar 2004
    Location
    Czech Republic
    Posts
    2,037
    Hi,

    CAknView class has AppUi() method. Call it and mace cast type to your appui class derived from CAknViewAppUi:

    ((CMyAppUi*)this->AppUi())->iMyData

    Bye

    STeN

  3. #3
    Regular Contributor
    Join Date
    Mar 2003
    Posts
    101
    In addition to answer above:

    You can dynamically get the AppUi class of your application is using CEikonEnv function AppUi(). Cast return value to your specific AppUi-type, and you are ready to access functions in your AppUi-class. See CEikonEnv and CCoeEnv-class documentation in SDK help.

    More straightforward way is to store a pointer (or reference for that matter) to your AppUi-class as a member variable and set that in your container/view/whatever class constructor like this:

    Appui ConstructL code:
    iMyView = new CMyView(<other arguments> ,this);

    CMyView::CMyView(<other arguments, const CMyAppUi* aAppUi):
    iAppUi(aAppUi)
    {
    ...
    }

    Remember that you must never delete AppUI handle in your view class (you don't "own" it and in any case framework handles deletion of AppUi objects).
    Last edited by bitnir; 2004-05-07 at 11:25.

Posting Permissions

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