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
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register LoginAdvertisement