9
$\begingroup$

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

$\endgroup$
4
  • $\begingroup$ yep, I would say its a front end bug...perhaps a workaround can be found by fiddling with styesheets $\endgroup$
    – chuy
    Commented Jun 9, 2015 at 14:57
  • $\begingroup$ Interesting, on 10.1 on Win8.1 I don't need to scroll over to change the appearance, but there is a pause before it changes on its own $\endgroup$ Commented Jun 10, 2015 at 20:36
  • 5
    $\begingroup$ You should set CacheGraphics->False. i.e. Button[Style[SetAlphaChannel[Graphics@Rectangle[], Graphics@Disk[]], CacheGraphics -> False], Print[1]] $\endgroup$
    – ihojnicki
    Commented Jul 13, 2016 at 19:59
  • 1
    $\begingroup$ This issue has wider affects; see also: (121082) $\endgroup$
    – Mr.Wizard
    Commented Jul 20, 2016 at 11:52

1 Answer 1

5
$\begingroup$

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.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.