# Container properties

**URL:** <https://forum.inductiveautomation.com/t/container-properties/2734>\
**Category:** Ignition\
**Created:** [March 7, 2011, 7:12pm UTC](https://forum.inductiveautomation.com/t/container-properties/2734 "2011-03-07T19:12:31Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![MCC](https://avatars.discourse-cdn.com/v4/letter/m/3e96dc/32.png) [@MCC](https://forum.inductiveautomation.com/u/MCC)\
**Post date:** [March 7, 2011, 7:12pm UTC](https://forum.inductiveautomation.com/t/container-properties/2734/1 "2011-03-07T19:12:31Z")

</div>

I just noticed some odd behavior with the container component. Perhaps this is by design or I am missing something. If I bind the background color property to a color whose alpha is less than 255, then the opaque property gets set to false and the color does not display (it sets the container to completely transparent regardless of the background property). It seems impossible to have a container that is partially transparent. I just confirmed this for a simpler case – the background color is not bound, I am just setting it in designer. If the alpha is 255, the opaque property is set and the color is displayed. If the alpha is anything less than 255, the opaque property is cleared (and cannot be set) and the color is not displayed.

---

<div class="post-metadata">

**Author:** ![Carl.Gould](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/carl.gould/32/7262_2.png) [@Carl.Gould](https://forum.inductiveautomation.com/u/Carl.Gould)\
**Post date:** [March 7, 2011, 11:23pm UTC](https://forum.inductiveautomation.com/t/container-properties/2734/2 "2011-03-07T23:23:45Z")

</div>

Yeah I see what you’re saying. This is a side-effect of what the “opaque” property means to Swing. I’ve made a ticket to get this fixed.

---

<div class="post-metadata">

**Author:** ![Carl.Gould](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/carl.gould/32/7262_2.png) [@Carl.Gould](https://forum.inductiveautomation.com/u/Carl.Gould)\
**Post date:** [March 11, 2011, 12:14am UTC](https://forum.inductiveautomation.com/t/container-properties/2734/3 "2011-03-11T00:14:25Z")

</div>

The fix for this made it into 7.2.4, which was released today.

---

<div class="post-metadata">

**Author:** ![MCC](https://avatars.discourse-cdn.com/v4/letter/m/3e96dc/32.png) [@MCC](https://forum.inductiveautomation.com/u/MCC)\
**Post date:** [March 14, 2011, 3:42am UTC](https://forum.inductiveautomation.com/t/container-properties/2734/4 "2011-03-14T03:42:47Z")

</div>

Hi Carl,

Thanks for the fix. I am running 7.2.5b1 and I still see some issues with this. For static colors, it seems to work fine, but something isn’t right when you animate the colors. I am using styles to set the colors for a highlight effect when the mouse goes over a container. If I apply identical colors and scripting on a rectangle, I get one result and the same configuration for a container acts differently. The state 0 background colors I have tested are color(255,255,255,85) or color(92,92,92,64). The state 1 color is color(255,255,170,255). For a rectangle, the state 1 color shows as a sort of cream color. For the containers, the background becomes transparent instead of going from partially transparent to opaque and cream colored.

Thanks,  
Max

---

<div class="post-metadata">

**Author:** ![Carl.Gould](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/carl.gould/32/7262_2.png) [@Carl.Gould](https://forum.inductiveautomation.com/u/Carl.Gould)\
**Post date:** [March 14, 2011, 5:29pm UTC](https://forum.inductiveautomation.com/t/container-properties/2734/5 "2011-03-14T17:29:44Z")

</div>

Can you make a simple window that demonstrates what you’re describing and post it here please?

---

<div class="post-metadata">

**Author:** ![MCC](https://avatars.discourse-cdn.com/v4/letter/m/3e96dc/32.png) [@MCC](https://forum.inductiveautomation.com/u/MCC)\
**Post date:** [March 14, 2011, 8:17pm UTC](https://forum.inductiveautomation.com/t/container-properties/2734/6 "2011-03-14T20:17:08Z")

</div>

Interesting, when I created a new container for the test window it worked OK. When I copied one of the misbehaving containers to it, it continued to misbehave. Maybe you will see something I am missing.  
[ContainerHoverTest.vwin](https://us1.discourse-cdn.com/inductiveautomation/original/1X/4238965e2c7941ee18b28333c4d51561031f4375.vwin) (14.9 KB)

---

<div class="post-metadata">

**Author:** ![Carl.Gould](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/carl.gould/32/7262_2.png) [@Carl.Gould](https://forum.inductiveautomation.com/u/Carl.Gould)\
**Post date:** [March 17, 2011, 5:17pm UTC](https://forum.inductiveautomation.com/t/container-properties/2734/7 "2011-03-17T17:17:57Z")

</div>

I see what’s going on here. When I imported that window, neither container’s hover color worked. I’ll bet if you close your container and re-open it, neither will work either. It wasn’t that one was created in an older version and one was newer - it was that one had been serialized and one was “virgin”.

The problem is that when you set the background to a transparent color, it forces opaque off (this is a requirement of Swing, otherwise it would paint using a dirty buffer). Then when you serialize the window, it notices that opaque has been turned off, and so it interprets that as you having un-checked that property, and so when you hover your mouse over the container and it changes the color to an opaque color, it doesn’t paint it because it thinks you’ve un-checked opaque.

The solution? Add a column to your styles dataset: “opaque”: mouseHover 0 \> false, mouseHover 1 \> true

---

<div class="post-metadata">

**Author:** ![MCC](https://avatars.discourse-cdn.com/v4/letter/m/3e96dc/32.png) [@MCC](https://forum.inductiveautomation.com/u/MCC)\
**Post date:** [March 17, 2011, 7:02pm UTC](https://forum.inductiveautomation.com/t/container-properties/2734/8 "2011-03-17T19:02:03Z")

</div>

Thanks for the reply, Carl. Another workaround that I am using is to just not set the hover color to an opaque color – if I set it to almost opaque (alpha = 254) it works! That is close enough to opaque for me.

---

<div class="post-metadata">

**Author:** ![Carl.Gould](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/carl.gould/32/7262_2.png) [@Carl.Gould](https://forum.inductiveautomation.com/u/Carl.Gould)\
**Post date:** [March 17, 2011, 10:42pm UTC](https://forum.inductiveautomation.com/t/container-properties/2734/9 "2011-03-17T22:42:09Z")

</div>

Yep, that’ll work too. It only looks at the value of opaque as a hint to not draw the background at all if the background color is totally opaque.
