在implementation语句的上面,一般会有这样的几个句子
var
Form1: TForm1;implementation
我习惯在这里定义全局变量,
比如
var
Form1: TForm1;
searched:Boolean;implementation
不知道对了没?
var
Form1: TForm1;implementation
我习惯在这里定义全局变量,
比如
var
Form1: TForm1;
searched:Boolean;implementation
不知道对了没?
解决方案 »
- 求图片 平均灰度值 与 噪声阈值
- 请问如何用代码来改变字体的颜色?
- 感谢[jinjazz],散分喽......
- 关于设置光标的问题
- 关于利用Delphi和Java技术进行 b/s和c/s双结构系统开发问题 >>>>>
- 请问使用delphi程序如何将excel表中的的内容添加到Access数据库表中相应的字段中去,急急急(100分,不够再加加加)
- 如何用DELPHI定义一个结构?
- 高手请进:ADOConnection的连接字符串包含IP地址怎么就有问题呢?
- 高分求取用Delphi编写的最短路径算法程序。
- 转换字符为asc码的函数,另请问有无delphi常用函数的资料下载
- 谁有全系列Delphi
- 打印报表的问题!
var
searched:boolean;
public
searched:boolean;
begin
if searched then
begin
searched:=false;
listbox1.item.clear;
label5.caption:=''
end;
请问书中说searched是全局变量,用于表明LISTBOX1当前显示内容是查找的结果还是从FILELISTBOX1中选定文件,什么意思,是不是SEARCHED要定义为全局变量,如何定义呢。
//定义全局变量上面已经说了,但是至于你所写的意思,我觉得你在其他的过程
//中肯定要对searched赋值。
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls, Db, DBTables, Grids, DBGrids, FileCtrl;type
TForm1 = class(TForm)
FileListBox1: TFileListBox;
procedure FileListBox1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;var
Form1: TForm1;
searched:Boolean; ///////////////////在这里implementation{$R *.DFM}procedure TForm1.FileListBox1Click(Sender: TObject);
begin
if searched then
begin
searched:=false;
listbox1.item.clear;
label5.caption:=''
end;
end;end.
1。全局变量:如果用户在单元的Interface部分声明的一个变量,她的作用域将扩展到任何声明使用它的单元中。
2。隐含全局变量:如果用户在单元implementation部分里生命一个变量,她的作用域是这个单元。版权归属Marco Cantu--The end;