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 (buf.Length()==0)
{
iEikonEnv->InfoMsg( _L("Can't push empty text") );
}
else
{
buf.Insert(0, _L(" "));
CDesCArray* array =
static_cast
array->InsertL(0,buf);
iListBox->HandleItemAdditionL();
buf.Zero();
iPushNumber->SetTextL(&buf);
}
break;
}
case EMyStackCmdAppPop:
{
CDesCArray* array =
static_cast
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;
更多精彩
赞助商链接