Hi Jim,

Jim Hunter schrieb:
> I am having a bit of a problem actually getting something simple to 
> work. I can create a Mixin and my code still works, but as soon as I try 
> and include the Mixin in qx.ui.core.Widget the code does not execute 
> anything past that line. Here is the sample Application file I have 
> created, please let me know why it doesn't work. If you comment out the 
> include line, the code runs fine.
You define the member method "getMyToolId" in your Mixin. This method is 
also defined in "qx.ui.core.Widget". The include mechanism allows you 
only to add functionality to a given class not to redefine/overwrite 
methods. If you need to overwrite this specific method use 
"qx.Class.patch" instead.

Do you have FireBug running? FireBug told me nicely what the error was. 
Spitting out this exception message:
"[Exception... "'Error: Overwriting member "getMyToolId" of Class 
"qx.ui.core.Widget" is not allowed!' when calling method: 
[nsIDOMEventListener::handleEvent]" nsresult: "0x8057001c 
(NS_ERROR_XPC_JS_THREW_JS_OBJECT)" location: "<unknown>" data: no]"

cheers,
   Alex

> 
> qx.Class.define("Application",
> {
>   extend : qx.application.Gui,
> 
>   members :
>   {
> 
>     main : function()
>     {
>      
>       // Call super class
>       this.base(arguments);
> 
>       qx.Mixin.define("MObject",
>       {
>         "properties" :
>         {
>           "ToolId" :
>           {
>             check         : "string",
>             init : ""
>           },
> 
>           "MyToolId" :
>           {
>             check         : "string",
>             init : ""
>           }
>         },
>         
>         "members" : {
>           getMyToolId : function()
>           {  // will put code in here later once I get it working
>           }
>             
>           }
>       });
>  
>       qx.Class.include(qx.ui.core.Widget, MObject);
> 
>       // Create button
>       var button1 = new qx.ui.form.Button("First Button", "./button.png");
> 
>       // Set button location
>       button1.setTop(50);
>       button1.setLeft(50);
> 
>       // Add button to document
>       button1.addToDocument();
> 
>       // Add an event listener
>       button1.addEventListener("execute", function(e) {
>         alert("Hello World!");
>       });
>     }
>   }
> });
> 
> Thanks,
> Jim
> www.D4PHP.org <http://www.D4PHP.org>
> www.D4PHP-Hosting.com <http://www.D4PHP-Hosting.com>


-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >>  http://get.splunk.com/
_______________________________________________
qooxdoo-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel

Reply via email to