Join Now
Quality Rating:
  • Currently 0.0 / 5
(0.0 / 5 - 0 votes cast)
Expertise Level:
  • Currently 0.0 / 5
(0.0 / 5 - 0 votes cast)

This page was last modified 10:26, 20 May 2008.

CS000971 - Sending package buffer between views

From Forum Nokia Wiki


ID CS000971 Creation date May 20, 2008
Platform S60 3rd Edition, MR Tested on devices Nokia N95
Category Symbian C++ Subcategory Code Examples


Keywords (APIs, classes, methods, functions): CAknViewAppUi, TPckgBuf, CAknView

Overview

The following example shows how to send package buffer custom messages from a CAknView to another.

See also the code snippet CS000970 - Sending custom message between views

Header

// Custom message
class TViewParameter
    {
    public:
         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.iDate.HomeTime();
param.iId = 1;
param.iName.Copy(_L("Hello"));
 
// 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->SetMopParent(this);
        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;
        package.Copy(aCustomMessage);
        
        // Read value from package buffer
        TViewParameter param;
        param = package();
 
        // TODO: Do something with received param data
        }
   }

Postconditions

Package buffer data sent and received between the two views.

See also

CS000970 - Sending custom message between views

Related Discussions
Thread Thread Starter Forum Replies Last Post
Sending file(s) from PC to S60 mobiles using J2ME alam.sher Bluetooth Technology 1 2006-12-22 14:10
After Obfuscating MIDlet class not found when using MIDlet on a Phone. Woody_FX Mobile Java General 6 2004-01-22 20:48
ListBox & color Jeepy General Symbian C++ 1 2003-02-10 14:58
My (stupid?) application architecture animage General Symbian C++ 10 2007-03-14 18:39
streaming mp3 santosh shetty Symbian Media (Graphics & Sounds) 73 2008-02-20 10:50
 
Powered by MediaWiki
     
     RDF Facets:
     
     
     qfnZtypeQUqfnTypeZCommunityContentQ
     qfnZtypeQUqfnTypeZWebpageQ
     qfnZtypeQUqfnTypeZWikiContentQ
     qmarsZlanguageQUxhttpE3aE2fE2fswE2enokiaE2ecomE2flanguageE2d1E2fenX