Namespaces
Variants
Actions
Revision as of 09:34, 15 June 2012 by hamishwillee (Talk | contribs)

Archived:Accessing data anywhere in application

Jump to: navigation, search
Archived.png
Archived: 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

Article
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 = ... ;
367 page views in the last 30 days.
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