UI doesn't update
-
In several of my scripts sometimes the UI doesn't update during a part of the script execution. In the beginning the UI update correctly after a while it doesn't update anymore but the script is still running. After a while the scripts ends and everything is back to normal and the script has done what it should do. But the script is much slower when the UI doesn't update! How can I avoid this problem?
regards,
Guy
-
- If it's the various inspector dialogs such as Entity Info, Layers dialog, etc., you can call:
- If it's the model client view you wish to refresh, you can call:
-
None of that will work - when a ruby script starts to do lots of work the UI will not update and not become responsive. There is no API methods that will avoid that.
Under OSX that statusbar will still update, but under Windows it will not. In some of my heavy processing plugins, such as CleanUp, I do a Win32 API call to PeekMessage to make the UI update - but the user still won't be able to interact with it.
It's a very annoying behaviour of SketchUp that's been a source of complaints for a long time. Many developers has tried to find ways around it, threads etc without any luck. Fredo got a system with timers, that somewhat prevents the window from completely turning unresponsive, but it cannot be applied to all tasks and it add to the total processing time.
-
Sorry... I did not realize he was talking about "The curse of the Ghost Window"
-
@thomthom said:
None of that will work - when a ruby script starts to do lots of work the UI will not update and not become responsive. There is no API methods that will avoid that.
Under OSX that statusbar will still update, but under Windows it will not. In some of my heavy processing plugins, such as CleanUp, I do a Win32 API call to PeekMessage to make the UI update - but the user still won't be able to interact with it.
It's a very annoying behaviour of SketchUp that's been a source of complaints for a long time. Many developers has tried to find ways around it, threads etc without any luck. Fredo got a system with timers, that somewhat prevents the window from completely turning unresponsive, but it cannot be applied to all tasks and it add to the total processing time.
Thanks thomthom, now i know it's a SU problem.
-
Update for Sketchup 2014 :
require "Win32API.rb msg = "\000" * 36 peekMessage = Win32API.new('user32','PeekMessage' , 'PLIII', 'I') peekMessage.call( msg, 0, 0, 0, 0x0000 ) != 0
Advertisement