开发者

qooxdoo error (qx.html is undefined)

I am learning qooxdoo (which i think is awesome btw since i actually understand it). Unfortunately, while following the twitter client tutorial, i ran into an error when i load the page.

After creating a new class file MainWindow.js

qx.Class.define("twitter.MainWindow",
{
    extend: qx.ui.window.Window,

    construct : function()
    {
        this.base(arguments, "Tweeter");
    }
});

I go to the Application.js class file and add

var main = new twitter.MainWindow();
    main.open();

which is supposed to let me see the small window.

After running generate.py source i get this error in firebug

qx.html is undefined
[Break On This Error] return new qx.html.Element("div", styles, attributes); 

I have tried running generate.py with source-all and even build but to no avail. Can someone please help me, I really need to get started with this (I wasted two days trying to work with cappuccino and SproutCore... useless)

UPDATE I solved the issue. Apparently, i was typing the window code outside the application class definition. In my defense, the tutorial said "add this to the end of the Application.js file"

so this


qx.Class.define("twitter.Application",
{
  extend : qx.applica开发者_如何学Ction.Standalone,

  members :
  {
    main : function()
    {
      // Call super class
      this.base(arguments);

      // Enable logging in debug variant
      if (qx.core.Environment.get("qx.debug"))
      {
        qx.log.appender.Native;
        qx.log.appender.Console;
      }


    }
  }
});

var main = new twitter.MainWindow();
        main.open();

should should have been


qx.Class.define("twitter.Application",
{
  extend : qx.application.Standalone,

  members :
  {

    main : function()
    {
      // Call super class
      this.base(arguments);

      // Enable logging in debug variant
      if (qx.core.Environment.get("qx.debug"))
      {
        qx.log.appender.Native;
        qx.log.appender.Console;
      }

      var main = new twitter.MainWindow();
        main.open();
    }
  }
});


Very good, you solved it all by yourself :-). Yes, the tutorial text is ambiguous in this point, and I will file a bug to fix that.

In general, qooxdoo uses a "closed form" for its class definition. Every information pertaining to a specific class is in this one big map that is passed to qx.Class.define. The manual goes to some length explaining the various elements of a class definition, maybe you find that helpful (see e.g. here).

On the other hand, what you did first is perfectly legal JavaScript, so you didn't get any of the syntax errors that would cause the generator to exit right away. You should have seen a warning, though, in the generator output.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