home *** CD-ROM | disk | FTP | other *** search
/ Delphi Programming Unleashed / Delphi_Programming_Unleashed_SAMS_Publishing_1995.iso / misc / objects / listsub / main.pas < prev    next >
Encoding:
Pascal/Delphi Source File  |  1995-03-21  |  1.2 KB  |  61 lines

  1. unit Main;
  2.  
  3. { Program copyright (c) 1995 by Charles Calvert }
  4. { Project Name: LISTSUB }
  5.  
  6. { Tired of always writing ListBox1.Items.Add? The ListBox shown
  7.   in unit MYLIST lets you right ListBox1.Add. }
  8.  
  9. interface
  10.  
  11. uses
  12.   WinTypes, WinProcs, Classes,
  13.   Graphics, Forms, Controls,
  14.   MyList, StdCtrls, SysUtils,
  15.   DB, Dialogs;
  16.  
  17. type
  18.   TForm1 = class(TForm)
  19.     Button1: TButton;
  20.     Database1: TDatabase;
  21.     GetCurrent: TButton;
  22.     procedure Button1Click(Sender: TObject);
  23.     procedure GetCurrentClick(Sender: TObject);
  24.   private
  25.     LBox: TMyListBox;
  26.   end;
  27.  
  28. var
  29.   Form1: TForm1;
  30.  
  31. implementation
  32.  
  33. {$R *.DFM}
  34.  
  35. procedure TForm1.Button1Click(Sender: TObject);
  36. var
  37.   i: Integer;
  38. begin
  39.   GetCurrent.Enabled := True;
  40.   LBox := TMyListBox.Create(Self);
  41.   LBox.Parent := Form1;
  42.   LBox.Left := 10;
  43.   LBox.Top := 10;
  44.   Lbox.Width := ClientWidth - 20;
  45.   LBox.Height := ClientHeight - 75;
  46.   LBox.Visible := True;
  47.   for i := 1 to 100 do
  48.     LBox.Add('Itemless ListBox! => ' + IntToStr(i));
  49. end;
  50.  
  51. procedure TForm1.GetCurrentClick(Sender: TObject);
  52. var
  53.   S: string;
  54. begin
  55.   S := LBox.CurString;
  56.   MessageDlg(S, mtInformation, [mbOk], 0);
  57. end;
  58.  
  59. end.
  60.  
  61.