Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

While preparing a dynamic module, I discovered a weird behaviour of Mathematica's controls when you rotate them:

Rotate[Button["Toto", Null], 0]
Rotate[Button["Toto", Null], 0.01]
Rotate[Button["Toto", Null], 0.02]

enter image description here

The first non-rotated button has standard Mac OS styling. The last one, for large enough rotation, uses a non-native styling, which is somewhat ugly. But the real surprise is that controls with small enough rotation are displayed with native styling (and it is actually rotated, not just rounded down to the case of the non-rotated button).

My point of view is that, while I can live with the ugliness of non-native buttons, I'd rather have uniformity between all my controls. So, my question is two-fold:

  • How can I force rotated controls to be displayed with native styling?
  • If that's not possible, how can I force non-rotated controls to be displayed with non-native styling?
share|improve this question
add comment

2 Answers

up vote 7 down vote accepted

You can use the Style setting ControlRendering to display controls in their generic form:

Rotate[Style[Button["Toto", Null], ControlsRendering -> "Generic"], 0]

If you don't see the bottom line you need to set the Buttons ImageMargins:

Rotate[Style[Button["Toto", Null, ImageMargins -> 1], 
  ControlsRendering -> "Generic"], 0.0]
share|improve this answer
    
This sounds like what I was looking for, but it doesn't work for me (Mac OS 10.8, MMA 8.0.4.0) because the bottom border of the button isn't drawn :( –  F'x Sep 4 '12 at 8:45
    
Adding ImageMargins option will make the line visible. –  Matariki Sep 4 '12 at 9:14
add comment

Maybe something like this:

 Rotate[Framed[
  Button["Toto", Null, Appearance -> "Frameless", 
   BaseStyle -> {"GenericButton", 16, Bold}], RoundingRadius -> 5, 
  Background -> GrayLevel[.95]], 0]
 Rotate[Framed[
  Button["Toto", Null, Appearance -> "Frameless", 
   BaseStyle -> {"GenericButton", 16, Bold}], RoundingRadius -> 5, 
  Background -> GrayLevel[.95]], 0.01]
 Rotate[Framed[
  Button["Toto", Null, Appearance -> "Frameless", 
   BaseStyle -> {"GenericButton", 16, Bold}], RoundingRadius -> 5, 
  Background -> GrayLevel[.95]], 0.02]

enter image description here

share|improve this answer
    
Hum, drawing my own controls… why not? The only downside I see in my first tries is that it makes the clickable area slightly smaller. –  F'x Sep 4 '12 at 8:46
    
@F'x You can probably increase the clickable area with the Button option FrameMargins. –  VLC Sep 4 '12 at 9:11
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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