Lazarus

Programming => LCL => Topic started by: Jvan on May 17, 2021, 12:25:20 am

Title: How to set the position of a secondary form below a editbox of the main form?
Post by: Jvan on May 17, 2021, 12:25:20 am
considering form borders.
Title: Re: How to set the position of a secondary form below a editbox of the main form?
Post by: jamie on May 17, 2021, 01:02:37 am
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.
Title: Re: How to set the position of a secondary form below a editbox of the main form?
Post by: Jvan on May 17, 2021, 01:27:09 am
Thanks.
TinyPortal © 2005-2018