Hi Nislim,

This is because you are calling the function when your application
starts. Try this:

var f = function() { alert("Alerted"); };

var a = f();
var b = f;

alert(typeof a);
alert(typeof b);

You should see the results. f() will always call function f, so if you
want function that calls function f, you should create new one (or
anonymous):

var I_Will_Call_F_And_Return_String = function() { f(); return "string"; };

So in listener if you want function that will call something, use anonymous:

fileMenu.addListener("execute", function(e) { do something here } );

Cheers
- Petr

2008/10/7 nislim <[EMAIL PROTECTED]>:
>
>
> Matthew Gregory wrote:
>>
>> Hi nislim,
>> Try changing this.createFileMenu() to this.createFileMenu.
>> You don't want to call the function here you just want to reference it.
>>
>> Also instead of trying to get the document width have you tried
>> something like this?
>> frame.add(menuBar, {left : 0, right : 0})
>>
>>
>> nislim wrote:
>>> This is the code i use to generate a simple menu:
>>>
>>> CreateMenu : function()
>>>        {
>>>                if (parseInt(navigator.appVersion)>3) {
>>>                      if (navigator.appName=="Netscape") {
>>>                      winW = window.innerWidth;
>>>                      }
>>>                      if (navigator.appName.indexOf("Microsoft")!=-1) {
>>>                      winW = document.body.offsetWidth;
>>>      }
>>> }
>>>
>>>                var frame = new qx.ui.container.Composite(new 
>>> qx.ui.layout.Grow);
>>>
>>>       var menuBar = new qx.ui.menubar.MenuBar;
>>>       menuBar.setWidth(winW-2);
>>>       frame.add(menuBar);
>>>
>>>       // [MenuBar]
>>>      menuBar.add(new qx.ui.menubar.Button("Test",
>>> this.createFileMenu()));
>>>        //fileMenu.addListener("execute", this.createFileMenu());
>>>
>>>
>>>       return frame;
>>>        },
>>>
>>>              createFileMenu: function()
>>>        {
>>>        alert("Do you see?");
>>>        }
>>>
>>> I want that the alert do you se shows when i click the button but instead
>>> it
>>> shows when i open the page.
>>
>>
>> -------------------------------------------------------------------------
>> This SF.Net email is sponsored by the Moblin Your Move Developer's
>> challenge
>> Build the coolest Linux based applications with Moblin SDK & win great
>> prizes
>> Grand prize is a trip for two to an Open Source event anywhere in the
>> world
>> http://moblin-contest.org/redirect.php?banner_id=100&url=/
>> _______________________________________________
>> qooxdoo-devel mailing list
>> [email protected]
>> https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel
>>
>>
> Thanks, now I can create a menu but if I want to call for example a
> message(alert("You clicked me!")) but if I do that. It will pop-up when I
> start the application.
> --
> View this message in context: 
> http://www.nabble.com/Menubutton-error-tp19810858p19864225.html
> Sent from the qooxdoo-devel mailing list archive at Nabble.com.
>
>
> -------------------------------------------------------------------------
> This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
> Build the coolest Linux based applications with Moblin SDK & win great prizes
> Grand prize is a trip for two to an Open Source event anywhere in the world
> http://moblin-contest.org/redirect.php?banner_id=100&url=/
> _______________________________________________
> qooxdoo-devel mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel
>

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
qooxdoo-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel

Reply via email to