10-20-2018 07:23 PM
I started with a empty 2D array.. then try to type these strings..
but when I closed the typedef and reopened, it is always empty..very frustrated, it took me a while to type all the strings..
another thing, how to make the strings centered in the display? I tried aligned objects but did not work..
Thanks so much!
Solved! Go to Solution.
10-20-2018 07:34 PM
I see all your string in the attached typedef. Can you explain how you are losing the default values?
(If you want different strings, enter them, then make current value default (for the array, not the string element!), then save.)
Also, the string are centered. It's a menu from the font pulldown (justify...center).
10-20-2018 08:04 PM
Thanks... it solved...but I still don't like it..
once I finished all the typing... is there a easier way?
or when I type partially (only the first 1D array) and then use “make current vale default”, the rest of the untyped array will have the same string message.
10-20-2018 08:21 PM
The easiest thing is if you had all these string already typed somewhere else like a text file or Excel file, is to use LabVIEW to read that data into and write it to an indicator. Then right click and turn it into a constant. Use that constant to populate any indicators or controls when your VI runs.
Type defs are meant to define the data type, particularly useful for enums and clusters, not really necessary for ordinary LabVIEW data types like numerics, booleans, and strings.
Strict type defs go a step further to define the appearance of the control or indicator.
Going so far to define the data stored in a control, while typed defs might be able to do that, is a pretty unusual case. Using constants and saving values as default in controls is the typical way to define the data values to be used.
10-20-2018 08:30 PM
very useful advice.
thanks so much!
10-20-2018 08:39 PM
@idjuven1 wrote:or when I type partially (only the first 1D array) and then use “make current vale default”, the rest of the untyped array will have the same string message.
The default for the element needs to be an empty string. You only need to make the value of the array the default. Apparently you made the non-empty string the default for the element, so undo that.
10-21-2018 05:48 PM
@idjuven1 wrote:
I started with a empty 2D array.. then try to type these strings..
but when I closed the typedef and reopened, it is always empty..very frustrated, it took me a while to type all the strings..
A simple way to do this is to make a vi with your predefined array inside.
Then you can use it where needed in your program.
A more robust solution would use the First Call function to read the data from a file
and store it in a shift register.
10-21-2018 09:05 PM
There is no reason to make a 2D array of strings a typedef.
Seems these values are static and should probanly not be changed by the user at run time. One easy way to enter the data once is to make it a diagram constant. (... and if you ever want it as a control with the same default data, just turn a copy of that constant into a control).
10-22-2018 07:35 AM
Thanks...
one reason is that we need to find the message out (right column) using the the message in (left column)
in that case, we can apply the array operation functions to achieve it..
10-22-2018 08:30 AM
@idjuven1 wrote:
Thanks...
one reason is that we need to find the message out (right column) using the the message in (left column)
in that case, we can apply the array operation functions to achieve it..
All of that is the reason for doing what in the program?