sketchucation logo sketchucation
    • Login
    ℹ️ Licensed Extensions | FredoBatch, ElevationProfile, FredoSketch, LayOps, MatSim and Pic2Shape will require license from Sept 1st More Info

    Webdialog losing focus in V16?

    Scheduled Pinned Locked Moved Developers' Forum
    7 Posts 3 Posters 776 Views 3 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • K Offline
      kaas
      last edited by

      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.

      1. Move the mouse off the webdialog and the focus is gone and whatever you're typing is firing keypress shortcuts.
      2. 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?


      focus.jpg

      1 Reply Last reply Reply Quote 0
      • D Offline
        driven
        last edited by

        does it happen to .show_modal or just .show dialogs?

        if not, can you flip between the two modes?

        john

        learn from the mistakes of others, you may not live long enough to make them all yourself...

        1 Reply Last reply Reply Quote 0
        • K Offline
          kaas
          last edited by

          I only used .show in my plugins.

          Thanks for the suggestion. I tried show_modal next in a small name-plugin but show_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.


          webdialog.jpg

          1 Reply Last reply Reply Quote 0
          • jiminy-billy-bobJ Offline
            jiminy-billy-bob
            last edited by

            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.

            25% off Skatter for SketchUcation Premium Members

            1 Reply Last reply Reply Quote 0
            • K Offline
              kaas
              last edited by

              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...
              1 Reply Last reply Reply Quote 0
              • D Offline
                driven
                last edited by

                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

                learn from the mistakes of others, you may not live long enough to make them all yourself...

                1 Reply Last reply Reply Quote 0
                • K Offline
                  kaas
                  last edited by

                  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() or window.focus() doesn't seem to work.

                  Edit: applying the same code to some more complex plugins doesn't seem to work...

                  1 Reply Last reply Reply Quote 0
                  • 1 / 1
                  • First post
                    Last post
                  Buy SketchPlus
                  Buy SUbD
                  Buy WrapR
                  Buy eBook
                  Buy Modelur
                  Buy Vertex Tools
                  Buy SketchCuisine
                  Buy FormFonts

                  Advertisement