E
E
Evgeny Ivanov2016-10-10 17:38:13
Delphi
Evgeny Ivanov, 2016-10-10 17:38:13

How to change the component class?

The program written in Delphi 7 has a panel component. TPanel class. There are many other objects on the panel.
I want to replace this panel with another one, sPanel (Alpha Controls).
Of course, in the program code I refer to only one property - visible. It is on both panels.
Which program modules need to be changed?
I changed in Unit1.pas - type TPanel to sPanel and in Unit1.dfm TPanel to sPanel.
But when opened, it says that the sPanel class was not found, although sPanel is written in uses.
Or is such a replacement impossible and you have to create a new panel yourself, drag all objects and delete the old one?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
Mercury13, 2016-10-10
@Mercury13

The easiest way. Open DFM (RMB on the form, View as Text) and run Search-Replace.
After that, we make any changes to the module (yes, at least add a space and delete it), and save it. Automation will ask: replace? - we agree.

I changed in Unit1.pas - type TPanel to sPanel and in Unit1.dfm TPanel to sPanel.
But when opened, it says that the sPanel class was not found, although sPanel is written in uses.

If the module is called sPanel, then the component itself should be a little different. TsPanel?
UPD. Yes, TsPanel, if that's it.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question