* * *

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

JLWest

  • Full Member
  • ***
  • Posts: 192
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.
                         
JLWEST 
 FPC 3.0.4, Lazarus IDE v1.8.2 Windows 10 Pro
 Intel i7 770K CPU 4.2GHz 16 Gig Ram
GeForce GTX 1080 Graphics - 8 Gig 1.5 Terabyte SSD

Soner

  • New member
  • *
  • Posts: 29
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

  • Full Member
  • ***
  • Posts: 192
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..
JLWEST 
 FPC 3.0.4, Lazarus IDE v1.8.2 Windows 10 Pro
 Intel i7 770K CPU 4.2GHz 16 Gig Ram
GeForce GTX 1080 Graphics - 8 Gig 1.5 Terabyte SSD

jamie

  • Hero Member
  • *****
  • Posts: 715
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.


 

Recent

Get Lazarus at SourceForge.net. Fast, secure and Free Open Source software downloads Open Hub project report for Lazarus