Jump to content
pktl

XControl Pane Color

Recommended Posts

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?

Share this post


Link to post
Share on other sites

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?

Share this post


Link to post
Share on other sites

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...

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

Good point... I'm not sure. It's implemented like this:

XControlColor.png.b2b0616a79230222af9bcac496c86408.png

If this is incorrect, how can I get the reference to the actual clone?

Share this post


Link to post
Share on other sites

That looks right to me. I don't know why it wouldn't work.

Edited by drjdpowell

Share this post


Link to post
Share on other sites

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.

  • Thanks 1

Share this post


Link to post
Share on other sites

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 by pktl
  • Like 1

Share this post


Link to post
Share on other sites
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 by Rolf Kalbermatter

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.