How is it possible to copy text with its font properties from a string control/indicator to another?
I know that this can be performed with Ctrl-C (when the desired text is selected) an Ctrl-V (in the new location); however, how can I perform this action programmatically?
please find attached file. If each letter has different color you should go through all string letter by letter and check his color.
I am sorry but I do not understand your question? Do you mean without a for loop? Could you please give me an example or tell me what is your application?
Yes. Turn Destiny 1, 2, and 3 into Indicators (they are currently Controls) and simply connect them with a LabVIEW Wire to Origin 1, 2 and 3!
If (for some reason) you need to keep Destiny 1, 2, and 3 as Controls, and simply want to set them to look like Origin 1, 2, and 3, and don't want to use Property Nodes, you can create Local Variables (which have other Bad Features) and simply wire Origin 1 to Local Variable Destiny 1.
P.S. -- if this is the answer you are seeking, please mark it as a Solution.
Yes, I meant without the FOR loop.
In my application, I have a string indicator that plays the Console role, continuously different parts of my code send messages (with a specific color and size) to be printed in the string indicator. However, as in your code, for every new message I have to read character by character the previous message in the Console and then add the new message; I would like to copy the entire Old state of the Console (with its font properties), concatenate the new message and only modify the font for the last message.
If I concatenate the Old state with the new text and only change the font for the new message I get this (Case 1), if I utilize the same approach than in your VI I get the desired results (Case 2). But this solution is very slow, to run copyFont_modified2.vi.
Bob_Schor, I already tried that but it does not copy the font properties (color, size) only the text content.
The solution that I've found, as I need colors by line is the following:
Aha, I learned something unexpected -- if the string has multiple properties, you cannot do the "simple" copying that I advocated! Note that a uni-color, uni-attribute string will wire just fine ...
There is a discussion on the Idea Exchange about why the string datatype will not be extended to include the formatting information. I did not search for it to provide a link but I recall looking at it recently.
1. Property nodes execute from top to bottom. Make sure that the Selection Start and Selection End properties are at the top of the list.
2. It may help, particularly on much longer strings, to place Defer Panel Update property nodes before (True) and after (False) the for loop. This will prevent the FP from attempting to update for each character and may improve the speed.
I think there is no way how to avoid using For Loop. Problem is in this sentence " I would like to copy the entire Old state of the Console (with its font properties)". There is no tool to copy font properties of all letters in the string.
As johnsold said, Defer Panel Update property node helps a lot to increase an execution speed.