在用InputBox这个函数的时候 我怎么才能判断用户按的是Yes还是Cannel呀
str:=InputBox('输入','输入名称','name');
当str的值是name的时候 我怎么判断用户按的是哪个按钮
str:=InputBox('输入','输入名称','name');
当str的值是name的时候 我怎么判断用户按的是哪个按钮
解决方案 »
- IE工具条开发问题请各位会的朋友赐教
- 窗体切换刷新的问题
- 我的心里所想
- 在D7中用IdTelnet控件 在断开是出现错误
- 谁有ExpressBars 4.1的原版?
- delphi 调用OLEDB的数据连接属性对话框
- 高手们,在数据模块上能用messagebox吗?怎么老是报错!
- 关于jpeg的savetostream问题
- 一个超~~~`超~~超级怪异的问题!
- hedong(电脑动能)、amei2000go(浪子)请进来拿分!--->“急,关于报表的,无论高手低手都一律请入,分数陆续会加到600分!分数必分,决不食言!(VB转Delphi者求助!)”(little_hero)
- 请高手帮我分析这个过程是怎么实现。。。
- 谁知道windowsmediaplayer怎么播放一个列表中文件吗
InputBox不能判断用户按的是哪个按钮,但如果按的是Cancel,返回的一定是默认值。如果要知道用户按的哪个按钮,用InputQuery()。function InputQuery(const ACaption, APrompt: string; var Value: string): Boolean;ACaption is the caption of the dialog box.APrompt is the text that prompts the user to enter input in the edit box.Value is the string that appears in the edit box when the dialog box first appears and which returns the value that the user enters.(默认值,如果用户输入了,就是返回值)InputQuery returns True if the user chooses OK, and False if the user chooses Cancel or presses the Esc key.(此函数如果返回True,就是OK,否则是False)
Form1: TForm1;
ok:boolean;
str:string;
implementation{$R *.dfm}procedure TForm1.Button1Click(Sender: TObject);
begin
ok:=InputQuery('輸入','輸入名稱 : ',str);
if ok then
showmessage('ok')
else
showmessage('no');
end;