Menu

When using the mnu.addCheckbox() method, the checkbox will display in the sub polygon using this code (sibling option):



mnuMn.addNewSibling(“file”, “view”, “View”, false);

mnuMn.addNewChild(“view”, 0, “temp_1”, “Place Holder”, false);

mnuMn.addCheckbox(“sibling”, “temp_1”, null, “show_Grid_a”, “Show Analysis Pane”, true, false);



whereas using this code (child option), the checkbox menu item will not appear:



mnuMn.addNewSibling(“file”, “view”, “View”, false);

mnuMn.addNewChild(“view”, 0, “temp_1”, “Place Holder”, false);

mnuMn.addCheckbox(“child”, “view”, 1, “show_Grid_a”, “Show Analysis Pane”, true, false);



nor will it appear using this code (my preference):



mnuMn.addNewSibling(“file”, “view”, “View”, false);

mnuMn.addCheckbox(“child”, “view”, 0, “show_Grid_a”, “Show Analysis Pane”, true, false);



Any suggestions?



Thanks,

Dan


Hello,


The new checkbox should be child of the “temp_1”, isn’t it ?


In this case:


mnuMn.addCheckbox(“child”,“temp_1”,null,“show_Grid_a”, “Show Analysis Pane”, true, false);


If this element is a child of “view”:


mnuMn.addCheckbox(“sibling”, “temp_1”, null, “show_Grid_a”, “Show Analysis Pane”, true, false);

mnuMn.addNewSibling(“file”, “view”, “View”, false);

mnuMn.addNewChild(“view”, 0, “temp_1”, “Place Holder”, false);

mnuMn.addCheckbox(“sibling”, “temp_1”, null, “show_Grid_a”, “Show Analysis Pane”, true, false);

This works as expected - the Place Holder and Show Analysis Pane both show up as child menu items to View.

However, only require Show Analysis Pane as the first child menu item of View.   That I cannot get to work. 

I thought this should work (with the temp) – to demonstrate that “child” mode works, but it doesn’t.
mnuMn.addNewSibling(“file”, “view”, “View”, false);

mnuMn.addNewChild(“view”, 0, “temp_1”, “Place Holder”, false);

mnuMn.addCheckbox(“child”, “view”, 1, “show_Grid_a”, “Show Analysis Pane”, true, false);



My requirement is this:
mnuMn.addNewSibling(“file”, “view”, “View”, false);

mnuMn.addCheckbox(“child”, “view”, 0, “show_Grid_a”, “Show Analysis Pane”, true, false);



wouldn’t sibling mode at this point make Show Analysis Pane make it a peer to view, which happens to be a main menu item, which I thought i read is not possible?

As always, thanks for the quick replies,
Dan


It is possible to set the new checkbox position after its adding:



mnuMn.addNewChild(“view”, 0, “temp_1”, “Place Holder”, false);


mnuMn.addCheckbox(“sibling”,“temp_1”,null, “show_Grid_a”, “Show Analysis Pane”, true, false);
mnuMn.setItemPosition(“show_Grid_a”, 0);



I wish I had a cleaner solution, but this will do for now.

Set as main menu logic
 mnuMn.addNewChild(“view”, 0, “temp_1”, “Place Holder”, false);
 mnuMn.addCheckbox(“sibling”, “temp_1”, null, “show_Grid_a”, “Show Analysis Pane”, true, false);

then…

mnuMn.setItemPosition(“show_Grid_a”, 0);
mnuMn.setItemPosition(“temp_1”, 1);
mnuMn.hideItem(“temp_1”);

Thanks for the suggestion.
Dan