delphi中popupmenu的应用,右键文件没有弹出“重命名”的菜单,属性如何设置啊?运行无错误
---unit19implementationusesUnit20;{$R*.dfm}procedureTForm1.renameClick(Sender:TObject...
---unit 19
implementation
uses Unit20;
{$R *.dfm}
procedure TForm1.renameClick(Sender: TObject);
var oldname:string;
begin
oldname:=filelistbox1.FileName;
form2.Label3.Caption:=oldname;
form2.ShowModal;
end;
---unit 20
implementation
uses unit19 ;
{$R *.dfm}
procedure TForm2.Button1Click(Sender: TObject);
var newname:string;
ok:boolean;
begin
if edit1.text='' then //条件语句是 = 不是 :=; 变量声明语句是 str:string;
showmessage('文件名不存在!')
else
begin
newname:=form1.FileListBox1.Directory+'\'+edit1.Text;
ok:=renamefile(form1.FileListBox1.FileName,newname) ;
if ok then
begin
form2.Close;
form1.FileListBox1.Update;
end;
end
end;
procedure TForm2.Button2Click(Sender: TObject);
begin
close;
end; 展开
implementation
uses Unit20;
{$R *.dfm}
procedure TForm1.renameClick(Sender: TObject);
var oldname:string;
begin
oldname:=filelistbox1.FileName;
form2.Label3.Caption:=oldname;
form2.ShowModal;
end;
---unit 20
implementation
uses unit19 ;
{$R *.dfm}
procedure TForm2.Button1Click(Sender: TObject);
var newname:string;
ok:boolean;
begin
if edit1.text='' then //条件语句是 = 不是 :=; 变量声明语句是 str:string;
showmessage('文件名不存在!')
else
begin
newname:=form1.FileListBox1.Directory+'\'+edit1.Text;
ok:=renamefile(form1.FileListBox1.FileName,newname) ;
if ok then
begin
form2.Close;
form1.FileListBox1.Update;
end;
end
end;
procedure TForm2.Button2Click(Sender: TObject);
begin
close;
end; 展开
1个回答
展开全部
PopupMenu在编辑菜单的时候 各子按钮有各自的名称
例如 N1111 N2222 N3333
可以用enable属性 也可以用Visible属性
if 有图层 then
begin
N1111.Enabled:=true;
N2222.Enabled:=false;
N3333.Enabled:=true;
end
else
begin
N1111.Enabled:=false;
N2222.Enabled:=true;
N3333.Enabled:=false;
end;
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询