Can tool shortcut keys be suppressed in the VCB?

I discovered some unexpected behaviors when trying to write a custom tool. SketchUp native tools seem to suppress certain keys from triggering tool shortcuts. For example, if I have the letter ‘s’ assigned as a shortcut key, I can still enter “12s” in the VCB while using the Circle tool without triggering the shortcut key behavior. Or if I enter ‘30mm’ in the VCB, the letter ‘m’ will not trigger a tool shortcut key.

However, in my case, I want to use a different key, the letter ‘L’. I want to prevent the letter L from triggering a shortcut key but it appears that only certain pre-defined keys can be suppressed when entering text in the VCB.

I thought that returning ‘true’ from onKeyDown might prevent shortcut keys from being triggered but so far I’ve had no luck with this.

Am I missing something here? Is it only possible for certain SketchUp-defined keys to be suppressed? (such as ‘s’, ‘m’, and other keys that could refer to units of length)

Is this on all versions? OR is this new to 2023?

Same in SU2022 but I haven’t tested older versions yet

There is a hardcoded list somewhere of characters that can be used in the measurement box, and they must be preseeded by a number.

The list includes the characters used in the SketchUp units and S for segments. However this is not a documented behavior and I’m not sure how safe it is to rely on.

1 Like

What about trapping the L in onUserText() ? or does this require the user hit ENTER ?

onUserText is not fired until ENTER is pressed

I think all letters should be accepted in the VCB after the first character is a digit or one of /-*+=. Same for parentheses which can be used for formulas.

1 Like

Yeah, this feels like the right approach