Tabbar contextmenu

Hi,
We are using dhtmlx pro edition in our product.
Can i have context menu on tabbar, so that i can choose which tabs to be displayed.

Is there any other options please let me know.

Thanks in advance,
Naresh Adla

I have tried your answer like adding Menu item to tabbar.
It is worked but can i have any other option because context menu displays when i right click on tabbar, but i have to show when clicking on a button
Can i add a button in tabbar item and when i click that button can i show the context menu?

Hi
There are 3 ways.
The First - CM to current tab (but you don’t want a right click):

menu = new dhtmlXMenuObject(); menu.setIconsPath("../dhtmlxMenu/samples/common/imgs/"); menu.renderAsContextMenu(); tabbar = new dhtmlXTabBar("b_tabbar", "top"); tabbar.setImagePath("../dhtmlxTabbar/codebase/imgs/"); tabbar.setSkin("dhx_skyblue"); tabbar.setSkinColors("white","#FFFACD"); tabbar.addTab("a1", "Tab1", "100px"); tabbar.addTab("a2", "Tab2", "100px"); tabbar.addTab("a3", "Tab3", "100px"); tabbar._tabs["a1"].id = "a1"; menu.addContextZone(tabbar._tabs["a1"].id); tabbar._tabs["a2"].id = "a2"; menu.addContextZone(tabbar._tabs["a2"].id); tabbar._tabs["a3"].id = "a3"; menu.addContextZone(tabbar._tabs["a3"].id); menu.attachEvent("onBeforeContextMenu", function(id){ console.log(id) return true; }); menu.loadXML("../___xml/menuTabs.xml");
The Second - use image with context menu:

[code] function doOnLoad(){
menu = new dhtmlXMenuObject();
menu.setIconsPath("…/dhtmlxMenu/samples/common/imgs/");
menu.renderAsContextMenu();
tabbar = new dhtmlXTabBar(“b_tabbar”, “top”);
tabbar.setImagePath("…/dhtmlxTabbar/codebase/imgs/");
tabbar.setSkin(“dhx_skyblue”);
tabbar.setSkinColors(“white”,"#FFFACD");
tabbar.addTab(“a1”, “Tab1 <img src=‘http://cdn2.iconfinder.com/data/icons/picol-vector/32/arrow_sans_down-16.png’ id=‘buttonImg’ onclick=‘cmFunc(this)’’>”, “100px”);
tabbar.addTab(“a2”, “Tab2”, “100px”);
tabbar.addTab(“a3”, “Tab3”, “100px”);
tabbar.setTabActive(“a1”);

        menu.loadXML("../___xml/menuTabs.xml");
	}
        function cmFunc(pic){
            document.getElementById("buttonImg").onclick = function(e) {
                if(!e) e = event;
                e.cancelBubble = true;
                x = e.clientX +10;
                y = e.clientY +10;
                menu.showContextMenu(x,y);
            }
        }[/code]

The Fird - use dhtmlxPopup list as context menu (you can there images too):

[code] function doOnLoad(){
myPop = new dhtmlXPopup();
myPop.attachList(“command”, [
{id: 1, command: “New”},
{id: 2, command: “Close”},
myPop.separator,
{id: 3, command: “Print”},
{id: 4, command: “Save”},
{id: 5, command: “Load”}
]);
myPop.attachEvent(“onClick”,function(id){
alert("Command number is "+id)
})

        tabbar = new dhtmlXTabBar("b_tabbar", "top");
        tabbar.setImagePath("../dhtmlxTabbar/codebase/imgs/");
        tabbar.setSkin("dhx_skyblue");
        tabbar.setSkinColors("white","#FFFACD");
        tabbar.addTab("a1", "<span style='top: -5px'>Tab1 </span><span style='top: -2px; left: 6px'><img src='http://cdn2.iconfinder.com/data/icons/picol-vector/32/arrow_sans_down-16.png' id='buttonImg' onclick='cmFunc(this)''></span>", "100px");
        tabbar.addTab("a2", "Tab2", "100px");
        tabbar.addTab("a3", "Tab3", "100px");


	}
        function cmFunc(pic){
            var x = getAbsoluteLeft(pic);
            var y = getAbsoluteTop(pic);
            var w = pic.offsetWidth;
            var h = pic.offsetHeight;
            myPop.show(x, y, w, h);

        }[/code]

I have tried the first option.
It is working fine in IE,Firefox nd chrome, but not working with safari and opera?

What will be the problem?

Support team please respond !

Thanks,

Naresh Adla

In Safari everything is ok
In Opera - the is a feature: to show context menu you need to usr ctrl+lbm_click