如何获得用户在对话框重点击的按钮?

laodizhuq 2003-06-10 09:52:37
当用showmessage()或messagebox()弹出消息框时,如何获得用户在对话框重点击的按钮是哪个?
请详细点介绍一下好吗,我是一个菜鸟。
...全文
28 6 打赏 收藏 转发到动态 举报
写回复
用AI写文章
6 条回复
切换为时间正序
请发表友善的回复…
发表回复
google1106 2003-06-10
  • 打赏
  • 举报
回复
谢谢楼上的指点,我原来不知道messagebox的用法,让高手见笑了
laodizhuq 2003-06-10
  • 打赏
  • 举报
回复
谢谢!
myshushu005 2003-06-10
  • 打赏
  • 举报
回复
messagebox()地返回值可以判断
IDOK 1 The user chose the OK button.
IDCANCEL 2 The user chose the Cancel button.
IDABORT 3 The user chose the Abort button.
IDRETRY 4 The user chose the Retry button.
IDIGNORE 5 The user chose the Ignore button.
IDYES 6 The user chose the Yes button.
IDNO 7 The user chose the No button.
google1106 2003-06-10
  • 打赏
  • 举报
回复
老大,showmessage好像只有一个按钮吧,message是API函数,和showmessage是差不多的,要想得到Yes,No,Cancel的对话框可以用
MessageDlg('这里是你的内容',mtConfirmation,mbYesNoCancel,0),返回的事实上是一个整数,当然也可以用mrYes,mrNo,mrCancel来表示返回的结果
l_xiaofeng 2003-06-10
  • 打赏
  • 举报
回复
靠,老兄不慢啊!
Linux2001 2003-06-10
  • 打赏
  • 举报
回复
if MessageBox(Handle, '试验', '测试点击了什么按钮', MB_YESNO) = 6 then
ShowMessage('点击了YES按钮')
else
ShowMessage('点击了NO按钮');

5,392

社区成员

发帖
与我相关
我的任务
社区描述
Delphi 开发及应用
社区管理员
  • VCL组件开发及应用社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

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