Aplikasi Perpustakaan Untuk Tugas Akhir Tingkat Pemula

Oke, teman teman kali ini saya akan berbagi source code untuk program Delphi 7.
Bagi kalian yang menyukai bahasa pemprograman terutama untuk Delphi, mari kita sharing di blog ini.
Berikut saya akan membahas mengenai aplikasi perpusatakaan dalam program delphi.

Program Perpusatakaan.


Tampilan Menu Utama
1. Membuat Menu Form Utama.

Buatlah sebuah Form untuk Menu Utama
Apabila kalian sudah menambahkan form coba kalian masukan koding di bawah ini.

source code:



1: unit Unit2;
2:
3: interface
4:
5: uses
6: Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
7: Dialogs, XPMan, Menus, ExtCtrls, ComCtrls, DB, ADODB, StdCtrls, Buttons;
8:
9: type
10: TForm_Utama = class(TForm)
11: XPManifest1: TXPManifest;
12: MainMenu1: TMainMenu;
13: MenuFile: TMenuItem;
14: FileKeluar: TMenuItem;
15: StatusBar1: TStatusBar;
16: Timer1: TTimer;
17: Koneksi: TADOConnection;
18: Panel1: TPanel;
19: BitBtn1: TBitBtn;
20: BitBtn2: TBitBtn;
21: BitBtn3: TBitBtn;
22: BitBtn4: TBitBtn;
23: FileLogout: TMenuItem;
24: Data: TMenuItem;
25: DataBuku: TMenuItem;
26: DataAnggota: TMenuItem;
27: DataPeminjaman: TMenuItem;
28: Tentang: TMenuItem;
29: MLS: TMenuItem;
30: procedure FormClose(Sender: TObject; var Action: TCloseAction);
31: procedure FileKeluarClick(Sender: TObject);
32: procedure Timer1Timer(Sender: TObject);
33: procedure FormActivate(Sender: TObject);
34: procedure FormCreate(Sender: TObject);
35: procedure BitBtn4Click(Sender: TObject);
36: procedure BitBtn2Click(Sender: TObject);
37: procedure BitBtn1Click(Sender: TObject);
38: procedure BitBtn3Click(Sender: TObject);
39: procedure FileLogoutClick(Sender: TObject);
40: procedure DataBukuClick(Sender: TObject);
41: procedure DataAnggotaClick(Sender: TObject);
42: procedure DataPeminjamanClick(Sender: TObject);
43: procedure MLSClick(Sender: TObject);
44: private
45: { Private declarations }
46: public
47: { Public declarations }
48: end;
49:
50: var
51: Form_Utama: TForm_Utama;
52:
53: implementation
54:
55: uses
56: unit1,unit3,unit4,unit5,unit6,unit7,unit8,unit9,unit10;
57:
58: {$R *.dfm}
59:
60: procedure TForm_Utama.FormClose(Sender: TObject; var Action: TCloseAction);
61: begin
62: if MessageDlg('Yakin ingin keluar?',mtConfirmation,[mbCancel,mbOk],0) = mrCancel then
63: Action := caNone
64: else
65: Form_Startup.Close;
66: end;
67:
68: procedure TForm_Utama.FileKeluarClick(Sender: TObject);
69: begin
70: close;
71: end;
72:
73: procedure TForm_Utama.Timer1Timer(Sender: TObject);
74: begin
75: StatusBar1.Panels[0].Text := FormatDateTime('hh:mm',Time);
76: StatusBar1.Panels[1].Text := FormatDateTime('dddd, dd/mm/yyyy',Date);
77: end;
78:
79: procedure TForm_Utama.FormActivate(Sender: TObject);
80: begin
81: Panel1.Left := round((screen.Width / 2) - (Panel1.Width / 2));
82: Panel1.Top := round((screen.Height / 2) - (Panel1.Height / 2));
83: statusbar1.Panels[0].Width := round(screen.Width * 0.1);
84: statusbar1.Panels[1].Width := round(screen.Width * 0.3);
85: statusbar1.Panels[2].Width := round(screen.Width * 0.4);
86: statusbar1.Panels[3].Width := round(screen.Width * 0.2);
87: if StatusBar1.Panels[3].Text = '' then
88: begin
89: Panel1.Hide;
90: Form_Login.ShowModal;
91: end;
92: end;
93:
94: procedure TForm_Utama.FormCreate(Sender: TObject);
95: begin
96: Koneksi.ConnectionString := 'Provider=Microsoft.Jet.OLEDB.4.0;Data Source=' +
ExtractFilePath(Application.ExeName) + '\Data\dbPerpus.mdb';
97: end;
98:
99: procedure TForm_Utama.BitBtn4Click(Sender: TObject);
100: begin
101: close;
102: end;
103:
104: procedure TForm_Utama.BitBtn2Click(Sender: TObject);
105: begin
106: panel1.Hide;
107: Form_AnggotaBaru.ShowModal;
108: end;
109:
110: procedure TForm_Utama.BitBtn1Click(Sender: TObject);
111: begin
112: Panel1.Hide;
113: Form_Peminjaman.ShowModal;
114: end;
115:
116: procedure TForm_Utama.BitBtn3Click(Sender: TObject);
117: begin
118: panel1.Hide;
119: Form_Pengembalian.ShowModal;
120: end;
121:
122: procedure TForm_Utama.FileLogoutClick(Sender: TObject);
123: begin
124: statusbar1.Panels[3].Text := '';
125: statusbar1.Panels[2].Text := '';
126: self.Activate;
127: end;
128:
129: procedure TForm_Utama.DataBukuClick(Sender: TObject);
130: begin
131: if (statusbar1.Panels[3].Text = 'Admin') then
132: begin
133: panel1.Hide;
134: Form_DataBuku.ShowModal;
135: end
136: else
137: begin
138: MessageDlg('Anda tidak diijinkan membuka Data Buku!',mtError,[mbOk],0);
139: end;
140: end;
141:
142: procedure TForm_Utama.DataAnggotaClick(Sender: TObject);
143: begin
144: panel1.Hide;
145: Form_DataAnggota.ShowModal;
146: end;
147:
148: procedure TForm_Utama.DataPeminjamanClick(Sender: TObject);
149: begin
150: panel1.Hide;
151: Form_DataPeminjaman.ShowModal;
152: end;
153:
154: procedure TForm_Utama.MLSClick(Sender: TObject);
155: begin
156: panel1.Hide;
157: Form_Tentang.ShowModal;
158: end;
159:
160: end.

Setelah kalian memasukan code source di atas, selanjutnya kita membuat form untuk pendaftaran Anggota Baru Peminjam. Untuk tutorial atau source codenya bisa kalian lihat di sini.

Comments