S60 2nd edition feature pack 3

Making TimeLine Control

Update by Artem: With the permission of the author I attached the compilable example to this article. Feel free to download and try

The timeline in puzzle games, lifetime in fighting games, that is a very normal element.
The following article will tell you how to make a timeline control step by step in S60.

Author Website: http://www.symbianer.com


Frist, you need to refer to the articles
I.Symbian OS: Creating Custom Controls

Protecting the RPointerArray content against the leave – CleanupResetAndDestroyPushL

Every object allocated on the heap should be protected by pushing its pointer to the cleanup stack via CleanupStack::PushL. Kernel resources used by the R-objects like RPointerArray are protected via CleanupClosePushL.

Sometimes you’d like or have to protect all the RPointerArray content without pushing all the individual items to the cleanup stack. There are custom solutions for this purpose, but there is also a built-in facility – CleanupResetAndDestroyPushL. It is not well known and not widely used only because it is defined in a quite an unusual place - \epoc32\include\mmf\common\mmfcontrollerpluginresolver.h

Creating contacts

Here is how you can programmatically create a new phonebook contact. This code example is the universal ExeDll – it can be compiled both for S60 2nd edition and for S60 3rd edition. Note that for 3rd edition the WriteUserData capability is needed to add the contact to the phonebook. If the program didn’t have this capability, the CPbkContactEngine::AddNewContactL would leave with KErrWrite.

Preprocessing the incoming message

Start this code example (ready to install sis file included) and while the demo program is running all the incoming messages will be appended with the ".Changed" text.


For emulator trials, the demo program has an option to simulate the incoming message.

Streaming Example

Compilable code example of using the Symbian Streaming API. Demonstrates how to store the whole object with the boolean, integer and descriptor data fields to and from stream.


// Let the data format be:
//
//
// Note, that when dealing with packaged data, we have to be careful about
// the concrete size in bytes. Descriptors will be saved using Symbian
// default format for descriptors. For TBool we use the default conversion
// to TInt
void CEmployee::ExternalizeL( RWriteStream &aStream ) const
{
// Write the used protocol version first
aStream << KEmployeeProtocolVersion;
aStream << static_cast ( iAge );
aStream << static_cast ( iFired );
aStream << static_cast ( iName->Length() );
aStream << *iName;
aStream << static_cast ( iSurname->Length() );
aStream << *iSurname;
}

Universal HelloExeDll for S60 2nd and 3rd edition

ExeDlls are the targets for Symbian projects that make the projects compile into EXE for the hardware platform and into a special DLL, that can be launched as an EXE from the WINS emulator.

For S60 3rd edition EXEs can be started from the fully loaded emulator and some system interfaces have been changed. Universal HelloExeDll uses a bit of preprocessor magic and can be compiled both for S60 3rd and 2nd edition. On the 3rd edition the project will be built as an EXE; on the 2nd edition it will be built as a usual ExeDll - as an EXE for hardware and as a DLL for WINS.

HelloWorld united. Single code base for S60 2nd and 3rd editions

The 3rd edition of Nokia's S60 platform is all cool and new, but there are a lot of older devices you would still like to support.

The introduction of platform security in the 3rd edition changed the internals of the system a lot. However, from the point of view of the regular application programmer, changes are not that big and are mostly related to the configuration-like issues. We have to rewrite the MMP file, declare couple of things differently, use different type of icons, etc. - a lot of small things that you just have to carefully do once. As the end result of these small differences you'll have two projects with a bit different structure, a bit different set of files and minor changes in the application code.

Syndicate content