Recent

Author Topic: Synchronization of dfm variables with source files  (Read 2707 times)

vfclists

  • Hero Member
  • *****
  • Posts: 1013
    • HowTos Considered Harmful?
Synchronization of dfm variables with source files
« on: July 30, 2014, 09:01:09 am »

After changing the class of a control in the IDE, the type of the object in the source was not changed and this resulted in EClassNotFound errors when I run the program, which raises these questions.

Does changing the class of an object only affect the .dfm?

Doesn't it automatically warn and change about the object type in the source file?

Does it mean that adding code directly to the dfm will not automatically create a variable for it in the source, or that if the dfm variable already exists in the source it will not be updated?
Lazarus 3.0/FPC 3.2.2

taazz

  • Hero Member
  • *****
  • Posts: 5368
Re: Synchronization of dfm variables with source files
« Reply #1 on: July 30, 2014, 03:49:59 pm »

After changing the class of a control in the IDE,

How? as far as I know there is no such think in the IDE, you have to delete the existing object and place the new one. Changing the name of the new object to the old one might solve all compile problems or it might not.

the type of the object in the source was not changed and this resulted in EClassNotFound errors when I run the program, which raises these questions.

Does changing the class of an object only affect the .dfm?

Doesn't it automatically warn and change about the object type in the source file?

Does it mean that adding code directly to the dfm will not automatically create a variable for it in the source, or that if the dfm variable already exists in the source it will not be updated?

Yeah that is what happens if you edit the lfm directly, no lfm does not support two way editing if you make any change to the lfm then you are required to make the appropriate chances to the pas file as well manually.
Good judgement is the result of experience … Experience is the result of bad judgement.

OS : Windows 7 64 bit
Laz: Lazarus 1.4.4 FPC 2.6.4 i386-win32-win32/win64

vfclists

  • Hero Member
  • *****
  • Posts: 1013
    • HowTos Considered Harmful?
Re: Synchronization of dfm variables with source files
« Reply #2 on: July 30, 2014, 06:27:54 pm »

After changing the class of a control in the IDE,

How? as far as I know there is no such think in the IDE, you have to delete the existing object and place the new one. Changing the name of the new object to the old one might solve all compile problems or it might not.


The IDE has the ability to change the class of an object. Right click on it and from the menu you select 'Change Class...' . After you change the class you will get  a dialog that warns you if the new class doesn't have some of the properties of the previous class, and gives you the chance to delete them.

If you don't know about it then welcome to Lazarus. There are lots of changes but because Lazarus developers don't blog, no one gets to know about them. When you are struggling with an existing project the last thing on your mind is looking for new IDE features.
Lazarus 3.0/FPC 3.2.2

 

TinyPortal © 2005-2018