LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

dynamic captions for textbox

Solved!
Go to solution

I have an array of indicators that are created dynamically along with a set of channel properties (array). I would like to map array elements to the captions of the dynamically created indicators.  I created a caption text property from one of the indicators and am trying to loop thru and write the proper caption.  What I'm seeing is that all the captions get written the same value as it indexes thru the 'for' loop. How do I index into the correct indicator?  Thank you!

caption-for-indicator.png2019-08-26_20-13-54.jpg

 

0 Kudos
Message 1 of 14
(1,844 Views)

Based on your Logic the Last Value will be the one which will get reflect. and For array you cannot provide unique Label for each element.

All the Elements in the array will be having same Label.

Pazhanivel Thiruvenkadam,
CertifiedLabVIEWArchitect|| CertifiedTestStandDeveloper,
Currently able to Access LV2015&LV2017
0 Kudos
Message 2 of 14
(1,809 Views)
Solution
Accepted by topic author beneeto

Hi beneeto,

 

in an array all elements share the same properties. They only differ by their value.

The caption of the numeric element is a property…

 

Possible solutions:

  • Create an array of cluster of [numeric, string]. Now you can set a string indicator independently for each array element as it is a value and not a property.
  • Use a table/multicolumn listbox to display a list of data. This gives much nicer UI instead of bulky arrays…
Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO
Message 3 of 14
(1,793 Views)

Thanks the text box worked well.  One followup on this though. The channel name and units columns are flickering every 100ms (see attached vid).  What's the proper way to handle this? 

 

textbox-voltage-monitoring.png

0 Kudos
Message 4 of 14
(1,752 Views)

Hi beneeto,

 

only update the table when values change.

Do you need to update each 100ms?

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO
0 Kudos
Message 5 of 14
(1,737 Views)

What Gerd says is correct.

 

But there is also a graphical bug with tables that causes that flickering.  You can get rid of the flicker if you take a small transparent decoration and place it so it overlaps the table, even if just barely.

Message 6 of 14
(1,720 Views)

I've dropped the scan time to 200ms and added the transparency decoration.  Thank you, those are both good improvements.  I'm not sure I want to dive into adding an Event structure to handle value change (assuming that's what you're suggesting)..although I know that's the correct way to do the display.   

 

I have a follow-on question about handling multiple tables.  I apologize if I should be starting a new thread, but figure I already had your attention.  I added a case statement that splits the displayed channels into two tables.  As shown below i'm using the 'last value' of the for loop as an input to the case selector.  That obviously doesn't work.  I've been fooling around trying to refactor things and thought i would ask for suggestions.  Thanks again.

 

two-textbox.png2019-08-27_15-58-16.jpg

0 Kudos
Message 7 of 14
(1,704 Views)

What is the purpose of the two tables?  What determines what goes into table 1 vs. table 2?

0 Kudos
Message 8 of 14
(1,684 Views)

@beneeto wrote:

I added a case statement that splits the displayed channels into two tables.  As shown below i'm using the 'last value' of the for loop as an input to the case selector.  That obviously doesn't work.  I've been fooling around trying to refactor things and thought i would ask for suggestions.  Thanks again.

 

Now you need to pause and think things through. As you're sending 'i' to the case selector you're using "How many lines did i recieve, minus one, unless it's zero in case it's still zero". That's not a very secure way of handling the data.

It's better to use Array Size on the incoming array (and even better to switch the notifier to a queue, that's basically all you need to do).

But, i'm assuming your logic is (correct me if i'm wrong):

- If i get 24 channels, update table 1

- elsif i get 0 channels then i'll update the table with an empty array (this should be safe, if unnecessary and is one of the causes of the flicker)

- else update table 2

 

What i'd do is add a row 1st in the array that indexes which table the data should go to. You just need to add a Split array and let this 1st number control the Case and the other continues on like now. 

/Y

 

two-textbox.png2019-08-27_15-58-16.jpg


 

G# - Award winning reference based OOP for LV, for free! ADDQ VIPM Now on GitHub
"Only dead fish swim downstream" - "My life for Kudos!" - "Dumb people repeat old mistakes - smart ones create new ones."
Certified-LabVIEW-Developer
Message 9 of 14
(1,665 Views)

Thanks, that is an easy solution to implement.

Message 10 of 14
(1,643 Views)