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. Thanks for all your past and future contributions.

Archived:Sending package buffer between views in Symbian C++

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}}.

Remove from Archive?: This article has been marked for removal from archive, for the following reasons:
I think still valid for current versions of Symbian C++ (Belle). Incorreclty archived

The following example shows how to send package buffer custom messages from a CAknView to another. See also the code snippet Archived:Sending custom message between views using Symbian C++

Article Metadata
Tested with
Devices(s): Nokia N95
Platform(s): S60 3rd Edition, MR
S60 3rd Edition (initial release)
Platform Security
Signing Required: Self-Signed
Capabilities: None
Keywords: CAknViewAppUi, TPckgBuf, CAknView
Created: tepaa (14 May 2008)
Last edited: hamishwillee (28 Sep 2012)



// Custom message
class TViewParameter
TInt32 iId;
TBuf<32> iName;
TTime iDate;
const TUid KView1Id = {1};
const TUid KView2Id = {2};
const TUid KCustomMessageUid= {2}; // Your custom message uid

Source, sending custom package buffer message

// Create parameter
TViewParameter param;
param.iId = 1;
// Create package buffer
TPckgBuf<TViewParameter> package(param);
// Activate another view
AppUi()->ActivateLocalViewL(KView2Id, KCustomMessageUid, package);

Source, receiving custom package buffer message

void CSecondView::DoActivateL(const TVwsViewId& aPrevViewId,
TUid aCustomMessageId, const TDesC8& aCustomMessage)
// Create Container
if (!iContainer)
iContainer = new (ELeave) CMyViewContainer2;
iContainer->ConstructL( ClientRect() );
AppUi()->AddToStackL( *this, iContainer );
// 1. Check aCustomMessageId to handle aCustomMessage
// 2. You could check aPrevViewId if you were curious to know
// from where this view was called from.
if (aCustomMessageId==KCustomMessageUid)
// Create package buffer and copy received parameter in it
TPckgBuf<TViewParameter> package;
// Read value from package buffer
TViewParameter param;
param = package();
// TODO: Do something with received param data


Package buffer data sent and received between the two views.

See also

Archived:Sending custom message between views using Symbian C++

This page was last modified on 28 September 2012, at 04:50.
43 page views in the last 30 days.