Recent

Author Topic: Manually editing the lfm file - change doesn't show in IDE  (Read 5943 times)

dculp

  • Full Member
  • ***
  • Posts: 129
Manually editing the lfm file - change doesn't show in IDE
« on: April 28, 2017, 01:49:44 pm »
In the lfm file I have -
Code: Pascal  [Select][+][-]
  1.   object Label1: TLabel
  2.     Left = 53
  3.     Height = 15
  4.     Top = 70
  5.     Width = 81
  6.     Caption = 'Label1'
  7.     ParentColor = False
  8.   end
  9.  

If I manually change Caption = 'Label1' to Caption = 'New label' in the lfm file and build, then 'New label' is correctly displayed when run. However, the change doesn't show in the IDE -- the Object Inspector and Form1 still show the original 'Label1'. Is there a way to refresh the IDE so that it will show 'New label' instead of 'Label1'?

Why? Just curious.

Thanks.

jma_sp

  • Full Member
  • ***
  • Posts: 150
  • El conocimiento si ocupa lugar.
Re: Manually editing the lfm file - change doesn't show in IDE
« Reply #1 on: April 28, 2017, 01:59:17 pm »
Also if you change the name of a unit or form it not change the previous name of files .lfm .pas and the code where it appears.

 
Devuan Beowulf 3.0( JWM/ROX/iDesk) - Puppy Linux,  Haiku OS,.ReactOS 0.4.xx  - FreeDos .

Handoko

  • Hero Member
  • *****
  • Posts: 5131
  • My goal: build my own game engine using Lazarus
Re: Manually editing the lfm file - change doesn't show in IDE
« Reply #2 on: April 28, 2017, 02:07:42 pm »
Why? Just curious.

I can't reproduce your issue. Everything seems to work correctly on my Lazarus 1.6.4 FPC 3.0.2 x86_64-linux-gtk 2. Have you tried to restart your Lazarus or maybe restart the computer?

:-\ I wonder why you prefer to edit the file directly instead of using Object Inspector.
« Last Edit: April 28, 2017, 02:09:36 pm by Handoko »

molly

  • Hero Member
  • *****
  • Posts: 2330
Re: Manually editing the lfm file - change doesn't show in IDE
« Reply #3 on: April 28, 2017, 02:13:43 pm »
:-\ I wonder why you prefer to edit the file directly instead of using Object Inspector.
Besides that, it is not recommendable to do so. you can seriously damage your project that way.

Which also answers jma_sp's question. Renaming forms outside the editor and then expect the lazarus to pick up on that requires a bit more insight in how lazarus and project information is stored.

I only edit files outside lazarus with caution and only when necessary, and that also means properly taking care of lpi files.

x2nie

  • Hero Member
  • *****
  • Posts: 515
  • Impossible=I don't know the way
    • impossible is nothing - www.x2nie.com
Re: Manually editing the lfm file - change doesn't show in IDE
« Reply #4 on: April 28, 2017, 02:20:38 pm »
... Is there a way to refresh the IDE so that it will show 'New label' instead of 'Label1'?

Why? Just curious.

Thanks.


Yes, close the project, and reopen.
Why... it is because:
AFAIK, when you were editing LFM , your modification is not auto reloaded by Lazarus.
And when you just run/compile, the compiler is FPC (not lazarus who compiles your codes+LFM)
BUt, nowadays, when you back to Lazarus (after saving modified LFM), I think the Lazarus will warn you that the files opened (LFM/PAS) is has been edited outside the IDE, so you just need one more click (on OKE button) to get them syncrhonized wit Object Inspector.


Not sure, but this should be that.
When you were logged in, you can see attachments.
Lazarus Github @ UbuntuCinnamon-v22.04.1 + LinuxMintDebianEdition5

Handoko

  • Hero Member
  • *****
  • Posts: 5131
  • My goal: build my own game engine using Lazarus
