luca71 Posted February 25, 2018 Share Posted February 25, 2018 Hi,I have a problem with the size of the UnimLabel. Please check the attached picture.I have a UnimPanel, which I create at runtime, with 5 TUnimLabel inside it.If I set the TUnimLabel.caption with a long text, the TUnimLabel is enlarged and is superimposed on the successive TUnimLabel.I would like to understand if it is possible:1) Set a maximum height to UnimLabel2 in such a way that it can not overlap with UnimLabel3 (and UnimLabel4, ...).2) Without setting a maximum height to the UnimLabel2, after having set UnimLabel2.caption know what is its height in order to move down UnimLabel3, UnimLabel4, UnimLabel5 and increase the height of UnimPanel1 Thanks. This is the code://******************************************************************************{ MyPanel }constructor MyPanel.Create( Aowner :TComponent ; CodiceProdotto: Integer; DescrizioneSinteticaProdotto, DescrizioneMarca: String;Disponibilita, QtaPerConfezione: Integer );begininherited Create ( Aowner ) ;self.Color := clWhite ;self.Height := 136 ;// UnimLabel1UnimLabel1 := TUnimLabel.Create ( self ) ;UnimLabel1.Name := 'UnimLabel1_' + IntToStr ( CodiceProdotto ) ;UnimLabel1.Caption := DescrizioneMarca ;UnimLabel1.Top := 7 ;UnimLabel1.Left := 139;UnimLabel1.Height := 23 ;UnimLabel1.ClientEvents.UniEvents.Add ( 'beforeInit=function beforeInit(sender, config)'#13#10'{'#13#10' config.style = "font-size:18px; font-weight:bold; color:red";'#13#10'}' ) ;UnimLabel1.Parent := self;// UnimLabel2UnimLabel2 := TUnimLabel.Create ( self ) ;UnimLabel2.Name := 'UnimLabel2_' + IntToStr ( CodiceProdotto ) ;UnimLabel2.Caption := DescrizioneSinteticaProdotto ;UnimLabel2.Top := 28 ;UnimLabel2.Left := 139;UnimLabel2.Height := 23 ;UnimLabel2.AutoSize := false ;UnimLabel2.ClientEvents.UniEvents.Add ( 'beforeInit=function beforeInit(sender, config)'#13#10'{'#13#10' config.style = "font-size:18px; font-weight:bold; color:green";'#13#10'}' ) ;UnimLabel2.Parent := self;// UnimLabel3UnimLabel3 := TUnimLabel.Create ( self ) ;UnimLabel3.Name := 'UnimLabel3_' + IntToStr ( CodiceProdotto ) ;UnimLabel3.Caption := 'Codice prodotto: <b>' + IntToStr ( CodiceProdotto ) + '</b>' ;UnimLabel3.Top := 70 ;UnimLabel3.Left := 139;UnimLabel3.Height := 14 ;UnimLabel3.ClientEvents.UniEvents.Add ( 'beforeInit=function beforeInit(sender, config)'#13#10'{'#13#10' config.style = "font-size:12px; color:black";'#13#10'}' ) ;UnimLabel3.Parent := self ;// UnimLabel4UnimLabel4 := TUnimLabel.Create ( self ) ;UnimLabel4.Name := 'UnimLabel4_' + IntToStr ( CodiceProdotto ) ;UnimLabel4.Caption := 'Disponibilità: <b>' + IntToStr ( Disponibilita ) + '</b>' ;UnimLabel4.Top := 85 ;UnimLabel4.Left := 139;UnimLabel4.Height := 14 ;UnimLabel4.ClientEvents.UniEvents.Add ( 'beforeInit=function beforeInit(sender, config)'#13#10'{'#13#10' config.style = "font-size:12px; color:black";'#13#10'}' ) ;UnimLabel4.Parent := self ;// UnimLabel5UnimLabel5 := TUnimLabel.Create ( self ) ;UnimLabel5.Name := 'UnimLabel5_' + IntToStr ( CodiceProdotto ) ;UnimLabel5.Caption := 'Q.tà per confezione: <b>' + IntToStr ( QtaPerConfezione ) + '</b>' ;UnimLabel5.Top := 100 ;UnimLabel5.Left := 139;UnimLabel5.Height := 14 ;UnimLabel5.ClientEvents.UniEvents.Add ( 'beforeInit=function beforeInit(sender, config)'#13#10'{'#13#10' config.style = "font-size:12px; color:black";'#13#10'}' ) ;UnimLabel5.Parent := self ;end; Link to comment Share on other sites More sharing options...
Sherzod Posted February 25, 2018 Share Posted February 25, 2018 Hi, If I understand you correctly, one possible solution using CSS: http://forums.unigui.com/index.php?/topic/9368-adding-ellipses-to-tunilabeltext-if-insufficient-space/&do=findComment&comment=48549 Best regards, Link to comment Share on other sites More sharing options...
luca71 Posted February 26, 2018 Author Share Posted February 26, 2018 Thanks for the reply. About point 1) I tried using this CSS .ellipsisText { white-space: normal; text-overflow: ellipsis; overflow: hidden; } and the result is quite good (the text does not exceed the spaces I have assigned to it, but unfortunately "text-overflow: ellipsis" does not work: it does not put "..." when cutting the text, but I think it's a Sencha problem) About point 2) Do you have any idea how I can do? If I assign UnimLabel2.caption a long text, its size is enlarged and I would like the UnimLabel3 to move down. I tried setting Align = alTop for both UnimLabel2 and UnimLabel3, but without result. Thank you. Link to comment Share on other sites More sharing options...
Recommended Posts