Namespaces

Variants
Actions

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.

Using TResourceReader

From Wiki
Jump to: navigation, search
Article Metadata
Article
Created: vasant21 (13 Aug 2007)
Last edited: hamishwillee (03 Feb 2012)

For using TResouceReader you need to include barsread.h and Link against: bafl.lib.

TResourceReader is used to read resources, first you need to create a TResourceReader object, then using control environment's CreateResourceReaderLC() method you can read the specified resource from the resource file.

As a simple example, we would prepare EDWIN from resource defined in .Rss file

/*
* Edwin Resource defined in .Rss file.
*
**/

 
#define qnn_edwin_data_width 10
#define qnn_edwin_data_height 4
#define qnn_edwin_data_maxlength 0
 
RESOURCE EDWIN r_application_edwin_data
{
flags = EAknEditorFlagDefault;
width = qnn_edwin_data_width;
lines= qnn_edwin_data_height;
maxlength = qnn_edwin_data_maxlength;
}
 
/*
* Using TResource Reader, for contructing EDWIN.
*
***/

 
// Create TResouceReader Object //
TResourceReader reader;
// Reade the R_APPLICATION_EDWIN_DATA Resouce into reader //
iCoeEnv->CreateResourceReaderLC(reader, R_APPLICATION_EDWIN_DATA);
// Create Edwin //
iEdwin = new (ELeave) CEikEdwin;
iEdwin->SetContainerWindowL(*this);
/*
As the name suggests, it Completes the construction of a new Edwin
by contructing the edwin from reader object.
*/

iEdwin->ConstructFromResourceL(reader);
// Resource Reader //
CleanupStack::PopAndDestroy();
 
}
This page was last modified on 3 February 2012, at 04:12.
43 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.

×