Arsip: Cara menambahkan komponent edit

 
user image
more 14 years ago

de27de

halo master delphi mohon bantuan nya plz aku mau buat inputan yang component edit nya bisa ditambahkan secara otomatis di form contoh barang 1 barang 2 barang 3 barang 4 barang 5 button ( + )button (-) yang pertama muncul barang 1 nah pas di klik button (+) inputan barang 2 muncul klik button (+) lagi inputan baranag 3 muncul klik button(+)lagi inputan barang 4 mucul gmn master coding buat menambahkan komponent edit aku coba 2 inputan berhasil tpi kalo datanya itu lebih dari 2 gmn cara nya menampilkan component edit /inputan mohon pencerahan nya
user image
more 14 years ago

elva_ivana

gunakan looping
user image
more 14 years ago

mas_kofa

koding yg udah kamu tulis kayak apa?
user image
more 14 years ago

de27de

coding masih simple edit2.show; untuk button (+)untuk button(-) edit2.hide; baru kaya gitu
user image
more 14 years ago

de27de

looping komponet aku ga tau kk gmn cara nya kalo char selain menggunakan komponent bis
user image
more 14 years ago

mas_kofa


unit Unit1;
interface
uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls;
type
  TForm1 = class(TForm)
    Edit1: TEdit;
    Edit2: TEdit;
    Edit3: TEdit;
    Edit4: TEdit;
    Edit5: TEdit;
    btnPlus: TButton;
    btnMinus: TButton;
    procedure FormCreate(Sender: TObject);
    procedure btnPlusClick(Sender: TObject);
    procedure btnMinusClick(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;
  EditSet : array of TEdit ;
  idx: integer;
implementation

{$R *.dfm}
procedure TForm1.FormCreate(Sender: TObject);
begin
  //set edit1..edit5 invisible;
  idx := 0;
  EditSet[1] := Edit1;
  EditSet[2] := Edit2;
  EditSet[3] := Edit3;
  EditSet[4] := Edit4;
  EditSet[5] := Edit5;
end;
procedure TForm1.btnPlusClick(Sender: TObject);
begin
  inc(idx);
  if idx > 5 then
  begin
    idx := 6;
    exit;
  end;
  EditSet[idx].Visible := true;
end;
procedure TForm1.btnMinusClick(Sender: TObject);
begin
  dec(idx);
  if idx < 1 then
  begin
    idx := 0;
    exit;
  end;
  EditSet[idx].Visible := false;
end;
end.
user image
more 14 years ago

mas_kofa

NB : if idx &gt; 5 then --> if idx > 5 then if idx &lt; 1 then --> if idx < 1 then
user image
more 14 years ago

de27de

tq kk mas_kofa
user image
more 14 years ago

mas_kofa

yupe..
more ...
  • Pages:
  • 1
Share to

Random Topic

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