Jump to content

Recommended Posts

Posted
18 hours ago, eduardosuruagy said:

I don't want to let the user right-click on the HTMLMemo, if he clicks I want to be able to open a custom UniPoupUpMenu, with other functionalities

One possible solution:

1.

procedure TMainForm.UniFormCreate(Sender: TObject);
begin
  UniHTMLMemo1.JSInterface.JSAddListener(
    'initialize',
    'function(me){me.getEditorBody().oncontextmenu = function(e){e.preventDefault(); ajaxRequest(me, "contextmenu", {x: e.x, y: e.y + me.getToolbar().getHeight()})}}'
  );
end;

2. 

procedure TMainForm.UniHTMLMemo1AjaxEvent(Sender: TComponent; EventName: string;
  Params: TUniStrings);
begin
  if EventName = 'contextmenu' then
    UniPopupMenu1.Popup(Params.Values['x'].ToInteger() + 5, Params.Values['y'].ToInteger() + 5, Sender);
end;

 

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...