From 04:00 PM CDT – 08:00 PM CDT (09:00 PM UTC – 01:00 AM UTC) Tuesday, April 16, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

allow scrolling a disabled listbox

Solved!
Go to solution

I have a multi column listbox (MCL) on my front panel that is populated with a list of all the possible tests to be performed on a unit. When the user select select a test case the tests to be performed in this test case are selected (highlighted) in the listbox.

 

By default the MCL control is disabled but by pressing a button the user can edit the sequence. To do this I use the disable property of the MCL. The issue I'm facing is when the MCL is disabled we can't use the scrollbar to check the whole list to validate the selected tests. The disabled items property is not a solution since it greys out the items and deselect them.

 

Any idea for a workaround?

 

Ben64

0 Kudos
Message 1 of 10
(5,717 Views)
Solution
Accepted by topic author ben64

Create a transparent string control which is the size of the MCL and place it over and in front of the MCL. Disable this control when you want to prevent editing. Leave the scroll bar exposed and you should get the functionality you want.



Mark Yedinak
Certified LabVIEW Architect
LabVIEW Champion

"Does anyone know where the love of God goes when the waves turn the minutes to hours?"
Wreck of the Edmund Fitzgerald - Gordon Lightfoot
Message 2 of 10
(5,713 Views)

What if you display the contents of the control into an indicator?

 

If you wanted to make it look like it is a control, position the indicator in the same spot as the control.  When disabling, hide the control and show the indicator.  When re-enabling, hide the indicator and show the control.

Message 3 of 10
(5,710 Views)

@RavensFan wrote:

What if you display the contents of the control into an indicator?

 

If you wanted to make it look like it is a control, position the indicator in the same spot as the control.  When disabling, hide the control and show the indicator.  When re-enabling, hide the indicator and show the control.


The down side of this is that you need to maintain two copies of the data. The transparent string control doesn't require anything more than enabling/disabling it.



Mark Yedinak
Certified LabVIEW Architect
LabVIEW Champion

"Does anyone know where the love of God goes when the waves turn the minutes to hours?"
Wreck of the Edmund Fitzgerald - Gordon Lightfoot
0 Kudos
Message 4 of 10
(5,703 Views)

But if the string control is enabled, it doesn't allow you to edit the underlying list box, it just takes focus when you try to manipulate the listbox.

 

But I do like your idea, I would leave the string control disabled, and just change its position, or hide and show it when you need to enable or disable the listbox.

 

(Yes trying to manage to copies of data with my idea is a downside.  I posted it because it was the first thing that popped into my head and is a plausible method, though it certainly is not the best method.)

0 Kudos
Message 5 of 10
(5,699 Views)

Personally I would use the mouse filter event on the list instead of the value change on the boolean:

 

New Bitmap Image.png

Message 6 of 10
(5,698 Views)

Thanks to all for your suggestions. I went with Mark solution because it doesn't need filtering or passing data between control and indicator (I used it with the visible property of the string indicator).

 

Ben64

0 Kudos
Message 7 of 10
(5,690 Views)

I just use the disable property and the Mouse Down event myself.  You can even scroll grayed out controls using this method.  Only discarding clicks still leaves other methods of editing available.

 

ScrollMCListbox.png

 

Edit:  I am probably old-fashioned, but overlapping controls on the FP can be a CPU burner in some cases (graphs especially) as LV becomes a bit too aggressive in repainting.  Might be better in newer versions, I am just out of the habit so I don't know.  Always available as a fall-back solution, but I personally would be careful using it as a go-to method.  While it may be ok here, pretty soon if you start doing it everywhere things get out of hand.

 

And while I am at it, I have to think about the appropriateness of the scrollbar being disabled with the rest of the control.  Not sure I like it.

Message 8 of 10
(5,674 Views)

A couple of years old but I wanted to thank you for your solution Darin.  I don't have any personal beliefs that make me not want to have overlapping controls, but I did want to support greyed out controls, and my table fits to the pane so it may grow or moves oddly, and having a control over top of it that also needs to behave similarly would be a pain.  But your solution works great.  Some flicker is seen when going from greyed out to enabled but it is better than not being able to scroll at all.

 

My situation is where a table can be used to set a simple profile, but when the test is running I wanted the controls to be disalbed and greyed out, then reenabled after the test has stopped.  Some users complained that they couldn't view the full table if many steps were added.

0 Kudos
Message 9 of 10
(5,311 Views)

I got a simple solution here.

It doesn't disable the table, but the user cannot edit the cell because mouse down action is discarded with in table area.

and the scroll bar works fine.

and it doesn't involve any constant number parameter, using point to row column method to determine whether mouse is in table.

 

sss.png

Message 10 of 10
(4,753 Views)