7
$\begingroup$

I often make CDF documents using Manipulate.

However, the Update(ⓤ) button created with ContinousAction-> None is too small.

enter image description here

Is there a way to make this button(ⓤ) bigger?

$\endgroup$
1
  • $\begingroup$ btw, can you add a simple example where this button works? I could not find it. ps. you code does not match the output, AppearanceElements clearly are not None./ $\endgroup$
    – Kuba
    Jul 4, 2017 at 10:11

2 Answers 2

8
$\begingroup$

Using a custom icon and wrapping Manipulate with a function (based on @Kuba's method) that replaces the built-in icon with the custom one:

ClearAll[uicon, resizeU]
uicon[size_: 30] := Rasterize[Graphics[{GrayLevel[.7], Disk[], 
  Inset[Style["U", "Panel", Bold, White , FontSize -> Scaled[.7], 
   Background -> None]]}, ImageSize -> size], 
 ImageResolution -> 600, Background -> None]

resizeU[size_: 30] := RawBoxes[ToBoxes[#] /. 
  MapAt[RuleCondition, DownValues[Manipulate`ManipulateBoxes], {All, 2}] /. 
   FEPrivate`FrontEndResource["FEBitmaps", "UpdateIcon"] :> 
    ToBoxes @ uicon[size]]&;

resizeU[60] @ 
   Manipulate[10!, ContinuousAction -> None, AppearanceElements -> None]

Mathematica graphics

resizeU[]@ Manipulate[x, {x, {1, 2, 3}}, 
  AppearanceElements -> {"ResetButton", "UpdateButton", "HideControlsButton"}]

Mathematica graphics

$\endgroup$
2
  • $\begingroup$ You gave me new information. thank you very much. $\endgroup$
    – Milk
    Jul 5, 2017 at 23:17
  • $\begingroup$ @user21427, my pleasure. Thank you for the accept. $\endgroup$
    – kglr
    Jul 5, 2017 at 23:21
3
$\begingroup$

A general answer would need this to be available Can one effectively edit a Front End Resource that is already loaded?, but it is not.

Non trivial solution is to modify the boxes:

RawBoxes[
 ToBoxes[
    Manipulate[10!, AppearanceElements -> {"UpdateButton"}]
 ] /. MapAt[RuleCondition, DownValues[Manipulate`ManipulateBoxes], {All, 2}
 ] /. icon : FEPrivate`FrontEndResource["FEBitmaps", "UpdateIcon"] :> 
   RuleCondition @ ToBoxes @ Show[ToExpression @ FE`Evaluate @ icon, ImageSize -> 300
 ]
]

enter image description here

But as we can see the icon was designed to be small.

A better approach would be to add a custom update button:

Manipulate[10!, 
 Button[Style["U", Thick, 25], Typeset`update$$ = AbsoluteTime[], 
  Appearance -> None], AppearanceElements -> {}, TrackedSymbols :> {}]

related:

Manipulate: How to create custom reset Button automatically?

$\endgroup$
1
  • $\begingroup$ Thank you for your reply. $\endgroup$
    – Milk
    Jul 5, 2017 at 23:18

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.