WEB开发网
开发学院手机开发Symbian 开发 Symbian 学习之按键事件、程序分析及程序启动 阅读

Symbian 学习之按键事件、程序分析及程序启动

 2010-03-13 20:26:00 来源:WEB开发网   
核心提示:void CMyStackContainer::HandleCommandL(TInt aCommand){switch ( aCommand ){case EMyStackCmdAppPush:{TBuf<32> buf;buf.Zero();iPushNumber->GetText(buf);if

void CMyStackContainer::HandleCommandL(TInt aCommand)

{

switch ( aCommand )

{

case EMyStackCmdAppPush:

{

TBuf<32> buf;

buf.Zero();

iPushNumber->GetText(buf);

if (buf.Length()==0)

{

iEikonEnv->InfoMsg( _L("Can't push empty text") );

}

else

{

buf.Insert(0, _L(" "));

CDesCArray* array = static_cast(iListBox->Model()->ItemTextArray());

array->InsertL(0,buf);

iListBox->HandleItemAdditionL();

buf.Zero();

iPushNumber->SetTextL(&buf);

}

break;

}

case EMyStackCmdAppPop:

{

CDesCArray* array = static_cast(iListBox->Model()->ItemTextArray());

if (array->Count()==1)

{

iEikonEnv->InfoMsg( _L("The stack is empty") );

}

else

{

TBuf<32> buf;

TPtrC ptr = (*array)[0];

buf.Copy(ptr);

buf.Delete(0,1);

iEikonEnv->InfoMsg(buf);

iPopContentLabel->SetTextL(buf);

array->Delete(0);

iListBox->HandleItemRemovalL();

}

break;

}

default:

{

break;

}

}

}

MyStackAppUi,cpp

void CMyStackAppUi::HandleCommandL(TInt aCommand)

{

switch ( aCommand )

{

case EAknSoftkeyBack:

case EEikCmdExit:

{

Exit();

break;

}

case EMyStackCmdAppPush:

case EMyStackCmdAppPop:

{

iAppContainer->HandleCommandL(aCommand);

break;

Tags:Symbian 学习 按键

编辑录入:coldstar [复制链接] [打 印]
赞助商链接