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:
- Right click on TEdit and select Edit Custom Style
- In Structure window, expand editstyle (TLayout)
- Put a TRectangle on content (TRectangle becomes child of content)
- Change Rectangle.HitTest to False
- Change Rectangle.Align to alClient
- Change Rectangle.Fill.Color to a custom color
- Change Rectangle.Stroke.Kind to bkNone
- Apply and Close
Related videos on Youtube
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, 2022Comments
-
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 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 HeffernanPlease 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 HeffernanI've edited the question to add that as a tag. That's the way to do it, for future reference.
-
Edijs KolesnikovičsI have version in the title.
-
Edijs KolesnikovičsThats Embarcadero® Delphi® XE4 Version 18.0.4905.60485
-
-
Peter over 10 yearsI'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 over 10 yearsIndeed, I have no 'Edit Custom Style' in XE4.
-
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: