08-07-2014 08:23 PM - edited 08-07-2014 08:25 PM
Hi,
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?
Thank you
08-08-2014 02:32 AM
Hi Ray_Cassani,
please find attached file. If each letter has different color you should go through all string letter by letter and check his color.
Best Regards,
CaravagGIO
08-08-2014 12:05 PM
08-08-2014 12:42 PM
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?
Regards,
CaravagGIO
08-08-2014 12:42 PM
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.
Bob Schor
P.S. -- if this is the answer you are seeking, please mark it as a Solution.
08-08-2014 01:33 PM
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.
Thanks
08-08-2014 03:10 PM
Hi,
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:
08-08-2014 03:41 PM
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 ...
BS
08-08-2014 03:55 PM
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.
Two details:
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.
Lynn
08-08-2014 04:41 PM
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.
Regards,
CaravagGIO