Sorry for my bad English, first this is the logout syntax.
When I click logout, all active forms keep showing up and not closing.
procedure Tf_utama.KELUAR1Click(Sender: TObject);
begin
if MessageDlg('Logout ??',mtConfirmation,mbOKCancel,0)=mrOK
then
DATAINPUTAN1.Visible:=False;
INFODATA1.Enabled:=False;
TRANSAKSI.Enabled:=False;
LAPORAN1.Enabled:=False;
PENGATURAN1.Enabled:=False;
f_databuku:=nil;
f_rakbuku:=nil;
f_permintaan_pembeli:=nil;
f_rakbuku:=nil;
f_pengguna:=nil;
f_transaksi_penjualan:=nil;
f_transaksi_pembelian:=nil;
f_supplier:=nil;
StatusBar1.Panels[0].Text:='Nama Pengguna :';
StatusBar1.Panels[1].Text:='Hak Akses :';
end;
On each form to close I am using:
procedure Tf_caribuku.FormClose(Sender: TObject; var Action: TCloseAction);
begin
Action:=caFree;
f_caribuku:=nil;
end;
That's not how you close and free the form. You are just assigning nil to form pointers, which doesn't close them. What you have to call is TForm.Close(). Also, you have to open your if MessageDlg(... statement with begin..end; blocks if you want to execute multiple commands if statement is satisfied. So your code would look something like this:
procedure Tf_utama.KELUAR1Click(Sender: TObject);
begin
if MessageDlg('Logout ??',mtConfirmation,mbOKCancel,0) = mrOK then
begin
DATAINPUTAN1.Visible:=False;
INFODATA1.Enabled:=False;
TRANSAKSI.Enabled:=False;
LAPORAN1.Enabled:=False;
PENGATURAN1.Enabled:=False;
f_databuku.Close;
f_rakbuku.Close;
f_permintaan_pembeli.Close;
f_rakbuku.Close;
f_pengguna.Close;
f_transaksi_penjualan.Close;
f_transaksi_pembelian.Close;
f_supplier.Close;
StatusBar1.Panels[0].Text:='Nama Pengguna :';
StatusBar1.Panels[1].Text:='Hak Akses :';
end;
end;
Also, if any of forms you're trying to close is not created, I believe it will fail with AV exception. Better way to do this is to make another class which will serve as form container, e.g. TFormContainer, where you can Add and Remove forms on need. That way, upon logout, opened forms will be in TFormContainer class, and you can close them.