TForm f;
TListbox l;
TButton b;

void ButtonClick(TButton Sender)
{
  f.ModalResult = mrOk;
}

{
   string s = "1. First line\n2. Second line";
   
   f = new TForm(nil);
   f.Caption = "MyApp...";
   f.BorderStyle = bsSizeable;
   f.Position = poScreenCenter;
   f.Width = 400;
   f.Height = 300;
   int w = f.ClientWidth;
   int h = f.ClientHeight;
   
   l = new TListBox(f);
   l.Name = "lbData";
   l.Parent = f;
   l.SetBounds(1, 1, w - 1, h - 35);
   l.Anchors = akLeft+akTop+akRight+akBottom;
   l.Items.Text = s; 
   
   b = new TButton(f);
   b.Name = "btnClose";
   b.Parent = f;
   b.SetBounds(w - 80, h - 30, 75, 25);
   b.Anchors = akRight+akBottom;
   b.Caption = "Close";

   b.OnClick = &ButtonClick; 
   
   // Show the dialog
   f.ShowModal;
   f.Free;

}

