In SketchUp 2026, when using a custom Ruby tool, pressing the Tab key in a specific state (@statestate == 2 in :fixed_height mode) causes the Value Control Box (VCB) to lose focus, preventing user input for dimensions (e.g., depth). The issue appears to be a bug in SketchUp 2026, where the Tab key incorrectly shifts focus to other UI elements (e.g., toolbars or tabs) instead of maintaining focus on the VCB.
Without Sketchup.focus, the focus shifts to other UI elements, making VCB unusable.
Workaround in my example:
To resolve the issue, a timer (UI.start_timer) with a 0.1-second delay is used to reinitialize the VCB and restore focus using Sketchup.focus. This ensures the VCB is ready for input after the Tab key event is processed.
Example Code:
def onKeyDown(key, rpt, flags, view)
if key == VK_TAB && @state == 2 && @drawing_mode == :fixed_height && @base_pts_original
@thickness_offset_mode = @thickness_offset_modes[(@thickness_offset_modes.index(@thickness_offset_mode) || 0) + 1 % @thickness_offset_modes.length]
apply_thickness_offset
update_prompt
Sketchup::set_status_text @prompt, SB_PROMPT
# Use a delayed timer to initialize the VCB
UI.start_timer(0.1, false) do
Sketchup::set_status_text("Depth", SB_VCB_LABEL)
Sketchup::set_status_text("", SB_VCB_VALUE)
# Explicitly return focus to SketchUp
Sketchup.focus
view.invalidate
end
view.invalidate
return true
end
false
end
Is there another way and am I doing something wrong?