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
在使用sockets例子里面的CSocketEngine出现的问题 herosu Symbian 3 2005-09-29 01:31
Switch views in Series80... GeKI Symbian User Interface 2 2005-11-02 10:21
TCP/IP communication failure damsku Symbian Networking & Messaging 5 2007-04-12 10:58
INI Files kamalsinghania General Symbian C++ 21 2006-11-24 11:42
HBufC question... GeKI General Symbian C++ 5 2006-01-12 07:30
 
Powered by MediaWiki
     
     RDF Facets:
     
     
     qfnZtypeQUqfnTypeZCommunityContentQ
     qfnZtypeQUqfnTypeZWebpageQ
     qfnZtypeQUqfnTypeZWikiContentQ
     qmarsZlanguageQUxhttpE3aE2fE2fswE2enokiaE2ecomE2flanguageE2d1E2fenX