Welcome Guest Search | Active Topics | Sign In | Register

saving images using the context menu Options
Bodmoor
Posted: Monday, September 25, 2017 9:13:53 AM
Rank: Member
Groups: Member

Joined: 9/4/2017
Posts: 10
Hello,

I've been trying to save images using the context menu. I can save an image, by obtaining the base64 through javascript. When testing I had this function on the mouseclick event, where I can freely call evalscript.

the beforecontextmenu call, required for modifying the context menu of my view, does not support evalscript.

This leaves me with no obvious method to test the current location of my click to there being an image there I can actually save. I want to prevent the item being visible, of no image can be saved.

Is there a way to check the current location of the context menu, while in the beforecontextmenu event, so that I can make the context menu actually context sensitive in this situation?
eo_support
Posted: Monday, September 25, 2017 10:24:56 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,225
Hi,

There is no way for you to run JavaScript code from within BeforeContextMenu event because it's a blocking event. However you can check e.MenuInfo.MediaType inside your event handler to see whether the node below is an image.

Thanks!
Bodmoor
Posted: Monday, September 25, 2017 10:26:34 AM
Rank: Member
Groups: Member

Joined: 9/4/2017
Posts: 10
Hi,

Thanks for your reply.

This works in the event of an image, but not when there is a div with a background image. That has a mediatype of None.

Kind regards, Paul
eo_support
Posted: Monday, September 25, 2017 10:46:47 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,225
Then your only option would be NOT using the built-in context menu and display the context menu yourself. You would need to:

1. Disable the built-in context menu by calling e.Menu.Items.Clear() in your BeforeContextMenu event handler;
2. Handle the WebView's MouseDown event. Inside the event you can check whether the right button has been clicked and then display your own context menu;

Please let us know if this works for you.

Thanks!
Bodmoor
Posted: Monday, September 25, 2017 10:48:35 AM
Rank: Member
Groups: Member

Joined: 9/4/2017
Posts: 10
ahh thanks,

I was wondering if there was an override. Good to know that can be achieved by removing all the items. Consider my question answered.

Kind regards,
Paul
eo_support
Posted: Monday, September 25, 2017 10:55:12 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,225
You are welcome. Please feel free to let us know if you run into any other issues.


You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.