From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, 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: 

Programmatically Write Values to a Multicolumn Listbox

Solved!
Go to solution

Hi guys, I will be referring to the following example:

https://forums.ni.com/t5/Example-Code/Programmatically-Write-Values-to-a-Multicolumn-Listbox/ta-p/34...

 

The example works fine, I have no issues with it.

I'm trying to edit the example, so I don't need to physically press the button, instead, have it done programmatically.

To test it, I just created an additional While Loop, inside it, a Flat Sequence, and every 3 seconds I'm setting the Update button to true, then again to false (I had to change the mechanical action from latch to switch though).

 

When I press the button, the value is inserted, but every time the value of the button is changed programmatically, nothing happens...

Could someone explain why this isn't working?

 

I'm attaching the edited example.

Cheers,

Johnny

0 Kudos
Message 1 of 6
(1,303 Views)
Solution
Accepted by topic author JohnatanBravo

Hi Johnny,

 


@JohnatanBravo wrote:

When I press the button, the value is inserted, but every time the value of the button is changed programmatically, nothing happens...


Changing the value of a control by user actions generates a ValueChange event, but setting the values programmatically (using local variables or "value" properties) does NOT generate a ValueChange event… (Basic knowledge about event structures!)

 

The quick&dirty solution is to use a "value (signalling)" property as that one will also generate the desired ValueChange event… (Beware of side effects!)

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 2 of 6
(1,273 Views)

Thank you, it's working now.

I'm only going through Core 1 at the moment, and wasn't aware of that.

 

Could you elaborate on the side effects? What are the possible side effects of doing this?

I'm only updating some test info using this, I don't see any possible bugs...

 

Working example attached.

 

Cheers,

Johnny

0 Kudos
Message 3 of 6
(1,249 Views)

Hi Johnny,

 


@JohnatanBravo wrote:

What are the possible side effects of doing this?


Each time you write to a "value (signalling)" property node an event is triggered - regardless if the value has changed or not…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 4 of 6
(1,236 Views)

That's good to know, thanks again.

 

Cheers,

Johnny

0 Kudos
Message 5 of 6
(1,218 Views)

@GerdW wrote:

Hi Johnny,

 


@JohnatanBravo wrote:

What are the possible side effects of doing this?


Each time you write to a "value (signalling)" property node an event is triggered - regardless if the value has changed or not…


As a side note, inside an XControl, a "Data Change" event will be triggered only if the value is different.

"If you weren't supposed to push it, it wouldn't be a button."
0 Kudos
Message 6 of 6
(1,186 Views)