I have a simple component
type
TTimedScrollBox = class(TScrollBox)
private
procedure WMVScroll(var Message: TWMVScroll); message WM_VSCROLL;
protected
FSkipTime: Cardinal;
FEndTimeout: Cardinal;
FSkipScrollTimer: TTimer;
FEndScrollTimer: TTimer;
FLastMessage: TWMVScroll;
FWaiting: boolean;
FLastMessageValid: boolean;
FLog: TStrings;
FSkipCount: integer;
procedure SkipTimerEvent(Sender: TObject);
procedure EndTimerEvent(Sender: TObject);
public
constructor Create(AOwner: TComponent); override;
destructor Destroy; override;
property Log: TStrings read FLog;
published
property ScrollSkipTime: Cardinal read FSkipTime write FSkipTime default 100;
property ScrollEndTimeout: Cardinal read FEndTimeout write FEndTimeout default 200;
end;
I want to be able to specify values for ScrollSkipTime and ScrollEndTimeout at design time. I had the impression that all I need to do this is write the code as shown, but
What am I missing/doing wrong?
The default values you provide in the property declaration are only used by the streaming framework and the IDE. For instance, the property is not streamed if the value is equal to the default value. The default values are also used to allow the IDE to highlight, in bold, which values have been modified from their defaults.
What is missing in your code is that you need to set the values of the backing field in your component's constructor. We can't see that code but I'm pretty sure that is what is missing.
This issue is covered in the documentation: