home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2002 March / PCWMAR02.iso / software / turbocad / v8trial / TurboCADv8ProfessionalNoReg.exe / Data.Cab / F41360_modProperties.bas < prev    next >
Encoding:
BASIC Source File  |  2001-10-16  |  3.5 KB  |  116 lines

  1. Attribute VB_Name = "modProperties"
  2. '******************************************************************'
  3. '*                                                                *'
  4. '*                      TurboCAD for Windows                      *'
  5. '*                   Copyright (c) 1993 - 2001                    *'
  6. '*             International Microcomputer Software, Inc.         *'
  7. '*                            (IMSI)                              *'
  8. '*                      All rights reserved.                      *'
  9. '*                                                                *'
  10. '******************************************************************'
  11.  
  12. Option Explicit
  13.  
  14. Public Function PropertyFlagsAsString(ByVal prop As Property)
  15.     On Error Resume Next
  16.     Dim s As String
  17.     s = ""
  18.     If prop.IsAttribute Then s = s & "Attr "
  19.     If prop.ReadOnly Then s = s & "RO   "
  20.     PropertyFlagsAsString = s
  21. End Function
  22.  
  23. Public Function PropertyTypeAsString(ByVal prop As Property)
  24.     On Error Resume Next
  25.     Dim s, s2 As String
  26.     Dim t As Integer
  27.     t = 0
  28.     t = prop.Type
  29.     If (t And vbArray) <> 0 Then
  30.         t = t And 8191
  31.         s2 = "()"
  32.     Else
  33.         s2 = ""
  34.     End If
  35.     Select Case t
  36.         Case vbEmpty: s = "Empty"
  37.         Case vbError: s = "Error"
  38.         Case vbByte: s = "Byte"
  39.         Case vbString: s = "String"
  40.         Case vbBoolean: s = "Boolean"
  41.         Case vbInteger: s = "Integer"
  42.         Case vbLong: s = "Long"
  43.         Case vbSingle: s = "Single"
  44.         Case vbDouble: s = "Double"
  45.         Case vbObject: s = "Object"
  46.         Case Else:
  47.             s = "?" & t
  48.             MsgBox "Unknown type: " & t
  49.     End Select
  50.     PropertyTypeAsString = s & s2
  51. End Function
  52.  
  53. Public Function PropertyValueAsString(ByVal prop As Property)
  54.     On Error Resume Next
  55.     Dim i, l, u, t As Integer
  56.     Dim s As String
  57.     Dim arr As Variant
  58.     s = "<Err>"
  59.     t = 0
  60.     t = prop.Type
  61.     If (t And vbArray) <> 0 Then
  62.         arr = prop.Value
  63.         l = LBound(arr)
  64.         u = UBound(arr)
  65.         s = "("
  66.         For i = l To u
  67.             s = s & arr(i)
  68.             If i < u Then s = s & ", "
  69.         Next
  70.         s = s & ")"
  71.     Else
  72.         s = prop.Value
  73.     End If
  74.     PropertyValueAsString = s
  75. End Function
  76.     
  77. Public Sub PrintPropertiesToFile(ByVal props As Properties)
  78.     On Error Resume Next
  79.     Dim i, count As Integer
  80.     Dim prop As Property
  81.     count = props.count
  82.     Print #1, "      " & count & " Properties:"
  83.     For i = 0 To count - 1
  84.         Set prop = props(i)
  85.         Print #1, "[" & i & "] Name " & prop.Name
  86.         Print #1, "Flags " & PropertyFlagsAsString(prop)
  87.         Print #1, " Type " & PropertyTypeAsString(prop)
  88.         Print #1, "Value " & PropertyValueAsString(prop)
  89.     Next
  90. End Sub
  91.  
  92. Public Sub DebugPrintProperties(ByVal props As Properties)
  93.     On Error Resume Next
  94.     Dim i, count As Integer
  95.     Dim prop As Property
  96.     count = props.count
  97.     Debug.Print "      " & count & " Properties:"
  98.     For i = 0 To count - 1
  99.         Set prop = props(i)
  100.         Debug.Print " Name " & prop.Name
  101.         Debug.Print "Flags " & PropertyFlagsAsString(prop)
  102.         Debug.Print " Type " & PropertyTypeAsString(prop)
  103.         Debug.Print "Value " & PropertyValueAsString(prop)
  104.     Next
  105. End Sub
  106.  
  107. Public Sub DebugAppProperties()
  108.     DebugPrintProperties Application.Properties
  109. End Sub
  110.  
  111. Public Sub DebugDwgProperties()
  112.     DebugPrintProperties ActiveDrawing.Properties
  113. End Sub
  114.  
  115.  
  116.