Guest User

Untitled

a guest
Jun 22nd, 2018
133
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.48 KB | None | 0 0
  1. type
  2. String40 = string;
  3.  
  4. type
  5. TPerson = class
  6. private
  7. FFirstName = String40;
  8. published
  9. FirstName: string40 read FFirstName write FFirstName;
  10. end;
  11.  
  12. var
  13. MyPropInfo: TPropInfo;
  14. PropTypeName: string;
  15. MyPerson: TPerson;
  16. begin
  17. MyPerson := TPerson.Create;
  18. MyPropInfo := GetPropInfo(MyPerson, 'FirstName')^;
  19. PropTypeName := MyPropInfo.PropType^.Name;
  20.  
  21. type
  22. String40 = type string;
  23.  
  24. program Project1;
  25.  
  26. uses
  27. Classes,
  28. typInfo,
  29. Dialogs,
  30. Forms;
  31.  
  32. {$R *.RES}
  33.  
  34. type
  35. String40 = type string;
  36. TPerson = class(TPersistent)
  37. private
  38. FFirstName: String40;
  39. published
  40. property FirstName: string40 read FFirstName write FFirstName;
  41. end;
  42.  
  43. var
  44. MyPropInfo: TPropInfo;
  45. PropTypeName: string;
  46. MyPerson: TPerson;
  47.  
  48. begin
  49. Application.Initialize;
  50. MyPerson := TPerson.Create;
  51. MyPropInfo := GetPropInfo(MyPerson, 'FirstName')^;
  52. PropTypeName := MyPropInfo.PropType^.Name;
  53. ShowMessage(PropTypeName);
  54. end.
  55.  
  56. type
  57. String40 = type string;
  58. TPerson = class
  59. private
  60. FFirstName : String40;
  61. published
  62. property FirstName: string40 read FFirstName write FFirstName;
  63. end;
  64.  
  65. var
  66. MyPropInfo: PPropInfo;
  67. PropTypeName: string;
  68. MyPerson: TPerson;
  69. begin
  70. MyPerson := TPerson.Create;
  71. try
  72. MyPerson.FirstName := 'My first name';
  73. MyPropInfo := GetPropInfo(MyPerson, 'FirstName');
  74. if MyPropInfo<>nil then begin
  75. PropTypeName := MyPropInfo^.PropType^.Name;
  76. Memo1.Lines.Add(PropTypeName);
  77. end;
  78. finally
  79. MyPerson.FRee;
  80. end;
  81. end;
Add Comment
Please, Sign In to add comment