?
Solved

Default property values for components in delphi.

Posted on 2007-11-14
2
Medium Priority
?
2,609 Views
Last Modified: 2013-11-23
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.
0
Comment
Question by:kevincox29
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 21

Accepted Solution

by:
developmentguru earned 1000 total points
ID: 20280918
You just need to add a line to the constructor to set the property to your default value.  The Default specifier on the property line only indicates that it does not need to store the value if it happens to be the default.

Let me know if you need more
0
 

Author Comment

by:kevincox29
ID: 20281145
Excellent ..

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

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …
In this video, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …
Suggested Courses
Course of the Month15 days, 8 hours left to enroll

741 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question