Jump to content

Custom Panel Component CSS


freedowsRoO

Recommended Posts

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.

Link to comment
Share on other sites

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;

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...