Messagebox of doom!
-
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?
-
Just to make it a more sane - try with one second.
-
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'); };
-
@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 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 tofalse
) after it processes the block given toUI.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.
Advertisement