dhtmlXScheduler - dhtmlXScheduler

Could you please pass the native click event object when you call showLightbox? It’s awkward handling a click event without access to the click event native object. The specific use case I’m looking at is showing a context menu instead of the light box initially, if there are multiple add forms available for the given calendar.

There are few different scenarios which can lead to the showLightbox call.

Are you need to implement such context menu when new event created ? You can use
scheduler.attachEvent(“onEventCreated”,function(id,e){
//e - native DOM event
// this code will be called exactly after event creation, before lightbox
// you can take necessary values from event for later reusage
this._my_pos = some_method(e);
})
scheduler.showLightBox=function(id){
// this._my_pos - store position of creation
}

The second strategy can be in locating related html event
scheduler.showLightBox=function(id){
var left, top;
scheduler.for_rendered(id,function(node){
left = getAbsoluteLeft(node);
top = getAbsoluteLeft(top);
});
//now you have coordinates of related event
}

To a certain extent that will work for double click (though onDblClick would be better), but it breaks down in a couple of ways:

Consider the case where the user selects a region of the calendar in order to create a new event.  The onEventCreated event is raised on the initial mouse move, not the final one.  So the coordinates are approximately where the the user started the drag instead of the ending position.

You also leave yourself open to issues caused by a lack of contiguity.  Consider where in the future additional behaviors may occur between those two steps, and may either invalidate the position you are caching or cause the position from one event creation to be applied to another.

In the case of showLightbox, the only instance where it is called where the native event object may not be known is when it is a button on the event’s menu bar in which case not passing the argument in that case seems reasonable (i.e it would be null).  In the cases of double-click and on-mouse-up, you are in the handler for a native event so it would be very easy to include the additional context information.