Unit1.pas 557 B

12345678910111213141516171819202122232425262728293031323334353637
  1. unit Unit1;
  2. interface
  3. uses
  4. Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  5. Dialogs, StdCtrls;
  6. type
  7. TForm1 = class(TForm)
  8. lst1: TListBox;
  9. btn1: TButton;
  10. procedure btn1Click(Sender: TObject);
  11. private
  12. { Private declarations }
  13. public
  14. { Public declarations }
  15. end;
  16. var
  17. Form1: TForm1;
  18. implementation
  19. {$R *.dfm}
  20. { Realiza la acción del botón. }
  21. procedure TForm1.btn1Click(Sender: TObject);
  22. begin
  23. if lst1.ItemIndex >= 0 then
  24. begin
  25. Caption := lst1.Items[lst1.ItemIndex];
  26. end;
  27. end;
  28. end.