GetObjectProp(Fonte, 'Style') will not work, since Style not an object-oriented property, it is a Set property. And GetPropValue(Estilo, 'fsBold', true) simply wrong (not that you got far enough to call it anyway), because fsBold not a property, it is a member of the TFontStyle enumeration. To get the value of the Style property, you should use GetOrdProp(Fonte, 'Style') , GetSetProp(Fonte, 'Style') or GetPropValue(Fonte, 'Style') (as an integer , string or variant respectively) instead.
After you get the TextSettings object, you donβt need to use RTTI at all to access the Font.Style property, just enter the property directly.
Try this instead:
procedure Tfrm1.aoClicarComponente(Sender: TObject); var Componente_cc: TControl; TextSettings: TTextSettings; begin Componente_cc := ...; if IsPublishedProp(Componente_cc, 'TextSettings') then begin TextSettings := GetObjectProp(Componente_cc, 'TextSettings') as TTextSettings; Edit1.Text := BoolToStr(TFontStyle.fsBold in TextSettings.Font.Style, true); end; end;
The best (and preferred) solution is to not use RTTI at all. FMX classes that have the TextSettings property also implement the ITextSettings interface for this situation, for example:
procedure Tfrm1.aoClicarComponente(Sender: TObject); var Componente_cc: TControl; Settings: ITextSettings; begin Componente_cc := ...; if Supports(Componente_cc, ITextSettings, Settings) then begin Edit1.Text := BoolToStr(TFontStyle.fsBold in Settings.TextSettings.Font.Style, true); end; end;
See the Embarcadero documentation for more details:
Setting text options in FireMonkey