社区
ActiveX/COM/DCOM
帖子详情
TlistBox或TComboBox的AddItem(AnsiString Item,TObject Object)的Object参数怎么用?
sinth
2003-09-12 05:35:54
我随便传一个对像指针或NULL,也不会出错,看程序也没有什么异常.
如果我传一个String给它,作为对应Item的符加值,我怎样取回我符加的String?
...全文
122
3
打赏
收藏
TlistBox或TComboBox的AddItem(AnsiString Item,TObject Object)的Object参数怎么用?
我随便传一个对像指针或NULL,也不会出错,看程序也没有什么异常. 如果我传一个String给它,作为对应Item的符加值,我怎样取回我符加的String?
复制链接
扫一扫
分享
转发到动态
举报
写回复
配置赞助广告
用AI写文章
3 条
回复
切换为时间正序
请发表友善的回复…
发表回复
打赏红包
nightfallrove
2003-09-14
打赏
举报
回复
ComboBox->text就是String啊,
你可以把一个对象加到ComboBox()中去,
这时候就可以用Object了,
ComboBox->AddItem("OK",cmdButton1);//cmdButton is the name of OK
niuzhenjun
2003-09-12
打赏
举报
回复
ListBox->Items->Add("ffff");
ComboBox->Items->Add("jjjj");
ComboBox->Text;
sinth
2003-09-12
打赏
举报
回复
我是说Object参数怎么用!!!!!,如果我传一个String给Object参数作为对应Item的符加值,我怎样取回我符加的String?
Delphi为T
Listbox
控件和T
Combobox
控件增加搜索功能.rar
Delphi为T
Listbox
控件和T
Combobox
控件增加搜索功能,使其具备输入提示功能,用起来更人性化,功能更完备。在右边输入一字符,左侧会自动出现匹配的字符串,本搜索是在T
Listbox
、T
Combobox
控件中实现的,若想自己添加这种功能,可参考下本源码。
一些 VCL 控件的Delphi用法示例参考.rar
一些 VCL 控件的Delphi用法示例参考,这些示例都挺基础和实用,对学习Delphi中的VCL控件使用有帮助: 动态创建主菜单和菜单项,加速T
ListBox
控件的填充和清空,加速TTreeView控件的填充和清空,实现.dfm文件和.txt文件的互相转换,使程序能在循环中响应界面操作,消除在TEdit控件中按下回车键时的声音,用剪贴板复制和粘贴图像,在
String
Grid中设置只读栏,在T
Listbox
、T
Combobox
中实现自动搜索,在T
String
Grid控件中删除整行……
delphi_随机滚动_抽奖
unit UnitMain; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls, ExtCtrls, math, Buttons; type TRandomForm = class(TForm) Button1: TButton; Timer1: TTimer; EditPath: TEdit;
ListBox
1: T
ListBox
; Button2: TButton; SpeedButton1: TSpeedButton; EditName: TEdit; OpenDialog: TOpenDialog; procedure Button1Click(Sender: T
Object
); procedure Timer1Timer(Sender: T
Object
); procedure Button1KeyPress(Sender: T
Object
; var Key: Char); procedure FormShow(Sender: T
Object
); procedure SpeedButton1Click(Sender: T
Object
); procedure Button2Click(Sender: T
Object
); private s: T
String
List; //从文件中读取数据 Current: Integer; //随机数产生的序号 Num: Integer; //数组中的数量 I: Integer; //序号 public // procedure LoadFile; // 装载文件 procedure GetNameValue; end;
delphi 基本控件T
ListBox
的应用
delphi 基本控件T
ListBox
的应用 delphi7编译测试通过 delphi 式微
delphi7系统文件备份系统
unit Unit1; interface uses Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls, FileCtrl; type TForm1 = class(TForm) Drive
ComboBox
1: TDrive
ComboBox
; File
ListBox
1: TFile
ListBox
; Directory
ListBox
1: TDirectory
ListBox
; Button1: TButton; Button2: TButton;
ListBox
1: T
ListBox
; Button3: TButton; Button4: TButton; Button5: TButton; Button6: TButton; Edit1: TEdit; Label1: TLabel; Label2: TLabel; Label3: TLabel; Label4: TLabel; Label5: TLabel; Label6: TLabel; Label7: TLabel; Label8: TLabel; Label9: TLabel; Edit2: TEdit; Label10: TLabel; Label11: TLabel; Edit3: TEdit; Label12: TLabel; procedure Start(Sender: T
Object
); procedure changedrive(Sender: T
Object
); procedure SelectFolder(Sender: T
Object
); procedure Directory
ListBox
1Change(Sender: T
Object
); procedure
Add
it(Sender: T
Object
); procedure Del(Sender: T
Object
); procedure Savelist(Sender: T
Object
); procedure foldercheck(Sender: T
Object
); procedure Search(Sender: T
Object
); procedure findlist(sender: T
Object
); procedure main(Sender: T
Object
); private { Private declarations } public { Public declarations } end; var Form1: TForm1; Bak:
string
; implementation {$R *.DFM} procedure TForm1.Start(Sender: T
Object
); {copies files when backup required only replaces ones with newer time date} var dir,newstr,oldstr,s,ss:
string
; d,f,n,nod,nof,age,bakage,len,lendir,newF:integer; {number of directories ,number of files} a,b:boolean; begin NewF:=0; a:=false; dir:=Directory
ListBox
1.Directory; nod:=
ListBox
1.
item
s.count; for d:=0 to (nod-1) do begin Directory
ListBox
1.Directory:=
listbox
1.
item
s[d]; File
ListBox
1.Directory:=Directory
ListBox
1.Directory; dir:=Directory
ListBox
1.Directory; nof:=File
ListBox
1.
item
s.count; for f:=0 to (nof-1) do begin oldstr:=Bak; newstr:=dir+'\'+File
listBox
1.
item
s[f]; lendir:=length(dir); {oldstr:=Bak+'\'+copy(dir,4,len-3);} n:=pos('\',dir); s:=copy(dir,n+1,lendir); n:=pos('\',s); repeat ss:=copy(s,1,n-1); oldstr:=oldstr+'\'+ss; b:=DirectoryExists(oldstr); if b=false then mkdir(oldstr); len:=length(oldstr); s:=copy(dir,len-2,lendir); n:=pos('\',s); until n=0; len:=length(newstr); oldstr:=bak+'\'+copy(newstr,4,len-3); age:=fileage(newstr); bakage:=Fileage(oldstr); if (age
Object); begin Directory
ListBox
1.Drive:=Drive
ComboBox
1.Drive; File
ListBox
1.Drive:=Drive
ComboBox
1.Drive; end; procedure TForm1.SelectFolder(Sender: T
Object
); begin File
ListBox
1.Directory:=Directory
ListBox
1.Directory; end; procedure TForm1.Directory
ListBox
1Change(Sender: T
Object
); begin File
ListBox
1.Directory:=Directory
ListBox
1.Directory; end; procedure TForm1.
Add
it(Sender: T
Object
); {
Add
s a folder to the bakup list and saves list - click button when
add
ed} begin
ListBox
1.
item
s.
Add
(Directory
ListBox
1.Directory); Savelist(sender); end; procedure TForm1.Del(Sender: T
Object
); var n:integer; begin n:=
listbox
1.
item
index;
Listbox
1.
item
s.Delete(n); end; procedure TForm1.Savelist(Sender: T
Object
); {saves as bakup disk\bakup folder\folderlist.txt to disk the list of folders requiring bakup on } var folderlist:textfile; n,m:integer; s:
string
; begin n:=
listbox
1.
item
s.count; assignfile(folderlist,bak+'\folderlist.txt'); rewrite(folderlist); for m:=0 to (n-1) do begin s:=
listbox
1.
item
s[m]; writeln(folderlist,s); end; closefile(folderlist); end; procedure TForm1.findlist(sender: T
Object
); {Finds the list as saved on Disk and loads it at startup} var folderlist:textfile; s,ss:
string
; begin Bak:=edit1.text; ss:=bak+'\folderlist.txt'; assignfile(folderlist,ss{bak+'\folderlist.txt'}); reset(folderlist); repeat readln(folderlist,s);
listbox
1.
item
s.
add
(s); until (s='eof') or (s=''); closefile(folderlist); end; procedure TForm1.foldercheck(Sender: T
Object
); {check folders in
Listbox
and makes ones not already existing} var n,nod,d:integer; s,sFront,sTemp:
string
; b:boolean; begin nod:=
ListBox
1.
item
s.count; {first see if all folders exist in Bakup folder starting from the top make any not existing - ie sets up the Bakup folder structure} for d:=0 to nod-1 do begin s:=
listbox
1.
item
s[d]; s:=s+'\'; delete(s,1,3); sFront:=Bak; repeat n:=pos('\',s); if n<>0 then begin sTemp:=copy(s,1,n-1); sFront:=sFront+'\'+sTemp; b:=DirectoryExists(sFront); if b=false then MkDir(sFront); Delete(s,1,n); end; until n=0; end; end; procedure TForm1.Search(Sender: T
Object
); {Takes folder list in
listbox
1 and looks to see if one next level down has new folders. If yes then it makes the new folder and
add
s it to the
listbox
this enables bakup of new web pages with a PageFiles folder then saves list Does not seem to
add
to list box new directories found so that it digs deeper next time appears to
add
directory tried this saw it in .txt file (notpad) but on closing it must save in it original form as it has them gone has this to do with the blank lie that gets
add
ed in??????????????????} var nod,numinbox,nn,d,NewDir,len:integer; s,ss,dir:
string
; b:boolean; begin NewDir:=0; nod:=
ListBox
1.
item
s.count; for d:=0 to nod-1 do begin Directory
ListBox
1.Directory:=
listbox
1.
item
s[d]; File
ListBox
1.Directory:=Directory
ListBox
1.Directory; dir:=Directory
ListBox
1.Directory; numinbox:=directory
ListBox
1.
item
s.count; {top:=directory
ListBox
1.
item
s[0]; top2nd:=directory
ListBox
1.
item
s[1];} for nn:=3 to numinbox-1 do begin s:=
listbox
1.
item
s[d]+'\'+Directory
ListBox
1.
item
s[nn]; b:=DirectoryExists(s); if b=true then begin len:=length(s); ss:=copy(s,4,len); ss:=Bak+'\'+ss; b:=DirectoryExists(ss); if b=false then begin mkdir(ss);
listbox
1.
item
s.
add
(s); NewDir:=NewDir+1; end; end; end; end; Edit2.text:=inttostr(NewDir); savelist(sender); end; procedure TForm1.main(Sender: T
Object
); begin findlist(sender); {find list of directories from disk}; foldercheck(sender);{check directories from list exist and if not make them} search(sender); {search for folder one level down} start(sender); {save files if there is a more up to date one} end; end.
ActiveX/COM/DCOM
703
社区成员
3,002
社区内容
发帖
与我相关
我的任务
ActiveX/COM/DCOM
C++ Builder ActiveX/COM/DCOM
复制链接
扫一扫
分享
社区描述
C++ Builder ActiveX/COM/DCOM
社区管理员
加入社区
获取链接或二维码
近7日
近30日
至今
加载中
查看更多榜单
社区公告
暂无公告
试试用AI创作助手写篇文章吧
+ 用AI写文章