eduardosuruagy Posted March 15, 2021 Share Posted March 15, 2021 I wanted to open popupmenu in UniCalendarPanel only when an event exists and is clicked on. CalendarPanel.rar Link to comment Share on other sites More sharing options...
eduardosuruagy Posted March 16, 2021 Author Share Posted March 16, 2021 Can someone help me? Link to comment Share on other sites More sharing options...
Sherzod Posted March 16, 2021 Share Posted March 16, 2021 10 minutes ago, eduardosuruagy said: Can someone help me? Hello, We will analyze it. 1 Link to comment Share on other sites More sharing options...
Sherzod Posted March 16, 2021 Share Posted March 16, 2021 19 hours ago, eduardosuruagy said: I wanted to open popupmenu in UniCalendarPanel only when an event exists and is clicked on. I almost found a solution, I'll try to publish it a bit later. Link to comment Share on other sites More sharing options...
eduardosuruagy Posted March 16, 2021 Author Share Posted March 16, 2021 1 minute ago, Sherzod said: Quase encontrei uma solução, tentarei publicá-la um pouco mais tarde. OK, I'm waiting Link to comment Share on other sites More sharing options...
Sherzod Posted March 16, 2021 Share Posted March 16, 2021 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 More sharing options...
eduardosuruagy Posted March 16, 2021 Author Share Posted March 16, 2021 1 hour ago, Sherzod said: Experimente esta abordagem: 1. UniCalendarPanel1 -> ClientEvents -> ExtEvents -> 2. UniCalendarPanel1 -> ClientEvents -> ExtEvents -> 3. UniCalendarPanel1 -> OnAjaxEvent -> Thanks, it worked perfectly 1 Link to comment Share on other sites More sharing options...
TobiS Posted January 25, 2022 Share Posted January 25, 2022 This works great to set the popup at the correct location. Is there a way to put the eventid as a parameter in the "afterrender" event? Link to comment Share on other sites More sharing options...
Sherzod Posted January 25, 2022 Share Posted January 25, 2022 42 minutes ago, TobiS said: Is there a way to put the eventid as a parameter in the "afterrender" event? Hello, Can you please explain in more detail? Link to comment Share on other sites More sharing options...
TobiS Posted January 25, 2022 Share Posted January 25, 2022 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 More sharing options...
Sherzod Posted January 25, 2022 Share Posted January 25, 2022 So were you able to solve the problem? Link to comment Share on other sites More sharing options...
TobiS Posted January 25, 2022 Share Posted January 25, 2022 its a workaround for the left mouse button. Would be great if it would work on the right mouseclick. Link to comment Share on other sites More sharing options...
Recommended Posts
Please sign in to comment
You will be able to leave a comment after signing in
Sign In Now