Setting BoundsRect locked out within OnCreate of form if not using poDesign. lazarus / 31-LCL ---------------------------------------------------------------------- jamie · 2019-06-19 20:52 When did this inability of Setting the BoundsRect inside of the OnCReate of a form stop working if you are not using poDesign for the POSITION property?   I had my forms set to poDefault and while that uses the OS suggested position for your form, I still need to be able to set it from my config file when starting the app..  The only time I don't set it is if I don't yet have a config file or the entry isn't in there, therefor I can allow the OS to pick A location for the initial position of the form..   The setting of the POSITION property "boundsrect" should respect what I want to do while in the OnCreate event and if I chose not to set it, it'll  use the OS settings.  If I use poDesign it will allow me to set it but then again, if the app runs the first time on a PC with a different screen layout It may not fit!.. ---------------------------------------------------------------------- Zoran · 2019-06-19 22:34 Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i procedure TForm1.FormCreate(Sender: TObject);begin  if FoundConfigFile then begin    Position := poDesigned;    top := 500; // what you read from config file    Left := 800;  end else    Position := poDefault;end; ---------------------------------------------------------------------- jamie · 2019-06-20 01:21 In the past I didn't have to change the Position property within the Event to do this..  basically the form should be setting the boundsRect before the OnCreate event is called and if the code in the OnCreate decides to change it again so be it.   But that isn't what's happening..    Although I can work around this, as pointed out by you, I shouldn't need to do this.   This has to be a change that was done in a recent release of Laz because I don't remember seeing this before.  I made a class derived from TInifile that has a TIniFileEx.WriteRect(Section, Key:String; Value:TRect);  The reading part accepts a Default TRECT which is the current BoundsRect of the form if the value does not yet exist in the file. So this stands the reason why the TFORM.OnCreate should already have a valid BoundsRect setup before this event.  I will need to do some more research... Thanks.  TiniFileExe ---------------------------------------------------------------------- Thaddy · 2019-06-20 06:14 Quote from: jamie on June 20, 2019, 03:21:19 amSo this stands the reason why the TFORM.OnCreate should already have a valid BoundsRect setup before this event. Theoretically you have only three solid options: - In the constructor of your form. - In the AfterConstruction of your form - In the OnCreate Event itself Any other options that may have worked (e.g. onpaint, onshow) are by accident. ---------------------------------------------------------------------- jamie · 2019-06-23 20:03 For now  I used Zoran's idea. R := BoundsRect; Position := poDesigned; BoundsRect := SetUpini.ReadRect(Section, FormBoundsRectKey, R); This way I have the form startup in poDefault, get the suggested bounds as the default and use it as a Default if the key does not yet exist in the INI file. btw, I sub classed the TiniFIle and added some bells and ding dongs to it..