dhtmlXMenuObject keeps generating a "tbd" error

Hi to all,

Despite I have some experience using dhtmlx librairies (grid and toolbar), I can’t figure how to work with context menus in an HTA file. Everytime I launch the page, I get the error: <‘tbd’ is null or not an object>. Here is the code I’m using, and the full project is attached below:

var oMenu = new dhtmlXMenuObject(contextArea);
oMenu.setIconsPath("imgs/");    
oMenu.renderAsContextMenu();
oMenu.addNewSibling(null, "file", "File", false);       
oMenu.addNewChild("file", 0, "file_new", "New", false);
oMenu.setHotKey("file_new", "Ctrl+N");                 
oMenu.addNewSeparator("file_new");

If you prefer, you can rename the HTA file with an HTML extension for testing. Any tips or suggestions are welcome.

Thank you in advance,

Michel
Menu.zip (97.5 KB)

Hi
Try to use the right order and look at the sample below.

oMenu = new dhtmlXMenuObject(); oMenu.renderAsContextMenu(); oMenu.addContextZone('contextArea'); oMenu.setIconsPath("scripts/imgs/"); oMenu.addNewSibling(null, "file", "File", false); oMenu.addNewChild("file", 0, "file_new", "New", false); oMenu.setHotKey("file_new", "Ctrl+N"); oMenu.addNewSeparator("file_new");
dhtmlx.com/docs/products/dht … _item.html

With the right order, it is working now.

Thank you.

Michel

You are welcome!