ArcPad Scripting Object Model
CreateAppObject Method
See Also  Example  Send comments on this topic.
pTypeName
Required. A String that represents the type of object to be created.
Application Object : CreateAppObject Method

Glossary Item Box

Description

Creates and returns a reference to a creatable ArcPad object.

Syntax

Set variable = object.CreateAppObject ( pTypeName )

Parameters

pTypeName
Required. A String that represents the type of object to be created.

Return Type

Object

Remarks

The following Object Types are supported:

"Archive", "ArcIMS", "CoordSys", "Ellipse", "File", "Font", "FTP", "INET", "Line", "Point", "Points", "Polygon", "RecordSet", "Rectangle", "Symbol", "TextSymbol"

Example

  • CenterAt and CenterAtXY Example
  • Drawshape Example
  • INET Example
  • ShowColor Example
  • ShowFont Example
Centers the map at the location clicked by the user.
CenterAt and CenterAtXY (VBScript)Copy Code
Sub CenterMap
  Dim objPoint
  Set objPoint = Application.CreateAppObject("point")
  objPoint.X = Application.Map.PointerX
  objPoint.Y = Application.Map.PointerY
  Application.Map.CenterAt(objPoint)
  Set objPoint = Nothing
End Sub

Sub CenterMapXY
  Dim lngPointerX, lngPointerY
  lngPointerX = Application.Map.PointerX
  lngPointerY = Application.Map.PointerY
  Call Application.Map.CenterAtXY(lngPointerX,lngPointerY)
End Sub
Opens a URL and displays the results in a message box.
INET (VBScript)Copy Code
Sub OpenESRI
  Dim objNet, strURL, varData
  Set objNet = Application.CreateAppObject("INET")
  strURL = "http://www.esri.com"
  'Display the host name in a message box
  MsgBox objNet.HostName, vbOKOnly, "HostName"
  varData = objNet.OpenURL(strURL)
  'Display the data in a message box.
  MsgBox varData, vbOKOnly, strURL
  Set objNet = Nothing
End Sub
Allows the user to select a color, displays the RGB values of the selected color, and displays a rectangle filled with selected color on the screen.
ShowColor (VBScript)Copy Code
Sub SymbolColor
      'Create a symbol object
      Dim pSymbol
      Set pSymbol = Application.CreateAppObject("Symbol")
      
      'Construct a default color of purple
      Dim lngDefaultColor
      lngDefaultColor = pSymbol.MakeColor(255,0,255)
      
      'Get a color from the user, using purple as the default
      Dim varSelColor
      varSelColor = CommonDialog.ShowColor (lngDefaultcolor)
      
      'Display RGB components of the selected color
      MsgBox "RGB components of your selected color:" & vbCrlf & _
               "Red: " & pSymbol.GetRed(varSelColor) & vbCrlf & _
               "Green: " & pSymbol.GetGreen(varSelColor) & vbCrlf & _
               "Blue: " & pSymbol.GetBlue(varSelColor),vbInformation,"RGB"
      
      'Create a rectangle to draw on the screen
      Dim pRect
      Set pRect = Map.Extent
      pRect.ScaleRectangle 0.3
      
      'Set the symbol's fill color to the color selected by the user
      pSymbol.FillColor = varSelColor
      pSymbol.FillStyle = 0
      
      'Draw the rectangle
      Map.DrawShape pRect, pSymbol
End Sub
Allows the user to select a font and displays the font details.
ShowFont Example (VBScript)Copy Code
Sub ShowFont
      Dim pFont, blnOK
      Set pFont = Application.CreateAppObject ("font")
      
      blnOK = CommonDialog.ShowFont (pFont)
      If blnOK Then
            MsgBox "Here are the details of the font you selected:" & vbCrlf & _
                        "Bold: " & pFont.Bold & vbCrlf & _
                        "Charset: " & pFont.Charset & vbCrlf & _
                        "Italic: " & pFont.Italic & vbCrlf & _
                        "Name: " & pFont.Name & vbCrlf & _
                        "Size: " & pFont.Size & vbCrlf & _
                        "Strikethrough: " & pFont.StrikeThrough & vbCrlf & _
                        "Underlined: " & pFont.Underline & vbCrlf & _
                        "Weight: " & pFont.Weight, vbInformation, "Font details"
      Else
            MsgBox "No font selected.  The Cancel button was pushed.", vbInformation, "No font selected"
      End If
End Sub

See Also

© 2012 All Rights Reserved.