求教个对话框的问题

Beover1984 2005-12-19 03:11:34
我自己实现了一个对话框,并为其添加了菜单,重写了OkToExitL()和ProcessCommandL()用于显示菜单和响应菜单命令,因为我想在响应某个命令后退出对话框,本以为在ProcessCommandL()中调用OkToExitL()并使其返回ETrue来结束对话框,可现在发现行不通,执行后没有反应,在SDK中也没找到其它能退出对话框的函数,哪位给指条路,谢谢了先!

CMailCreateDlg *dlg = new( ELeave )CMailCreateDlg( addressee, subject, text );

dlg->ConstructL( R_OPTIONS_MENU_BAR );
TBool rt = dlg->ExecuteLD( R_DLG_MAIL_CREATE );
...全文
229 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
missle 2006-06-21
  • 打赏
  • 举报
回复
强人,我也干过这个事情,做了上面的第一部分,后来发现OKToExit,退不出来,就放弃了,换了个做发,谢谢摇兄了。
gorilla007 2005-12-26
  • 打赏
  • 举报
回复
摇兄真乃猛士也!可我好象没见过这个帖子啊。
Beover1984 2005-12-26
  • 打赏
  • 举报
回复
问题解决了:可以使用CEikDialog::TryExitL()模拟左右软键,并在OkToExitL()中决定是否退出对话框.

TryExitL()
protected: void TryExitL(TInt aButtonId);
Description
Tries to exit the dialog when the specified button is pressed, if this button should exit the dialog.

See OkToExitL() to determine which buttons can exit the dialog.

This will fail if user exit is prevented by the EEikDialogFlagNoUserExit flag. If the EEikDialogFlagNotifyEsc flag is not set and the dialog has been cancelled it immediately deletes itself.

Parameters
TInt aButtonId The ID of the pressed button.


void CMailCreateDlg::ProcessCommandL( TInt aCommandId )
{
switch ( aCommandId )
{
case ECmdMailSendNow:
{
iSendNow = ETrue; // Send message now
TryExitL( EAknSoftkeyOk ); //Tries to exit the dialog
return; //为了防止下面的语句造成非法访问,在调用TryExitL()后应该直接退出函数
}
....
}
...
}
Beover1984 2005-12-19
  • 打赏
  • 举报
回复
忘了说那个对话框是等待的。

3,120

社区成员

发帖
与我相关
我的任务
社区描述
塞班系统(Symbian系统)是塞班公司为手机而设计的操作系统,它的前身是英国宝意昂公司的 EP ( Electronic Piece of cheese)操作系统。
社区管理员
  • Symbian社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