Per this question, I have created a custom graphical control object which evaluates to a list of values. I would like to be able to create such an object quickly, rather than typing some command, pressing shift+enter, then copying the resulting object into wherever I want to use it. For example, something like typing \[Theta]
which turns into θ
... is it possible to create such a custom shorthand notation? (Even better, is it possible that when I start to type in a function which takes such a list as arguments, it pops up this control object for me to type the values in?)
Answer
Assuming you are referring to this control. You can
- Evaluate in a separate cell each time and copy paste (you don't like this)
- Write the command and evaluate in place
- Copy the control once and paste it several times: remember the variables were localized so each will have its own copy and they won't interfere
Create a palette
CreatePalette@PasteButton["Paste control", myControl["a"~CharacterRange~"g"]];
Create a toolbar
AppendTo[CurrentValue[InputNotebook[], DockedCells],
Cell@BoxData@
ToBoxes@PasteButton["Paste control",
myControl["a"~CharacterRange~"g"]]]Create an input alias, or an input auto replacement. Example of input alias (the other one is the same)
AppendTo[CurrentValue[InputNotebook[], InputAliases],
"control" -> ToBoxes@myControl["a"~CharacterRange~"g"]]
Comments
Post a Comment