Thursday, November 8, 2012

Dart showModalDialog

‹prev | My Chain | next›

Last night I made my Dart modal dialog class absolutely perfect. Well, at least as perfect as the dart_analyzer tool can help me make it.

But while messing around with it, I happened to stumble across the showModalDialog dialog method built into the dart:html library. Based on the method signature, which requires a URL as the first argument, I doubt that I can bend it to my will—dynamically building awesome dialogs like:


Still, if there is a built-in approach to doing these things, it might be worth some investigation.

A bit of research shows that showModalDialog is actually a HTML5 function. I have yet to come across that. Let's see what it can do in the world of Dart.

I replace my modal dialog call with showModalDialog:
// ...
    // el = new ModalDialog();
    var ret = window.showModalDialog('/test.html');
    _attachUiHandlers();
    // ...
When I try to use this, I find nothing but a big, hairy stack trace:
Exception: [info: third_party/WebKit/Source/WebCore/bindings/dart/custom/DartDOMWindowCustom.cpp:146]
Stack Trace: #0      _LocalWindowImpl.showModalDialog (/mnt/data/b/build/slave/dartium-lucid64-inc/build/src/out/Release/obj/gen/webkit/bindings/dart/dart/LocalWindowImpl.dart:108:3)
#1      AddComicForm.post_initialize (http://localhost:3000/scripts/web/Views.AddComicForm.dart:14:37)
#2      HipsterView.HipsterView (http://localhost:3000/scripts/web/packages/hipster_mvc/hipster_view.dart:18:25)
#3      AddComicForm.AddComicForm (http://localhost:3000/scripts/web/Views.AddComicForm.dart:9:5)
#4      AddComic._toggle_form._toggle_form (http://localhost:3000/scripts/web/Views.AddComic.dart:31:17)
 FIXME:1
I dig through the Dart code a bit and it seems as though this should forward onto a native implementation. So I try this in the JavaScript console to see if Dartium is the problem:


Pfft. That's no modal. This seems to be a dead end. Even if the Dart version of showModalDialog() worked and I could dynamically update the contents, it does not seem as though Chrome / Dartium supports it in a meaningful way. Oh well, at least I looked into it. And now I can stick with my own implementation with confidence.


Day #564

2 comments:

  1. Hi Chris,

    Well yeah the window.showModalDialog (which probably just calls window.open with a few arguments) is the new popup, lets go 10 years behind :P

    ReplyDelete
  2. Japh(R) By Chris Strom: Dart Showmodaldialog >>>>> Download Now

    >>>>> Download Full

    Japh(R) By Chris Strom: Dart Showmodaldialog >>>>> Download LINK

    >>>>> Download Now

    Japh(R) By Chris Strom: Dart Showmodaldialog >>>>> Download Full

    >>>>> Download LINK YG

    ReplyDelete