title: Delphi 2009 - Set default property values in custom delphi components
body: <p>This should be very simple but I can't find the exact answer I want. I have a custom delphi control based on TSpeedButton. I want the Caption Property of the SpeedButton to always be 'Comments' but I don't want to set it at run-time I want to set it in the component itself so that when I place it on my form it's already populated with this text. I also want to set the height and width of the button but I imagine the method for doing this will be the same as for setting the caption.</p>
  
  <p>For the sake of completeness, here is the component code:</p>
  
  <pre><code>unit CustomSpeedButton;
  
  interface
  
  uses
    SysUtils, Classes, Controls, Buttons;
  
  type
    TCustomSpeedButton = class(TSpeedButton)
    private
      FCommentText: string;
      FCommentTitle: string;
  
      procedure SetCommentText(const Value: string);
      procedure SetCommentTitle(const Value: string);
  
      { Private declarations }
    protected
      { Protected declarations }
    public
      { Public declarations }
  
    published
      { Published declarations }
      property CommentTitle: string read FCommentTitle write SetCommentTitle;
      property CommentText: string read FCommentText write SetCommentText;
    end;
  
  procedure Register;
  
  implementation
  
  procedure Register;
  begin
    RegisterComponents('Standard', [TCustomSpeedButton]);
  end;
  
  { TCustomSpeedButton }
  
  procedure TCustomSpeedButton.SetCommentText(const Value: string);
  begin
    FCommentText := Value;
  end;
  
  procedure TCustomSpeedButton.SetCommentTitle(const Value: string);
  begin
    FCommentTitle := Value;
  end;
  
  end.
  </code></pre>