Recent

Author Topic: Get design time size of a Form at runtime?  (Read 784 times)

winni

  • Hero Member
  • *****
  • Posts: 3197
Get design time size of a Form at runtime?
« on: April 07, 2020, 09:52:06 pm »
Hi!

Is there an chance to get the design time size of a form at runtime -
after it may be resized a lot of times?

Winni

howardpc

  • Hero Member
  • *****
  • Posts: 4144
Re: Get design time size of a Form at runtime?
« Reply #1 on: April 07, 2020, 10:18:56 pm »
Could you not do something like this:
Code: Pascal  [Select][+][-]
  1. const
  2.   form_size: Types.TSize = (cx: 250, cy:300);  // or whatever ...
  3.  
  4. procedure TForm1.FormCreate(Sender: TObject);
  5. begin
  6.   SetInitialBounds(0, 0, form_size.cx, form_size.cy);
  7. end;  
where form_size if effectively the design time size?

winni

  • Hero Member
  • *****
  • Posts: 3197
Re: Get design time size of a Form at runtime?
« Reply #2 on: April 07, 2020, 10:27:11 pm »
Hi!

Thanx for the reply - I had the same idea.

I just asked if in the depth of TForm somewhere the design time size is hidden.

If not I will work with cx/cy const.

Winni

furious programming

  • Hero Member
  • *****
  • Posts: 858
Re: Get design time size of a Form at runtime?
« Reply #3 on: April 08, 2020, 09:04:56 am »
I just asked if in the depth of TForm somewhere the design time size is hidden.

What about resources? There are hidden lfm's — as RCDATA, for all forms.

Use Resource Hacker or similar software and you'll see. 8)
« Last Edit: April 08, 2020, 09:16:23 am by furious programming »
Lazarus 3.2 with FPC 3.2.2, Windows 10 — all 64-bit

Working solo on an acrade, action/adventure game in retro style (pixelart), programming the engine and shell from scratch, using Free Pascal and SDL. Release planned in 2026.

 

TinyPortal © 2005-2018