Select to view content in your preferred language

HowTo Programatically Disable Popups

1302
5
Jump to solution
10-01-2012 01:21 PM
BrianKowalski
Occasional Contributor
I am creating a FeatureLayer and adding it thru the API. How do you turn off Popups thru the API?

There is an option to "Don't display popup window" in the Layer Properties dialog after the layer is added.
But I need to do this for the user via the API as I am adding/removing many Feature Layers thru my Addin.

Thanks much,
0 Kudos
1 Solution

Accepted Solutions
ErinBrimhall
Deactivated User
This property defaults to ???false??? and if set to ???true??? the FeatureLayer will display MapTips...


Are you sure you're setting the value of the "PopupType" attribute of the "PopupProperties" object?  "PopupType" is an enumeration, so when you said it was defaulting to "false" that tells me you were most likely setting some other property, e.g. "ShowTips".

I know that setting PopupType to PopupLayerType.None hides on-click popups from appearing, at least for ServiceLayer objects, as we are using this approach in one of our own projects.  I haven't tried specifically with a FeatureLayer, but I would expect the functionality to be the same.

View solution in original post

0 Kudos
5 Replies
BrianKowalski
Occasional Contributor
If there is no way to reliably detect "Visible" there are ways to use a couple of Events to infer Visibility.

      //Is true when the Addin is Created
      private bool _isVisible = true;
      //Fires when the Addin is Hidden - But ONLY when it is hidden
      private void SilcObjectBrowser_VisibleChanged(object sender, EventArgs e)
      {
         //Even though the Addin is now hidden, this.Visible == true!!!
         _isVisible = false;
      }
      //Will only fire when the Addin is Visible
      private void SilcObjectBrowser_Paint(object sender, PaintEventArgs e)
      {
         _isVisible = true;
      }
      //Return the current state of _isVisible
      public bool IsVisible { get { return _isVisible; } }


This is a start. BUT I would actually like to be able to reliably detect when an Addin is *Active*. Example:

I have an Addin. I click the Button to create and show it: it's now Visible AND *Active*. I Dock it with the Content Window as a tab. So now I have my Addin and the Contents Window on the same Dock Control each having a separate tab. If I click the Contents Window tab, my Addin is not Visible (and the above code will detect this). BUT, it is *Active* and I need to know that.

Is there a straight forward way to detect *Active*? If not, is there a not so straight forward way, like using Events such as above?

Thanks much,
0 Kudos
ErinBrimhall
Deactivated User
I am creating a FeatureLayer and adding it thru the API. How do you turn off Popups thru the API?

There is an option to "Don't display popup window" in the Layer Properties dialog after the layer is added.
But I need to do this for the user via the API as I am adding/removing many Feature Layers thru my Addin.

Thanks much,


Hi Brian,

Have you tried something like this?

FeatureLayer.PopupProperties.PopupType = PopupLayerType.None;
0 Kudos
BrianKowalski
Occasional Contributor
Hi Brian,

Have you tried something like this?

FeatureLayer.PopupProperties.PopupType = PopupLayerType.None;



Yes Ebrim I tried that. This property defaults to �??false�?� and if set to �??true�?� the FeatureLayer will display MapTips. But these are totally different and work when the mouse hovers over a Feature as opposed to clicking.

Ironically, if I could not turn MapTips off it would be ok. But the Popups are a big problem.

I have tried everything on the FeatureLayer Class I could think of including removing the entire PopupProperties itself. This just yielded an empty Popup, but it still displayed.

I have a kludge of a workaround though. Since I can�??t access a Property to turn off Popups I force the Popup Closed after it opens. This is very clunky and a bit ugly, but it is better than requiring the user to close it on every map navigation click.

As I said this solution is clunky and I would love a way to turn off Popups thru API �?? either supported or unsupported 😉


Thanks very much for the suggestion though!
0 Kudos
ErinBrimhall
Deactivated User
This property defaults to ???false??? and if set to ???true??? the FeatureLayer will display MapTips...


Are you sure you're setting the value of the "PopupType" attribute of the "PopupProperties" object?  "PopupType" is an enumeration, so when you said it was defaulting to "false" that tells me you were most likely setting some other property, e.g. "ShowTips".

I know that setting PopupType to PopupLayerType.None hides on-click popups from appearing, at least for ServiceLayer objects, as we are using this approach in one of our own projects.  I haven't tried specifically with a FeatureLayer, but I would expect the functionality to be the same.
0 Kudos
BrianKowalski
Occasional Contributor
Erin,

My bad! That is exactly what I wanted. I was looking at the wrong Property.

Thanks much!
0 Kudos