Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    Use of HTML5 Canvas

    Hey guys,
    i need to use the html5 canvas tag in order to build a small scenegraph library on top of Smart GWT. I didn't found any "HTML5Canvas" Widget so far and it seems direct manipulation of DOM is some sort of a "bad idea" for handling smart gwt widgets right.

    So, have you any suggestions?

    Greetings,
    Druadan

    #2
    Could do it inside of a HTMLPane.

    Comment


      #3
      Hi,

      I am using GWT 2.3 and SmartGWT 2.4. I am trying to embed a <canvas> HTML5 element in my SmartGWT app. I tried doing it like it was suggested in the post above:

      final HTMLPane pane = new HTMLPane();
      pane.setWidth100();
      pane.setHeight( 200 );
      pane.setContents( "<canvas id='testcanvas'></canvas>" );

      The canvas gets embedded properly, but I don't know where / how to initialize it. To do it I need to call a Javascript function ('native') that calls document.getElementById("testcanvas"). I tried inserting appropriate code in addDrawHandler(...) and in Scheduler.get().scheduleDeferred(...), but getElementById() always returns null. I also tried using addContentLoadedHandler() but the handler never get called. And I tried embedding a <script> tag right after <canvas> inside setContents(), but it doesn't work either.

      Where should I call the initialization Javascript function from?

      Best,
      Michał Błażejczyk
      Last edited by blazej; 9 Aug 2011, 09:47.

      Comment


        #4
        Bump :)))

        I'm hoping someone will post a solution. I find it hard to believe that there is no way to embed an HTML5 <canvas> within a SmartGWT application...

        Best,
        Michał

        Comment

        Working...
        X