Recent

Author Topic: [Solved]Phantom component: can't compile or find it till put new one and delete.  (Read 945 times)

Gald

  • Full Member
  • ***
  • Posts: 107
Hello!

Sometimes things like these happen (first time with a TFrame) to me, but i can't reproduce them every time.

I just add a new Frame, with a ToggleBox and them remove it and his empty OnChange event.

The following project shows a warning when it is opened and there is only one way to solve it:

Place a new ToggleBox on the Form and delete it.

Is this a Known Issue?

Solved Edit: Thanks for your replies!
« Last Edit: December 06, 2020, 02:44:00 am by Gald »
Lazarus 2.0.12 r64642 FPC 3.2.0 x86_64-win64-win32/win64/Manjaro KDE 21
AMD Ryzen 3 1300X Quad-Core Processor 3.50 GHz / 8,00 GB RAM / GTX 1500 TI / 2TB M.2 NVMe

Gald

  • Full Member
  • ***
  • Posts: 107
Re: Phantom component: can't compile or find it till put a new one and delete.
« Reply #1 on: December 06, 2020, 12:39:34 am »
It's here: unit1.lfm

Code: Pascal  [Select][+][-]
  1. object Form1: TForm1
  2.   Left = 421
  3.   Height = 358
  4.   Top = 72
  5.   Width = 460
  6.   Caption = 'Form1'
  7.   ClientHeight = 358
  8.   ClientWidth = 460
  9.   LCLVersion = '2.0.10.0'
  10.   inline Frame1_1: TFrame1
  11.     Left = 32
  12.     Top = 40
  13.     DesignLeft = 986
  14.     DesignTop = 180
  15.     inherited ToggleBox1: TToggleBox
  16.       OnChange = ToggleBox1Change
  17.     end
  18.   end
  19.   object Button1: TButton
  20.     Left = 262
  21.     Height = 25
  22.     Top = 17
  23.     Width = 75
  24.     Caption = 'Button1'
  25.     TabOrder = 1
  26.   end
  27. end

inherited ToggleBox1: TToggleBox
OnChange = ToggleBox1Change
Lazarus 2.0.12 r64642 FPC 3.2.0 x86_64-win64-win32/win64/Manjaro KDE 21
AMD Ryzen 3 1300X Quad-Core Processor 3.50 GHz / 8,00 GB RAM / GTX 1500 TI / 2TB M.2 NVMe

jamie

  • Hero Member
  • *****
  • Posts: 7544
Re: Phantom component: can't compile or find it till put a new one and delete.
« Reply #2 on: December 06, 2020, 12:52:54 am »
that could happen when renaming of items manually, the lfm still has the other name but your class has your new name..

your new stuff no longer gets the events properly assigned because there is like you say, one that has been created in the background of a different name.
The only true wisdom is knowing you know nothing

wp

  • Hero Member
  • *****
  • Posts: 13363
Re: Phantom component: can't compile or find it till put a new one and delete.
« Reply #3 on: December 06, 2020, 01:00:20 am »
You are only allowed to modify property of the frame components, but you cannot delete them - that's probably your problem.
Since you cannot distinguish components on the frame from components added separately the work with frames can very easily become very frustrating.

Whenever I use frames I only insert them at runtime so that these issues cannot occur. The must prominent application using Frames, the Lazarus IDE, does the same, and it is very successful this way.

 

TinyPortal © 2005-2018