Sketchup.set_status_text not showing text


#1

I have been using Sketchup.set_status_text for quite a while with no issue, but during the last few weeks it has not been working properly. It does not show any text while some long operation is executing. At the end of the operation it seems to work fine by displaying the last text.

I am on macOS Sierra and using SU 2015 Pro.

I have installed my plugin on a separate machine - same machine, same SU - and it has no problem.

Any clue on what could be the cause of this?


#2

Think back carefully: What did you change a few weeks ago? SU 2015 did not change, so you must have done something (or your computer did it automatically for you, e.g. an update). Did you install any new extensions? Did you modify your code?


#3

I am sure I did :slight_smile:

For sure I have not installed any new extension. I have been changing the code of course, but it’s very difficult to check every single change. I was kind of hoping that it was a known issue and the cause could be identified…


#4

Are you using this method only whilst your custom tool is active?
That is what it is meant for. Otherwise, when the mouse moves, the active tool’s status text will overwrite whatever was displayed. (So it is really meaningless to try to use it while some other tool outside your control is active.)

If, yes, did you perhaps add the second true argument to the model#start_operation() method call? This suppresses GUI updates during the operation.

If, no, (ie, some other tool is active,) I would suggest using a WebDialog to display your status messages, and then close it when done. (Or give the user a “Close” button.)


#5

@DanRathbun raises a very good point that I forgot to mention: at all times, the currently active Tool has “ownership” of the status field. Anything written there by other code can be overwritten at any time. So, unless your code implements a Tool and that Tool is currently active, you can’t use the status text. You need to use other means such as UI.messagebox or WebDialog (or HTMLDialog).


#6

I am not actually using a custom tool nor I am performing an operation.

From my plugin WebDIalog I launch various Net:SSH sessions on Amazon AWS. One of these sessions is a NET::SFTP where I want to monitor the download status. Nothing is being done locally.

The interesting thing is that the same configuration on my colleagues’ mac doesn’t have this issue. I will try to install SU 2016 Make and check whether I have the same issue.


#7

Sounds like your not really understanding what we are trying to tell you.

Which is, you need to use some other means to keep the user informed.


#8

I’ll try one more time…

You have been led astray by the fact that you previously saw your code post status messages. That it ever worked only indicated that the active Tool didn’t post its own message. That could be due to the specific Tool that was active (not all Tools post status, or may do so only at certain points in their operation), could be because the active Tool is a Ruby extension and your script blocks Ruby, or could be something as simple as that you didn’t touch the mouse. But there is nothing you can do to seize control of the status text except to write your own Tool and have it active.

This situation has been the same for many versions of SketchUp and is still the same in SU 2016 and 2017. If you want to reliably display status without implementing a Tool, you need to use some other technique.


#9
Sketchup.set_status_text('text')

will override any active tool’s text, until it sends new text…

there were a few old plugins that did this in a timer, but it is a bit of a hack and fails silently when it fails…

maybe that’s what was happening…

john


#10

OK. Got it now. Thanks!