orko Posted January 18, 2007 Report Share Posted January 18, 2007 I'm currently involved with a project that involves displaying numerous indicators with differing values, but changing appearance (colors, flashing, bold, etc) according to the value received. It sounded like a good excuse to pursue Xcontrols, which up until now I've not found much use in my applications for. I can do this manually, but with >50 indicators refreshing as fast as possible I thought Xcontrols would be more efficient. My problem (and it may be a silly problem but I've expended much energy on Google and LAVA to no avail) is that I'm trying to get a numeric Xcontrol indicator that takes up about 60x24 pixels, but the windows operating system seems to not want to allow resizing the front panel below 120 wide? Messing with the "Window Bounds" property of the VI seems only to temporarily solves the issue...unless I have to programmatically set up the position/size/bounds of the Xcontrol in the Init VI (which I just tried to do but must have done wrong since I crashed LV). I've tried making my Xcontrol facade big and resizing it down once on the main app's FP, but it didn't seem to work as expected. Even checking the "Maintain proportions of window" and "Scale all objects on front panel as the window resizes" options in the VI Properties of the Fa Quote Link to comment
Doon Posted January 19, 2007 Report Share Posted January 19, 2007 Hiya orko, If control Scaling is not an issue, you can unset the VI Properties>>Window Size>>"Scale . . . as window resizes" checkbox. Then after you plop the XControl onto your Front Panel, you can resize the XControl's container down to the right size. Hope that helps, --H Quote Link to comment
Michael Aivaliotis Posted January 19, 2007 Report Share Posted January 19, 2007 No problems for me. I did the following: Create new XControl Placed a numeric control on the facade from: Controls>Classic>Simple Numeric Rightclick on the numeric and selected: Fit Control to Pane. Saved the XControl Plopped it on a blank VI panel. That's it. Quote Link to comment
Ton Plomp Posted January 19, 2007 Report Share Posted January 19, 2007 Basically I'm trying to put a bunch of these identically processed Xcontrols into arrays for display to the user, so I can't have any "empty space" around the indicator when I drop it down onto my main app's FP or things get messy real quick. This won't work, you can't place an XControl inside an array.... You should make the array inside the XControl, or just use them apart Ton Quote Link to comment
Doon Posted January 19, 2007 Report Share Posted January 19, 2007 This won't work, you can't place an XControl inside an array.... Oh yeah, I didn't catch that. Thanks for pointing that out, tcplomp --- orko, As near as I can tell, one cannot give array elements different properties (e.g, color, font style). One possible (almost-)solution is to build an array of numeric indicators in front of an array of color indicators and set the color values based on your conditionals. I have built a small vi (with a big name) that demonstrates my suggestion. I hope that helps, --H Download File:post-3343-1169221347.vi Quote Link to comment
Michael Aivaliotis Posted January 19, 2007 Report Share Posted January 19, 2007 This won't work, you can't place an XControl inside an array....Well that sucks!You can, however, place them inside a cluster. With some programmatic trickery, you can position them automatically and you can get an array of references where you can set properties (color, etc) to a specific element. Cluster to array and array to cluster primitives help here. i think this type of thing was also on the CLA test. Quote Link to comment
orko Posted January 22, 2007 Author Report Share Posted January 22, 2007 Michael_Aivaliotis--> Thanks for the steps you provided. They do provide a way to resize the Xcontrol's numeric indicator, but the "container" that is dropped onto the blank VI's FP ends up still being bigger than the indicator, which means that putting say 30 of the indicators on the FP and trying to align them all up with the compression/alignment tools gets real messy. You end up doing the alignment by hand (in my case it's about 50 indicators). tcplomp--> Argh. Not being able to put these into arrays is hampering my style... Thanks for the very timely advice. Doon--> Good point about not being able to change the properties of elements of an array individually. Another lesson I've relearned... Your VI is very....colorful but it does illustrate a possible way I can go with this. The problem here is aligning the two arrays and all their elements perfectly so there's no "ghosting" of colors into adjoining elements. Michael_Aivaliotis--> Yes, it does suck that you cannot have Xcontrols in arrays... but I understand what you are saying about using clusters and getting references into an array to do the coloring/blinking/etc by element positioning. One question... Will the cluster to array primitive *always* index the resulting array corresponding to the cluster control orderring? If so, I could use this approach... Edit: A little RTFM and yes, the cluster to array primitive does always index using the cluster order. 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.