Jump to content

UniTreeMenu still can not scroll


Kattes

Recommended Posts

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

 

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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 !

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...