Forum > Beginners
copy and paste:Identifier not found "Button13
pentilisea:
Hi,
want to copy and paste a control, here Button9 being copied and assigned to be Button13.
So far, so good, but compiler says: Identifier not found "Button13"
The component window lists Button13
The control inspector shows Button13 and the event tab shows OnClick: Button13.Click
Unit1 shows in the type section the procedure: procedure Button13Click(Sender: TObject); - same in the implentation section.
???????
I just want to copy a selection of controls and having the controls listed without any code - so I can enter the correct code for the new controls - as it works with comparable other IDEs.
What am I doin wrong?
dseligo:
What is Lazarus and OS versions?
How do you copy Button9? What is the name of Button9's OnClick method?
If you copy button on a form to the same form or different form, Lazarus keeps same OnClick method, so this is strange what you are describing. I.e. if your Button9's OnClick method name is Button9Click, then after you copy button and it becomes Button13, OnClick method stays the same: Button9Click.
Thaddy:
Which "comparable" IDE? I don't believe you.
Lazarus (and Delphi for that matter) plain works but NOT between instances.
pentilisea:
Lazarus 2.0.12
OS: MX Linux
Sorry for all the type errors ...
Several times I tried copy and paste controls, but due to what I experienced I rather add controls manually, which is time consuming...
Just doing it now.
So, when I copy a control, like a button23, captionn ot the new control goes up, button24, when I double click the old name is in inspector and the old procedure comes up: "TForm1.Button23Click(Sender: TObject);" with code. Then I do create an default event and the button23 procedure opens up again, in the type section button24 is listed, the procdure for button24 is not listed. The inspector shows button24 with no caption, because these buttons need to show no caption when running, however, I doubled this in code by writing "button24.caption ;= '';"
The inspector Event tab shows OnClick: Button23Click.
Now, I used to correct this as much as possible, but it does not work every time, so I delete the new button and create it new.
I'm lost for a solution, as the work becomes cumbersome. Maybe, because I put these buttons up without a caption?
Labels for example copy ok. So when I copy a button that has not caption in the inspector, but has a name provokes this behavior?
Also when copying the code of the control comes with it - that should not happen ....
Anyway, thanks for asking.
Klaus
Thaddy:
--- Quote from: pentilisea on March 08, 2023, 10:34:58 am ---Also when copying the code of the control comes with it - that should not happen ....
--- End quote ---
Klaus, you have to understand that a simple copy operation on its own does not have enough context to succeed.
Navigation
[0] Message Index
[#] Next page