1.inputbox的说明:函数原型:function inputbox(string,string,string):string;3个参数分别为对话框的标题,提示信息,让用户输入的内容,也就是说,我们只有关系第三个参数内容就行;返回的是字符串内容
2.inputquery的说明:函数原型:function inputquery(string,string,string):boolean;3个参数分别为对话框的标题,提示信息,让用户输入的内容,也就是说,我们只有关系第三个参数内容就行;返回的是boolean类型
3.2者比较:inputquery和inputbox比较,前者多了按钮事件,可以根据用户点击不同的按钮,选择不同的操作;
4.判断下面的过程那些是正确,那些是错误的:
(1):
procedure Tform1.button1Click(Sender :TOBject);
var
s : string;
begin
s := inputBox('标题','提示信息',s);
if s<>'' then
begin
showmessage(s);
end;
end;
var
s : string;
begin
s := inputBox('标题','提示信息',s);
if s<>'' then
begin
showmessage(s);
end;
end;
(2):
procedure button2Click(Sender : TOBject);
var
s : string;
begin
if (inputBox('标题','提示信息',s) then
begin
showmessage(s);
end;
end;
var
s : string;
begin
if (inputBox('标题','提示信息',s) then
begin
showmessage(s);
end;
end;
(3):
procedure Tform1.button3Click(Sender : TOBJect);
var
s : string;
b : boolean;
begin
b := inputQuery('标题','提示信息',s);
if b=true then
begin
showmessage(s);
end;
end;(4):
procedure Tform1.button4Click(Sender : TOBject);
var
s : string;
begin
if (inputQuery('标题','提示信息',s)) then
begin
showmessage(s);
end;
end;
上面的4个过程可以知道,只有(2)是错误的,inputbox返回的字符串类型,不能表达式的判断;
浙公网安备 33010602011771号