• Login
sketchucation logo sketchucation
  • Login
⚠️ Libfredo 15.4b | Minor release with bugfixes and improvements Update

Some menus don't open during a custom tool operation

Scheduled Pinned Locked Moved Developers' Forum
11 Posts 3 Posters 325 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.
  • R Offline
    Roschetch
    last edited by 1 Apr 2014, 17:04

    I am writing a construction line tool as an exercice. It is getting far more complex than the linetool.rb. Everything is fine but some menus (the Preference menu and all sub-menus) just don't open during the tool operation and the File/Exit simply do nothing. I have to select another tool or press the ALT key to have access to the menus or close Sketchup.

    Besides, I observed that onMouseMove is not called when I press the ALT key. Specifically when the key goes up. The normal behavior returns after another ALT key press. The tool onKeyDown doesn't catch the ALT key, just the CTRL key and the TAB key.

    The code is too large to display here.

    Any ideas of the possible causes?

    1 Reply Last reply Reply Quote 0
    • D Offline
      Dan Rathbun
      last edited by 1 Apr 2014, 20:30

      The ALT key giving focus to the menu, is a Windows system feature.

      I'm not here much anymore.

      1 Reply Last reply Reply Quote 0
      • D Offline
        Dan Rathbun
        last edited by 1 Apr 2014, 20:32

        @roschetch said:

        ... but some menus (the Preference menu and all sub-menus) just don't open during the tool operation...

        Preferences is a modal dialog box, not a menu.

        I'm not here much anymore.

        1 Reply Last reply Reply Quote 0
        • D Offline
          Dan Rathbun
          last edited by 2 Apr 2014, 00:30

          I tested some good Ruby Tools and do not have any of the issues you describe in SketchUp 2014.
          No problem accessing the menus, nor opening modal dialogs like Preferences.
          The tools just resume after the dialog is closed, etc.

          Are you really still using version 8 Free ?

          Suggest you do not use the ALT key within the tool.

          I'm not here much anymore.

          1 Reply Last reply Reply Quote 0
          • R Offline
            Roschetch
            last edited by 2 Apr 2014, 01:36

            Thank you, Dan, for your help.

            Yes, I am using SU 8. And the tool do not use the ALT key, only CTRL , TAB and ESC.

            With the tool active, I have access to all main menus (File, Edit, View, etc). But no submenu (like Edit/Unhide) open neither do the Preference modal dialog nor the Help/About. After trying to open the Preferences dialog, all main menu itens turn gray and the icons do not respond; the only ways I found to regain control of SU is either pressing the ALT key, the ESC key or a keyboard shortcut of another tool. After pressing the ALT key and closing the dialog, the tool resumes normally.

            1 Reply Last reply Reply Quote 0
            • D Offline
              Dan Rathbun
              last edited by 2 Apr 2014, 02:34

              Disable ALL OTHER plugins when testing your Tool. To eliminate the possibility that some other plugin's ToolsObserver is not causing issues.

              I'm not here much anymore.

              1 Reply Last reply Reply Quote 0
              • R Offline
                Roschetch
                last edited by 2 Apr 2014, 03:30

                Sorry, Dan, but no success. I removed all other tools from the plugin folder and disabled all the native SU tools. The odd behavior remains. 😞

                1 Reply Last reply Reply Quote 0
                • D Offline
                  Dan Rathbun
                  last edited by 2 Apr 2014, 05:01

                  Ok then if your tool is the only thing loaded, then it is your code.

                  I'm not here much anymore.

                  1 Reply Last reply Reply Quote 0
                  • R Offline
                    Roschetch
                    last edited by 2 Apr 2014, 17:01

                    Dan, you are right and I think I found the bug source inside my own code.

                    I deleted the tool method codes leaving just the codes of activate, onMouseMove and draw. The bug remained active. So I stripped those codes to a minimum and then deleted one statement at a time. And I found an improper view.invalidate inside the draw code... 😳

                    I am ashamed of this so basic mistake. I cannot remember why and when I put that line but it was there and caused the bug. I suppose that view.invalidate will, at some instance, call draw, right?

                    Thank you very much for your help.

                    1 Reply Last reply Reply Quote 0
                    • D Offline
                      Dan Rathbun
                      last edited by 3 Apr 2014, 01:49

                      Yes I think it does. Thomas can confirm.

                      I'm not here much anymore.

                      1 Reply Last reply Reply Quote 0
                      • T Offline
                        tt_su
                        last edited by 3 Apr 2014, 11:53

                        Yes, view.invalidate will tell SketchUp to redraw. It doesn't redraw immediately, but let SketchUp manage update rate. Not sure how this is related to dialogs, focus and ALT key though...

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

                        Advertisement