haXe - Dojo Type Signatures

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

haXe - Dojo Type Signatures

blackdog-2
Reply | Threaded
Open this post in threaded view
|

Re: haXe - Dojo Type Signatures

tommedema
Nice work!

I personally won't be doing visuals with Javascript but I'm sure a lot of people do.

By the way, you said stdhx had to be modified? It still works for people without Dojo right? I'm pretty sure the answer is yes, just checking.

- Tom



--
haXe - an open source web programming language
http://haxe.org
Reply | Threaded
Open this post in threaded view
|

Re: haXe - Dojo Type Signatures

blackdog-2
hi Tom

Actually, you only need stdhx if your'e generting the API, if you just want to use the api it's just standard js target no node.js

bd

On Mon, Jul 19, 2010 at 6:13 AM, Tom <[hidden email]> wrote:
Nice work!

I personally won't be doing visuals with Javascript but I'm sure a lot of people do.

By the way, you said stdhx had to be modified? It still works for people without Dojo right? I'm pretty sure the answer is yes, just checking.

- Tom



--
haXe - an open source web programming language
http://haxe.org


--
haXe - an open source web programming language
http://haxe.org
Reply | Threaded
Open this post in threaded view
|

Re: haXe - Dojo Type Signatures

Niel Drummond-3
I'd be interested if you manage to get Dojo's widget inheritance working correctly with haXe's inheritance.. IIRC I was having some problems with this last time I tried - this allows you to have some HTML like:

<div dojoType="haxe.class.Name"></div>

which references a class "haxe.class.Name", which could extend a widget.
This unfortunately only seemed to work when you add the following boilerplate stub before running dojo.parser.parse() (something that IMO should not be necessary):

dojo.declare( "haxe.class.Name", dojox.Grid, haxe.class.Name.prototype );


- Niel

On 19/07/10 12:23, blackdog wrote:
hi Tom

Actually, you only need stdhx if your'e generting the API, if you just want to use the api it's just standard js target no node.js

bd

On Mon, Jul 19, 2010 at 6:13 AM, Tom <[hidden email]> wrote:
Nice work!

I personally won't be doing visuals with Javascript but I'm sure a lot of people do.

By the way, you said stdhx had to be modified? It still works for people without Dojo right? I'm pretty sure the answer is yes, just checking.

- Tom



--
haXe - an open source web programming language
http://haxe.org



--
haXe - an open source web programming language
http://haxe.org
Reply | Threaded
Open this post in threaded view
|

Re: haXe - Dojo Type Signatures

blackdog-2
hi Neil

Interesting usage, in fact it reminds me of what I'm trying to do with haxe and commonjs modules, that is, integrating haxe into the javascript ecosystem.

As I mentioned I don't know all the possibilties of Dojo as I haven't used it, however as I get into it more I'll see what I can do. At the moment it's just getting the basic apis working. Most of it 'should' work as advertised, but I need to tweak the generator to better handle namespace methods/props, e.g. dojo.grx should create a corresponding dojo.Grx class which provides createSurface and such - i'll probably have that done for tomorrow.

FYI, I now have the following test compiling and running: 

import Dojo;

class App {

  static var dojo:Dojo = untyped __js__("dojo");
  
