Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9119823
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T05:29:14+00:00 2026-06-17T05:29:14+00:00

I have a TForm like this: TMyForm = class (TForm) [MyAttr(‘Data’)] edit1: TEdit; private

  • 0

I have a TForm like this:

TMyForm = class (TForm)
  [MyAttr('Data')] 
  edit1: TEdit;
private
 FData: String;
end

When I try to get the fields of this form via RTTI, I only get the edit1 field, not FDATA, and when I query for edit1 field attributes I get an empty array.

For another class that does not inherit TForm, all works ok. Why?

Edit for sample:

type


{$RTTI EXPLICIT FIELDS([vcPrivate,vcProtected, vcPublic])}
  TForm3 = class(TForm)
    [TCustomAttribute]
    Button1: TButton;
    Memo1: TMemo;
    procedure Button1Click(Sender: TObject);
  private
    { Private declarations }
    [TCustomAttribute]
    FData: String;
  public
    { Public declarations }
  end;

var
  Form3: TForm3;

implementation

{$R *.dfm}

procedure TForm3.Button1Click(Sender: TObject);
var
  LCtx: TRttiContext;
  LField: TRttiField;
  LAttr: TCustomAttribute;
begin
  for LField in LCtx.GetType(Self.ClassInfo).GetDeclaredFields do
  begin
      Memo1.Lines.Add(lField.Name);
      for LAttr in LField.GetAttributes do
        Memo1.Lines.Add(#9+LAttr.ClassName);

  end;
end;

end.

Result where Button1 is clicked:

FData
    TCustomAttribute
Button1
Memo1
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T05:29:16+00:00Added an answer on June 17, 2026 at 5:29 am

    There could be a $RTTI directive somewhere in your project that’s causing extended RTTI to not work.

    Try adding the following just before the declaration of TMyForm:

    {$RTTI EXPLICIT
      METHODS(DefaultMethodRttiVisibility)
      FIELDS(DefaultFieldRttiVisibility)
      PROPERTIES(DefaultPropertyRttiVisibility)}
    

    This will reset RTTI generation for everything declared after it, and you should get proper RTTI after that point.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a very basic and simple class like this: unit Loader; interface uses
So far I have this code: ****SimpleForm.h**** class TForm1 : public TForm { __published:
have written this little class, which generates a UUID every time an object of
I have tested a couple of benchmarking snippets on Delphi like this one: uses
I have this XML input: <?xml version=1.0 encoding=utf-8?> <string> &lt;N/A&gt; </string> Here is a
I often embed a TForm descendant into another TForm descendant like this: var Form1:
Right now i have 2 forms. On Form1 i open up Form2 like this:
today is my first day with Delphi. I have record like this: type FT_Device_Info_Node
I have this form: class TourForm(ModelForm): class Meta: model = Tour I wanna design
I'd like to have a TForm with BorderStyle = bsNone (no borders, no caption),

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.