Reset HtmlDialog Preference

Is there a way to delete/reset the stored preference (location and size) associated with the preference key of an HtmlDialog?

By reset I mean, set location and postion from the values passed to the constructor.

PS: please add the documentation from WebDialog to HtmlDialog.

to retrieve properties you need to first store them…

note that you can store extra ones as well…

dialog_properties = 
{
  :dialog_title => "Dialog Example",
  :preferences_key => "com.sample.plugin",
  :scrollable => true,
  :resizable => true,
  :width => 600,
  :height => 400,
  :left => 100,
  :top => 100,
  :min_width => 50,
  :min_height => 50,
  :max_width =>1000,
  :max_height => 1000,
  :style => UI::HtmlDialog::STYLE_DIALOG,
  :url => "http://www.sketchup.com"
}
dialog = UI::HtmlDialog.new(dialog_properties)
dialog.set_url(dialog_properties[:url])
dialog.show

# then, for example, after manually changing the window size, you can then call

 dialog.set_size(dialog_properties[:width],dialog_properties[:height])

not sure what you mean by your PS:

john

1 Like

Yes, you can open regedit on windows (just type regedit in the start menu) and then navigate to the SketchUp version you are using and find it there. I suppose there is a similar approach on Mac but don’t know exactly how it’s done. I think you may need to restart SketchUp for it to forget these values.

You can also leave out the pref key until you have decided the sizing and positioning of the dialog and only then add a pref key. In some cases, e.g. if you want to mimic a dialog box you can also leave out the pref key completely as these typically don’t remember their position.

1 Like

SU has never stored the :preferences_key on a mac, and apple only stores these for the session…

john

1 Like

@john_drivenupthewall Thank you for the work around.

I mean, the HtmlDialog API documentation does not explain what the hash values are and I had to stumble the explanations in WebDialog API documentation.

@eneroth3 I need to accomplish that using the Ruby API.

1 Like

Use #set_size and #set_position to change an existing WebDialog or HtmlDialog. The values passed with the constructor are only the default values that will be used if there is nothing stored for the preference_key. Deleting the information itself associated with the preference_key cannot be done with the API.

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.