9

Bug introduced in V9.0 or earlier and persisting through V11.3


I have a problem with images with alpha channel which I want to use as labels on Button etc. Unless I scroll or move cursor over the Button the alpha channel is considered a white background.

Button[
 SetAlphaChannel[Graphics@Rectangle[], Graphics@Disk[]],
 Print[1]]

enter image description here

Same with a Graphics in various objects, shown here with the ReverseColor stylesheet:

icon = Graphics[{Green, Disk[]}, ImageSize -> {15, 15}, Background -> None];
{Button[Dynamic@Row@{icon}, {}],
 Panel[Dynamic@Row@{icon}],
 Pane[Dynamic@Row@{icon}, BaseStyle -> {Background -> White}],
 Framed[Dynamic@Row@{icon}, Background -> White]}

enter image description here

For more examples, see Dynamic graphics appears first with wrong background.

How to force the first appearance to be there instantaneously, without moving the mouse over. I'm working on Win7 V10.1. Is there any stable solution to this problem?


Edit 10.09.15

I reported the issue and received a bug confirmation:

[...] Unfortunately, we do not have a work-around for this issue and I apologize for any inconvenience this is causing you. I have forwarded an incident report to our developers with the information you provided. [...]

Kuba
  • 136,707
  • 13
  • 279
  • 740

1 Answers1

5

The workaround given in comments works.

You should set CacheGraphics->False. i.e.

Button[ 
  Style[ 
    SetAlphaChannel[ Graphics@Rectangle[], Graphics@Disk[]], 
    CacheGraphics -> False
  ], 
  Print[1]
]

– ihojnicki Jul 13 at 19:59

One can put it in BaseStyle -> {CacheGraphics -> False} too.

Kuba
  • 136,707
  • 13
  • 279
  • 740