SketchUp / api-issue-tracker

Public issue tracker for the SketchUp and LayOut's APIs
https://developer.sketchup.com/
39 stars 10 forks source link

[REQ] `UI::HtmlDialog` #minimize and #restore methods #833

Open DanRathbun opened 1 year ago

DanRathbun commented 1 year ago

SketchUp Ruby API Issue Feature Request

[REQ] UI::HtmlDialog #minimize and #restore methods.

It would be nice if a Ruby command could minimize all dialogs and another could later restore those minimized.

This could be used because there is no native command to do this. (A Mac user has recently requested a "Hide All 3rd Party Dialogs" command.)

We can create a command to close them like so ...

UI.menu("Window").add_item(
  UI::Command.new("Close 3rd Party Dialogs") do
    ObjectSpace.each_object(UI::WebDialog) { |dlg|
      dlg.close if dlg.visible?
    }
    if defined?(UI::HtmlDialog)
      ObjectSpace.each_object(UI::HtmlDialog) { |dlg|
        dlg.close if dlg.visible?
      }
    end
  end
)

... but it is probable that users would rather temporarily "put them out of sight" (minimize) so that they do not lose their content.

A ::minimize_all() and ::restore_all() method could be class methods.

~

thomthom commented 1 year ago

No sure if I think the "hide all third party dialogs" is a very good use-case. These types of user cases often make too many assumptions on behalf of the user.

DanRathbun commented 1 year ago

This comes from a Mac user who may be on a small notebook. I think the Mac edition has a "Hide All" command which will hide (or minimize) native dialogs, but not html based extension windows.

This is likely to be less used on MS Windows platform especially if we get dockable HtmlDialog panels (where we can use the AutoHide feature.)

But there are some scenarios where (rather than moving a floating window off screen) it will be better to minimize the dialog window into the taskbar JumpList so that the dialog content is not lost and the window would need to be reloaded and all the callback methods reattached.

It is true that a user can manually minimize dialog windows individually, but a Ruby method allows menu commands to be written which can allow keychord shortcuts to be assigned. (Currently HtmlDialog window captions do not automatically appear on the Window menu nor in the shortcuts list.)