gpaulino Posted January 22, 2014 Posted January 22, 2014 Text boxes with background image I'm around trying to put an image in a text box by css, but not in that event put the code extevent this is the css that gets me the image in the text box .searchBox{ background-image:url('images/magnifying-glass.gif'); background-repeat:no-repeat; padding-left:20px;} this is the code I put in the event onbeforerender sender.addCls('searchBox'); and does not work help? Quote
Sherzod Posted January 22, 2014 Posted January 22, 2014 Hi Guillermo E. Paulino. Try the following: 1. .searchBox{ background:url('images/magnifying-glass.gif') no-repeat !important; padding-left:20px; } 2. not onbeforerender, you need to add to afterrender function afterrender(sender, eOpts) { Ext.get(sender.id + '-inputEl').addCls("searchBox"); } 1 Quote
gpaulino Posted January 23, 2014 Author Posted January 23, 2014 delphi developer many thanks I'll try tomorrow morning Quote
DeHeus Posted May 14, 2018 Posted May 14, 2018 Is it possible to do this in Delphi code as well?I want to do it based on the value of a property. EDIT I found you can do it like this: yourControl.Color := StringToColor(dmCss.RequiredField); dmCss is just a simple datamodule. type TdmCss = class(TDataModule) private { Private declarations } public const RequiredField = '$00F1DDC1'; end; But that does only the background color. Using a CSS class would be much better, as that gives us the possibility to also color border and do more styling on a web based way. We are doing web development, aren't we? So if anyone knows the answer how to add a CSS class to the input element via Delphi code, please let me know :-) Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.