LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Reverse Value Change events order

Hi

See attached VI. I've got some values in Listbox which I would like to edit using Numeric control. The problem is: when I click on listbox directly after editing number, wrong item is updated (the one that was just clicked, not the one I was editing). I need to reverse the order of events.

 

Any ideas? I've got Kudos to give 😄

0 Kudos
Message 1 of 6
(2,543 Views)

@PiDi wrote:

Hi

See attached VI. I've got some values in Listbox which I would like to edit using Numeric control. The problem is: when I click on listbox directly after editing number, wrong item is updated (the one that was just clicked, not the one I was editing). I need to reverse the order of events.

 

Any ideas? I've got Kudos to give 😄


I think you need to re-think your logic.  Turn on the lightbulb (highlight execution) to see what happens.  Then try to fix it.  🙂

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
0 Kudos
Message 2 of 6
(2,538 Views)

Your problem is that the clicking on the listbox is causing the numeric control to lose focus and therefore change value.  I remember seeing this problem before, I just don't remember what solution we came up with was.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 3 of 6
(2,522 Views)

Of course the Highlight Execution comes into play again...

 

The solution is actually fairly simple.  I just had to play around with it for a few minutes for it to come back to me.  You just need to keep the currently selected value of the listbox in a shift register.  On the Numeric Value Change event, you read the shift register for which item to update.  On the Listbox Value Change event, you update the shift register.  The value should just be passsed through for all of the other cases.

 

This can be done since the Numeric Value Change event is fired before the Listbox Value Change.  But the value in the listbox has already been updated by the time you read it inside of the Numberic Value Change event.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
Message 4 of 6
(2,518 Views)

I can't believe I didn't found crossrulz solution myself 😄 I'll need to check it twice on my actual code to find out if there was any surprises preventing me from implementing this 😉

0 Kudos
Message 5 of 6
(2,466 Views)

I don't know your whole application so I can't say if this is a solution or not.  But if all you are trying to do is allow the user to edit the Listbox then right click and choose "Editable Cells"  Now the user can click the item in the listbox and change the string text there.

0 Kudos
Message 6 of 6
(2,452 Views)