LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

can you enable a scroll bar in a disabled control

I have a text control with a scroll bar.  I want to disable the control so the user cannot change the text, but I want the scroll bar enabled so the user can view the entire text field.  The control is part of a cluster with other elements that the user can change; hence, I cannot make the text field an indicator unless there is a way to mix controls and indicators in the same cluster.

Message 1 of 33
(6,188 Views)

The only way I know of doing it is for table controls where you use the mouse down? filter event and use a control method to get the row/column of the cell clicked and only allow the click if it was not in the table i.e. the scrollbar.

 

Not sure if that would work for elements inside a cluster - I tend not to use clusters for UI elements very often (and instead break the data out into individual indicators).


LabVIEW Champion, CLA, CLED, CTD
(blog)
0 Kudos
Message 2 of 33
(6,181 Views)

If it's important for the user experience, I do something like this. It's essentially just an indicator with the label hidden, that matches the exact size of the control. I position it right over the control without putting it inside the cluster. It is hidden by default and then made visible when you want to disable the control.

Hide String Control.png

 

(You can drag the snippet above on to your block diagram to import it in to LabVIEW. If the string indicator is placed behind the control because of the import, click the cluster and press Ctrl+Shift+K.)

Cheers


--------,       Unofficial Forum Rules and Guidelines                                           ,--------

          '---   >The shortest distance between two nodes is a straight wire>   ---'


0 Kudos
Message 3 of 33
(6,172 Views)

Please look at all the comments of this idea, then vote for it. 😄

0 Kudos
Message 4 of 33
(6,167 Views)

Okay a couple of things.  Usually when this comes up with me I actually have an array of elements not just a string.  In those cases you can actually disable the element control (the data type in the array) but have the array enabled which allows for you to scroll but not change the value.

 

For the string another option would be to use the event structure and detect if a mouse down? took place.  Looking at the Master Bounds Rect you can see if a mouse down took place on the control, but wasn't in the main content of the control, which would mean it took place on something like a scrollbar.  In that event you can then Discard the mouse down if they user was in the main content of the control.  Of course you'll probably also want to disable the control while tabbing, otherwise the user can still get into it to change the data.

 

EDIT:  It looks like the Master Rect property includes scrollbars in the size.  You can still probably use this, just subtract the constant size of the scrollbar and see if your mouse is outside of that new value to determine if the scrollbar was clicked.

0 Kudos
Message 5 of 33
(6,135 Views)

You could put a transparent decoration over the part of the control you don't want to allow a user to change, but leave the scrollbar uncovered.

Message 6 of 33
(6,119 Views)

@RavensFan wrote:

You could put a transparent decoration over the part of the control you don't want to allow a user to change, but leave the scrollbar uncovered.


A decoration wouldn't work because he would have to be able to make it visible/invisible. I've done this before with a boolean instead of a decoration.

Cheers


--------,       Unofficial Forum Rules and Guidelines                                           ,--------

          '---   >The shortest distance between two nodes is a straight wire>   ---'


0 Kudos
Message 7 of 33
(6,105 Views)

@James.M wrote:

@RavensFan wrote:

You could put a transparent decoration over the part of the control you don't want to allow a user to change, but leave the scrollbar uncovered.


A decoration wouldn't work because he would have to be able to make it visible/invisible. I've done this before with a boolean instead of a decoration.



I don't remember reading that as part of his requirements.

 

But you could still use the idea.  If you need to make it "invisible" so that the control is fully enabled, you can use a reference to that decoration and change its position to something offscreen.

0 Kudos
Message 8 of 33
(6,085 Views)

@RavensFan wrote:

I don't remember reading that as part of his requirements.


I guess you're right. Maybe he just wants to disable the control the whole time and the only reason it's a control is because it's part of a cluster.

Cheers


--------,       Unofficial Forum Rules and Guidelines                                           ,--------

          '---   >The shortest distance between two nodes is a straight wire>   ---'


0 Kudos
Message 9 of 33
(6,073 Views)

use local varible read inside the control so it is control but act as indicator 

0 Kudos
Message 10 of 33
(6,054 Views)