10-30-2024 05:25 PM
Hello again,
Please could you help me with a problem that I have not been able to solve. It happens that I have 3 text files with items NUM1, NUM2, NUM3 ... NUM10. and those items are displayed in a combobox. In addition to this I have 6 string cells where the same items appear (NUM1, NUM2, ... NUM10) but at random order. The user can modify these cells with random or consecutive values of the NUM. My intention is to color the text depending on the user's selection. For example, if I select NUM 3 (left box) manually and select green option on combobox, I want that NUM 5 to turn green.
I think one way is to use the combobox where all the options are and select the option I require, the color and the apply button. Or manually select the letters I want to color, select the color and click apply.
What would you do?
Solved! Go to Solution.
10-30-2024 06:14 PM
I would use lisboxes.
10-31-2024 08:30 AM
I don't think you can change the color of different string lines, since they are on the same String indicator/control.
One way to accomplish what you want is to replace the string boxes with a cluster with strings , in this case each string indicator will be independent and you can change the color independently with property nodes.
The cluster property node will give you an array of references for each string control/indicator, using a FOr loop you can setup the color of each individual.
10-31-2024 08:54 AM
@LVNinja wrote:
I don't think you can change the color of different string lines, since they are on the same String indicator/control.
One way to accomplish what you want is to replace the string boxes with a cluster with strings , in this case each string indicator will be independent and you can change the color independently with property nodes.
The cluster property node will give you an array of references for each string control/indicator, using a FOr loop you can setup the color of each individual.
You should be able to use the text selection property along with text.text color (foreground and background) to get the desired results. It will get ugly with the string match indices (there may be an unusual off-by-one to account for the index after matches.)
By ugly, I mean even CA won't get that to fit on a postage stamp! But highly doable.
10-31-2024 09:55 AM - edited 11-01-2024 10:13 AM
As I said, use listboxes and rings.
Can you explain how the saved files should look like? For example do you only want to save the colored items? (A plain text file will not retain color information).
You still have some glaring issues in general:
10-31-2024 10:56 AM
See if this quick draft can give you some ideas.
I still have absolutely no idea what you are trying to save, so I left that out.
You also should format your "masterlist.txt a little better. Having long sequences of spaces is not a good delimiter!
11-07-2024 04:28 PM
Hi Knight Of NI, sorry to bother you again, I have a question, in case I want an item that opens in the MasterList.txt list to start with a default color, how should I do it? As I see, the LstBox (strict) sends all the items to the different listbox with the same color. I don't know if adding a case inside the loop would work.
The code for this area:
11-08-2024 08:55 AM
solved 🙂
11-08-2024 09:06 AM
You can wire the string directly to the Case and have ITEM as case selector instead. 🙂
11-08-2024 10:01 AM
I tried it but it doesn't work properly. Do you know what could be causing this problem? The solution I put previously also stopped working.
When I run the VI only some items are displayed in color, even those that do not belong to the specified condition