Re: Manually editing the lfm file - change doesn't show in IDE
« Reply #5 on: April 28, 2017, 02:24:26 pm »
I ever messed up the code by direct editing it.  :-[

After then I learned that some of those items (especially the "Name") should not be modified manually. They may be linked to/by other objects in the project.

@x2nie:

If the TS modifying the code while it's still being opened by other program, that is a big no.  >:(

SunyD

  • Guest
Re: Manually editing the lfm file - change doesn't show in IDE
« Reply #6 on: April 28, 2017, 02:48:41 pm »
Sometimes I edit LFM-Files manually too, I know this problem.
You have a copy of LFM-Files in compiled files folder (YourProjectSources\lib\..).
You must delete the lib subfolder.

Handoko

  • Hero Member
  • *****
  • Posts: 5131
  • My goal: build my own game engine using Lazarus
Re: Manually editing the lfm file - change doesn't show in IDE
« Reply #7 on: April 28, 2017, 03:02:51 pm »
You must delete the lib subfolder.

Sounds logical.

dculp

  • Full Member
  • ***
  • Posts: 129
Re: Manually editing the lfm file - change doesn't show in IDE
« Reply #8 on: April 28, 2017, 03:40:04 pm »
Yes, I realize there's potential danger.

Closing Lazarus and restarting refreshes the IDE to agree with the modified lfm file.

BTW, I was editing the lfm file in the IDE source editor (not an external editor) so I would have assumed that any changes to the lfm file would have been picked up immediately by the IDE.


Handoko

  • Hero Member
  • *****
  • Posts: 5131
  • My goal: build my own game engine using Lazarus
Re: Manually editing the lfm file - change doesn't show in IDE
« Reply #9 on: April 28, 2017, 03:45:46 pm »
BTW, I was editing the lfm file in the IDE source editor (not an external editor) so I would have assumed that any changes to the lfm file would have been picked up immediately by the IDE.

I consider it is a bug, or at least there should be a reload project feature. Maybe you can submit a feature request.

http://bugs.freepascal.org
« Last Edit: April 28, 2017, 03:49:44 pm by Handoko »

JuhaManninen

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4459
  • I like bugs.
Re: Manually editing the lfm file - change doesn't show in IDE
« Reply #10 on: April 28, 2017, 04:16:37 pm »
BTW, I was editing the lfm file in the IDE source editor (not an external editor) so I would have assumed that any changes to the lfm file would have been picked up immediately by the IDE.
I consider it is a bug, or at least there should be a reload project feature.
It is not a bug because the .lfm file is not meant to be edited. It is maintained by the IDE.
Sure it can be edited but that is an "expert action", the IDE will not guide you then.
The question for dculp remains: why don't you use Object Inspector? It is a sophisticated tool as are the other tools that modify .lfm form files. They are an essential part of a RAD system.
Mostly Lazarus trunk and FPC 3.2 on Manjaro Linux 64-bit.

Handoko

  • Hero Member
  • *****
  • Posts: 5131
  • My goal: build my own game engine using Lazarus
Re: Manually editing the lfm file - change doesn't show in IDE
« Reply #11 on: April 28, 2017, 04:21:50 pm »
Because the IDE allows we to open and edit that files as normal text. So some may think it is how it works (edit it using Object Inspector and manually as text).

Maybe we can add a warning when we open the 'special' files as text.

molly

  • Hero Member
  • *****
  • Posts: 2330
Re: Manually editing the lfm file - change doesn't show in IDE
« Reply #12 on: April 28, 2017, 04:22:38 pm »
@JuhaManninen:
Although i agree with what you wrote there, this kind of thing still amazes me.

The 'file' is not meant to be edited, yet is is pretty easy to switch from lfm to text mode _and_ have the editor happily allow you to modify things (even though it is allowed and considered actions for an expert).

Why not disallow editing of lfm files (when switched to text-mode) by default ?

JuhaManninen

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4459
  • I like bugs.
Re: Manually editing the lfm file - change doesn't show in IDE
« Reply #13 on: April 28, 2017, 04:51:44 pm »
The 'file' is not meant to be edited, yet is is pretty easy to switch from lfm to text mode _and_ have the editor happily allow you to modify things (even though it is allowed and considered actions for an expert).
Why not disallow editing of lfm files (when switched to text-mode) by default ?
Yes, that is a valid point, too. I think the editing should be made more difficult.
The fact is that editing a .lfm form file is almost never needed. You can change all its data through the nice GUI tools. You can change a component's properties, anchors and parent. You can change a component's class. And so on...
What is missing? We can add it.

I personally have edited .lfm form files only when they got corrupted by some failed experiment, or when I hit bugs like:
 http://bugs.freepascal.org/view.php?id=13510
 http://bugs.freepascal.org/view.php?id=24528
which should be fixed obviously.
Mostly Lazarus trunk and FPC 3.2 on Manjaro Linux 64-bit.

 

TinyPortal © 2005-2018