LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Change color in string boxes

Solved!
Go to solution

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.

Mocte117_2-1730326903408.png

 

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?

 

 

 

0 Kudos
Message 1 of 6
(243 Views)

I would use lisboxes.

0 Kudos
Message 2 of 6
(231 Views)

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. 

 

LVNinja_1-1730381358620.png

LVNinja_2-1730381377249.png

 

 

 

0 Kudos
Message 3 of 6
(185 Views)

@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. 

 

LVNinja_1-1730381358620.png

LVNinja_2-1730381377249.png

 

 

 


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. 


"Should be" isn't "Is" -Jay
0 Kudos
Message 4 of 6
(178 Views)

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:

 

  • There is no event for the [apply] button
  • Your VI cannot be stopped. You need a stop button and an event for it.
  • All latch action booleans should be inside their event case so they reset when the event is handled.
  •  Are you expecting the List*.txt files to constantly change by external causes? If not it would be sufficient to read the once and not with every iteration of the loop.
  • concatenating a single string returns the input unchanged. Delete these functions!
  • You don't need to wire the indices for index array if you want the elements in order (see picture)
  • Wouldn't it be more useful to have the "array" terminal on the loop diagram instead of inside the save event so we can see what will be saved before the same button is pressed?
  • Is the user allowed to randomly change the various strings and what should happen if he does?
  • ... etc etc.

 

 

altenbach_0-1730386263433.png

 

Message 5 of 6
(170 Views)
Solution
Accepted by Mocte117

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!

 

 

altenbach_0-1730390075031.png

 

0 Kudos
Message 6 of 6
(158 Views)