Arsip: component terenabled ..?

 
user image
more 15 years ago

nurez

hiii all :p moga2 ngga bosen jwb masalah2ku ini, sY lg coba running porgram, yang codenya:
unit pegawai;
interface
uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls, Buttons, ADODB, DB, Grids, DBGrids;
type
  TForm1 = class(TForm)
    nip: TEdit;
    nama: TEdit;
    jab: TEdit;
    alamat: TEdit;
    jenis: TComboBox;
    mulai: TEdit;
    status: TComboBox;
    gol: TComboBox;
    Label1: TLabel;
    Label2: TLabel;
    Label3: TLabel;
    Label4: TLabel;
    Label5: TLabel;
    Label6: TLabel;
    Label7: TLabel;
    Label8: TLabel;
    GroupBox1: TGroupBox;
    save1: TBitBtn;
    clear1: TBitBtn;
    edit1: TBitBtn;
    delete1: TBitBtn;
    close1: TBitBtn;
    ADOConnection1: TADOConnection;
    ADOTable1: TADOTable;
    DBGrid1: TDBGrid;
    DataSource1: TDataSource;
    Query1: TADOQuery;
    pencarian: TGroupBox;
    find2: TEdit;
    find1: TBitBtn;
    BitBtn2: TBitBtn;
    procedure save1Click(Sender: TObject);
    procedure find1Click(Sender: TObject);
    procedure FormCreate(Sender: TObject);
    procedure DBGrid1MouseMove(Sender: TObject; Shift: TShiftState; X,
      Y: Integer);
    procedure FormKeyPress(Sender: TObject; var Key: Char);
    procedure edit1Click(Sender: TObject);
    procedure clear1Click(Sender: TObject);
    procedure delete1Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;
var
  Form1: TForm1;

implementation

{$R *.dfm}
procedure TForm1.FormCreate(Sender: TObject);
begin
nip.Text:='';
nama.Text:='';
status.Text:='';
alamat.Text:='';
jenis.Text:='';
gol.Text:='';
jab.Text:='';
mulai.Text:='';
status.Items.clear;
status.Items.append('menikah');
status.Items.append('single');
status.Items.append('janda');
status.Items.append('duda');
jenis.Items.clear;
jenis.Items.append('laki-laki');
jenis.Items.append('perempuan');
gol.Items.clear;
gol.Items.append('A1-Tetap');
gol.Items.append('A2-Bulanan');
gol.Items.append('A3-Harian');
end;
procedure TForm1.FormKeyPress(Sender: TObject; var Key: Char);
begin
if Key =#13then
  begin
    
    Key :=#0;
  end;
end;
procedure TForm1.save1Click(Sender: TObject);
begin
  adotable1.Close;
  adotable1.Open;
  if adotable1.FieldValues['nip'] <> nip.Text  then
  begin
    adotable1.Append;
    adotable1.FieldValues['nip']:=nip.Text;
    adotable1.FieldValues['nama']:=nama.Text;
    adotable1.FieldValues['status']:=STATUS.Text;
    adotable1.FieldValues['alamat']:=alamat.Text;
    adotable1.FieldValues['JENIS']:=jenis.Text;
    adotable1.FieldValues['golongan']:=gol.Text;
    adotable1.FieldValues['jabatan']:=jab.Text;
    adotable1.FieldValues['mulai_kerja']:=mulai.Text;
    formcreate(sender);
    adotable1.UpdateRecord;
    adotable1.Post;
    showmessage('silakan dilihat di DBmsnya Udah Terupdate belum..?');
  end
  else
    showmessage('nip yang anda input sudah ada');
    nip.SetFocus;
end;
procedure TForm1.find1Click(Sender: TObject);
begin
if adotable1.Locate('nip',find2.Text,[loCaseInsensitive]) then
begin
  nip.enabled:=false;
  nip.Text:=adotable1.FieldValues['nip'];
  nama.Text:=adotable1.FieldValues['nama'];
  status.Text:=adotable1.FieldValues['status'];
  alamat.Text:=adotable1.FieldValues['alamat'];
  jenis.Text:=adotable1.FieldValues['jenis'];
  gol.Text:=adotable1.FieldValues['golongan'];
  jab.Text:=adotable1.FieldValues['jabatan'];
  mulai.Text:=adotable1.FieldValues['mulai_kerja'];
  find2.Text:='';
  end
  else
  showmessage('nip yang anda input tidak ada');
end;

procedure TForm1.DBGrid1MouseMove(Sender: TObject; Shift: TShiftState; X,
  Y: Integer);
var
pt: TGridcoord;
begin
pt:= DBGrid1.MouseCoord( x, y ) ;
//change the cursor when over title
if pt.y=0 then 
DBGrid1.Cursor:=crHandPoint
else 
DBGrid1.Cursor:=crDefault;
If pt.X > 0 Then 
Caption := Format( 'by= nurezio kolom: %d, baris: %d, field name: %s',
[pt.x, pt.y, DBGrid1.columns[pt.x-1].title.caption] )
Else
Caption := Format( 'kolom: %d, baris: %d',[pt.x, pt.y] ) ;
end;


procedure TForm1.edit1Click(Sender: TObject);
begin
adotable1.Edit;
adotable1.FieldValues['nip']:=nip.Text;
adotable1.FieldValues['nama']:=nama.Text;
adotable1.FieldValues['status']:=STATUS.Text;
adotable1.FieldValues['alamat']:=alamat.Text;
adotable1.FieldValues['JENIS']:=jenis.Text;
adotable1.FieldValues['golongan']:=gol.Text;
adotable1.FieldValues['jabatan']:=jab.Text;
adotable1.FieldValues['mulai_kerja']:=mulai.Text;
adotable1.post;
nip.enabled:=false;
end;
procedure TForm1.clear1Click(Sender: TObject);
begin
formcreate(sender);
nip.enabled:=false;
end;
procedure TForm1.delete1Click(Sender: TObject);
begin
adotable1.delete;
formcreate(sender);
end;
end.
ketika sY klik edit... trnyata nip.text ter enabled sendiri atau ngga bisa di isi data baru...? mohon pencerahannya :) Thanks All suported by: saysansay
user image
more 15 years ago

LuriDarmawan

ter enabled sendiri ? terdisable sendiri mungkin maksudnya ya? coba cek ada penulisan:
nip.enabled:=false
ini khan men-disable obyek
user image
more 15 years ago

deLogic

yoa.. kali aja itu akibat copy-paste yang nilainya belum sempat diubah jadi True... :)
user image
more 15 years ago

saysansay

Akhi nurez untuk pencarian akhi salah...moso abis funsi locaseisensitife [php:1:26c443bdfa] begin nip.enabled:=false; [/php:1:26c443bdfa] akhi nuRez teliti..jagan ceroboh gitu...atuhhhhh...afwan jiddan...ana terlalu memanjakan antum....astagfirullaohalazim..
user image
more 15 years ago

nurez

..astagfirullaohalazim...
afwan ane lupa akhi :) ngga inget sm skli, trnayta banyak yg ter-disable, ntr ane edit lg d :) 1 hurs later... "Yaaa aminnn dh bisa :) ane hapus smua "nip.enabled:=false -nya"
Akhi nurez untuk pencarian akhi salah...moso abis funsi locaseisensitife..
maksudnya akh.? kn dh ok runningnya..? asa masih ada yg salah sama FIND nya..? THx all dh jawab masalah ini :)
more ...
  • Pages:
  • 1
Share to

Random Topic

Local Business Directory, Search Engine Submission & SEO Tools FreeWebSubmission.com SonicRun.com