Forum > Designer

Project is broken if I rename a Listbox using "Rename identifier"

(1/1)

Alextp:
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.

wp:
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.

Alextp:
Then IDE should not allow to change it.

lucamar:

--- Quote from: Alextp on August 08, 2020, 02:59:31 pm ---Then IDE should not allow to change it.

--- End quote ---

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.

Martin_fr:
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.

Navigation

[0] Message Index

Go to full version