Recent

Author Topic: Form move event  (Read 2151 times)

Borneq

  • Full Member
  • ***
  • Posts: 248
Form move event
« on: January 28, 2020, 03:08:33 pm »
Is possible detect if form is moved?  I ca'nt font OnMove event nor WM_MOVE message.
Problem is when I open popup form not modal but always on top. When I move basic form, popup form should close or also move.
If I set popup form as child - it can't go beyond parent form.
« Last Edit: January 28, 2020, 03:12:23 pm by Borneq »

wp

  • Hero Member
  • *****
  • Posts: 11853
Re: Form move event
« Reply #1 on: January 28, 2020, 03:14:08 pm »
There is an OnChangeBounds event of the form:

Code: Pascal  [Select][+][-]
  1. procedure TForm1.FormChangeBounds(Sender: TObject);
  2. begin
  3.   Caption := Format('L = %d, T = %d, W = %d, H = %d', [Left, Top, Width, Height]);
  4. end;  

Borneq

  • Full Member
  • ***
  • Posts: 248
Re: Form move event
« Reply #2 on: January 28, 2020, 04:17:53 pm »
I try first form with Edit, and second popup form, but is problem: popup should hide if edit or first form is deactivated, but it can be possible click on second form and use scrollbars.
My next attempt: two forms, second popup form has list and edit both.
Best solution would be is second form was child of first form, but is impossible popup go beyond first form?
Third attempt: big transparent form with two child forms?

Borneq

  • Full Member
  • ***
  • Posts: 248
Re: Form move event
« Reply #3 on: January 28, 2020, 06:43:22 pm »
Is posssible make resizable child control ? for example resizable panel? not resize after resizing form, but in reverse - form change it size to fit panel?

lucamar

  • Hero Member
  • *****
  • Posts: 4219
Re: Form move event
« Reply #4 on: January 28, 2020, 06:57:26 pm »
Is posssible make resizable child control ? for example resizable panel? not resize after resizing form, but in reverse - form change it size to fit panel?

I'm not sure whether it'll work but you can try setting the child form's Align property. But note that forms are not really designed for this kind of operation (i.e. making them children of other controls). Frames are most suited to this; it's in fact their raison d'être :)
Turbo Pascal 3 CP/M - Amstrad PCW 8256 (512 KB !!!) :P
Lazarus/FPC 2.0.8/3.0.4 & 2.0.12/3.2.0 - 32/64 bits on:
(K|L|X)Ubuntu 12..18, Windows XP, 7, 10 and various DOSes.

jamie

  • Hero Member
  • *****
  • Posts: 6090
Re: Form move event
« Reply #5 on: January 28, 2020, 10:51:59 pm »
Is posssible make resizable child control ? for example resizable panel? not resize after resizing form, but in reverse - form change it size to fit panel?

Place a TPanel on the form. Place a TSplitter beside it. Go into  the Anchor editor and have the Panel anchor to the splitter..

When you move the splitter the panel will size with it.
The only true wisdom is knowing you know nothing

Alexandr R

  • New Member
  • *
  • Posts: 24
Re: Form move event
« Reply #6 on: March 06, 2020, 08:35:41 pm »

 

TinyPortal © 2005-2018