02-25-2016 03:20 AM
Any thoughts on...
02-25-2016 03:24 AM
For the string box: there is an option if you right click it "Size to text"
For FOR Loop: "Auto grow"
02-25-2016 03:27 AM
In my post, I've used a term 'Programmatically' also I'm interested to match the width of all three elements...
Neither 'Size To Text' nor 'Auto Grow' will help.
02-25-2016 04:32 AM - edited 02-25-2016 04:32 AM
I stumbled on this post, which was very helpful in how I solved this. It is not easy, there is a lot of things to be added to the case structure but it is possible.
Hope this helps.
02-25-2016 07:51 AM
You've stumbled upon a little-known fact -- programmatically getting a String Indicator to "fit the string" at run-time is a fairly difficult proposition. I posted some code on the Forum to do that, but it was complicated and not very "obvious". It also was (as I recall) somewhat dependent on which set of Front Panel Palettes (Classic, System, Modern, Silver) you were using ...
Bob Schor
02-25-2016 08:05 AM
@.aCe. wrote:
A couple of comments on this code:
If this is something that the OP wants to do often, making it into a right click shortcut (in LV 2015) or a Quick Drop keyboard shortcut is advisable.
02-25-2016 08:18 AM - edited 02-25-2016 08:23 AM
@tst wrote:
A couple of comments on this code:
- You probably don't need to extract the width from the master rect, since you get it as a property.
- I would highly recommend not doing the transition through the flattened string. The best option is To More Specific Class. In some classes, the relevant properties exist but are not exposed through VI Server and then you can sometimes access them by type casting the reference to a class which does have them (which is basically what you're doing), but that's potentially dangerous and should generally be avoided.
- The basic idea behind the code is that there are no general width and height properties that you can use to set this. Each class has specific properties for this, which is why you need the cast.
If this is something that the OP wants to do often, making it into a right click shortcut (in LV 2015) or a Quick Drop keyboard shortcut is advisable.
Hello tst,
Thanks for the comments, I'd like to explain why I did what I did.
1. As a matter of fact, Area Width is the wrong property to look at as it may include width of labels etc if present. So width from Master Rectangle is what should be used for comparison.
2. I am aware of this. As mentioned in my post and by Bob, the link explains why 'To More Specific Class' (Which I have used in the ForLoop without any issues as expected) throws an error.