×

Discussion Board

Results 1 to 3 of 3
  1. #1
    Registered User
    Join Date
    Jun 2003
    Location
    HongKong
    Posts
    63

    About the pointer between view and container

    I find the code of view pointer to its AppUi
    CMyCalendarAppUi* pApp=(CMyCalendarAppUi*)iEikonEnv->AppUi();

    but i cannot find the code about container pointer to its view

    Anyone can help me~~!
    Thank U

  2. #2
    Registered User
    Join Date
    May 2003
    Location
    France
    Posts
    22
    Construct your container passing it a pointer to your view and store that pointer in container's member variable.

    Because there is a relationship between view and application UI, framework provides you with a way to access app UI from the view.

    However, container doesn't necessarily have to be created (or used) with a view, so there is no ready-made access to it.
    Last edited by klisa; 2003-08-24 at 09:17.

  3. #3
    Regular Contributor
    Join Date
    Jun 2003
    Posts
    318
    Yeah,

    But when u need to reference something in your view from your container, pass a pointer to the view during construction of the container, in the view itself.

    Here's how its done in the simplest fashion, i hope:
    -------------------------------------------------------------------------------------------------------------------
    In my View's DoActivateL function:

    Container = new (ELeave) CF2FContainer(this); //'this' returns a pointer to itself (the view)

    -------------------------------------------------------------------------------------------------------------------
    In my Container's Constructor:

    CStupidContainer::CStupidContainer(CStupidView* aView)
    : iView(aView) //get the view that owns the container
    {
    }

    -------------------------------------------------------------------------------------------------------------------
    Then of course in your container's header file (.h),
    You have to declare ur constructor:

    public: // Constructors and destructor
    CStupidContainer(CStupidView* aView);

    -------------------------------------------------------------------------------------------------------------------
    and also.... u'r variable to point to your View

    private:
    CStupidView* iView;

    -------------------------------------------------------------------------------------------------------------------

Posting Permissions

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