08-01-2014 12:56 AM
Greetings,
I need to make an array containing verticle strings. The size of the array will very during runtime.
I know that for a single string indicator I can ignore the actual control, rotate the caption and change its text property and for a cluster there's an array of references to each member which can be used for accessing the caption text of each member but it appears that all members of an array share a caption.
Am I correct that there's no way (yet) to do that?
Peace
phroggie
08-01-2014 01:18 AM
08-01-2014 02:05 AM
You should be able to do this using a picture control. Here are some options:
08-01-2014 04:29 PM
Hello phrog,
This functionality can be implemented in LabVIEW by adding a custom string indicator to an array. First create a single array indicator and customize it to exhibit the desired behavior. Then add this string indicator to an array on the front panel. As GerdW has said, every element in an array shares the same properties as the control/indicator you add to it. So by placing a custom indicator in an array you ensure that every string element posses the same customizations.
08-01-2014 06:24 PM
Yes, I'm aware that all the elements of the array share properties.
But how do I make a rotated string indicator?
(Other than converting the text to a bitmap and rotating that. I'm not sure that's practical in this case. Also, I'd rather the OS does the vertical text rendering. Once it's a bitmap there's no anti-aliasing.)
Will an Xcontrol handle it?
08-02-2014 01:15 PM
An Xcontrol won't help you because you can't put XControls in arrays. Even if you could, they would still share properties.
If you don't want to use picture controls because of the rendering (I never looked into that), then another option you have is an array of subpanels, where each panel shows a copy of a VI which only has a control. This is more complicated, both because you can't actually put a subpanel into an array any more than you can an XControl and because you need to somehow communicate with all the VIs. If you want to look into this, you can search for "array of subpanels" and find some examples I posted here. You also still have the last option I mentioned in the previous reply.
08-03-2014 03:56 PM
Make a cluster with floating text objects. Set their vertical orientations as desired. (You also have to put a control in it (but you can hide it)
Those text objects are decorations whose references can be accessed through a property node of the cluster; through those references, the text can be updated.
See attachment.
08-03-2014 04:27 PM
Greetings,
Thank you Paul. I have been toying with that very idea but I'm not sure it would work in my case.
The number of elements will change during runtime. And I have to accommodate anywhere from 1 to at least 256, but preferably more.
To make it work, I'd have make a cluster with the maximum number of elements I intend/expect to support then set the Visible propery on each member each time the size changes. Meanwhile, the indicator would not resize and, correct me if I'm wrong, there won't be a horizontal scroll bar.
Thank you again
08-04-2014 11:43 AM
Hello Phrog,
It seems like the solution proposed by Paul is sufficient for your application. But I would like to suggest an alternative solution (with its own trade offs) that may address some of your functionality concerns. The width of a string indicator and text wrapping can both be set in the properties menu. Because of these settings, each character would appear vertically stacked. An array of these string indicators could be sized dynamically and viewed using a scroll bar. Unfortunately the letter “m” is wider than combinations of other two letters such as “is”. If the width is set too low then the letter “m” gets cutoff. If the width is set too high then smaller letters like “is” appear on the same line. There is no magic width that prevents these two cases.
The example I have attached works around the letter “m” by appending a space between each non-m character and uses an indicator width of 23 pixels. This is enough space to display the letter “m” while the inserted spaces prevent smaller letters from appearing on the same line. Despite this inconvenience, you gain the use of built in dynamic array sizing and the horizontal scroll bar.
Otherwise, scroll bar functionality is not built into clusters. It is possible to implement a scroll bar for a cluster programmatically as shown in this community example: https://decibel.ni.com/content/docs/DOC-35704
This solution isn't necessarily easy to implement, so using stacked characters in an array may be a worthwhile trade off depending on your application.
08-04-2014 11:51 AM - edited 08-04-2014 11:51 AM
Thanks, Earl.
This might be the only way to do it. It may not be pretty since I won't be able to "bottom justify" (or it won't be easy) but at least I'm using an array of string indicators. Also, I'll try a fixed width typeface.
Thank you