Mads Posted August 27, 2012 Report Share Posted August 27, 2012 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). Quote Link to comment
Antoine Chalons Posted August 27, 2012 Report Share Posted August 27, 2012 :-o made it this morning : 1 Quote Link to comment
jcarmody Posted August 27, 2012 Report Share Posted August 27, 2012 This is in my CaseSelect JKI RCF plugin: You don't use my plugin. Quote Link to comment
Antoine Chalons Posted August 27, 2012 Report Share Posted August 27, 2012 You don't use my plugin. I do - great tool by he way! - I just new dug into it Quote Link to comment
Mads Posted August 29, 2012 Author Report Share Posted August 29, 2012 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. Quote Link to comment
Antoine Chalons Posted August 29, 2012 Report Share Posted August 29, 2012 Yes, it gets tricky quickly. With trees you also other things to be carefull about if you want to auto-show/hide the horizontal scroll : are symbols visible? is the vertical scroll visible? how wide is your scroll? etc... Have fun! Quote Link to comment
Yair Posted August 29, 2012 Report Share Posted August 29, 2012 (edited) ...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 August 29, 2012 by Yair Quote Link to comment
Mads Posted August 30, 2012 Author Report Share Posted August 30, 2012 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. Quote Link to comment
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.