# Ideas to add a Clear highlighted button to toolbar?

**URL:** <https://community.wolfram.com/t/ideas-to-add-a-clear-highlighted-button-to-toolbar/21896>\
**Category:** Questions\
**Created:** [April 15, 2023, 9:25am UTC](https://community.wolfram.com/t/ideas-to-add-a-clear-highlighted-button-to-toolbar/21896 "2023-04-15T09:25:40Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![rolandfranzius](https://avatars.discourse-cdn.com/v4/letter/r/5f8ce5/32.png) [@rolandfranzius](https://community.wolfram.com/u/rolandfranzius)\
**Post date:** [April 15, 2023, 9:25am UTC](https://community.wolfram.com/t/ideas-to-add-a-clear-highlighted-button-to-toolbar/21896/1 "2023-04-15T09:25:40Z")

</div>

Since all times I fight with a method to clear a wrong definition by

```
Clear@mydef[x_]:=...

```

just by prepending the Clear@ in front, highlight the text up to " [" and press Shift+Ctrl+Enter for immediate execution and clearing the definition.

In vs 13, often overwriting a definition does not work so anymore, especially in multiple definitions with conditions. Not to mention the nuisance when setting f=4 first and defining f[x\_]:= later on.

How to add this procedure similar to the Shift+Ctrl+Enter entry in keyevent.tr located in SystemFiles\FrontEnd\TextResources\Windows\KeyEventTranslations.tr ?

---

<div class="post-metadata">

**Author:** ![mroge02](https://yyz1.discourse-cdn.com/wolfram/user_avatar/community.wolfram.com/mroge02/32/28775_2.png) [@mroge02](https://community.wolfram.com/u/mroge02)\
**Post date:** [April 15, 2023, 2:16pm UTC](https://community.wolfram.com/t/ideas-to-add-a-clear-highlighted-button-to-toolbar/21896/2 "2023-04-15T14:16:21Z")

</div>

Not an answer to give what you ask, but an alternative way to “fight” an old definition:

I put my definition(s) for a function `func[]` in a single cell that begins with `ClearAll`. If I have resources I want precomputed, I put those in a separate cell and define a way to access them from `func[]`. Then I don’t have to recompute them every time I adjust the API or code for `func[]`.

```
func // ClearAll;
func // Options = {Method -> Automatic,...}; (* optional: default options *)
func // Attributes = {HoldFirst}; (* optional: attributes *)
func::usage = (* optional: messages *)
 "func[x, n] computes something for nonnegative integers n.";
(* Definitions: *)
func[x_, 0] := 1;
func[x_, 1] := x;
func[x_, n_Integer?Positive] : 2 x func[x, n - 1] - func[x, n - 2];

```

There is no need for `HoldFirst` in this function; the example just illustrates how to include options, attributes, etc. You don’t have to use the `//` style either. It’s my preference to see `func` start many lines in a row.
