Webdialog losing focus in V16?
-
Posted this issue a few days ago on the official forum but no response there. Just noticed the same issue in another plugin using a webdialog: ThomThom's Editable 3d Text. Posting here hoping somebody knows some javascript/ruby code to prevent this.
If you have a plugin using a webdialog where you have to input some text, in V16 the webdialog can loose focus and then you're firing keyboard shortcuts instead.
- 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.
Nobody else noticed this? Any suggestions for javascript/ruby code could to prevent this?
-
does it happen to .show_modal or just .show dialogs?
if not, can you flip between the two modes?
john
-
I only used
.show
in my plugins.Thanks for the suggestion. I tried
show_modal
next in a small name-plugin butshow_modal
seems to break the webdialog actions:- the combo box isn't visible anymore,
- it doesn't respond to the javascript onClick button action,
- <enter> doesn't close the webdialog.
Will have to look into the documentation for
show_modal
.
-
Yes this is a new behaviour in SU2016 on Windows.
If the cursor enters the viewport, then the viewport gets the focus.This happens with webdialogs, but also inspectors, the ruby console, etc...
This is quite annoying...
The viewport also gets the focus if you activate a tool even while the cursor is still inside a webdialog. -
SU V16 and me don't seem to get along... There must be a way to bypass this problem?!
- I tried using a javascript onblur detection and re-focus again. That fails.
- I tried using ruby to detect if the cursor 'wants' to change (sort of changing focus I thought) and do a wd.show again but that doesn't help either (or wrong idea on my part that it shouldn't ever have helped).
- I did see though that ProfileBuilder2 doesn't seem to suffer from this problem. Entering a name for a new profile never seems to loose focus so there must be some way...
-
something has changed with focus() and blur() on mac as well...
I just tested some onMouseOver and onMouseOut code that used to work and now doesn't...
but, maybe they will for your usage...
john
-
I think I have a fix for the textbox input losing focus. Just a few lines in the html/Javascript.
In the body:
<body onblur= go_focus();>
And in the Javascript part:
function go_focus(){ document.getElementById("textbox").focus(); }
Doing a
self.focus()
orwindow.focus()
doesn't seem to work.Edit: applying the same code to some more complex plugins doesn't seem to work...
Advertisement