Link to home
Start Free TrialLog in
Avatar of Thor371
Thor371

asked on

form create

im making a form at run time but when i create form i cant access form1 anymore the focus shifts to new form and i have to close form1 in order to be able to access anything on form1.

How can i have 2 forms which allow for one to be inactive with focus while i'm using the other form?

my code

procedure TForm1.Button1Click(Sender: TObject);
nForm: TForm;
lstbx: TListBox;
begin
  nForm := TForm.Create(Application);
  lstbx := TListBox.Create(nForm);
  with nForm do
  try
  Parent := Form1;
  Height := 150;
  Width := 350;
  caption := 'Test';
  horzscrollbar.Visible := false;
  vertscrollbar.Visible := false;
  snapbuffer := 20;
  screensnap := true;
  with lstbx do
  begin
  Parent := nForm;
  Width := 350;
  Height := 150;
  end;
  ShowModal();
  finally
  nForm.Release();
end;
end;
ASKER CERTIFIED SOLUTION
Avatar of BlackTigerX
BlackTigerX

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Thor371
Thor371

ASKER

ty tiger