Recent

Author Topic: 1.6.4 form oncreate issue?  (Read 5707 times)

snorkel

  • Hero Member
  • *****
  • Posts: 817
1.6.4 form oncreate issue?
« on: March 07, 2017, 11:47:37 pm »
I looked in the release notes and did not notice anything, but I compiled one of my apps with 1.6.4 and I noticed that the oncreate event for the forms is not behaving the same as before, it seemed in prior releases that the oncreate was the first thing to fire, now objects on the form are being created first before the oncreate fires.

or it's an issue with tcombobox firing the onchange event with no items to add.

Not sure yet, but the app ran fine yesterday when built with 1.6.2.


***Snorkel***
If I forget, I always use the latest stable 32bit version of Lazarus and FPC. At the time of this signature that is Laz 3.0RC2 and FPC 3.2.2
OS: Windows 10 64 bit

mangakissa

  • Hero Member
  • *****
  • Posts: 1131
Re: 1.6.4 form oncreate issue?
« Reply #1 on: March 08, 2017, 11:01:28 am »
FormCreate is not the same as OnCreate. The first is a procedure, the other a constructor.
So Lazarus is doing exactly what it must do.
Lazarus 2.06 (64b) / FPC 3.0.4 / Windows 10
stucked on Delphi 10.3.1

Pascal

  • Hero Member
  • *****
  • Posts: 932
Re: 1.6.4 form oncreate issue?
« Reply #2 on: March 08, 2017, 11:21:41 am »
... now objects on the form are being created first before the oncreate fires.

That has always been the case for OnCreate. Nothing new here.
laz trunk x64 - fpc trunk i386 (cross x64) - Windows 10 Pro x64 (21H2)

snorkel

  • Hero Member
  • *****
  • Posts: 817
Re: 1.6.4 form oncreate issue?
« Reply #3 on: March 08, 2017, 02:52:36 pm »
Well, the behavior is different than 1.6.2...
I am talking about the oncreate handler for a form, when you double click on it in the events tab it creates a handler called formcreate or similar and the order that it's being called is different.

Just reporting what I have observed,  it could be some other changes in 1.6.4 that are causing it like the combo box onchange firing with no items added.  I will dig more into it today.
Bottom line is the code worked yesterday and for years going through each release of Lazarus.
***Snorkel***
If I forget, I always use the latest stable 32bit version of Lazarus and FPC. At the time of this signature that is Laz 3.0RC2 and FPC 3.2.2
OS: Windows 10 64 bit

snorkel

  • Hero Member
  • *****
  • Posts: 817
Re: 1.6.4 form oncreate issue?
« Reply #4 on: March 08, 2017, 04:58:26 pm »
Well, I got it working.
turned out it was something with the tdatetime picker control.
I have it sharing it's onchange with some comboboxes and it's onchange was firing before the forms oncreate event.
I had to uncheck it's DefaultToday property to stop it from firing it's onchange.  Once I did that the app works like it did before.

I don't think that property is new, so it still could be the forms oncreate is not firing first.  I don't have time to dig into in further so let's just keep in mind this is just behavior I observed after upgrading to 1.6.4
***Snorkel***
If I forget, I always use the latest stable 32bit version of Lazarus and FPC. At the time of this signature that is Laz 3.0RC2 and FPC 3.2.2
OS: Windows 10 64 bit

Bart

  • Hero Member
  • *****
  • Posts: 5265
    • Bart en Mariska's Webstek
Re: 1.6.4 form oncreate issue?
« Reply #5 on: March 08, 2017, 05:13:15 pm »
turned out it was something with the tdatetime picker control.
I have it sharing it's onchange with some comboboxes and it's onchange was firing before the forms oncreate event.
I had to uncheck it's DefaultToday property to stop it from firing it's onchange.  Once I did that the app works like it did before.

Pease file a bugreport about that (and attach a minimal testcase).

Bart

snorkel

  • Hero Member
  • *****
  • Posts: 817
Re: 1.6.4 form oncreate issue?
« Reply #6 on: March 08, 2017, 05:42:24 pm »
ok, if I have time.
I just compiled another app that uses the tdateedit control and had to uncheck the defaulttoday property, so that two instances of it so far.
I always set the current date in the forms oncreate so maybe that property is new?
***Snorkel***
If I forget, I always use the latest stable 32bit version of Lazarus and FPC. At the time of this signature that is Laz 3.0RC2 and FPC 3.2.2
OS: Windows 10 64 bit

Bart

  • Hero Member
  • *****
  • Posts: 5265
    • Bart en Mariska's Webstek
Re: 1.6.4 form oncreate issue?
« Reply #7 on: March 08, 2017, 06:01:33 pm »
IIRC then the old behaviour with DefaultToday was that it set the date to the date the program was built, which was rather odd.
It now forces a correct date in the control in TDateEdit.Loaded.
This can force the text to be changed.

Bart
« Last Edit: March 08, 2017, 06:08:46 pm by Bart »

Zoran

  • Hero Member
  • *****
  • Posts: 1828
    • http://wiki.lazarus.freepascal.org/User:Zoran
Re: 1.6.4 form oncreate issue?
« Reply #8 on: March 25, 2017, 12:42:53 pm »
turned out it was something with the tdatetime picker control.
...
I had to uncheck it's DefaultToday property to stop it from firing it's onchange.  Once I did that the app works like it did before.

TDateTimePicker doesn't have DefaultToday property, it's TDateEdit you are talking about, right?

snorkel

  • Hero Member
  • *****
  • Posts: 817
Re: 1.6.4 form oncreate issue?
« Reply #9 on: May 02, 2017, 10:49:38 pm »
yes, sorry TDateEdit.
***Snorkel***
If I forget, I always use the latest stable 32bit version of Lazarus and FPC. At the time of this signature that is Laz 3.0RC2 and FPC 3.2.2
OS: Windows 10 64 bit

 

TinyPortal © 2005-2018