Monday, March 12, 2012

Praktikum AP 2A Minggu ke-1





Listing Program :


unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, ExtCtrls, StdCtrls;

type
  TForm1 = class(TForm)
    Label1: TLabel;
    Label2: TLabel;
    Edit1: TEdit;
    Label3: TLabel;
    Edit2: TEdit;
    Button1: TButton;
    Panel1: TPanel;
    Label4: TLabel;
    Label5: TLabel;
    procedure Button1Click(Sender: TObject);
    procedure Edit1Change(Sender: TObject);
    procedure Edit2Change(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.Button1Click(Sender: TObject);
begin

Label4.Caption := 'NAMA : ' + Edit1.Text;
if Label4.Font.Color = clBlue then
begin
Label4.Font.Color := clGreen;
end
else
begin
Label4.Font.Color := clBlue;
end;

label5.Caption := 'NPM  : ' + Edit2.Text;
if Label5.Font.Color = clBlue then
begin
Label5.Font.Color := clGreen;
end
else
begin
Label5.Font.Color := clBlue;
end;

Edit1.Text := '';
Edit2.Text := '';

end;

procedure TForm1.Edit1Change(Sender: TObject);
begin
if Edit1.Text = 'TypeHere' then
begin
Edit1.Text := '';
Edit1.Font.Style := Edit1.Font.Style-[fsItalic];

end;
end;

procedure TForm1.Edit2Change(Sender: TObject);
begin
if Edit2.Text = 'TypeHere' then
begin
Edit2.Text := '';
Edit2.Font.Style := Edit2.Font.Style-[fsItalic];

end;
end;

end.


Download File HERE!!