Recent

Author Topic: Form sizing and position  (Read 2021 times)

JLWest

  • Hero Member
  • *****
  • Posts: 1293
Form sizing and position
« on: April 18, 2018, 08:48:35 pm »
  SetBounds((Screen.WorkAreaWidth -1100) Div 2,
            (Screen.WorkAreaHeight-500) Div 2,
             500, 300);
  Constraints.MinHeight:= 700;
  Constraints.MaxHeight:= 700;
  Constraints.MinWidth := 1100;
  Constraints.MaxWidth := 1100;
 
I Have been using this code to set the size of a modal form for quite some time.

Today when I opened the project it threw an error. I have no Idea why all of a sudden it throws an error.

I would like the form to open in the center of the screen, not be resizable.
                         
FPC 3.2.0, Lazarus IDE v2.0.4
 Windows 10 Pro 32-GB
 Intel i7 770K CPU 4.2GHz 32702MB Ram
GeForce GTX 1080 Graphics - 8 Gig
4.1 TB

Soner

  • Sr. Member
  • ****
  • Posts: 305
Re: Form sizing and position
« Reply #1 on: April 18, 2018, 09:55:34 pm »
[quote author=J
...
I would like the form to open in the center of the screen, not be resizable.
                         
[/quote]
You should post which error you get.
But forget what you did.  Make this in form designer for your form:
Code: Pascal  [Select][+][-]
  1. Position:=poScreenCenter; //there is more options
  2. BorderStyle:= bsSingle; //you can also take bsDialog


JLWest

  • Hero Member
  • *****
  • Posts: 1293
Re: Form sizing and position
« Reply #2 on: April 18, 2018, 10:27:00 pm »
I think I have something else going on.

I committed out the line giving the error.

Then I get an error on the next line down.
and so on and so on.

So I copied all the code to another dir and I'm dismantling the code procedure and function one by one recompiling after each delete to try and determine the problem..
FPC 3.2.0, Lazarus IDE v2.0.4
 Windows 10 Pro 32-GB
 Intel i7 770K CPU 4.2GHz 32702MB Ram
GeForce GTX 1080 Graphics - 8 Gig
4.1 TB

jamie

  • Hero Member
  • *****
  • Posts: 6090
Re: Form sizing and position
« Reply #3 on: April 18, 2018, 11:20:52 pm »
its the line before that is giving you the error, that is why it appears that way..

maybe you forgot to finalize the line before because the cursor for the error may sit on the next line.

The only true wisdom is knowing you know nothing

 

TinyPortal © 2005-2018