  public static function
  main() {

    if(haxe.Firebug.detect())
      haxe.Firebug.redirectTraces();
    else {
      // haxe.Log.trace = myTrace;
    }
    
    dojo.addOnLoad({},function(x){
        var q = dojo.query(".niceclass");
        
        q.connect("onclick", function(evt) {
            trace("got click");
            dojo.fadeOut({ node: evt.target }).play();
          });
        
        var t = ["1","2","3","4"];
        
        q.forEach(function(el,i) {
            el.innerText = t[i];
          });
        
        trace("Is Firefox :"+dojo.isFF);
        trace("Is webkit :"+dojo.isWebKit);
        trace("Is chrome :"+dojo.isChrome);
        
        dojo.require("dijit.layout.TabContainer");
        dojo.require("dijit.layout.ContentPane");
        dojo.require("dijit.Dialog");
        dojo.require("dijit.form.Button");
        dojo.require("dijit.Menu");
        dojo.require("dijit.Editor");
        dojo.require("dijit._editor.plugins.FontChoice"); 
        dojo.require("dijit._editor.plugins.TextColor");

        dojo.addOnLoad({},function(x) {
            var tc = new dijit.layout.TabContainer({
              style: "height: 100%; width: 100%;"
              },
              "tc1-prog");

            var cp1 = new dijit.layout.ContentPane({
              title: "Food",
              content: "We offer amazing food"
              });
            tc.addChild(cp1);

            var cp2 = new dijit.layout.ContentPane({
              title: "Drinks",
              content: "We are known for our drinks."
              });
            tc.addChild(cp2);

            tc.startup();

        
            // create a "hidden" Dialog:
            var dialog = new dijit.Dialog({ title:"Hello Dijit!" });
            //    dialog.startup();
        
            var button = new dijit.form.Button({
              label: "Click me!",
              onClick: function() {
                  // Do something:
                  dojo.byId("result1").innerHTML += "Thank you! ";
                  dialog.show();
                }
              },
              "progButtonNode");

         
            var pMenu = new dijit.Menu({
              targetNodeIds: ["prog_menu"]
              });
            pMenu.addChild(new dijit.MenuItem({
                label: "Simple menu item"
                    }));
            pMenu.addChild(new dijit.MenuItem({
                label: "Disabled menu item",
                    disabled: true
                    }));
            pMenu.addChild(new dijit.MenuItem({
                label: "Menu Item With an icon",
                    iconClass: "dijitEditorIcon dijitEditorIconCut",
                    onClick: function() {
                    trace('i was clicked');
                  }
                }));
            pMenu.addChild(new dijit.CheckedMenuItem({
                label: "checkable menu item"
                    }));
        
            pMenu.addChild(new dijit.MenuSeparator(null,null));

            var pSubMenu = new dijit.Menu(null);
            pSubMenu.addChild(new dijit.MenuItem({
                label: "Submenu item"
                    }));
            pSubMenu.addChild(new dijit.MenuItem({
                label: "Submenu item"
                    }));
            pMenu.addChild(new dijit.PopupMenuItem({
                label: "Submenu",
                    popup: pSubMenu
                    }));
        
            pMenu.startup();

            new dijit.Editor({
              height: '200px',
                  extraPlugins: ['dijit._editor.plugins.AlwaysShowToolbar']},
              dojo.byId('programmatic2'));
      
          });
      });
  }
}


On Tue, Jul 20, 2010 at 5:52 PM, Niel Drummond <[hidden email]> wrote:
I'd be interested if you manage to get Dojo's widget inheritance working correctly with haXe's inheritance.. IIRC I was having some problems with this last time I tried - this allows you to have some HTML like:

<div dojoType="haxe.class.Name"></div>

which references a class "haxe.class.Name", which could extend a widget.
This unfortunately only seemed to work when you add the following boilerplate stub before running dojo.parser.parse() (something that IMO should not be necessary):

dojo.declare( "haxe.class.Name", dojox.Grid, haxe.class.Name.prototype );


- Niel


On 19/07/10 12:23, blackdog wrote:
hi Tom

Actually, you only need stdhx if your'e generting the API, if you just want to use the api it's just standard js target no node.js

bd

On Mon, Jul 19, 2010 at 6:13 AM, Tom <[hidden email]> wrote:
Nice work!

I personally won't be doing visuals with Javascript but I'm sure a lot of people do.

By the way, you said stdhx had to be modified? It still works for people without Dojo right? I'm pretty sure the answer is yes, just checking.

- Tom



--
haXe - an open source web programming language
http://haxe.org



--
haXe - an open source web programming language
http://haxe.org


--
haXe - an open source web programming language
http://haxe.org