scheduler.attachEvent("onContextMenu", function (event_id, native_event_object){
but it does not solve two problems. Showing context menu only, when user right clicks on the event (everywhere else it does nothing) and hiding browsers native context menu (view source etc. )
I haven’t found any relevant information in forum or documentation. Any help appreciated.
you can check event_id to get info is right click occurs on event box or on empty space
also, you can block native right click event ( native DOM event object is provided as second parameter ) to prevent native context menu from appearing.
var menu = new dhtmlXMenuObject();
menu.renderAsContextMenu();
menu.addContextZone("scheduler_here");
menu.setSkin("dhx_blue");
menu.loadXML("dhxmenu.xml");
//menu.setAutoShowMode(false);
scheduler.attachEvent("onContextMenu", function (event_id, e){
if ( event_id != null ) {
menu.showContextMenu(e.clientX,e.clientY);
} else {
}
});
If I use setAutoSHowMode, then I have to hold down the right mouse button to see the menu. If I don’t use setAuto, then the context menu will be shown anywhere.
How to make so, that the context menu shows only on event, but stays after I release right mb?
Sorry, I’m having trouble getting the example to work. No context zone? Maybe you can post zip?
My axe hack:
menu = new dhtmlXMenuObject();
menu.renderAsContextMenu();
menu.addContextZone("scheduler_here");
menu.setSkin("dhx_blue");
scheduler.attachEvent("onContextMenu", function (event_id, e){
if ( event_id != null ) {
menu.clearAll();
menu.loadXMLString('<menu><item id="seaded" text="Seaded"><item id="sms_logi" text="SMS Logi"/></item></menu>', null);
menu.showContextMenu(e.clientX,e.clientY);
} else {
menu.clearAll();
menu.loadXMLString("<menu></menu>", null);
menu.showContextMenu(e.clientX,e.clientY);
}
});
I couldn’t use menu loadXML, something was out of sync (firebug showed get, but menu showed up after I hold down the rmb for longer time or clicked repeatedly) and the menu didn’t show up. loadXMLString works atm.