6

Is there any way to make the TMemo transparent in Delphi/iOS/FireMonkey?

I don't see any way to edit styles myself when selecting + right-clicking the memo control...

Danilo Casa
  • 506
  • 1
  • 9
  • 18
Tom
  • 3,587
  • 9
  • 69
  • 124

2 Answers2

8

Try removing memo's background on applying style event.

procedure TForm1.Memo1ApplyStyleLookup(Sender: TObject);
var
  BckObject: TFmxObject;
begin
  BckObject := Memo1.FindStyleResource('background');
  if Assigned(BckObject) and (BckObject is TSubImage) then
  begin
    TSubImage(BckObject).Source := nil;
  end;
end;
AvgustinTomsic
  • 1,809
  • 16
  • 22
2

You need to change the style of the control you want to display transparent as you want. Unfortunately Embarcadero does not provide a fully functional example, only some information on the Customizing FireMonkey Applications with Styles topic

RBA
  • 12,337
  • 16
  • 79
  • 126
  • I see this: "To see the style definitions in the FireMonkey Style Designer: Drop a control on a form in the Form Designer. Right-click the control and choose Edit Default Style" ... **but** I don't have any option called **Edit Default Style** which is rather odd. Does this work for you? Is my XE4/Pro + mobile addon installation messed up somehow? – Tom Jul 16 '13 at 08:46
  • 1
    @tom, this menu items have been deliberately removed when developing iOS apps. Getting to the built in styles for iOS is very complex. – Mike Sutton Jul 16 '13 at 13:03
  • 1
    @MikeSutton, actually it was removed because there was a serious bug that still hasn't been resolved. There is no reason to remove this otherwise and will eventually be reintroduced. – Peter Jul 16 '13 at 13:27
  • Any alternative way of getting a transparent TMemo then? :) – Tom Jul 16 '13 at 14:45
  • 3
    @Tom Just as an idea. Have you tried removing background on applying style event? `procedure TForm1.Memo1ApplyStyleLookup(Sender: TObject); var BckObject: TFmxObject; begin BckObject := Memo1.FindStyleResource('background'); if Assigned(BckObject) and (BckObject is TSubImage) then begin TSubImage(BckObject).Source := nil; end; end;` – AvgustinTomsic Jul 19 '13 at 09:40
  • @slotomo That works! Make it answer and I will give bounty :) – Tom Jul 20 '13 at 13:13