Brian Sheposh Posted April 3, 2012 Report Share Posted April 3, 2012 Hello. New to LAVA and new to VI Scripting, and I love it! I can change font attributes of StringConstant labels and captions.I cannot figure out how to change the font of the actual StringConstant text using VI Scripting. Does someone out there know how to? I have attached an image of my Block Diagram. Quote Link to comment
jcarmody Posted April 3, 2012 Report Share Posted April 3, 2012 I don't think that property is exposed, so I thought I'd be clever... ... but the formatting doesn't follow when changing the control back to a constant. I should have tried it manually first; it doesn't work that way either. Quote Link to comment
Aristos Queue Posted April 4, 2012 Report Share Posted April 4, 2012 Unfortunately, not everything you can do in the editor has been exposed through scripting, and this is one of the holes. Depending upon what you're trying to script, it might work to have a template VI that has a constant on it that already has the font style you want... instead of creating a new constant and trying to set the font, copy the constant from your template and just set the value. Obviously that won't work if you're trying to set an arbitrary font, but if you have a specific font you want to be able to do, it works. Quote Link to comment
Popular Post Bobillier Posted April 4, 2012 Popular Post Report Share Posted April 4, 2012 Hi I have one trick to solve you problem. the solution is to type cast your string constant reference to string type. In this case, you can accede to all properties of string constant text. Regards Eric 3 Quote Link to comment
Yair Posted April 5, 2012 Report Share Posted April 5, 2012 To expand on what Eric suggested, you should go read this thread - AQ has mellowed since then and would probably not say the same thing today, but it still is important to be aware of the implications of using type cast. Quote Link to comment
Aristos Queue Posted April 6, 2012 Report Share Posted April 6, 2012 AQ has mellowed since then and would probably not say the same thing today, but it still is important to be aware of the implications of using type cast. After I finished crying, I added an autotest to LV's nightly test suite just to make sure if anyone did try to change the private fields of those two classes in a way that they no longer coincidentally lined up, we'd see the crash on our end long before release. So far, so good. No one has felt the need to refactor strings. I still don't recommend it, which is why I was waiting to see if the "copy a constant with the right font" workaround would suffice before mentioning this dark alchemy. :-) 1 Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.