newsanti Posted March 21 Share Posted March 21 constructor TMainmForm.Create(AOwner: TComponent); begin inherited; with UniServerModule.CustomCSS do begin Add('.Round1 {'); Add(' border-radius: 50px;'); Add('}'); end; TUniLayoutConfig(Panel1.LayoutConfig).Cls:= 'Round1'; end; Not work! Quote Link to comment Share on other sites More sharing options...
Sherzod Posted March 21 Share Posted March 21 1 hour ago, newsanti said: with UniServerModule.CustomCSS do begin Add('.Round1 {'); Add(' border-radius: 50px;'); Add('}'); end; TUniLayoutConfig(Panel1.LayoutConfig).Cls:= 'Round1'; These codes work. But this is not a fact that your CustomCSS will work correctly. Quote Link to comment Share on other sites More sharing options...
Sherzod Posted March 21 Share Posted March 21 Try this: constructor TMainForm.Create(AOwner: TComponent); begin inherited; with UniServerModule.CustomCSS do begin Add('.round1 .x-panel-body {'); Add(' border-radius: 50px;'); Add('}'); end; TUniLayoutConfig(UniPanel1.LayoutConfig).Cls:= 'round1'; end; Quote Link to comment Share on other sites More sharing options...
newsanti Posted March 22 Author Share Posted March 22 9 hours ago, Sherzod said: Try this: constructor TMainForm.Create(AOwner: TComponent); begin inherited; with UniServerModule.CustomCSS do begin Add('.round1 .x-panel-body {'); Add(' border-radius: 50px;'); Add('}'); end; TUniLayoutConfig(UniPanel1.LayoutConfig).Cls:= 'round1'; end; work.. if code with servermodule.create and mainmodule.create. not work (round3) if code with mainm.create. How to customize css in form at run-time ? (Update MainPain CSS at run-time) it work only refresh browser again. (After add CSS to ServerModule.CustomCSS>>work only new MainPage) runtimeCSS.zip Quote Link to comment Share on other sites More sharing options...
Sherzod Posted March 22 Share Posted March 22 I didn't look at your last test case. Anyway, in my opinion, css classes should be defined at "design time" and not at runtime. I think this is good practice. Quote Link to comment Share on other sites More sharing options...
Hayri ASLAN Posted March 24 Share Posted March 24 You can check this approach Quote Link to comment Share on other sites More sharing options...
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.