Vertical list modify "enter" behavior


I have a Sheet with SheetEntry children, one of these is an empty line, and another one is my FunctionList node, which contains a list of Function nodes.

Image 1 above, Image 2 below

Now, what I want to do is: When I press enter at the end of the last FunctionList child, add a new child to the list. But when I press enter again at the left of this child, delete it and exit the functions block (so after pressing one enter, I should see image 1, and after pressing another, I should see image 2).

Right now, if there are no empty lines beneath the function block, pressing enter results in image 2, but if there are any, it results in image 1 (unrelated: why does that happen?)

I think I more or less grasped how the structure and editor aspects work, however I couldn't wrap my head around transformation menus. I think I need a menu to achieve this, but I don't know how to do it. Or can I do this simply with action maps? I know I can e.g. disable INSERT for the children of the list using action maps, but that means that pressing enter always results in image 2.


Ultimately I just want to make the editing experience intuitive, so if this is really complicated, I can use workarounds (for example using comma as a separator and simply disabling INSERT for the children of the list).

I tried looking in sample projects on how to do this, but couldn't find a project which utilizes more than a few simple transformation menus, so if you can point me to some more complex examples, I'll be grateful too.

1 comment
Comment actions Permalink

Enter key is not handled by transformation menus. It's mapped to the INSERT cell action, so you need to use a cell action map. In this case probably for the name property cell, and then also for arity. In the action map you would check if the current item has no name and no arity and if so, delete it and set the selection appropriately.


Please sign in to leave a comment.