How to activate the highlighted tab

Hi there folks!

At least in W10, if you use the mouse wheel on the scene tabs, you can highlight some other scenes WITHOUT switching to those scenes.

So I have five different scenes and the first one is activated. I can highlight the other tabs by moving up/down my wheel mouse. So my question is: Is there is a Ruby code to convert the highlighted tab into the current scene?

240318_skp-tabs

I tried things like this:

model = Sketchup.active_model
pages = model.pages
selected_page = pages.selected_page

model.pages.selected_page = selected_page

but it obviously don’t work, just because Scene_001 is the selected page. I didn’t find anything about highlighted tabs/scenes/pages on the Ruby documentation, so any help would be more than welcome.

Thank you!

You can not really interact interact with UI by Ruby code.

To make the desired page as current (selected) you have to refer it by its name.
(What you did above: retried the current page then asked for make it current, obviously nothing happened since it was the same…)

To select e.g. Scene_003 as current page:

model = Sketchup.active_model
pages = model.pages

pages.selected_page = pages["Scene_003"]

The Pages #[] method retrieves a page by either name or index.
The Pages #selected_page method is used to set the currently selected page.

1 Like

I would speculate (I’m on Mac) that the ability to highlight a non-selected scene in the GUI is a glitch that came in when SketchUp was ported to the Qt GUI library on Windows. There is no way to query the GUI from Ruby to determine the highlight state of the tabs, only to query the app for which one is selected.

2 Likes

Yes, but the history is more complicated: (I can only go back as far as SU2016)


Windows platform

CANNOT blue highlight pages other than the selected (active) page with mouse hover.
It used the OS theme selection highlighting for the selected (active) page tab. (Which on my machine is white text on blue background.)
But CAN still use the right-click context menu to fire commands upon non-active pages:

  • 2016
  • 2017

CAN blue highlight pages other than the selected page with mouse hover, without affecting the selected page. This allows using the right-click context menu to fire commands upon non-active pages:

  • 2018
  • 2019 (assumption - not installed)
  • 2021
  • 2022
  • 2023 - but is bugged

2023 bug: Mousescroll changes the selected (active) page indication without actually selecting another page.
The blue mouseover highlight is separate and is actually what the mousescroll should be changing, NOT the indication of the selected page.

So, yes, the bug came in with Qt migration of the scene tabs.

1 Like