Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Interposer class

Tags:

delphi

Do I need to put my Interposer class in all the form that will the particular class ? Say I want to re-implement TPanel, I redeclare it as TPanel = class(ExtCtrls.TPanel) in the unit. Do I need to do this in all the unit that uses TPanel ?

Thanks in advance !

like image 436
Rick Avatar asked Feb 27 '26 17:02

Rick


1 Answers

You yourself have acknowledged that this is a hack. It's not meant to scale well. It's meant for one-time cases where it's not worth the trouble to "do it right" by writing a bona fide custom control.

You can try putting your new class declaration in a separate unit. Make sure that unit appears on uses clauses after the VCL unit that declares the "real" version of the class. If that doesn't work, then yes, you need to make new declarations in every unit that uses the hack.

Since you're doing this to turn TLabel into TStaticText, you'd probably be better off simply changing your TLabel controls into real TStaticText controls on your forms. (That was the answer the last time you asked about this.) That way, the program you ship will be the same program you tested. Otherwise, you're testing a program with one kind of control and shipping one with another.

like image 84
Rob Kennedy Avatar answered Mar 02 '26 09:03

Rob Kennedy



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!