void __fastcall TCustomDialog::AddEditLikeControl(TWinControl * Edit, TLabel * Label, bool OneLine)
{
  Edit->Parent = GetDefaultParent();
  // this updates Height property to real value
  Edit->HandleNeeded();

  if (Label != NULL)
  {
    Label->Parent = GetDefaultParent();
    Label->Left = FIndent;

    if (OneLine)
    {
      DebugAssert(Edit->Height > Label->Height);
      Label->Top = FPos + ((Edit->Height - Label->Height) / 2);
    }
    else
    {
      Label->Top = FPos;

      FPos += Label->Height + ScaleByTextHeight(this, 4);
    }
  }

  Edit->Top = FPos;
  if (OneLine)
  {
    Edit->Left = GetDefaultParent()->ClientWidth - FHorizontalMargin - Edit->Width;
  }
  else
  {
    Edit->Left = FIndent;
    Edit->Width = GetMaxControlWidth(Edit);
  }

  AdjustHeight(Edit);

  if (Label != NULL)
  {
    if (Label->FocusControl == NULL)
    {
      Label->FocusControl = Edit;
    }
    else
    {
      DebugAssert(Label->FocusControl == Edit);
    }
  }

  AddWinControl(Edit);
}

void __fastcall TCustomDialog::AddEditLikeControl(TWinControl * Edit, TLabel * Label, bool OneLine)
{
  Edit->Parent = GetDefaultParent();
   
  Edit->HandleNeeded();

  if (Label != NULL)
  {
    Label->Parent = GetDefaultParent();
    Label->Left = FIndent;

    if (OneLine)
    {
      DebugAssert(Edit->Height > Label->Height);
      Label->Top = FPos + ((Edit->Height - Label->Height) / 2);
    }
    else
    {
      Label->Top = FPos;

      FPos += Label->Height + ScaleByTextHeight(this, 4);
    }
  }

  Edit->Top = FPos;
  if (OneLine)
  {
    Edit->Left = GetDefaultParent()->ClientWidth - FHorizontalMargin - Edit->Width;
  }
  else
  {
    Edit->Left = FIndent;
    Edit->Width = GetMaxControlWidth(Edit);
  }

  AdjustHeight(Edit);

  if (Label != NULL)
  {
    if (Label->FocusControl == NULL)
    {
      Label->FocusControl = Edit;
    }
    else
    {
      DebugAssert(Label->FocusControl == Edit);
    }
  }

  AddWinControl(Edit);
}
