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

    Messagebox of doom!

    Scheduled Pinned Locked Moved Developers' Forum
    5 Posts 2 Posters 428 Views 2 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.
    • thomthomT Offline
      thomthom
      last edited by

      UI.start_timer( 0, false ) { UI.messagebox('Hello World') }

      That, makes a long loop of messageboxes appear. I have to press Return down to stop them. And then the Ruby Console history is filled with empty lines...

      What gives?

      Thomas Thomassen — SketchUp Monkey & Coding addict
      List of my plugins and link to the CookieWare fund

      1 Reply Last reply Reply Quote 0
      • thomthomT Offline
        thomthom
        last edited by

        Just to make it a more sane - try with one second.

        Thomas Thomassen — SketchUp Monkey & Coding addict
        List of my plugins and link to the CookieWare fund

        1 Reply Last reply Reply Quote 0
        • thomthomT Offline
          thomthom
          last edited by

          This works as I would like my original code to behave:
          t=UI.start_timer( 1, false ) { UI.stop_timer(t); UI.messagebox('Hello World'); };

          Thomas Thomassen — SketchUp Monkey & Coding addict
          List of my plugins and link to the CookieWare fund

          1 Reply Last reply Reply Quote 0
          • TIGT Offline
            TIG Moderator
            last edited by

            @thomthom said:

            This works as I would like my original code to behave:
            t=UI.start_timer( 1, false ) { UI.stop_timer(t); UI.messagebox('Hello World'); };

            You might expect that UI.start_timer( 0, false ) { UI.messagebox('Hello World') } would kick in after '0'seconds ONCE and put up the messagebox BUT if you don't close the messagebox within a VERY short time it puts up another one!!!
            t=UI.start_timer( 1, false ) { 1.times{UI.stop_timer(t); UI.messagebox('Hello World')}} works as you only make one instance ?

            TIG

            1 Reply Last reply Reply Quote 0
            • thomthomT Offline
              thomthom
              last edited by

              @tig said:

              t=UI.start_timer( 1, false ) { 1.times{UI.stop_timer(t); UI.messagebox('Hello World')}} works as you only make one instance ?

              What I think happens is:

              SketchUp stops non-repeating timers ( with the repeat flag to false ) after it processes the block given to UI.start_timer. Because the messagebox is modal it halts normal execution, but the timer stills runs because it hasn't been stopped yet. My workaround is to manually stop it before the messagebox is displayed.

              I'd expect to see the same behaviour from modal webdialogs.

              Thomas Thomassen — SketchUp Monkey & Coding addict
              List of my plugins and link to the CookieWare fund

              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