Using TResourceReader

From Nokia Developer Wiki
Jump to: navigation, search
Article Metadata
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;
As the name suggests, it Completes the construction of a new Edwin
by contructing the edwin from reader object.

// Resource Reader //
This page was last modified on 3 February 2012, at 07:12.
46 page views in the last 30 days.