Jump to content

Auto-show/hide tree scrollbars - supporting multiple child text items?


Mads

Recommended Posts

Has anyone made a VI that will show or hide the vertical and horizontal scrollbars of a tree control depending on whether they are needed or not?

I've done one myself for listboxes, and though there was one already for trees (it's hidden in vi.lib\tree\Tree_ShowScrollBar.vi), but that one does not seem handle cases where the children have more than one text item. (You basically end up with those items invisible).

Link to comment

Thanks. Managing the vertical scrollbar is relatively simple. It's the horizontal part that gets a bit tricky ;) , at least if you have the rightmost column set to be "infinitely wide" and/or do not want to show the next (empty) column. If that was not the case I could use the same approach and use the "Number of columns"-property. Instead I'll probably need to calculate the width of the text in each column - and compare the widest item on display with the width of the tree. Not unlike how the mentioned vi.lib-VI does, but taking all columns into account.

Link to comment

...though there was one already for trees (it's hidden in vi.lib\tree\Tree_ShowScrollBar.vi), but that one does not seem handle cases where the children have more than one text item. (You basically end up with those items invisible).

According to this it should work, so you might want to report this to NI. Also, I didn't look, but the mod posted there might solve this issue.

Edited by Yair
Link to comment

The Tree_ShowScrollBar.vi sets each item as the active cell and calculates the width of its string. However that cell string is just the "Left cell string", not the item's full "Child Text", so it fails as soon as there is an item with such additional text.

Link to comment

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

Important Information

By using this site, you agree to our Terms of Use.