Firemonkey: When do published properties get set on a control?


I am working on a custom control which inherits from TListView. One of the features of the custom version of the TListView is that it can be configured to allow the user to double click on a list view item, and edit it’s text directly on the list view.

To do this, I have declared several properties in the published section of my header file to customize the TEdit component that allows the user to edit text.

__property bool EditableText = {read=FEditableText, write=FEditableText};
__property float EditWidth = {read=FEditWidth, write=FEditWidth};
__property float EditHeight = {read=FEditHeight, write=FEditHeight};
__property float EditLeftBuffer = {read=FEditLeftBuffer, write=FEditLeftBuffer};

Then in my constructor, if the EditableText property is true I want to go ahead and set up the TEdit control.

__fastcall TFmListView::TFmListView(TComponent* Owner)
: TListView(Owner)
if( FEditableText )

However, I haved noticed that in my constructor, FEditableText is always set to false, regardless of its value in the Object Inspector. Similarly, the variables set by my float properties, FEditWith, FEditHeight and FEditLeftBuffer always equal zero.

Additionally, I have noticed that if I check the values of these variables in the DoItemClick method of my control, the are set as one would expect.

At what point in the life of my control are these property values being applied to their respective variables? What is the proper way to do setup on my custom control, based on published properties specified in the Object Inspector? Is there an event on a control that is fired once these properties are set up?

Comments are closed.