Oops, your profile's looking a bit empty! To help us tailor your experience, please fill in key details like your SketchUp version, skill level, operating system, and more. Update and save your info on your profile page today!
š« Lightbeans Update | Metallic and Roughness auto-applied in SketchUp 2025+ Download
WebDialogs: To sub-class or not?
-
Just curious if anyone had any thoughts on creating webdialogs. I've seen 2 ways to use them: sub-classing and instancing:
class MyDialog < UI;;WebDialog ... endor
dlg = UI;;Webdialog.new({})Any advantages one way or the other?
-
Hi Jim,
Although I've only coded few WebDialogs, I'll vote for sub-classing. This is a good way for coding 'generic' attributes and methods if you have many other dialogs that will use them, by first extending the class.
Regards, -
a) subclassing and instancing
b) instancingIf you only need a window to display information, b) would do it. But if your dialog is more complex, subclassing seems to be a good choice, because you can let your class do a lot of things, i.e. generating the HTML by overriding the original set_html method:
class AzubyDialog < UI;;WebDialog private def generate_html arg s = '' # TODO; implement your HTML generator code s end public def set_html arg super(arg.kind_of?(String) ? arg ; generate_html(arg)) end endazuby
Advertisement