Udostępnij za pośrednictwem


Enter and Tab key handling in the ExpressionTextBox

The Enter and Tab keys work a bit differently in the ExpressionTextBox than in the big VB IDE. In the big IDE, Enter and Tab always insert their associated characters. If the IntelliSense completion list is up, Enter selects the item and inserts a new line.

We noticed that big IDE behavior does not always make sense in a single line editor. We found that users expected the ExpressionTextBox to behave exactly as a TextBox, especially in the property grid. So we changed the handling of the Tab and Enter keys a bit. In all places in the workflow designer, pressing Tab loses focus from the ExpressionTextBox. If you press Enter when the IntelliSense completion list is up, autocompletion occurs and no new line is inserted. In the property grid, the Variable designer, and the Argument designer, pressing Enter inside the ExpressionTextBox commits the expression. However, on the designer surface and in the expression editing dialog box spawned from the property grid, pressing Enter inserts a newline.

For custom activity designers, you can specify how you handle the Enter and Tab keys using the AcceptsReturn and AcceptsTab properties. These are the properties we set in the various parts of the UI to establish the behavior described above (except for the autocompletion not inserting a line thing, that’s hardcoded).