hi all ,
i want to show mtm editor through this code and this code is running without any error.but why mtm editor is not displaying.
plz help me
i am stuck with this for a long time.


void Cviewmsg::ViewMsg(TMsvId aMsvId)
{

//Cancel();
if ( iMsvEntry )
{
delete iMsvEntry;
iMsvEntry = NULL;
}

CClientMtmRegistry* mtmRegistry = CClientMtmRegistry::NewL( *iMsvSession );
CleanupStack::PushL( mtmRegistry );

CMtmUiRegistry* mtmUiRegistry = CMtmUiRegistry::NewL( *iMsvSession );
CleanupStack::PushL( mtmUiRegistry );


/*********************** Filtered Children ***************************************/


CMsvEntryFilter* aFilter= CMsvEntryFilter::NewLC();

TMsvSelectionOrdering* selectionOrder = new( ELeave ) TMsvSelectionOrdering( KMsvNoGrouping, EMsvSortByDateReverse, ETrue );

aFilter->SetOrder( *selectionOrder );

CMsvEntrySelection* childSelection = new(ELeave) CMsvEntrySelection;

iMsvSession->GetChildIdsL( aMsvId, *aFilter, *childSelection);

CMsvEntry* newEntry = iMsvSession->GetEntryL(aMsvId);

CBaseMtm* clientMtm = mtmRegistry->NewMtmL( newEntry->Entry().iMtm);//KUidMsgTypeSMS);

CleanupStack::PushL( clientMtm );

// Get UI Mtm
CBaseMtmUi* ui = mtmUiRegistry->NewMtmUiL( *clientMtm ); // UI MTM for SMS
CleanupStack::PushL( ui );
clientMtm->SwitchCurrentEntryL(newEntry->EntryId());//tmsvEntry.Id( ) );
TMsvEntry tmsvEntry( newEntry->Entry( ) );

TBool MsgState=tmsvEntry.Visible();
TInt num=0;
if(tmsvEntry.Visible()==EFalse)

{

num=0;
}
else
{

num=1;
}

tmsvEntry.SetOperation(EFalse);


// Shows the message in Editor of MTM
TRAPD(err,iOperation = ui->ViewL( iStatus ));

if(err==KErrNone)
{

CleanupStack::PopAndDestroy( 5 );
if ( iMsvEntry )
{
delete iMsvEntry;
iMsvEntry = NULL;
}


delete newEntry;

delete childSelection;
delete selectionOrder;

SetActive();

}
else
{
CleanupStack::PopAndDestroy( 5 );


if ( iMsvEntry )
{
delete iMsvEntry;
iMsvEntry = NULL;
}

delete newEntry;

delete childSelection;
delete selectionOrder;

}


}