-
Notifications
You must be signed in to change notification settings - Fork 2
WebDialog.new
You can specify the arguments as either a comma separated list, or as a single Hash
object. Currently the manual is missing information for both of these.
-
dialog_title
- The title to be displayed in the webdialog. -
scrollable
-true
if you want to allow scrollbars, false if you do not want to allow scrollbars. -
pref_key
- The registry entry where the location and size of the dialog will be saved. Ifpreferences_key
is not included, the location and size will not be stored. -
width
- The width of the webdialog. -
height
- The height of the webdialog. -
left
- The number of pixels from the left. -
top
- The number of pixels from the top. -
resizable
-true
if you want to allow the window to be resize by the user.
options = {
:dialog_title => title,
:scrollable => false,
:preferences_key => 'MyDialog',
:height => 300,
:width => 400,
:left => 200,
:top => 200,
:resizable => true,
:mac_only_use_nswindow => true
}
@dialog = UI::WebDialog.new(options)
But the hash exposes a new undocumented argument, :mac_only_use_nswindow
. No further info has been given about this argument.
Every time the WebDialog is moved and sized the settings is written. However, these settings are only read when UI::WebDialog.new
is called. webdialog.show
will display the window using the position and size of when the WebDialog was created. Because of this one has to destroy and recreate the WebDialog object everytime before calling webdialog.show
if one want to remember last settings.
When you specify position and size Sketchup only uses those values the first time you create the dialog. After that it reads the last used values from the registry. That might be want to you want for resizable windows. But maybe not for windows with a fixed size which the user can't resize.
When you develop a plugin you might find that you need to change the size of your fixed size window, but you can't see the effect because Sketchup just reads your last values. In which case you need to delete the registry settings for your Webdialog, or use the .set_size
method after you create the fixed size window to ensure the correct size.
The scrollbar argument does not seem to work on PC. In order to disable the scrollbars you must set a CSS property. What HTML to assign this property to depends if your HTML uses Quirks Mode or Standards Mode.
If you're using Quicks Mode you assign it to the BODY element:
body { overflow: hidden; }
If you are using Standard Mode you assign it to the HTML element:
html { overflow: hidden; }
This is because the effective root element in an HTML document differs from Quicks to Standards Mode.
And if you do not specify a preference key, Sketchup seem to disregard both size and position.