Select to view content in your preferred language

open custom-widget by mouse left/right click on a feature

2268
8
Jump to solution
10-03-2020 11:21 AM
MichaelLev
Regular Contributor

I use Web AppBuilder (Develper Edtion) 2.17, Launchpad Theme, on 3D Scenes (ArcGIS API for javascript 4.16).

Regularly mouse left click on a feaature opens feature default popup.

I don't want to change this, but how can I enable/disable an option that left click (or right click) on a feature will open my custom widget on that feature e.g. if I want to supply the user with query options on that feature?

0 Kudos
1 Solution

Accepted Solutions
RobertScheitlin__GISP
MVP Emeritus

How to redirect the left click to not open the regular popup

I thought that was pretty clear from my previous reply. The link I provided shows how to prevent the standard popup from appearing.

As far as making your popup show instead you just simply add a view click listener.

Setting it back to the default popup is as simple as undoing what you did to prevent it.

View solution in original post

8 Replies
MichaelLev
Regular Contributor

Dear Robert Scheitlin, GISP, no one has referred frm 3 Oct... Can you help, please?

0 Kudos
RobertScheitlin__GISP
MVP Emeritus
0 Kudos
MichaelLev
Regular Contributor

But I don't want to block or replace the default popup... I want that left-click on feature will still open the default popup, but that right-click on feature will open my custom-widget (or custom-popup) on that feature.

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

Michael,

   You are going to find very little info on adding a right click event to WAB as it is a very poor workflow choice. There is no right click on mobile, Apple is not a big supporter of right click, actually Windows is the main platform that uses right click. The few threads I have seen about adding right click to WAB normally they change their mind for a alternate workflow. But if that is your choice then the answer is just add a  view click listener and check the button property of the event.

https://developers.arcgis.com/javascript/latest/api-reference/esri-views-SceneView.html#event-click 

MichaelLev
Regular Contributor

Thank you very much, Robert, for this very  important insight!

So I have to use the left click, and have to be able to "choose" by some button, which popup will be opened, the default popup, or my special popup (or custom-widget).

How should I program this "switch" which will be opened by the left click?

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

That is completely up to you as the developer. Maybe a button in a widget or something.

0 Kudos
MichaelLev
Regular Contributor

I'll make it clear what I ask: How to redirect the left click to not open the regular popup but my custom widget (and how to set it back to the regular popup, after I opened the custom widget)

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

How to redirect the left click to not open the regular popup

I thought that was pretty clear from my previous reply. The link I provided shows how to prevent the standard popup from appearing.

As far as making your popup show instead you just simply add a view click listener.

Setting it back to the default popup is as simple as undoing what you did to prevent it.