I have s small plugin that allows me to group a selection and type in a custom name OR choose a name from a dropdown list. At the start of the tool the textbox is activated with document.getElementById("textbox").focus();
In V15 it works as intended. In V16, SketchUp often steals focus while I’m typing and then the keypresses are activating tools. Is there any way to prevent SketchUp to steal focus?
Just noticed the same behavior with ThomThom’s Editable Text plugin and a few more of my own plugins using a webdialog with some sort of input text option. They all suffer from this.
Move the mouse off the webdialog and the focus is gone and whatever you’re typing is firing keypress shortcuts.
Even without moving the mousecursor off the webdialog, the window can loose focus and you’re firing shortcuts again.
Strange nobody else is reporting this as well. It would be very very nice if this can be resolved somehow OR if some javascript/ruby code could prevent this.
This is really issue with long selection boxes that extend beyond the size of a webdialog.
I have had to modify my plugin especially for SU2016, although I don’t use webdialogs. The change is related to the new Trays, but I don’t know whether the behaviour can be modfied.
It would be very bad for plugin any developer who has to use a webdialog for their plugin if there is no way around this problem. The modification to your plugin for V16 was related to this problem?
I noticed this with my plugin as well. It’s especially annoying when you have a text box that you need to type in and then mouse moves away from the window while you are trying to type.
I wonder if it is an OS related issue as I see it in other applications too (Revit comes to mind first). Archicad has an annoying feature of cutting off your typing if you don’t press the keys fast enough.
I would be very surprised if its an OS related issue. V15 doesn’t have the same issue AND some scripts can be ‘fixed’ for V16 by re-focussing:
In the body of the html add
<body onblur= go_focus();>
and in the Javascript add:
function go_focus(){
document.getElementById("textbox").focus();
}
This would refocus to the textbox if focus gets lost to SketchUp while typing. The bad part is, it doesn’t seem to work in my more complex scripts. Don’t know why - didn’t have the time to find out. Still hoping for an official solution.
Yes. I have had a tool re-activating, but in a different mode. This was happening because my plugin window was loosing focus and getting it back right afterwards.
We have the same problem here at Modelur. Hope that SketchUp team fixes this in the next release. In the meanwhile we are thinkgin to solve this by using
webdialog.bring_to_front
method once cursor is out of the WebDialog. In brings it back to front and stays this way until something is clicked in 3D model or elsewhere… Hope it helps someone…