Jump to content

Open popupmenu in UniCalendarPanel


eduardosuruagy

Recommended Posts

21 minutes ago, eduardosuruagy said:

OK, I'm waiting

Try this approach:

1. UniCalendarPanel1 -> ClientEvents -> ExtEvents -> 

function afterrender(sender, eOpts) 
{
    sender.getEl().dom.addEventListener('mousedown', function(e) {
        if (e.button == 2 && e.target && e.target.getAttribute('class').search('x-calendar-event') > -1) {
            ajaxRequest(sender, '_contextmenu', ['x=' + Ext.get(e.target).getX(), 'y=' + Ext.get(e.target).getY()]);
        }
    });
}

2. UniCalendarPanel1 -> ClientEvents -> ExtEvents ->  

function mousedown(sender, x, y, eOpts)
{
  //ajaxRequest(MainForm.form, '_contextmenu', ['x='+x, 'y='+y]);
}

3. UniCalendarPanel1 -> OnAjaxEvent -> 

procedure TMainForm.UniCalendarPanel1AjaxEvent(Sender: TComponent;
  EventName: string; Params: TUniStrings);
var
  x, y: Integer;
begin
  if EventName = '_contextmenu' then
  begin
    x := StrToInt(Params.Values['x']) - Self.Left;
    y := StrToInt(Params.Values['y']) - Self.Top;
    UniPopupMenu1.Popup(x, y);
  end;
end;

 

Link to comment
Share on other sites

  • 10 months later...

yes of course. i used the code like explained to get the popup at the correct position. In addition i need the EventID from the clicked event so i can use it to access the Data for it. i made a workaround with the calendarpanel OnEventClick in combination with this code here. on the OnEventClick is the EventID. I like to return it in addition to the x, y params in the afterrender. 

Link to comment
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
×
×
  • Create New...