I’ve written a control descended from TCustomEdit but am having trouble changing the default size of the component from that defined in StdCtrls (i.e. width=121, height=21).
So in Create I have:
inherited Create(AOwner);
width:=40;
height:=20;
But when the control is placed on the form it is drawn with the default width and height for TCustomEdit. I’ve reduced the test case to a simple component that merely has the constructor above and nothing else. I’ve also tried setting autosize:=false in the constructor but no joy.
From searching around I think I’m doing the right thing but plainly it’s not working. How to I get the behaviour I’m after?
That works for me (XE2). Make sure your constructor is marked
overrideso that it is actually called:This is necessary because
TComponenthas a virtual constructor.