Recent

Author Topic: Project is broken if I rename a Listbox using "Rename identifier"  (Read 485 times)

Alextp

  • Hero Member
  • *****
  • Posts: 1153
    • UVviewsoft
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

  • Hero Member
  • *****
  • Posts: 7727
Re: Project is broken if I rename a Listbox using "Rename identifier"
« Reply #1 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.
Mainly Lazarus trunk / fpc 3.2.0 / all 32-bit on Win-10, but many more...

Alextp

  • Hero Member
  • *****
  • Posts: 1153
    • UVviewsoft
Re: Project is broken if I rename a Listbox using "Rename identifier"
« Reply #2 on: August 08, 2020, 02:59:31 pm »
Then IDE should not allow to change it.

lucamar

  • Hero Member
  • *****
  • Posts: 3186
Re: Project is broken if I rename a Listbox using "Rename identifier"
« Reply #3 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.
Turbo Pascal 3 CP/M - Amstrad PCW 8256 (512 KB !!!) :P
Lazarus/FPC 2.0.8/3.0.4 & 2.0.10/3.2.0 - 32/64 bits on:
(K|L|X)Ubuntu 12..18, Windows XP, 7, 10 and various DOSes.

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 6708
  • Debugger - SynEdit - and more
    • wiki
Re: Project is broken if I rename a Listbox using "Rename identifier"
« Reply #4 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