Kattes Posted July 4, 2023 Share Posted July 4, 2023 Hi, I am reopening an older support request from 2019, which is shown below. I am running 1.90.0.1565 and the previous solution no longer works. Does anyone have a proper solution for scrolling the uniTreeMenue vertically? I also tested to put the UniTreeMenu within a Scrollbox, but unfortuantely the size of UniTreeMenu keeps constant independing if you inflate sub-menus. Unfortunately I have a customer, who complains on this - so I urgently need to find a solution here. Kind regards, Kattes Quote Link to comment Share on other sites More sharing options...
Sherzod Posted July 4, 2023 Share Posted July 4, 2023 Hello @Kattes Works for me. Quote Link to comment Share on other sites More sharing options...
Kattes Posted July 4, 2023 Author Share Posted July 4, 2023 Hello @Sherzod, can you please give me some more details? is this based on my version of Unigui or a later one? is it still using this solution: treeMenu.afterCreate(sender) { sender.el.setStyle('overflow-y', 'auto'); } Kind regards, Kattes Quote Link to comment Share on other sites More sharing options...
Sherzod Posted July 4, 2023 Share Posted July 4, 2023 13 minutes ago, Kattes said: is this based on my version of Unigui or a later one? One of the latest, I checked on 1.90.0.1567. 16 minutes ago, Kattes said: is it still using this solution: treeMenu.afterCreate(sender) { sender.el.setStyle('overflow-y', 'auto'); } Yes. Quote Link to comment Share on other sites More sharing options...
Kattes Posted July 4, 2023 Author Share Posted July 4, 2023 When doing so my example crashes Quote Link to comment Share on other sites More sharing options...
Sherzod Posted July 4, 2023 Share Posted July 4, 2023 Everything is correct. Because you are doing it wrong! Quote Link to comment Share on other sites More sharing options...
Kattes Posted July 4, 2023 Author Share Posted July 4, 2023 Ok my friend Sherzod - then please enlighten me 🙂 Quote Link to comment Share on other sites More sharing options...
Sherzod Posted July 4, 2023 Share Posted July 4, 2023 3 minutes ago, Kattes said: When doing so my example crashes Not Ext.container.Container! 1 Quote Link to comment Share on other sites More sharing options...
Kattes Posted July 4, 2023 Author Share Posted July 4, 2023 Oh no - I was blind ! 🙄 Now everything works fine! Finally I used your code but put it to the MainForm OnCreate event, because I am not a friend of hidden JS scripts somewhere in the forms. I also suppressed the scroller from being visible in the standard browsers like Chrome, Firefox and Edge because I also wanted to keep the look and feel clean. But normally everyone uses the scroll-wheel anyway. Perhaps this is also useful for somebody else ... procedure TMainForm.UniFormCreate(Sender: TObject); var JSCode: string; begin // Write JavaScript code to add scroll to the TreeMenu JSCode := 'function treeMenu.afterCreate(sender) {' + ' sender.el.setStyle(''overflow-y'', ''auto'');' + ' sender.el.setStyle(''scrollbar-width'', ''none'');' + ' sender.el.setStyle(''-ms-overflow-style'', ''none'');' + ' var style = document.createElement(''style'');' + ' style.innerHTML = ' + ' `#${sender.el.id}::-webkit-scrollbar { display: none; }`;' + ' document.head.appendChild(style);' + '}'; // Execute JavaScript code UniTreeMenu1.ClientEvents.UniEvents.Add('treeMenu.afterCreate='+JSCode); end; Thank you again Sherzod ! 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.