Select to view content in your preferred language

Popup Misbehaves

2527
4
10-27-2010 08:00 AM
BrianKowalski
Occasional Contributor
Greetings,


I create a Popup,
Tell it how big to be,
Tell it what to say,
Would also like to tell it where to go (placement - relative or absolute - on the screen),
And it seems to take these instructions as suggestions.

How do you make it behave?

Here is some code: All parameters are valid data...

Point point = new Point(position.Lon, position.Lat);
Popup popup = new Popup(mapDisplay, popupInfo, popupTitle, point);

//Setting this helps to a degree, if I leave them off it is way too small
// but it only increases in size to a certain degree. What is particularly anoying is
// I cannot make it size to the point where the scroll bars do not show up.
popup.PopupHeight = 700;
popup.PopupWidth = 600;

popup.Activate();

Here you just see the size being set.

I have also been trying to display data that includes a table.
The table shows up with a table border and border on the cells (td tags)
So I tell the table border='0' and rules='none'
It still has borders.

I look at the source (right click the popup contents - then click view source)
and there are style settings prefixed to my content.
The style sets the table border and td border.

So I search for that style in the AGX install folder and find default.css
It has the styles just as in my popup source.
I edit the default.css file and remove these border settings.
Restart AGX.
And it still has borders.

Note: this would not be an optimal solution anyway because it would not be feasable to change the default.css file on all of our workstations (in the thousands)

However, I was just trying to get a handle on how to make it do what I want it to do.


Finally, being able to tell it where to display on the application would be nice. Such as "top left corner of the map display"). Is there any way to accomplish any of this?

Any help is greatly appreciated.


Thanks much!
0 Kudos
4 Replies
BrianKowalski
Occasional Contributor
I figured out a workaround for the content and sizing related issues.
Instead of putting contents in the Content Property of the popup.
Put a reference to the contents via an iframe tag.

Also add sizing, border, margin, scrolling, etc information to the iframe tag.

This worked for me:

String popupContentsIframe ="<iframe width='100%' height='100%' frameborder='0' " +
"marginwidth='0' marginheight='0' scrolling='no' " +
"src='http://myserver.com/getpopuphtml.aspx?id=123'></iframe>";

Point point = new Point(position.Lon, position.Lat);
Popup popup = new Popup(mapDisplay, popupContentsIframe, name, point)
{ PopupHeight = 440, PopupWidth = 480 };
popup.Activate();


Then http://myserver.com/getpopuphtml.aspx?id=123 returns my borderless tables and formatted text.


I would still, however, like to be able to tell the popup Where to open.


Thanks!
0 Kudos
AndreiIvanov
Deactivated User
Brian,

walkaround for this issue is to use Note instead of a Popup with "<html>" or "<style>" tag as first element in your content. For example:

 
    string content = "<html><table border=\"0\"><tr><td>row 1, cell 1</td><td>row 1, cell 2</td></tr><tr><td>row 2, cell 1</td><td>row 2, cell 2</td></tr></table></html>";
      Size sz = new Size(700, 600);

      Note note = new Note("Title", ESRI.ArcGISExplorer.Application.Application.ActiveMapDisplay.Center);
      note.Popup.Content = content;
      note.Popup.Size = sz;
      ESRI.ArcGISExplorer.Application.Application.ActiveMapDisplay.Map.ChildItems.Insert(0, note);
      note.Popup.Activate();
0 Kudos
BrianKowalski
Occasional Contributor
Andriy,
Thanks for your response.

This may work for the other user that posted - Christopher.
But unfortunately I use a Popup because I don't want to add a Note to the MapContents.

If I could create a Note and display it without adding it to the MapContents then it may be a viable workaround. But then that would essentially be a Popup...

For now the iframe solution works rather well.

Thanks again!
0 Kudos
AndreiIvanov
Deactivated User
Brian,

I will make sure this is fixed for the next release of ArcGIS Explorer. Thanks for identifying the issue.
0 Kudos