My personal FireMonkey buglet/oversight of the week is this: setting a TTextControl descendant’s Text property inside its constructor doesn’t do anything. For those who don’t know, TTextControl is the base class for things like TLabel, TListBoxItem and TExpander in FMX. Create custom descendants of these, then, and the following sort of code will not work:
type TMyExpander = class(TExpander) public constructor Create(const AOwner: TComponent; const AText: string); reintroduce; end; constructor TMyExpander.Create(const AOwner: TComponent; const AText: string); begin inherited Create(AOwner); Text := AText; end;
The reason is quite simple: TTextControl sets a flag in Create that prevents changes to the Text property doing anything until that flag is reset in an override of AfterConstruction. In true ‘FM squared’ fashion, the code is nevertheless convoluted enough to give you RSI from having to press F7 so much in trying to track this down. Argh!!!!