Recent

Author Topic: How to set the position of a secondary form below a editbox of the main form?  (Read 1441 times)

Jvan

  • Full Member
  • ***
  • Posts: 181
considering form borders.

jamie

  • Hero Member
  • *****
  • Posts: 6128
Code: Pascal  [Select][+][-]
  1. procedure TForm1.EditButton1ButtonClick(Sender: TObject);
  2. Var
  3.   P:TPoint;
  4. begin
  5.   P := EditButton1.ClientToScreen(Point(0,0));
  6.   Form2.Top := P.Y+EditButton1.Height;
  7.   Form2.Left:= P.X;
  8.   Form2.Show;
  9. end;                      
  10.  

Implement the OnDeActivate event of the drop down form so that you can set it non visible.
that way it behaves like a drop down and will go away as soon as you change focus to another control

Also I set the second form to have no border so you need to draw the outline of the form too.
The only true wisdom is knowing you know nothing

Jvan

  • Full Member
  • ***
  • Posts: 181
Thanks.

 

TinyPortal © 2005-2018