sketchucation logo sketchucation
    • Login
    🤑 SketchPlus 1.3 | 44 Tools for $15 until June 20th Buy Now

    UI.messagebox

    Scheduled Pinned Locked Moved Developers' Forum
    9 Posts 3 Posters 1.2k 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.
    • sdmitchS Offline
      sdmitch
      last edited by

      In the middle of testing out a new plugin I was creating, the UI.messagebox stopped displaying. The command was being executed because I could hear the beep and the plugin would lock up until I pressed Enter. I added a UI.messagebox command in a reset method that is executed when plugin starts and that one displayed as expected but no other messageboxes after that.

      Nothing is worthless, it can always be used as a bad example.

      http://sdmitch.blogspot.com/

      1 Reply Last reply Reply Quote 0
      • Dan RathbunD Offline
        Dan Rathbun
        last edited by

        Well one rule.. don't put UI.messagebox calls inside UI.start_timer blocks.

        You can have the console open when loading the plugin, and use puts("string") statements instead of messageboxes.

        I'm not here much anymore.

        1 Reply Last reply Reply Quote 0
        • Dan RathbunD Offline
          Dan Rathbun
          last edited by

          I have also found that if you have an error in the messagebox string argument... the UI.messagebox call silently fails.

          Copy the argument for the messagebox to the console and press enter.. see if you get errors.

          Second.. use puts and have the console open when loading... if there's an error in the arg.. then Ruby should spit out an Exception message.

          So rule 2: What works or doesn't for puts, will or won't for UI.messagebox

          I'm not here much anymore.

          1 Reply Last reply Reply Quote 0
          • sdmitchS Offline
            sdmitch
            last edited by

            I don't have any UI.start_timer blocks so that can't be the problem. I did copy the entire code statement "UI.messagebox("There are no valid snap points", MB_OK)" to the console and the message displayed normally. I even added a UI.inputbox statement to see if it would display and, like messagebox, the tone sounded but nothing displayed. Other than a method that does a calculation, I can't think of anything in this plugin that I have used many times before.

            Nothing is worthless, it can always be used as a bad example.

            http://sdmitch.blogspot.com/

            1 Reply Last reply Reply Quote 0
            • Dan RathbunD Offline
              Dan Rathbun
              last edited by

              Can you call the plugin's method(s) from the console, and see if you get any errors ?

              I'm not here much anymore.

              1 Reply Last reply Reply Quote 0
              • Dan RathbunD Offline
                Dan Rathbun
                last edited by

                @sdmitch said:

                Other than a method that does a calculation, I can't think of anything in this plugin that I have used many times before.

                That's likely it then.

                I had a similar problem with a messagebox silently failing.
                The error was a math calculation error, but not an exception. In other words Ruby was happy with the result, but the answer was a different class than I expected. (I wanted a float, but was getting a rounded integer, or visa versa.)

                The algorythm was my path_knife() method, for displaying long absolute path strings in a messagebox.
                See this post for the method: [code] Split a long pathstring ~in half at the nearest '/'
                Anyway whenever there's an error, the messagebox would not display.

                Did you know that you that you can use rescue as a modifier ? (Good to use, when wrapping the whole block in a begin .. rescue .. end block is overkill.)

                var = 2 1.0/var

                0.5

                var = nil 1.0/var

                Error: #<TypeError: (eval):414:in `/': nil can't be coerced into Float>

                var = nil 1.0/var rescue 0.5

                0.5

                .

                I'm not here much anymore.

                1 Reply Last reply Reply Quote 0
                • sdmitchS Offline
                  sdmitch
                  last edited by

                  Dan, It turned out to be an unneeded View.invalidate statement.
                  Once it was removed, all was OK.

                  Nothing is worthless, it can always be used as a bad example.

                  http://sdmitch.blogspot.com/

                  1 Reply Last reply Reply Quote 0
                  • JuantxoJ Offline
                    Juantxo
                    last edited by

                    Something similar occurs if you close dialog in a callback:

                    
                    my_dialog.add_action_callback("test") do |web_dialog,param| 
                    	web_dialog.close
                    	UI.messagebox('NOT DISPLAYED')
                    end
                    
                    
                    1 Reply Last reply Reply Quote 0
                    • Dan RathbunD Offline
                      Dan Rathbun
                      last edited by

                      @juantxo said:

                      Something similar occurs if you close dialog in a callback:

                      On the PC, this might work:

                      
                      my_dialog.add_action_callback("test") do |web_dialog,param| 
                        web_dialog.close
                      end
                      
                      my_dialog.set_on_close {
                        UI.messagebox('NOT DISPLAYED')
                      }
                      

                      AFIAK, set_on_close is still bugged on the Mac

                      I'm not here much anymore.

                      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