create context menu

1 view
Skip to first unread message

Anthony Ettinger

unread,
Oct 3, 2013, 5:16:31 AM10/3/13
to node-...@googlegroups.com
Is there a way I can do this after the item is created?

            var searchItem = new gui.MenuItem({
                label: myLabel
                , click: fn
            });


I would rather do it this way, but could not get it to work:

         var searchItem = new gui.MenuItem();
         
         searchItem.label = myLabel; 
         searchItem.click = fn;

LZAntal

unread,
Oct 4, 2013, 1:35:18 PM10/4/13
to node-...@googlegroups.com
Hi,

I prefer the current format but if you want to use your style you can create a factory function then your version works.
This works for me:
"""
function newMenuItem(){
return new gui.MenuItem({label:"empty", click:function(){ console.log("not implemented");}});
}

var searchItem = newMenuItem();
searchItem.label = "TEST"; 
searchItem.click = function(){ console.log("TEST"); };
"""

Hope it helps




--
You received this message because you are subscribed to the Google Groups "node-webkit" group.
To unsubscribe from this group and stop receiving emails from it, send an email to node-webkit...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply all
Reply to author
Forward
0 new messages