delagoutte Posted September 3, 2018 Share Posted September 3, 2018 i have a status bar with X panels. the first panel width is set to 200px if the text on my firstpanel is longer than 200px, it is write over the second panel. what can i do for having "..." in the end of text and having the full value in the hint ? Link to comment Share on other sites More sharing options...
Sherzod Posted September 3, 2018 Share Posted September 3, 2018 Hi, Maybe something like this, can you try? UniStatusBar -> ClientEvents -> UniEvents -> function beforeInit(sender, config) { config.defaults = { style: 'overflow:hidden; text-overflow:ellipsis;', listeners: { afterrender: function(item) { var tm = new Ext.util.TextMetrics(); new Ext.tip.ToolTip({ target: item, html: item.text, listeners: { beforeshow: function updateTipBody(tip) { if (item.getWidth() < (tm.getSize(item.text).width) + 5) { tip.update(item.text); } else { return false; } } } }); } } }; } Link to comment Share on other sites More sharing options...
delagoutte Posted September 4, 2018 Author Share Posted September 4, 2018 for style, it is ok but for the hint/tooltips, nothing is displayed Link to comment Share on other sites More sharing options...
Sherzod Posted September 4, 2018 Share Posted September 4, 2018 Hmm, works for me Link to comment Share on other sites More sharing options...
delagoutte Posted September 4, 2018 Author Share Posted September 4, 2018 ok it works on a sample project, probably a bad option in my code, i'll check it. thank you Link to comment Share on other sites More sharing options...
delagoutte Posted September 4, 2018 Author Share Posted September 4, 2018 there is a bug with this method : if you set the text in runtime, the text in tooltip is the text that was define in design time Link to comment Share on other sites More sharing options...
delagoutte Posted September 4, 2018 Author Share Posted September 4, 2018 with this code UniStatusBar1.Panels[1].Text := 'long text long text long text long text long text'; that is not the property item.text that is modified (it keep the initial value), there is a new property item.html that is created with this new value. a unigui bug ? So for my problem i fixe it with a patch like this : if (item.html){ tip.update(item.html); } else { tip.update(item.text); } Link to comment Share on other sites More sharing options...
Sherzod Posted September 4, 2018 Share Posted September 4, 2018 Or simple use like this: ... beforeshow: function updateTipBody(tip) { if (item.getWidth() < (tm.getSize(item.text).width) + 5 || item.getWidth() < (tm.getSize(item.html).width) + 5) { tip.update(item.html || item.text); } else { return false; } } ... 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