New answers tagged

7

There is too much burden attached to working with KeyEvenTranslations.tr so I rarely use it. You can try an alternative: DevTools`:NotebookActions: ResourceFunction["GitHubInstall"]["kubapod", "devtools"] Needs @ "DevTools`"; NotebookActionsEnable[]; EditNotebookActions[]; add a cell with: <| "Label" -> "ClearCell" , "ShortKey" -> "c" , "...


5

Instead, it is moved to after the cell containing the button, as if I had specified Cell instead of CellGroup in SelectionMove. On October, I reported this issue to the Wolfram support: [CASE:4323226]. They confirmed the bug and suggested a workaround. Here is the response: It does appear that SelectionMove is not behaving properly. <...> In the ...


5

button = Button["Move", SelectionMove[EvaluationCell[], After, GeneratedCell]]; Print["one"] Print[button] Print["two"] Print["three"] Print["four"] Alternatively, using a number greater than 1 in the fourth argument of SelectionMove gives the same behavior: button = Button["Move", SelectionMove[EvaluationCell[], After, CellGroup, 2]]; Print["one"...


3

Unfortunately cell groups api is very limited so can't say it is robust but it should work assuming the cell group structure you've described is in place. Button["Move", FrontEndExecute[{ SelectionMove[EvaluationCell[], All, Cell]; SelectionMove[EvaluationNotebook[], All, CellGroup]; SelectionMove[EvaluationNotebook[], After, CellGroup] }], ...


5

This seems to fit your needs: Button[ Defer[1 + 1], FrontEndExecute[{ FrontEnd`SelectionMove[FrontEnd`EvaluationCell[], After, Cell], FrontEnd`NotebookWrite[FrontEnd`InputNotebook[], #, All], FrontEnd`SelectionEvaluateCreateCell[FrontEnd`InputNotebook[]] }] &, Evaluator -> None ]


1

I using V11.3 and I can't reproduce your problem on that version. When I do an inline evaluation the block, I get a perfectly usable function — exactly what you want but are not getting. I do have a suggestion, however. Try selection the code that is being displayed in output form and press Cmnd+Shift+I (this is the MacOS shortcut, the will be similar ...


Top 50 recent answers are included