I just can't find a way of changing background color of Edit control in my mobile FireMonkey application.
Asked
Active
Viewed 1.4k times
4

David Heffernan
- 601,492
- 42
- 1,072
- 1,490

Edijs Kolesnikovičs
- 1,627
- 3
- 18
- 34
-
1Please 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 Aug 26 '13 at 14:59
-
1Thats Embarcadero® Delphi® XE4 Version 18.0.4905.60485 – Edijs Kolesnikovičs Aug 26 '13 at 15:21
-
1I've edited the question to add that as a tag. That's the way to do it, for future reference. – David Heffernan Aug 26 '13 at 15:23
-
1I have version in the title. – Edijs Kolesnikovičs Aug 26 '13 at 15:27
-
1@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. – Jerry Dodge Aug 26 '13 at 15:32
-
Oh, I'm sorry. My mistake. Anyway, it is better in the tags, FWIW. – David Heffernan Aug 26 '13 at 15:33
-
Via design time you can replace the style image used for the background, this however depends on the platform. At Runtime you could solve this by manipulating the bitmap of the background TSubImage of the style. – Peter Aug 27 '13 at 06:33
1 Answers
7
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

mh taqia
- 3,506
- 1
- 24
- 35
-
1I'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). – Peter Aug 27 '13 at 07:37
-
-
1@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:](http://stackoverflow.com/questions/17653139/delphi-xe4-firemonkey-tmemo-transparent-ios/17764884#17764884) – AvgustinTomsic Aug 28 '13 at 18:32