gpaulino Posted January 22, 2014 Share 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? Link to comment Share on other sites More sharing options...
Sherzod Posted January 22, 2014 Share 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 Link to comment Share on other sites More sharing options...
gpaulino Posted January 23, 2014 Author Share Posted January 23, 2014 delphi developer many thanks I'll try tomorrow morning Link to comment Share on other sites More sharing options...
DeHeus Posted May 14, 2018 Share 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 :-) Link to comment Share on other sites More sharing options...
Recommended Posts
Please sign in to comment
You will be able to leave a comment after signing in
Sign In Now