pktl Posted November 19, 2019 Report Share Posted November 19, 2019 Hello everyone, I'd like to adjust the background color of my XCtrl by setting the Color property of the Facade vi's Pane. However, that doesn't do anything. Instead, I tried to set the color of a decoration in the background. That also didn't work. (Maybe because I'm accessing the decorations reference through the Facade vi's Pane?) My current workaround is, to place a picture indicator behind the other controls and load an appropriate png file. That seems extremely inefficient, so I'd like to avoid it. Do you know of any documentation of this limitation regarding Pane properties of XControl Facade vi's? Is there a more efficient way of changing the background color of my XControl? Quote Link to comment
hooovahh Posted November 19, 2019 Report Share Posted November 19, 2019 In the Facade, set the background pane color to the transparent color value. This doesn't make the facade transparent when developing it, because...well it can't really. I believe when editing the VI the pane will appear black. But when the XControl is running in a new front panel, it will have a transparent pane color, meaning it will be the color of the front panel on that VI. The transparent color value is 0d16777216. https://forums.ni.com/t5/LabVIEW/Can-a-Color-Box-display-the-transparent-color-16777216/td-p/172288 Also is this documented somewhere or just tribal knowledge? Quote Link to comment
pktl Posted November 21, 2019 Author Report Share Posted November 21, 2019 Thanks, but that's not quite what I meant. I would like to change the color of the XControl based on the state of it. E.g. If True -> Set color green, if False -> Set color red. If I understood you correctly, by setting a transparent pane color, I just get the color of the frontpanel on which the XControl is placed. It looks like the pane color of XControls is a static property, not writable at runtime. However, I could not find any documentation on this restriction... Quote Link to comment
drjdpowell Posted November 21, 2019 Report Share Posted November 21, 2019 Are you sure you are referencing the right clone of your facade vi? A common error I've seen is to get a reference to the master copy of a reentrant vi and not to the actual clone in use. How are you getting your reference. Quote Link to comment
pktl Posted November 21, 2019 Author Report Share Posted November 21, 2019 Good point... I'm not sure. It's implemented like this: If this is incorrect, how can I get the reference to the actual clone? Quote Link to comment
drjdpowell Posted November 21, 2019 Report Share Posted November 21, 2019 (edited) That looks right to me. I don't know why it wouldn't work. Edited November 21, 2019 by drjdpowell Quote Link to comment
Darin Posted November 21, 2019 Report Share Posted November 21, 2019 I do not think that XControls draw their pane, that would become quite the pain when placing them on different front panels with different colors. What I would do is place a single page tab control on the facade (hide the tabs) and put your other controls on it. Control the background color using the FGColor property of the Tab control. 1 Quote Link to comment
pktl Posted November 22, 2019 Author Report Share Posted November 22, 2019 (edited) You found the solution! 14 hours ago, Darin said: I do not think that XControls draw their pane, that would become quite the pain when placing them on different front panels with different colors. Actually, the Facade vi runs transparent by default. If I unselect 'Window runs transparently' in the Custom Window Appearance dialog, it works as expected. No workarounds using tab controls/background images necessary Edited November 22, 2019 by pktl 1 Quote Link to comment
Rolf Kalbermatter Posted November 23, 2019 Report Share Posted November 23, 2019 (edited) On 11/19/2019 at 3:39 PM, hooovahh said: In the Facade, set the background pane color to the transparent color value. This doesn't make the facade transparent when developing it, because...well it can't really. I believe when editing the VI the pane will appear black. But when the XControl is running in a new front panel, it will have a transparent pane color, meaning it will be the color of the front panel on that VI. The transparent color value is 0d16777216. https://forums.ni.com/t5/LabVIEW/Can-a-Color-Box-display-the-transparent-color-16777216/td-p/172288 Also is this documented somewhere or just tribal knowledge? Well a color in LabVIEW is simply an int32 with the lower 24 bits being an RGB color when the MSB is 0. There are a few special constants when the MSB is exactly 1, with the 0x1000000 value indicating transparent, and 0x1000001 is a special type for most recent color and 0x1000002 indicates an invalid color. I don't think there are any other values above 0x1000002 that have any meaning in LabVIEW. The color box is a control with a special display logic that shows the transparent color with the T on top. It is meant as color chooser more than a visual object and if it just would display transparent as, well transparent, it would be hard for a user to know that it is a special color. You can do that with a boolean whose color is set to transparent if you need to. The boolean doesn't have special logic to display the T to indicate that it is transparent. Edited November 23, 2019 by Rolf Kalbermatter Quote Link to comment
LogMAN Posted November 23, 2019 Report Share Posted November 23, 2019 2 hours ago, Rolf Kalbermatter said: I don't think there are any other values above 0x1000002 that have any meaning in LabVIEW. There are, actually, quite a few: https://labviewwiki.org/wiki/Color#Environment_colors Quote Link to comment
Rolf Kalbermatter Posted November 23, 2019 Report Share Posted November 23, 2019 32 minutes ago, LogMAN said: There are, actually, quite a few: https://labviewwiki.org/wiki/Color#Environment_colors A the so called system color indices. Forgot about them. They are determined on startup based on the current OS scheme or possibly when Windows sends a system message that the OS scheme has been changed. Quote Link to comment
LogMAN Posted November 23, 2019 Report Share Posted November 23, 2019 Most of them are actually LabVIEW specific and do not change based on OS settings. I suppose these are used to make LabVIEW look the same on all platforms. Some of them also emit special behavior. For example, 0x01000037 (system owner) is an opaque color that automatically adjusts the color of an element to the color of its owning container. Changing the color of the container then also changes the color of the contained element without having to address it individually. Maybe this is also useful for XControls. 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.