LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Using the "Acquire Input Data" is stopping Value Change Events in an XControl

First off, the code is attached.  This might be a little hard to explain.

 

I have created a Color Slider XControl.  It allows the user to set an array of colors, calculates gradient transitions between the colors, saves the colors and transitions to an array called Color Table, and then displays the colors with transitions behind a Slider control.  As the slider is moved the value of the slider is the index to the Color Table which is the color under the slider pointer.  The data type of the XControl is output as a color.

 

As part of the XControl, I wanted a Tip Strip that hovers above the slider pointer but instead of giving the numeric value of the slider, it gives the hex value of the color in RGB.  I couldn't use the built-in tip strip because the value of the colors might not be in numeric order (sliders require numeric order).  So, to create my own I used a string control that I control the visibility.  I wanted this to have the same the same behavior as the built-in.  

 

The built-in behavior is as follows:

  1. It becomes visible on mouse down on the slider (which starts the slider causing Value Change Events).
  2. Value change events will continue even if the mouse moves off the control as long as the mouse button is still pressed and the tip strip stays visible.
  3. Becomes invisible on mouse up no matter where the mouse is located.

 

In order to see a mouse up event outside of the XControl I launch a polling VI launched asynchronously which watches for the mouse to stop being pressed.  It does this by using the Acquire Input Data for the mouse.

 

Now finally the question (or undesired behavior the title states).  When I enable this polling VI the Value Changes occur normally for about 1 second and the the XControl does not fire any more Value Change Events.  It does this no matter what the delay in the polling loop is set to.  But I do get the desired behaviour of my tip strip becoming invisible on mouse up even outside of the control.

 

If I disable the launch of this polling VI, Value Changes occur normally except now I can't make the tip strip dissapear when the mouse up is outside of the control.  

 

There is a Color Slider Tester.vi included to test the XControl and a disable diagram around the launcher of the polling VI which is in the Slider:Mouse Down event in the Facade.

 

This might be a bug with LabVIEW, or am I doing something wrong?  Or is there a workaround? Or maybe a different way to look at getting the desired results?

Quentin "Q" Alldredge

Chief LabVIEW Architect, Testeract | Owner, Q Software Innovations, LLC (QSI)
Director, GCentral | Admin, LabVIEW Wiki | Creator, The QControl Toolkit
Certified LabVIEW Architect | LabVIEW Champion | NI Alliance Partner



0 Kudos
Message 1 of 5
(3,089 Views)

Could the tip strip be implemented as a hidden string indicator in the control or VI?

Unhide and move the string indicator with the mouse etc.

I realise this means that it could not display outside the xcontrol but at least you wont have the overhead of an asynchronous polling VI that you have to manage.

 

(Sorry, should have read your post more carefully)

 

Have you checked if the main VI is losing focus. If the main VI is losing focus it will not get value change events.

 

I don't have LabVIEW 2013 installed yet so I can't check your VIs while they're operating, but I suspect your problem has to do with focus going to the wrong window.

Troy - CLD "If a hammer is the only tool you have, everything starts to look like a nail." ~ Maslow/Kaplan - Law of the instrument
0 Kudos
Message 2 of 5
(3,009 Views)

TroyK,

 

Good thought!  I went back and checked.  As far as I can tell the window still has focus.  Adding a Mouse Move event to the tester VI still updated the position, which wouldn't happen if the window lost focus.

 

I added a mouse move event with the coordinates as output on the facade as well, just to see if the Xcontrol froze completely.  It keeps working with the coords continuing to update.  So it seems only the Value Change event is affected.  The XControl isn't frozen or losing focus, just no new Value Change events are being enqueued after the first second or so.

 

--Q

Quentin "Q" Alldredge

Chief LabVIEW Architect, Testeract | Owner, Q Software Innovations, LLC (QSI)
Director, GCentral | Admin, LabVIEW Wiki | Creator, The QControl Toolkit
Certified LabVIEW Architect | LabVIEW Champion | NI Alliance Partner



0 Kudos
Message 3 of 5
(2,996 Views)

I've been waiting for an excuse to install LabVIEW 2013 SP1 and you gave me one!

 

It seems to work properly for me (once I enabled the diagram disable structure in the XControl).


The tip-strip keeps disappearing for ages, even when the mouse button is released off the front panel let alone off the control.  I haven't seen it stop responding.

 

Are you using LabVIEW 2013 or 2013 SP1?

 

The only thing I would challenge is this assumption:

constant-in-memory.png

 

I'm quite sure the compiler will see the constant on the select terminal and remove all other cases as dead code.

Change it to a control wired to a connector terminal and it will keep it in memory.  This functionality changed a few versions back. I know when I mass compiled some older code in LabVIEW 2011 it made this change automatically for backward compatibility.

Troy - CLD "If a hammer is the only tool you have, everything starts to look like a nail." ~ Maslow/Kaplan - Law of the instrument
0 Kudos
Message 4 of 5
(2,981 Views)

I can't get the XControl to fail, it seems to work fine (once I re-enable the disabled code in Facade).

Thoric (CLA, CLED, CTD and LabVIEW Champion)


0 Kudos
Message 5 of 5
(2,975 Views)