Status bar text


I’m missing something real simple.

If run these lines from the ruby console:

Sketchup.vcb_label= "label"
Sketchup.vcb_value= "value"
Sketchup.status_text= “status text”

Neither the vcb label nor value appear.
The status text appears only so long as the mouse in not in the drawing window.
While in the drawing windows the status bar text from currently selected toolbar button is shown.

How does I use these fields for feedback at end of a script? I’d rather avoid messagebox.


Whatever Tool is currently active “owns” those fields. Most Tools set their own values there when they are activated and when a state change requires new prompts. So, your tool can only show values there as long as it is active.


Thanks for the quick reply.
While my extensions use toolbar buttons, none so far involve any user interaction. Each button typically calls a script defined in that acts on previously selected objects.

I call the 3 lines above at the end of my button script while my toolbar button is still depressed (active.)
But the 3 have no effect: Only the status bar is not empty: either “ready”(?) while mouse is in drawing window, or the toolbar status bar text when hovering over the button.


As Steve said, and the API Doc should say, these functions have no use outside a Tool class implementation. They are in the “same boat” as the View.draw methods.

A “script”, or a proc of code attached to a UI::Command instance, is not the same as a Tool class instance.

The statusbar was not designed for in-progress or post-process reports.

A simple UI::messagebox (with an OK button) is more appropriate for a post-process report, but has the disadvantage on PC of being modal. (At least the current implementation of the SketchUp API.)


I suspected what you say, but also as you say, there is no way to know this from the API documentation. And modal is not nice.
I’m going to try, at the end of my script, and after a commit, to introduce a tool class instance for 2 purposes only:

  • give status bar feedback,
  • allow a user vcb entry that is then used to override the usual default script angle (90). In other words, entering a vcb value undoes the script action, reruns it with a non default angle.

User should them be able to continue trying different angles until he clicks on a different button.


Yes, the API documentation is not particularly helpful about the difference between a Command and a Tool, nor about what works for one and not for the other.

In a nutshell,

  • A Command is a SketchUp Ruby Class that provides a wrapper for a block of code. It adds features making the code more useful in menus, toolbars, etc. These include icons, menu text, tooltip, validation proc (for detecting whether to gray out the Command in a menu). It provides a status_bar_text, but this is somewhat like the tooltip: it only appears when the cursor floats over a menu or toolbar item linked to the Command. Using only the basic Command class, the presumption is that the code is “one shot”. That is, when the menu item is selected or the button is pressed, the code block executes and returns.

  • Tools are defined by an interface, or protocol for processing user input events and interacting with the SketchUp model and view. There is no Tool Class per-se. Any object that implements the methods of this protocol is a “Tool”. A Tool is activated by passing an object to Model#select_tool. This action is commonly wired into a Command by a code block that tells the active Model to select the desired Tool object. Once a Tool is activated, it remains active until the user or the code selects another Tool. While a Tool is active, SketchUp gives it “ownership” of the status bar and VCB. Imagine how confusing it would be otherwise. A Tool could be interacting with the user while some other code’s status is showing!


Thanks, that clears things up.

Meanwhile the API says:
The enableVCB? method is used to tell SketchUp whether to allow the user to enter text into the VCB (value control box, aka the “measurements” panel). If you do not implement this method, then the vcb is disabled by default.

Yet I don’t see this method used in the examples like linetool which do accept VCB input?


That method has been confusing for a long time. In most versions of SketchUp it seems to be unnecessary, that is, the VCB is active even if you don’t call it. It does no harm to call it.