Self Publishing Success
By default, only published properties are loaded and saved with a component. However, it is possible to load and save unpublished properties. This allows you to have persistent properties that do not appear in the Object Inspector. It also allows components to store and load property values that Delphi does not know how to read or write because the value of the property is too complex. For example, the TStrings object can't rely on Delphi's automatic behavior to store and load the strings it represents and must use the following mechanism. You can save unpublished properties by adding code that tells Delphi how to load and save your property's value. To store and load unpublished properties, you must first create a method to store your property value and another to load your property value. You have two choices
Besides redeclaring the properties to publish them, the component defines a data link object and the DataSource property. There's no DataField property for this component, because it refers to an entire record. The component's constructor is very important. It sets the values of many unpublished properties, including the grid options
This method uses Caption, which is an unpublished property, so that a user of the component cannot modify it in the Object Inspector. The result of this statement is to display the current time. This happens continuously, because the method is connected to the Timer's OnTimer event.
This component inherits from TCustomEdit instead of TEdit so that it can hide the Text property and surface the Integer Value property instead. Notice that I don't create a new field to store this value, because we can use the existing (but now unpublished) Text property. To do this, we'll simply convert the numeric value to and from a text string. The TCustomEdit class (or actually the Windows control it wraps) automatically paints the information from the Text property on the surface of the component
Have you always wanted to write your own book and get it published? Discover How to Write, Print Sell Your Own Book! Have you always wanted to write your own book and get it published? If you have written a book or even if you have a yen to be a writer, you are probably already aware of the competition in the writing field.