Please note that as of October 24, 2014, the Nokia Developer Wiki will no longer be accepting user contributions, including new entries, edits and comments, as we begin transitioning to our new home, in the Windows Phone Development Wiki. We plan to move over the majority of the existing entries over the next few weeks. Thanks for all your past and future contributions.

Archived:Accessing data anywhere in application

From Wiki
Jump to: navigation, search

Archived.pngArchived: This article is archived because it is not considered relevant for third-party developers creating commercial solutions today. If you think this article is still relevant, let us know by adding the template {{ReviewForRemovalFromArchive|user=~~~~|write your reason here}}.

Article Metadata
Created: vdharankar (25 Jul 2009)
Last edited: hamishwillee (15 Jun 2012)

In many situations, it is useful to have a method or a way to place data somewhere that could be accessed globally in the application. One of those ways is placing the global data in the Document class.

The Document class is the most appropriate place to keep the data which needs to be accessed from the whole application, according to the Document/View architecture. A global reference to the Document class instance if accessible through the AppUi's method Document(). This method has the following signature:

CEikDocument *Document() const;

This means that we should perform a cast on the result value to match our actual Document class, defined in the application. Now, here's how to access your Document instance:

#include <eikappui.h>
// suppose your Document class is named as 'MyDocument'
MyDocument* doc = static_cast <MyDocument*> (CEikonEnv::Static()->EikAppUi()->Document() );
// now access your data
doc->myData = ... ;
This page was last modified on 15 June 2012, at 06:34.
50 page views in the last 30 days.

Was this page helpful?

Your feedback about this content is important. Let us know what you think.


Thank you!

We appreciate your feedback.