Lazarus

Using the Lazarus IDE => Designer => Topic started by: Alextp on August 08, 2020, 10:54:27 am

Title: Project is broken if I rename a Listbox using "Rename identifier"
Post by: Alextp on August 08, 2020, 10:54:27 am
If I rename the Listbox (placed on a form) from Listbox1 to L (via F2 - Rename identifier and its occurences), IDE renames it to L in pascal code, but DONT rename it in LFM file.
Now I run the proj, and it crashes on using L (L is nil).
Can you make it ok, pls?

Laz 2.1 trunk. fpc 3.2.
Title: Re: Project is broken if I rename a Listbox using "Rename identifier"
Post by: wp on August 08, 2020, 11:11:48 am
I think the "Rename identifier" is thought to work only in source files for tasks like renaming variables, types, procedures etc. When you want to rename a control you should use the Object Inspector.
Title: Re: Project is broken if I rename a Listbox using "Rename identifier"
Post by: Alextp on August 08, 2020, 02:59:31 pm
Then IDE should not allow to change it.
Title: Re: Project is broken if I rename a Listbox using "Rename identifier"
Post by: lucamar on August 08, 2020, 08:11:26 pm
Then IDE should not allow to change it.

The IDE has no way of knowing what your final intention is; what, for example, if you want to use "rename identifier" and then edit the .lfm file? I do that somewhat frequently when some manual intervention is needed to edit a project, to correct a mishap or some such.

It's nice that our tools are advanced enough to be of real help and deliver the promised RAD experience but they can't (and shouldn't) be so "advanced" as to result constricting. In the end, and I say this with my most profound respect for you, Alex, it's the programmer's responsability to know and use them correctly.
Title: Re: Project is broken if I rename a Listbox using "Rename identifier"
Post by: Martin_fr on August 08, 2020, 09:17:02 pm
Actually "rename identifier" is a refactoring method, done via codetools. So it could know. But someone would need to implement things.

If you do a replace (search/replace), then that is an action that treads the sources a text. So that will never know if there is an lfm item.
TinyPortal © 2005-2018