HOW TO
It may be desirable to display a "Please Wait", or other message, in the client browser while processing takes place on the mapserver. You can accomplish this using two transactions. This document describes the conceptual steps involved.
Code:
.WriteString "<FORM NAME=MapForm TARGET=MapFrame ACTION=/scripts/esrimap.dll>" & vbCrLf
.WriteString "<INPUT TYPE=hidden NAME=name VALUE=MyMapservice>" & vbCrLf
' add radios
.WriteString "<INPUT TYPE=RADIO NAME=Cmd VALUE=ZoomIn " & _
IIf(f_bZoomSelected, "CHECKED", "") & "> Zoom In" & vbCrLf
Code:
.WriteString "<FORM NAME=MapForm TARGET=MapFrame ACTION=/scripts/esrimap.dll>" & vbCrLf
.WriteString "<INPUT TYPE=hidden NAME=name VALUE=MyMapservice>" & vbCrLf
.WriteString "<INPUT TYPE=hidden NAME=waitpage VALUE=waitpage>" & vbCrLf
' add radios
.WriteString "<INPUT TYPE=RADIO NAME=Cmd VALUE=ZoomIn " & _
IIf(f_bZoomSelected, "CHECKED", "") & "> Zoom In" & vbCrLf
Code:
' Check to see if waitpage is to be sent
Dim i As Integer
For i = 0 To arguments.Count - 1
If UCase$(arguments(i)) = "WAITPAGE" Then
' Call new sub to create "Please Wait" page on server.
' Pass all request information to the new subroutine:
' what action was requested by the client, the
' current map extent, where the user clicked, etc.
DoWaitPage strCMD, oExt, lClickX, lClickY
' Set any global variables to Nothing here, to ensure mapserver is stateless
Exit Sub
End If
Next i
Code:
Public Sub DoWaitPage(cmd As String, ext As MapObjects.Rectangle, x As Long, y As Long)
With WebLink
' specify what type of data we are going to send to the browser
.WriteResponseHeader "Content-type: text/html" + vbCrLf + vbCrLf
.WriteString "<HTML><HEAD>" & vbCrLf
'
' Write JavaScript functions into the header section of the HTML doc
.WriteString "<SCRIPT LANGUAGE=""JavaScript"">" & vbCrLf
.WriteString " function TimeOut() {" & vbCrLf
.WriteString " timerID = setTimeout(""GetMap()"", 100);" & vbCrLf
.WriteString " }" & vbCrLf
.WriteString " function GetMap() {" & vbCrLf
.WriteString " parent.MapFrame.location = 'http://<WEBSERVER>/scripts/esrimap.dll?" & _
"name=MyMapServiceName&cmd=" & cmd & "&Top=" & ext.Top & "&Bottom=" & ext.Bottom & _
"&Left=" & ext.Left & "&Right=" & ext.Right & "&click.x=" & x & "&click.y=" & y & "';" & vbCrLf
.WriteString " }" & vbCrLf
.WriteString "</SCRIPT>" & vbCrLf
.WriteString "<TITLE>MOIMS PleaseWait MapService</TITLE> </HEAD>" & vbCrLf
'
' Call the TimeOut function when the page is loaded
.WriteString "<BODY onLoad=""TimeOut()"" BGCOLOR=#ffffff>" & vbCrLf
'
' Add HTML code here to display the "Please Wait" message or graphic
.WriteString "Please wait... :-)" & vbCrLf
.WriteString "</BODY></HTML>" & vbCrLf
End With
End Sub
Warning:
Please note the code above is for illustration purposes only. Be aware that browsers have different ways of referring to documents; please consult the Document Object Model for the browser to determine the correct syntax. Also, some browsers may not support JavaScript functions.
Article ID:000002275
Get help from ArcGIS experts
Download the Esri Support App