I built a Tool (minimal example attached) that primarily shows an HtmlDialog to display data and also to receive keypress inputs. To deal with situations in which the user might have clicked in the view to manipulate the model, e.g. by orbit or pan, or in which the code posted a UI.messagebox, the Tool also implements onKeyDown because the HtmlDialog will have lost the focus. It all works correctly on Mac, but on Windows if any of those things shift focus out of the HtmlDialog the onKeyDown only sees a single keypress and then further keypresses vanish. Each time the user clicks again in the view, one more keypress will be seen. If the user restores focus to the HtmlDialog by clicking it, the HtmlDialog once again processes keypresses correctly.
The code also has commented out an issue that causes a BugSplat on Windows when the HtmlDialog implements a Tool quit via both a callback to Ruby and set_can_close both of which terminate the tool by calling Tools.pop_tooi(). This also works ok on Mac.
SketchUp 2020.1 on WIndows 10:
I built a Tool (minimal example attached) that primarily shows an HtmlDialog to display data and also to receive keypress inputs. To deal with situations in which the user might have clicked in the view to manipulate the model, e.g. by orbit or pan, or in which the code posted a UI.messagebox, the Tool also implements onKeyDown because the HtmlDialog will have lost the focus. It all works correctly on Mac, but on Windows if any of those things shift focus out of the HtmlDialog the onKeyDown only sees a single keypress and then further keypresses vanish. Each time the user clicks again in the view, one more keypress will be seen. If the user restores focus to the HtmlDialog by clicking it, the HtmlDialog once again processes keypresses correctly.
The code also has commented out an issue that causes a BugSplat on Windows when the HtmlDialog implements a Tool quit via both a callback to Ruby and set_can_close both of which terminate the tool by calling Tools.pop_tooi(). This also works ok on Mac.
keypress_test.zip