How to change Edit control background color in FireMonkey?

13,656

I dont know about FMX for mobile, but in FMX for Mac/Win you should do following steps:

  1. Right click on TEdit and select Edit Custom Style
  2. In Structure window, expand editstyle (TLayout)
  3. Put a TRectangle on content (TRectangle becomes child of content)
  4. Change Rectangle.HitTest to False
  5. Change Rectangle.Align to alClient
  6. Change Rectangle.Fill.Color to a custom color
  7. Change Rectangle.Stroke.Kind to bkNone
  8. Apply and Close

enter image description here enter image description here

Share:
13,656

Related videos on Youtube

Edijs Kolesnikovičs
Author by

Edijs Kolesnikovičs

I love programing! Do not hesitate and ask me to code something. No web stuff tho. I am Delphi programmer that is interested in Java or C++

Updated on June 04, 2022

Comments

  • Edijs Kolesnikovičs
    Edijs Kolesnikovičs almost 2 years

    I just can't find a way of changing background color of Edit control in my mobile FireMonkey application.

    • Jerry Dodge
      Jerry Dodge over 10 years
      @EdijsKolesnikovičs StackOverflow works quite well when you put your Delphi version in the tags. It tends to clutter space when you put it in the title.
    • David Heffernan
      David Heffernan
      Please supply Delphi version. FMX is very fluid between versions. You'll need to learn about FMX styles. A web search should reveal what you need.
    • David Heffernan
      David Heffernan
      I've edited the question to add that as a tag. That's the way to do it, for future reference.
    • Edijs Kolesnikovičs
      Edijs Kolesnikovičs
      I have version in the title.
    • Edijs Kolesnikovičs
      Edijs Kolesnikovičs
      Thats Embarcadero® Delphi® XE4 Version 18.0.4905.60485
  • Peter
    Peter over 10 years
    I've removed my down vote and voted up, you were correct, this does seem to work. However the OP will get stuck at the first instruction due to there not being any Edit Custom Style popup menu choice in Firemonkey mobile(xe4).
  • Edijs Kolesnikovičs
    Edijs Kolesnikovičs over 10 years
    Indeed, I have no 'Edit Custom Style' in XE4.
  • AvgustinTomsic
    AvgustinTomsic over 10 years
    @EdijsKolesnikovičs Instead of "Edit Custom Style" you can achive same result if you add rectangle on Edit ApplyStyleLookup event in runtime. Check this similar question: