home *** CD-ROM | disk | FTP | other *** search
/ Hot Shareware 35 / hot35.iso / ficheros / LVB / T2W32543.ZIP / _OBJECT.FRM < prev    next >
Text File  |  1998-05-21  |  16KB  |  435 lines

  1. VERSION 5.00
  2. Begin VB.Form frmObject 
  3.    BorderStyle     =   4  'Fixed ToolWindow
  4.    Caption         =   "Object"
  5.    ClientHeight    =   4845
  6.    ClientLeft      =   1890
  7.    ClientTop       =   3270
  8.    ClientWidth     =   7485
  9.    MaxButton       =   0   'False
  10.    MDIChild        =   -1  'True
  11.    PaletteMode     =   1  'UseZOrder
  12.    ScaleHeight     =   4845
  13.    ScaleWidth      =   7485
  14.    ShowInTaskbar   =   0   'False
  15.    Begin VB.Frame Frame2 
  16.       Caption         =   "Test Frame"
  17.       Height          =   750
  18.       Left            =   90
  19.       TabIndex        =   7
  20.       Top             =   4050
  21.       Width           =   7260
  22.       Begin VB.Label Label1 
  23.          Alignment       =   2  'Center
  24.          Caption         =   "Test Label"
  25.          DataField       =   "DataField for Label1"
  26.          ForeColor       =   &H00FF0000&
  27.          Height          =   330
  28.          Left            =   180
  29.          MousePointer    =   14  'Arrow and Question
  30.          TabIndex        =   8
  31.          Tag             =   "Tag for Label1"
  32.          Top             =   270
  33.          Width           =   7050
  34.       End
  35.    End
  36.    Begin VB.Frame Frame1 
  37.       Height          =   570
  38.       Left            =   0
  39.       TabIndex        =   1
  40.       Top             =   -90
  41.       Width           =   7485
  42.       Begin VB.CommandButton cmdNP 
  43.          Caption         =   ">"
  44.          Height          =   285
  45.          Index           =   1
  46.          Left            =   7110
  47.          TabIndex        =   6
  48.          Top             =   195
  49.          Width           =   285
  50.       End
  51.       Begin VB.CommandButton cmdNP 
  52.          Caption         =   "<"
  53.          Height          =   285
  54.          Index           =   0
  55.          Left            =   6210
  56.          TabIndex        =   5
  57.          Top             =   195
  58.          Width           =   285
  59.       End
  60.       Begin VB.CommandButton Command1 
  61.          Caption         =   "&Go"
  62.          Default         =   -1  'True
  63.          Height          =   285
  64.          Left            =   6570
  65.          TabIndex        =   4
  66.          Top             =   195
  67.          Width           =   465
  68.       End
  69.       Begin VB.ComboBox cmb_Function 
  70.          Height          =   315
  71.          Left            =   1365
  72.          TabIndex        =   2
  73.          Top             =   180
  74.          Width           =   4755
  75.       End
  76.       Begin VB.Label Label2 
  77.          Caption         =   "&Select a function"
  78.          Height          =   255
  79.          Left            =   90
  80.          TabIndex        =   3
  81.          Top             =   210
  82.          Width           =   1275
  83.       End
  84.    End
  85.    Begin VB.TextBox txt_Result 
  86.       BackColor       =   &H00C0C0C0&
  87.       BorderStyle     =   0  'None
  88.       Height          =   3270
  89.       Left            =   105
  90.       Locked          =   -1  'True
  91.       MultiLine       =   -1  'True
  92.       ScrollBars      =   2  'Vertical
  93.       TabIndex        =   0
  94.       Top             =   630
  95.       Width           =   7260
  96.    End
  97. End
  98. Attribute VB_Name = "frmObject"
  99. Attribute VB_GlobalNameSpace = False
  100. Attribute VB_Creatable = False
  101. Attribute VB_PredeclaredId = True
  102. Attribute VB_Exposed = False
  103. Option Explicit
  104. Option Base 1
  105.  
  106. Private Const Iteration = 250
  107.  
  108. Dim IsLoaded         As Integer
  109.  
  110. Dim TimerStartOk     As Integer
  111. Dim TimerCloseOk     As Integer
  112.  
  113. Dim TimerHandle      As Integer
  114. Dim TimerValue       As Long
  115. Private Sub cmdNP_Click(Index As Integer)
  116.  
  117.    Call sub_NextPrev(cmb_Function, Index)
  118.  
  119. End Sub
  120. Private Sub cmb_Function_Click()
  121.    
  122.    If (IsLoaded = False) Then Exit Sub
  123.    
  124.    Call cDisableFI(mdiT2W.Picture1)
  125.    
  126.    txt_Result = ""
  127.    
  128.    DoEvents
  129.    
  130.    Select Case cmb_Function.ListIndex
  131.       Case 0
  132.          Call TestObjectGetX
  133.       Case 1
  134.          Call TestGetObjX
  135.       Case 2
  136.          Call TestObjectPutX
  137.       Case 3
  138.          Call TestPutObjX
  139.       Case 4
  140.          Call TestEnumObjects
  141.    End Select
  142.  
  143.    DoEvents
  144.    Call cEnableFI(mdiT2W.Picture1)
  145.    
  146. End Sub
  147. Private Sub Form_Activate()
  148.  
  149.    mdiT2W.Label2.Caption = cInsertBlocks(mdiT2W.Label2.Tag, "" & Iteration)
  150.  
  151. End Sub
  152. Private Sub Form_Load()
  153.  
  154.    IsLoaded = False
  155.    
  156.    Show
  157.  
  158.    Call sub_Load_Combo(cmb_Function, T2WDirInst + "_object.t2w")
  159.    
  160.    IsLoaded = True
  161.    
  162. End Sub
  163. Private Sub Command1_Click()
  164.    
  165.    Call cmb_Function_Click
  166.    
  167. End Sub
  168. Private Sub TestObjectGetX()
  169.  
  170.    Dim intResult        As Integer
  171.    Dim strResult        As String
  172.    Dim strDisplay       As String
  173.    
  174.    Dim i                As Integer
  175.    
  176.    strResult = ""
  177.    strDisplay = ""
  178.  
  179.    strDisplay = strDisplay & "ObjectGetX for Frame2" & vbCrLf & vbCrLf
  180.    strDisplay = strDisplay & "Boolean (property 'enabled') is '" & cObjectGetBoolean(Frame2, "enabled") & "'" & vbCrLf
  181.    strDisplay = strDisplay & "Byte (property 'alignment') is '" & cObjectGetByte(Frame2, "alignment") & "'" & vbCrLf
  182.    strDisplay = strDisplay & "Integer (property 'mousepointer') is '" & cObjectGetInteger(Frame2, "mousepointer") & "'" & vbCrLf
  183.    strDisplay = strDisplay & "Long (property 'forecolor') is '" & cObjectGetLong(Frame2, "forecolor") & "'" & vbCrLf
  184.    strDisplay = strDisplay & "String (property 'caption') is '" & cObjectGetString(Frame2, "caption") & "'" & vbCrLf
  185.    strDisplay = strDisplay & "Variant (property 'tabindex') is '" & cObjectGetVariant(Frame2, "tabindex") & "'" & vbCrLf
  186.    strDisplay = strDisplay & "Variant (property 'caption') is '" & cObjectGetVariant(Frame2, "caption") & "'" & vbCrLf
  187.    strDisplay = strDisplay & "Variant (property 'visible') is '" & cObjectGetVariant(Frame2, "visible") & "'" & vbCrLf
  188.    strDisplay = strDisplay & "Index (property 'index') is '" & cObjectGetIndex(Frame2) & "'" & vbCrLf
  189.  
  190.    strDisplay = strDisplay & vbCrLf
  191.    
  192.    strDisplay = strDisplay & "ObjectGetX for Label1" & vbCrLf & vbCrLf
  193.    strDisplay = strDisplay & "Boolean (property 'enabled') is '" & cObjectGetBoolean(Label1, "enabled") & "'" & vbCrLf
  194.    strDisplay = strDisplay & "Byte (property 'alignment') is '" & cObjectGetByte(Label1, "alignment") & "'" & vbCrLf
  195.    strDisplay = strDisplay & "Integer (property 'mousepointer') is '" & cObjectGetInteger(Label1, "mousepointer") & "'" & vbCrLf
  196.    strDisplay = strDisplay & "Long (property 'forecolor') is '" & cObjectGetLong(Label1, "forecolor") & "'" & vbCrLf
  197.    strDisplay = strDisplay & "String (property 'caption') is '" & cObjectGetString(Label1, "caption") & "'" & vbCrLf
  198.    strDisplay = strDisplay & "Variant (property 'tabindex') is '" & cObjectGetVariant(Label1, "tabindex") & "'" & vbCrLf
  199.    strDisplay = strDisplay & "Variant (property 'caption') is '" & cObjectGetVariant(Label1, "caption") & "'" & vbCrLf
  200.    strDisplay = strDisplay & "Variant (property 'visible') is '" & cObjectGetVariant(Label1, "visible") & "'" & vbCrLf
  201.    strDisplay = strDisplay & "Index (property 'index') is '" & cObjectGetIndex(Label1) & "'"
  202.  
  203.    txt_Result = strDisplay
  204.    
  205.    'time the function
  206.  
  207.    TimerHandle = cTimerOpen()
  208.    TimerStartOk = cTimerStart(TimerHandle)
  209.    
  210.    For i = 1 To Iteration
  211.       strResult = cObjectGetString(cmb_Function, "text")
  212.    Next i
  213.    
  214.    mdiT2W.pnl_Timer = cTimerRead(TimerHandle)
  215.    
  216.    TimerCloseOk = cTimerClose(TimerHandle)
  217.  
  218. End Sub
  219. Private Sub TestGetObjX()
  220.  
  221.    Dim intResult        As Integer
  222.    Dim strResult        As String
  223.    Dim strDisplay       As String
  224.    
  225.    Dim i                As Integer
  226.    
  227.    strResult = ""
  228.    strDisplay = ""
  229.  
  230.    strDisplay = strDisplay & "GetObjX for Frame2" & vbCrLf & vbCrLf
  231.    strDisplay = strDisplay & "Caption is '" & cGetObjCaption(Frame2) & "'" & vbCrLf
  232.    strDisplay = strDisplay & "Container is '" & cGetObjContainer(Frame2) & "'" & vbCrLf
  233.    strDisplay = strDisplay & "Parent is '" & cGetObjParent(Frame2) & "'" & vbCrLf
  234.    strDisplay = strDisplay & "Tag is '" & cGetObjTag(Frame2) & "'" & vbCrLf
  235.    strDisplay = strDisplay & "Text is '" & cGetObjText(Frame2) & "'" & vbCrLf
  236.    strDisplay = strDisplay & "DataField is '" & cGetObjDataField(Frame2) & "'" & vbCrLf
  237.    strDisplay = strDisplay & "DataSource is '" & cGetObjDataSource(Frame2) & "'" & vbCrLf
  238.    strDisplay = strDisplay & "Name is '" & cGetObjName(Frame2) & "'" & vbCrLf
  239.    strDisplay = strDisplay & "Index is '" & cGetObjIndex(Frame2) & "'" & vbCrLf
  240.    strDisplay = strDisplay & "NameIndex is '" & cGetObjNameIndex(Frame2) & "'" & vbCrLf
  241.    strDisplay = strDisplay & "ClassName is '" & cGetObjClassName(Frame2) & "'" & vbCrLf
  242.  
  243.    strDisplay = strDisplay & vbCrLf
  244.    
  245.    strDisplay = strDisplay & "GetObjX for Label1" & vbCrLf & vbCrLf
  246.    strDisplay = strDisplay & "Caption is '" & cGetObjCaption(Label1) & "'" & vbCrLf
  247.    strDisplay = strDisplay & "Container is '" & cGetObjContainer(Label1) & "'" & vbCrLf
  248.    strDisplay = strDisplay & "Parent is '" & cGetObjParent(Label1) & "'" & vbCrLf
  249.    strDisplay = strDisplay & "Tag is '" & cGetObjTag(Label1) & "'" & vbCrLf
  250.    strDisplay = strDisplay & "Text is '" & cGetObjText(Label1) & "'" & vbCrLf
  251.    strDisplay = strDisplay & "DataField is '" & cGetObjDataField(Label1) & "'" & vbCrLf
  252.    strDisplay = strDisplay & "DataSource is '" & cGetObjDataSource(Label1) & "'" & vbCrLf
  253.    strDisplay = strDisplay & "Name is '" & cGetObjName(Label1) & "'" & vbCrLf
  254.    strDisplay = strDisplay & "Index is '" & cGetObjIndex(Label1) & "'" & vbCrLf
  255.    strDisplay = strDisplay & "NameIndex is '" & cGetObjNameIndex(Label1) & "'" & vbCrLf
  256.    strDisplay = strDisplay & "ClassName is '" & cGetObjClassName(Label1) & "'" & vbCrLf
  257.  
  258.    txt_Result = strDisplay
  259.    
  260.    'time the function
  261.  
  262.    TimerHandle = cTimerOpen()
  263.    TimerStartOk = cTimerStart(TimerHandle)
  264.    
  265.    For i = 1 To Iteration
  266.       strResult = cGetObjContainer(cmb_Function)
  267.    Next i
  268.    
  269.    mdiT2W.pnl_Timer = cTimerRead(TimerHandle)
  270.    
  271.    TimerCloseOk = cTimerClose(TimerHandle)
  272.  
  273. End Sub
  274. Private Sub TestObjectPutX()
  275.  
  276.    Dim intResult        As Integer
  277.    Dim strResult        As String
  278.    Dim strDisplay       As String
  279.    
  280.    Dim i                As Integer
  281.    
  282.    strResult = ""
  283.    strDisplay = ""
  284.  
  285.    strDisplay = strDisplay & "ObjectPutX for Frame2" & vbCrLf & vbCrLf
  286.    Call cObjectPutBoolean(Frame2, "enabled", False)
  287.    strDisplay = strDisplay & "Boolean (property 'enabled') is '" & cObjectGetBoolean(Frame2, "enabled") & "'" & vbCrLf
  288.    Call cObjectPutByte(Frame2, "alignment", 1)
  289.    strDisplay = strDisplay & "Byte (property 'alignment') is '" & cObjectGetByte(Frame2, "alignment") & "'" & vbCrLf
  290.    Call cObjectPutInteger(Frame2, "mousepointer", 7)
  291.    strDisplay = strDisplay & "Integer (property 'mousepointer') is '" & cObjectGetInteger(Frame2, "mousepointer") & "'" & vbCrLf
  292.    Call cObjectPutLong(Frame2, "forecolor", &HC0C0C0)
  293.    strDisplay = strDisplay & "Long (property 'forecolor') is '" & cObjectGetLong(Frame2, "forecolor") & "'" & vbCrLf
  294.    Call cObjectPutString(Frame2, "caption", "Frame2.Caption is now this")
  295.    strDisplay = strDisplay & "String (property 'caption') is '" & cObjectGetString(Frame2, "caption") & "'" & vbCrLf
  296.  
  297.    strDisplay = strDisplay & vbCrLf
  298.    
  299.    strDisplay = strDisplay & "ObjectPutX for Label1" & vbCrLf & vbCrLf
  300.    Call cObjectPutBoolean(Label1, "enabled", False)
  301.    strDisplay = strDisplay & "Boolean (property 'enabled') is '" & cObjectGetBoolean(Label1, "enabled") & "'" & vbCrLf
  302.    Call cObjectPutByte(Label1, "alignment", 1)
  303.    strDisplay = strDisplay & "Byte (property 'alignment') is '" & cObjectGetByte(Label1, "alignment") & "'" & vbCrLf
  304.    Call cObjectPutInteger(Label1, "mousepointer", 7)
  305.    strDisplay = strDisplay & "Integer (property 'mousepointer') is '" & cObjectGetInteger(Label1, "mousepointer") & "'" & vbCrLf
  306.    Call cObjectPutLong(Label1, "forecolor", &HC0C0C0)
  307.    strDisplay = strDisplay & "Long (property 'forecolor') is '" & cObjectGetLong(Label1, "forecolor") & "'" & vbCrLf
  308.    Call cObjectPutString(Label1, "caption", "Label1.Caption is now this")
  309.    strDisplay = strDisplay & "String (property 'caption') is '" & cObjectGetString(Label1, "caption") & "'" & vbCrLf
  310.  
  311.    txt_Result = strDisplay
  312.    
  313.    'time the function
  314.  
  315.    TimerHandle = cTimerOpen()
  316.    TimerStartOk = cTimerStart(TimerHandle)
  317.    
  318.    For i = 1 To Iteration
  319.       If ((i Mod 2) = 0) Then
  320.          Call cObjectPutByte(Label1, "borderstyle", 0)
  321.       Else
  322.          Call cObjectPutByte(Label1, "borderstyle", 1)
  323.       End If
  324.       DoEvents
  325.    Next i
  326.    
  327.    mdiT2W.pnl_Timer = cTimerRead(TimerHandle)
  328.    
  329.    TimerCloseOk = cTimerClose(TimerHandle)
  330.  
  331. End Sub
  332. Private Sub TestPutObjX()
  333.  
  334.    Dim intResult        As Integer
  335.    Dim strResult        As String
  336.    Dim strDisplay       As String
  337.    
  338.    Dim i                As Integer
  339.    
  340.    strResult = ""
  341.    strDisplay = ""
  342.  
  343.    strDisplay = strDisplay & "PutObjX for Frame2" & vbCrLf & vbCrLf
  344.    Call cPutObjCaption(Frame2, "Frame2.Caption set by PutObjCaption")
  345.    strDisplay = strDisplay & "Caption is '" & cGetObjCaption(Frame2) & "'" & vbCrLf
  346.    Call cPutObjDataField(Frame2, "DataField set by PutObjDataField")
  347.    strDisplay = strDisplay & "DataField is '" & cGetObjDataField(Frame2) & "'" & vbCrLf
  348.    Call cPutObjDataSource(Frame2, "DataSource set by PutObjSource")
  349.    strDisplay = strDisplay & "DataSource is '" & cGetObjDataSource(Frame2) & "'" & vbCrLf
  350.    Call cPutObjTag(Frame2, "Tag set by PutObjTag")
  351.    strDisplay = strDisplay & "Tag is '" & cGetObjTag(Frame2) & "'" & vbCrLf
  352.    Call cPutObjText(Frame2, "Text set by PutObjText")
  353.    strDisplay = strDisplay & "Text is '" & cGetObjText(Frame2) & "'" & vbCrLf
  354.  
  355.    strDisplay = strDisplay & vbCrLf
  356.    
  357.    strDisplay = strDisplay & "PutObjX for Label1" & vbCrLf & vbCrLf
  358.    Call cPutObjCaption(Label1, "Label1.Caption set by PutObjCaption")
  359.    strDisplay = strDisplay & "Caption is '" & cGetObjCaption(Label1) & "'" & vbCrLf
  360.    Call cPutObjDataField(Label1, "DataField set by PutObjDataField")
  361.    strDisplay = strDisplay & "DataField is '" & cGetObjDataField(Label1) & "'" & vbCrLf
  362.    Call cPutObjDataSource(Label1, "DataSource set by PutObjSource")
  363.    strDisplay = strDisplay & "DataSource is '" & cGetObjDataSource(Label1) & "'" & vbCrLf
  364.    Call cPutObjTag(Label1, "Tag set by PutObjTag")
  365.    strDisplay = strDisplay & "Tag is '" & cGetObjTag(Label1) & "'" & vbCrLf
  366.    Call cPutObjText(Label1, "Text set by PutObjText")
  367.    strDisplay = strDisplay & "Text is '" & cGetObjText(Label1) & "'" & vbCrLf
  368.  
  369.    txt_Result = strDisplay
  370.    
  371.    'time the function
  372.  
  373.    TimerHandle = cTimerOpen()
  374.    TimerStartOk = cTimerStart(TimerHandle)
  375.    
  376.    For i = 1 To Iteration
  377.       Call cPutObjTag(cmb_Function, "Tag set by PutObjTag")
  378.    Next i
  379.    
  380.    mdiT2W.pnl_Timer = cTimerRead(TimerHandle)
  381.    
  382.    TimerCloseOk = cTimerClose(TimerHandle)
  383.  
  384. End Sub
  385. Private Sub TestEnumObjects()
  386.  
  387.    Dim intResult        As Integer
  388.    Dim strResult        As String
  389.    Dim strDisplay       As String
  390.       
  391.    Dim i                As Integer
  392.    
  393.    Dim ObjectNameIndex  As String
  394.    Dim Obj              As Object
  395.       
  396.    strResult = ""
  397.    strDisplay = ""
  398.    
  399.    strDisplay = strDisplay + "Current objects (format 1) on this form " & vbCrLf & vbCrLf
  400.    
  401.    intResult = cEnumObjects(Me, ENUMOBJECTS_FORMAT1, True, ObjectNameIndex, Obj)
  402.    
  403.    While (intResult = True)
  404.       strDisplay = strDisplay & ObjectNameIndex & vbCrLf
  405.       intResult = cEnumObjects(Me, ENUMOBJECTS_FORMAT1, False, ObjectNameIndex, Obj)
  406.    Wend
  407.    
  408.    strDisplay = strDisplay & vbCrLf
  409.    
  410.    strDisplay = strDisplay + "Current objects (format 2) on this form " & vbCrLf & vbCrLf
  411.  
  412.    intResult = cEnumObjects(Me, ENUMOBJECTS_FORMAT2, True, ObjectNameIndex, Obj)
  413.    
  414.    While (intResult = True)
  415.       strDisplay = strDisplay & ObjectNameIndex & vbCrLf
  416.       intResult = cEnumObjects(Me, ENUMOBJECTS_FORMAT2, False, ObjectNameIndex, Obj)
  417.    Wend
  418.    
  419.    txt_Result = strDisplay
  420.  
  421.    'time the function
  422.  
  423.    TimerHandle = cTimerOpen()
  424.    TimerStartOk = cTimerStart(TimerHandle)
  425.    
  426.    For i = 1 To Iteration
  427.       'intResult = cEnumObjects(Me, False, ObjectNameIndex, Obj)
  428.    Next i
  429.    
  430.    mdiT2W.pnl_Timer = cTimerRead(TimerHandle)
  431.    
  432.    TimerCloseOk = cTimerClose(TimerHandle)
  433.  
  434. End Sub
  435.