user2383818
user2383818

Reputation: 689

Firemonkey styled TMemo does not get focus

I dropped a TMemo and a regular TStyleBook on a Form. I edited the custom style for the TMemo by adding a TRectangle to background so TMemo now has a different background color, and changed the TMemo.StyleLookup property to the actual StyleName, but at runtime the TMemo can not get focus.

unit Form1;

interface

type
  TForm1 = class(TForm1)
    Memo1: TMemo;
    StyleBook1: TStyleBook;
  end;

var
  Form1: TForm;

implementation

{$R *.fmx}

end.

StyleBook_StyledMemo

What I am missing?

Upvotes: 0

Views: 211

Answers (1)

user2383818
user2383818

Reputation: 689

Turns out that for setting properties to be applied to the background of the tMemo, the original background item must be replaced by a tRectangle and it's StyleName assigned with background. All items inside the original background, must be transferred to the new tRectangle background and the original must be deleted. The Align property of the tRectangle background must be set to Contents and The Align property of the contents item must be set to Client. After that, any property of the new tRectangle background can be set to the desired value and they will be properly displayed at design and run time. Finally yes, the tMemo can be focused!

StyleContainer
...
Memo1Style1
   ...
   background
   ...
...

background above, must be a tRectangle

Upvotes: 0

Related Questions