yuswaroengsoftware Blog’s Delphi Tutorial
mengganti nama direktori
procedure TForm1.BtnSelectClick(Sender: TObject);
var DirTemp: string;
begin
DirTemp:=GetCurrentDir;
if SelectDirectory(DirTemp, [], 1000) then
begin
Panel1.Caption := DirTemp;
Edit1.Text := DirTemp;
end;
end;
procedure TForm1.BtnRenameClick(Sender: TObject);
begin
if DirectoryExists(Panel1.Caption) then
begin
RenameFile(Panel1.Caption, Edit1.Text);
Panel1.Caption := Edit1.Text;
end;
end;
Aplikasi Dialog Box
unit main;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls, ExtCtrls;
type
TForm1 = class(TForm)
Button1: TButton;
Button2: TButton;
RadioGroup1: TRadioGroup;
Edit1: TEdit;
Label1: TLabel;
ListBox1: TListBox;
Label2: TLabel;
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.DFM}
procedure TForm1.Button1Click(Sender: TObject);
begin
showmessage(edit1.text);
end;
procedure TForm1.Button2Click(Sender: TObject);
var i:integer;
pbutton:set of TMsgDlgBtn;
picon:TMsgDlgType;
begin
pbutton:=[];
case radiogroup1.ItemIndex of
0: picon:=mtWarning;
1: picon:=mtError;
2: picon:=mtInformation;
3: picon:=mtConfirmation;
4: picon:=mtCustom;
end;
for i:=0 to listbox1.Items.Count-1 do begin
if listbox1.selected[i] then
case i of
0: pbutton:=pbutton+[mbYes];
1: pbutton:=pbutton+[mbNo];
2: pbutton:=pbutton+[mbOk];
3: pbutton:=pbutton+[mbCancel];
4: pbutton:=pbutton+[mbAbort];
5: pbutton:=pbutton+[mbRetry];
6: pbutton:=pbutton+[mbIgnore];
7: pbutton:=pbutton+[mbAll];
8: pbutton:=pbutton+[mbNoToAll];
9: pbutton:=pbutton+[mbYesToAll];
10: pbutton:=pbutton+[mbHelp];
end;
end;
messagedlg(edit1.text,picon,pbutton,0);
end;
end.
0 comments:
Post a Comment
Leave Your Comment Here!