BACKSPACE action?
Hello!
I want the Float is converted to Integer when a dot is deleted.
I defined sample Action map
and in FloatConstant editor I set this map
But it seems the event does not occur. I can not see debug message from
message debug "Backspace pressed", <no project>, <no throwable>;
I tried action CLICK and then all works fine. And I can see debug message. So what is wrong with Backspace?
Please sign in to leave a comment.
Hi,
I imagine the actions can only operate on nodes, but value is a property. The reason the CLICK action works is, in my opinion, that the CLICK is registered by the node, even when you click a property like "value".
The BACKSPACE and DELETE actions have some special behavior in particular, that I learned here: https://jetbrains-mps.slack.com/archives/C3YUV3YK0/p1518182296000387, maybe you want to check it out.
Short story: If only one DELETE is defined, it is called for both key presses, delete and backspace key. Not sure if newer MPS versions still have this behavior, though.
Nandha, ok, I agree, that may happen if the property cell is the only cell of the node, (or surrounded by collections). This happens because MPS wants to let the user delete the node after all and explicitly set the delete action in this case. This behavior should be reconsidered I think.
The workaround is the following: set the style "selectable: false" to the surrounding collection.
This style doesn't' let MPS set the action of explicit deletion down through the collection
Dear Kuruhuru,
The BACKSPACE/DELETE action will be executed when the text in the cell is empty, otherwise, MPS just process the usual text deletion
Pressing BACKSPACE/DELETE, after selecting the node,does not invoke the BACKSPACE/DELETE action. It simply deletes the node.
Semen Alperovich Thanks for the workaround. Will check it :)