Link to home
Start Free TrialLog in
Avatar of kevincox29
kevincox29Flag for United Kingdom of Great Britain and Northern Ireland

asked on

Default property values for components in delphi.

Hi All.

I was wondering if there is a way to change the default creation properties of a component at design time.

i.e. I have a Component, that has a flat and a transparent property, when I create one of these on my form at design time, these properties default to False. I then have to manually modify the properties.

The version of Delphi is Delphi 4 and I do have the source code for the component which is sub-classed from the TDBNavigator component.

I tried setting the Default of the transparent property to true :

// --------------------------------------------------------------------------------------------------//

 TBiDiDBNavigator = class(TDBNavigator)
  private
    fTransparent: Boolean;
    procedure SwapButtons;
    procedure SwapGlyphs;
    function Swaped: Boolean;
    procedure SetTransparent(Value: Boolean);
    procedure SetGlyphs(Index: TNavigateBtn; Glyph: TBitmap);
    function GetGlyphs(Index: TNavigateBtn): TBitmap;
  protected
    procedure Paint; override;
    procedure Loaded; override;
    procedure WMSize(var Msg: TWMSize); message WM_SIZE;
    procedure CMBiDiModeChanged(var Msg: TMessage); message CM_BIDIMODECHANGED;
  public
    property Glyphs[Index: TNavigateBtn]: TBitmap read GetGlyphs write SetGlyphs;
  published
    property BiDiMode;
    property ParentBiDiMode;
    property GlyphFirst: TBitmap index nbFirst read GetGlyphs write SetGlyphs;
    property GlyphPrior: TBitmap index nbPrior read GetGlyphs write SetGlyphs;
    property GlyphNext: TBitmap index nbNext read GetGlyphs write SetGlyphs;
    property GlyphLast: TBitmap index nbLast read GetGlyphs write SetGlyphs;
    property GlyphInsert: TBitmap index nbInsert read GetGlyphs write SetGlyphs;
    property GlyphDelete: TBitmap index nbDelete read GetGlyphs write SetGlyphs;
    property GlyphEdit: TBitmap index nbEdit read GetGlyphs write SetGlyphs;
    property GlyphPost: TBitmap index nbPost read GetGlyphs write SetGlyphs;
    property GlyphCancel: TBitmap index nbCancel read GetGlyphs write SetGlyphs;
    property GlyphRefresh: TBitmap index nbRefresh read GetGlyphs write SetGlyphs;
    property Transparent: Boolean read fTransparent write SetTransparent default True;
  end;

// --------------------------------------------------------------------------------------------------//

But that had no effect.
ASKER CERTIFIED SOLUTION
Avatar of developmentguru
developmentguru
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of kevincox29

ASKER

Excellent ..

I overrode the constructor and put my defaults in.. It worked a charm ... Thanks