Board index » delphi » Trying to replace VCL component with New Descendant Component

Trying to replace VCL component with New Descendant Component

I have created a new descendant class from DBLookupComboBox (thanks Yorai
Aminov), but have now run into another problem.  I have the DBLookupComboBox
class scattered throughout several forms and throughout several
applications.  What is the best way for me to replace the DBLookupComboBox
components with the new descendent class without deleting the existing
components and then dropping my new descendent class on the forms and
re-entering all the datasource and field info for each component?  I tried
just changing the name of the class in the form declarations, but that gives
me an error (Field FormName.cbLessor should be of type TDBLookupComboBox but
is declared as TDBLookupComboBoxSEO.   Correct the declaration?).

    cbLessor: TDBLookupComboBox;
was changed to
    cbLessor: TDBLookupComboBoxSEO;

but Delphi didn't seem to like that.

Any easy was to replace all my existing TDBLookupComboBox components with
the new descendent?  BTW, I only added a handler for CM_ENTER messages so
the published information hasn't changed.

Thanks in advance,
Stirling Olson
ol...@iport.com

 

Re:Trying to replace VCL component with New Descendant Component


After you change the class name in the form declaration, you need to change it
also in the forms dfm.  Right click on the form, and select "View as Text".
Then, change the classes there also.  (Do the form declarations first.)  When
finished, right click and select "View as Form".  If you missed any, you'll get
a message here.  Then, just save the form with your new components...
Quote
Stirling Olson wrote:
> I have created a new descendant class from DBLookupComboBox (thanks Yorai
> Aminov), but have now run into another problem.  I have the DBLookupComboBox
> class scattered throughout several forms and throughout several
> applications.  What is the best way for me to replace the DBLookupComboBox
> components with the new descendent class without deleting the existing
> components and then dropping my new descendent class on the forms and
> re-entering all the datasource and field info for each component?  I tried
> just changing the name of the class in the form declarations, but that gives
> me an error (Field FormName.cbLessor should be of type TDBLookupComboBox but
> is declared as TDBLookupComboBoxSEO.   Correct the declaration?).

>     cbLessor: TDBLookupComboBox;
> was changed to
>     cbLessor: TDBLookupComboBoxSEO;

> but Delphi didn't seem to like that.

> Any easy was to replace all my existing TDBLookupComboBox components with
> the new descendent?  BTW, I only added a handler for CM_ENTER messages so
> the published information hasn't changed.

> Thanks in advance,
> Stirling Olson
> ol...@iport.com

Other Threads