[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

default value in Delphi component

Posted on 2013-06-12
2
Medium Priority
?
570 Views
Last Modified: 2013-06-12
Hi

I have an own component where I add a property SaveOrder with a default value. If I add the component on design-time the SaveOrder is false instead of true:
  tTest = class(TDbGrid)
    private
      FSaveOrder : boolean;
    published
      property SaveOrder: boolean read FSaveOrder write FSaveOrder default true;
  end;

Open in new window


See my simple sample. What's wrong?
Thanks, Peter
0
Comment
Question by:formi
2 Comments
 
LVL 28

Accepted Solution

by:
Sinisa Vuk earned 2000 total points
ID: 39240531
Override constructor Create:

...
public
    { Public declarations }
    constructor Create(AOwner : TComponent); override;
....

constructor tTest.Create(AOwner: TComponent);
begin
  inherited;
  FSaveOrder := True;
end;

Open in new window


... and set FSaveOrder to True. Remove
default
directive.
http://docwiki.embarcadero.com/RADStudio/XE4/en/Properties
0
 

Author Closing Comment

by:formi
ID: 39240566
that works - but I don't understand what for the default specifier is ...
Thanks for your help!
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

This is about my first experience with programming Arduino.
In this post we will learn how to make Android Gesture Tutorial and give different functionality whenever a user Touch or Scroll android screen.
Progress
Introduction to Processes

834 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