freedowsRoO Posted January 25, 2019 Share Posted January 25, 2019 Hi there! I've created a custom panel component with a second panel inside it and i'm trying to add a CSS class in these two panels but just de main panel got the CSS, the second panel did not get the CSS class. Here the code: Panel 1: self.Color:= cColor; self.Layout:= 'vBox'; self.Height:= 200; self.Width:= 400; self.BorderStyle:= borderStyle; self.LayoutConfig.Margin:= '5 0 5 0'; self.LayoutConfig.flex:= 1; self.LayoutConfig.Width:= '100%'; self.LayoutConfig.Height:= '100%'; self.ClientEvents.UniEvents.Add('beforeInit=function beforeInit(sender, config){sender.cls="gray_borders";}'); Panel 2: FPanelTopo := TUniPanel.Create(Self); FPanelTopo.Parent:= Self; FPanelTopo.Layout:= 'hBox'; FPanelTopo.LayoutConfig.Width:= '100%'; FPanelTopo.LayoutAttribs.Align:= 'middle'; FPanelTopo.Color:= $00F5F5F5; FPanelTopo.Height:=30; FPanelTopo.Width:=400; FPanelTopo.BorderStyle:= borderStyle; FPanelTopo.AlignmentControl:= aligControl; FPanelTopo.Top:=2; FPanelTopo.LayoutConfig.Margin:= '0 0 5 0'; FPanelTopo.ClientEvents.UniEvents.Add('beforeInit=function beforeInit(sender, config){sender.cls="gray_borders";}'); Any ideia to help me? Thanks in advanced. Quote Link to comment Share on other sites More sharing options...
Sherzod Posted January 25, 2019 Share Posted January 25, 2019 Hello, Can you specify which edition and build of UniGUI are you using? 1 Quote Link to comment Share on other sites More sharing options...
freedowsRoO Posted January 25, 2019 Author Share Posted January 25, 2019 33 minutes ago, Sherzod said: Hello, Can you specify which edition and build of UniGUI are you using? Sure! Unigui: 1.0.0.1425 Ext: 4.2.5.1763 Quote Link to comment Share on other sites More sharing options...
Sherzod Posted January 25, 2019 Share Posted January 25, 2019 Sorry which edition? Are you using a trial edition? 1 Quote Link to comment Share on other sites More sharing options...
freedowsRoO Posted January 25, 2019 Author Share Posted January 25, 2019 30 minutes ago, Sherzod said: Sorry which edition? Are you using a trial edition? i'm using a UniGUi Complete - Professional edition not a trial edition. Quote Link to comment Share on other sites More sharing options...
Sherzod Posted January 25, 2019 Share Posted January 25, 2019 27 minutes ago, freedowsRoO said: i'm using a UniGUi Complete - Professional edition not a trial edition. Thank you! First of all, can you please adjust your forum email address? : http://forums.unigui.com/index.php?/topic/6291-new-users-please-adjust-your-forum-email-address/ 1 Quote Link to comment Share on other sites More sharing options...
Sherzod Posted January 25, 2019 Share Posted January 25, 2019 Ok, Thanks for the update Can you make a simple testcase for this? Or maybe you forgot to assign the name to the component? 1 Quote Link to comment Share on other sites More sharing options...
freedowsRoO Posted January 25, 2019 Author Share Posted January 25, 2019 I don't know if i made a test case it will work because i made a new component based on unigui panel. I made a component and it works fine but when i try to add a CSS on the second panel "FPanelTopo" it doesn't work, just the first panel "Self" get the Style. constructor panelBI.Create(AOwner : TComponent); var borderStyle: TUniBorderStyle; aligControl: TUniAlignmentControl; cColor: TColor; begin inherited Create(AOwner); borderStyle:= ubsNone; aligControl:= uniAlignmentClient; cColor:= clWhite; self.Color:= cColor; self.Layout:= 'vBox'; self.Height:= 200; self.Width:= 400; self.BorderStyle:= borderStyle; self.LayoutConfig.Margin:= '5 0 5 0'; self.LayoutConfig.flex:= 1; self.LayoutConfig.Width:= '100%'; self.LayoutConfig.Height:= '100%'; self.ClientEvents.UniEvents.Add('beforeInit=function beforeInit(sender, config){sender.cls="gray_borders";}'); FPanelTopo := TUniPanel.Create(Self); FPanelTopo.Parent:= Self; FPanelTopo.Layout:= 'hBox'; FPanelTopo.LayoutConfig.Width:= '100%'; FPanelTopo.LayoutAttribs.Align:= 'middle'; FPanelTopo.Color:= $00F5F5F5; FPanelTopo.Height:=30; FPanelTopo.Width:=400; FPanelTopo.BorderStyle:= borderStyle; FPanelTopo.AlignmentControl:= aligControl; FPanelTopo.Top:=2; FPanelTopo.LayoutConfig.Margin:= '0 0 5 0'; FPanelTopo.ClientEvents.UniEvents.Add('beforeInit=function beforeInit(sender, config){sender.cls="gray_borders";}'); end; Quote Link to comment Share on other sites More sharing options...
Sherzod Posted January 25, 2019 Share Posted January 25, 2019 FPanelTopo.Name := ? 1 Quote Link to comment Share on other sites More sharing options...
freedowsRoO Posted January 25, 2019 Author Share Posted January 25, 2019 OMG, it works! Thanks man.... 1 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.