unit popup; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls; type TForm2 = class(TForm) ListBox1: TListBox; procedure ListBox1DblClick(Sender: TObject); private { Private declarations } public { Public declarations } end; var Form2: TForm2; implementation uses main; {$R *.dfm} procedure TForm2.ListBox1DblClick(Sender: TObject); var x: Integer; begin x:= Form1.postoline(Form1.Source.Lines,Form1.Source.SelStart); Form1.Source.Lines.Insert(x,ListBox1.Items.Strings[Listbox1.ItemIndex]); Form1.Source.Lines.Delete(x-1); Form2.Hide; end; end.