New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Preferred way to show toolbar? #125

Eneroth3 opened this Issue Sep 21, 2018 · 2 comments


None yet
2 participants
Copy link

Eneroth3 commented Sep 21, 2018

What is currently the preferred way to show a toolbar, an how has this changed?

When I first started writing extensions I was recommended to use the following code:

UI.start_timer(0.1, false){ tb.restore }#Use timer as workaround for bug 2902434.

I think the bug ID refers to an internal issue tracker that I don't have access to.

Some examples, including the current API docs show show being called on the Toolbar, but if I'm not mistaking this would make the toolbar show even if the user has chosen to hide it, and prefer to access the plugin using the menu or shortcuts.

The plugin I work on now relies on get_last_state like so, but maybe calling restore has the same effect: unless toolbar.get_last_state == TB_HIDDEN

What approach is considered the preferred? The desired behavior is to have the toolbar show after plugin install (so the user knows it exists) and then keep whatever visibility state the user has chosen.

@thomthom thomthom added the question label Oct 3, 2018


This comment has been minimized.

Copy link

thomthom commented Oct 3, 2018

Use toolbar.restore. Takes care of it all.

@thomthom thomthom closed this Oct 3, 2018

@thomthom thomthom referenced this issue Oct 3, 2018


Check for UI.Toolbar.restore timer hack #71

9 of 9 tasks complete

@thomthom thomthom changed the title [Question/Documentation] Preferred way to show toolbar? Preferred way to show toolbar? Oct 3, 2018

@thomthom thomthom reopened this Oct 3, 2018


This comment has been minimized.

Copy link

thomthom commented Nov 2, 2018

Seems like .show currently have the same. Somewhat unexpectedly... I'd still recommend preferring .restore as expected API contract fits best with expected user behaviour. More details at SketchUp/rubocop-sketchup#82 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment