But it seems to me that I should be able to do this with Button options.

Q. How can I set appearance to None for both the pressed and unpressed button? If this cannot be done with button options--and it would seem an oversight if it is not possible--I will use EventHandler.

why not use Appearance -> None i.e., without the "Pressed" option?
–
The Toad♦Jun 11 '12 at 1:52

@R.M because when pressed it still gives the pressed style. That is the whole reason for this question ;)
–
Mike HoneychurchJun 11 '12 at 1:53

Is this OS X specific? If yes, can you please tag with macosx?
–
SzabolcsJun 13 '12 at 7:20

@Szabolcs I use Mac OS X. I do not know the behaviour on Windows ...but that does not mean it differs on Windows. The answer I got from tech support did indicate any platform specificity.
–
Mike HoneychurchJun 13 '12 at 11:24

2 Answers
2

There is no direct way of doing this but the work around is to set the button appearance to "Pressed" and set the button background to the inverse of the background you actually want. So for a white button:

That's easy enough. So you'd use Background -> Blue if you really want a yellow background, etc.... But my solution (with Graphics) also works when you don't use appearance "Pressed", whereas with this work-around here you can really only keep the button in the pressed state, because the non-pressed one will now have the inverse color.
–
JensJun 13 '12 at 0:35

@Jens. Yes it stays in the pressed state. I don't care so much about that because I wanting Appearance->None in both pressed an unpressed states. Actually I decided to go with EventHandler in my code. These works arounds are simple enough but I think EventHandler is much easier for others to read and see what is going on and why it is there.
–
Mike HoneychurchJun 13 '12 at 0:48

Based on a guess, I just tried "Disabled" in the appearance, and it worked:

Button["xxx", Null, Appearance -> {"Disabled", "Pressed"}]

However, it seems that this "non"-appearance results even if I replace "Disabled" by "". So maybe putting in the empty string is enough for your purposes.

Edit:

Since I can't guess an option value that works without producing a (harmless but annoying) frontend warning message in the console, maybe one could do the following. It's also a hack, but it produces "no appearance" while still using the functionality of Button (as opposed to the EventHandler approach which is actually easier but which wasn't desired):

Using "Disabled" generates an error in the messages window: "The specified setting for the option ButtonBoxOptions, Appearance cannot be used." You can get the same appearance even with Appearance -> {"blah", "Pressed"}
–
The Toad♦Jun 11 '12 at 1:46

Enabled->False switches off the functionality which is not what I want. The empty string seems to work.
–
Mike HoneychurchJun 11 '12 at 1:49

@R.M. is right - you do get a message in the message window, even for "". Maybe there's a better way - this was basically dumb luck.
–
JensJun 11 '12 at 1:54

Yes I hadn't cleared the message window. I can see now that an empty string produces the message as well.
–
Mike HoneychurchJun 11 '12 at 1:57

@MikeHoneychurch How about the new hack I added? Not exactly user-friendly, but as close as I can seem to get...
–
JensJun 11 '12 at 4:13

Mathematica is a registered trademark of Wolfram Research, Inc. While the mark is used herein with the limited permission of Wolfram Research, Stack Exchange and this site disclaim all affiliation therewith.