Watch, Follow, &
Connect with Us

For forums, blogs and more please visit our
Developer Tools Community.


Welcome, Guest
Guest Settings
Help

Thread: [Default(False)] and [Stored(False)]


This question is answered. Helpful answers available: 2. Correct answers available: 1.


Permlink Replies: 6 - Last Post: Dec 12, 2017 10:40 AM Last Post By: Remy Lebeau (Te...
Richard Maley

Posts: 6
Registered: 3/23/17
[Default(False)] and [Stored(False)]  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Dec 12, 2017 4:55 AM
In unit Data.SqlExpr.pas in Delphi 10.1 Berlin in the type definition for TSQLMonitor in the published section the following code appears:
published
[Default(False)]
property Active: Boolean read FActive write SetActive default False;
[Default(False)]
property AutoSave: Boolean read FAutoSave write FAutoSave default False;
property FileName: string read FFileName write SetFileName;
property OnLogTrace: TTraceLogEvent read FOnLogTrace write FOnLogTrace;
property OnTrace: TTraceEvent read FOnTrace write FOnTrace;
{ property TraceFlags not supported in DBExpress 1.0 }
[Stored(False)]
property TraceList: TStrings read FTraceList write SetTraceList stored False;
property SQLConnection: TSQLConnection read FSQLConnection write SetSQLConnection;
end;

I am unfamiliar with the following syntax:
[Default(False)]
and
[Stored(False)]

Why is this here? Are there options other than Default and Stored? Can this be used for values other than boolean? Where is this syntax explained?

Thank you.

Dick Maley

Edited by: Richard Maley on Dec 12, 2017 5:04 AM
Lajos Juhasz

Posts: 801
Registered: 3/14/14
Re: [Default(False)] and [Stored(False)] [Edit]  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Dec 12, 2017 5:13 AM   in response to: Richard Maley in response to: Richard Maley
Richard Maley wrote:

In unit Data.SqlExpr.pas in Delphi 10.1 Berlin in the type definition
for TSQLMonitor in the published section the following code appears:
published [Default(False)]
property Active: Boolean read FActive write SetActive default
False; [Default(False)]
property AutoSave: Boolean read FAutoSave write FAutoSave default
False; property FileName: string read FFileName write SetFileName;
property OnLogTrace: TTraceLogEvent read FOnLogTrace write
FOnLogTrace; property OnTrace: TTraceEvent read FOnTrace write
FOnTrace; { property TraceFlags not supported in DBExpress 1.0 }
[Stored(False)]
property TraceList: TStrings read FTraceList write SetTraceList
stored False; property SQLConnection: TSQLConnection read
FSQLConnection write SetSQLConnection; end;

I am unfamiliar with the following syntax:
[Default(False)]
and
[Stored(False)]

Why is this here? Are there options other than Default and Stored?
Can this be used for values other than boolean? Where is this syntax
explained?

Thank you.

Dick Maley

Edited by: Richard Maley on Dec 12, 2017 5:04 AM

They're attributes. A quick search returned
http://www.devsuperpage.com/search/Articles.aspx?G=2&ArtID=78480 here
you can find more references about attributes.
Richard Maley

Posts: 6
Registered: 3/23/17
Re: [Default(False)] and [Stored(False)] [Edit]  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Dec 12, 2017 6:26 AM   in response to: Lajos Juhasz in response to: Lajos Juhasz
Is this documented anywhere?
Lajos Juhasz

Posts: 801
Registered: 3/14/14
Re: [Default(False)] and [Stored(False)] [Edit]  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Dec 12, 2017 8:00 AM   in response to: Richard Maley in response to: Richard Maley
Richard Maley wrote:

Is this documented anywhere?

If you're asking about attributes you can find information if you read
the link i've posted earlier and in the books: Coding in Delphi and
Object Pascal handbook. Unfortunately these books doesn't cover the
attributes definied in the system.classes.
Pat Ritchey

Posts: 10
Registered: 3/9/99
Re: [Default(False)] and [Stored(False)] [Edit]  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Dec 12, 2017 8:49 AM   in response to: Richard Maley in response to: Richard Maley
Richard Maley wrote:
Is this documented anywhere?

In the IDE select Help|RAD Studio Help|Main Help and then navigate to:

RAD Studio Topics/Delphi Language Reference/Delphi Language Guide/Classes and Objects/Properties:Storage Specifiers

These are directives, NOT attributes as was stated earlier. Attributes are those things inside of brackets that might look something like

type
  [TSpecialAttribute('Hello World!')]
  TSomeType = record
  ...
  end;


--
Pat Ritchey [TeamB Emeritus]
Remy Lebeau (Te...


Posts: 9,447
Registered: 12/23/01
Re: [Default(False)] and [Stored(False)] [Edit]  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Dec 12, 2017 10:40 AM   in response to: Pat Ritchey in response to: Pat Ritchey
Pat Ritchey wrote:

These are directives, NOT attributes as was stated earlier.
Attributes are those things inside of brackets that might look
something like

type
  [TSpecialAttribute('Hello World!')]
  TSomeType = record
  ...
  end;

That is exactly what Richard is asking about - the [Default(False)] and
[Stored(False)] **attributes** that appear above some of the property
declarations. Not the 'default' and 'stored' directives inside the
property declarations themselves, like you are thinking of.

--
Remy Lebeau (TeamB)

Richard Maley

Posts: 6
Registered: 3/23/17
Re: [Default(False)] and [Stored(False)]  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Dec 12, 2017 8:53 AM   in response to: Richard Maley in response to: Richard Maley
Thank you. I think that answers it.
Legend
Helpful Answer (5 pts)
Correct Answer (10 pts)

Server Response from: ETNAJIVE02