LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Tree control, Disable but still use Scrollbar?

Solved!
Go to solution

Hi Experts

 

I'm using a Tree control and the user can select one or more Items (rows)

Sometimes i need to lock the control so that the user cant change the selected items. I use a Property Node to disable the control.

However the Disable also disable the Scrollbars.  Smiley Mad

I want the user to be able to vertically scroll through the Tree, without the possibility to change the value. (selected items)

 

How to do? 

 

Best regards 

Per

 

 

0 Kudos
Message 1 of 11
(2,955 Views)

Ideas:

- Use separate scroll bars

- Don't disable but instead discard events that you see as "change".If it's a value-change, then maybe you could jut set the value back to what it was.

Certified LabVIEW Architect
0 Kudos
Message 2 of 11
(2,926 Views)

How about this? Run the attached VI. Two rows are selected, but when you select another row, the selection is set to what it was.

Certified LabVIEW Architect
0 Kudos
Message 3 of 11
(2,921 Views)
Solution
Accepted by topic author PMN1966

If the tree is always disabled, it should be fairly easy to do something like the attached.

Basically, the tree has a method that converts a mouse click to a row/column and will also tell if the mouse click is within the content rectangle of the tree.  If it's not, that means the mouse click occurred on the border of the tree or inside the scrollbar.  Either way, enable the tree for scrolling until the mouse goes back up. 

If the tree is sometimes enabled and sometimes disabled as you say, you'll need to store the current disabled status and restore it on mouse up.  If it's already enabled, you don't want to disable it on mouse up.  I'll leave that for you to figure out. 

Disabled Tree with Scrollbars_BD.png

aputman
------------------
Heads up! NI has moved LabVIEW to a mandatory SaaS subscription policy, along with a big price increase. Make your voice heard.
Message 4 of 11
(2,891 Views)

You could also just use the Discard? terinal in that Mouse Down?  event when you decided that you do not want the user to change anything. Or use the similar Edit Cell?  filter event instead.

Rolf Kalbermatter
My Blog
Message 5 of 11
(2,889 Views)
@rolfk wrote:

You could also just use the Discard? terinal in that Mouse Down?  event when you decided that you do not want the user to change anything. Or use the similar Edit Cell?  filter event instead.


I don’t think so. If you discard the mouse down, you won’t be able to use the scroll bar. 

aputman
------------------
Heads up! NI has moved LabVIEW to a mandatory SaaS subscription policy, along with a big price increase. Make your voice heard.
0 Kudos
Message 6 of 11
(2,886 Views)

Even if you only discard it when it is in the visible colums?

Rolf Kalbermatter
My Blog
0 Kudos
Message 7 of 11
(2,881 Views)

Thanks Aputman! 

 

Exactly what i asked for. 🙂 There are some cool functions that can be implemented with that method!

 

Another question. Is there a way to do the same with Indent/outdent? (still without allowing to change the value(s)) 

 

In some situation i want the user to browse through the tree without changing the selection. (access to Scroll, Indent/Outdent.)  

In other cases it should be possible to have full access. 

 

Best regards 

Per

 

0 Kudos
Message 8 of 11
(2,867 Views)

I think Rolf's suggestion is better - it doesn't require toggling properties.

0 Kudos
Message 9 of 11
(2,862 Views)

Hi Pauldavey

 

Agree. !

But the main solution was to use the "Mouse in bounds" methods as aputman surgested. 

 

Br Per

 

 

0 Kudos
Message 10 of 11
(2,845 Views)