VERSION 5.00
Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCTL.OCX"
Begin VB.Form Form1 
   Caption         =   "Form1"
   ClientHeight    =   4650
   ClientLeft      =   60
   ClientTop       =   450
   ClientWidth     =   8910
   LinkTopic       =   "Form1"
   ScaleHeight     =   4650
   ScaleWidth      =   8910
   StartUpPosition =   3  'Windows ‚ÌŠù’è’l
   Begin VB.Timer Timer1 
      Enabled         =   0   'False
      Interval        =   1
      Left            =   6930
      Top             =   2340
   End
   Begin VB.Frame Frame1 
      Caption         =   "Set"
      Height          =   2085
      Left            =   60
      TabIndex        =   14
      Top             =   2460
      Width           =   7485
      Begin VB.TextBox txtForce 
         Height          =   300
         Index           =   0
         Left            =   2700
         TabIndex        =   18
         Text            =   "Text"
         Top             =   720
         Width           =   1335
      End
      Begin VB.TextBox txtForce 
         Height          =   300
         Index           =   1
         Left            =   2700
         TabIndex        =   17
         Text            =   "Text"
         Top             =   1140
         Width           =   1335
      End
      Begin VB.TextBox txtForce 
         Height          =   300
         Index           =   2
         Left            =   2700
         TabIndex        =   16
         Text            =   "Text"
         Top             =   1560
         Width           =   1335
      End
      Begin VB.ComboBox cmbSet 
         Height          =   300
         ItemData        =   "Form1.frx":0000
         Left            =   300
         List            =   "Form1.frx":0007
         TabIndex        =   15
         Text            =   "cmbSet"
         Top             =   360
         Width           =   2085
      End
      Begin MSComctlLib.Slider sldForce 
         Height          =   285
         Index           =   0
         Left            =   270
         TabIndex        =   19
         Top             =   750
         Width           =   2415
         _ExtentX        =   4260
         _ExtentY        =   503
         _Version        =   393216
         LargeChange     =   500
         Min             =   -3000
         Max             =   3000
         TickFrequency   =   1000
      End
      Begin MSComctlLib.Slider sldForce 
         Height          =   285
         Index           =   1
         Left            =   270
         TabIndex        =   20
         Top             =   1140
         Width           =   2415
         _ExtentX        =   4260
         _ExtentY        =   503
         _Version        =   393216
         LargeChange     =   500
         Min             =   -3000
         Max             =   3000
         TickFrequency   =   1000
      End
      Begin MSComctlLib.Slider sldForce 
         Height          =   285
         Index           =   2
         Left            =   270
         TabIndex        =   21
         Top             =   1530
         Width           =   2415
         _ExtentX        =   4260
         _ExtentY        =   503
         _Version        =   393216
         LargeChange     =   500
         Min             =   -3000
         Max             =   3000
         TickFrequency   =   1000
      End
   End
   Begin VB.Frame Frame 
      Caption         =   "Get"
      Height          =   2295
      Left            =   60
      TabIndex        =   0
      Top             =   120
      Width           =   8775
      Begin VB.TextBox txtGetVal 
         Height          =   315
         Index           =   15
         Left            =   6600
         TabIndex        =   25
         Top             =   1860
         Width           =   2055
      End
      Begin VB.TextBox txtGetVal 
         Height          =   315
         Index           =   14
         Left            =   4500
         TabIndex        =   24
         Top             =   1860
         Width           =   2055
      End
      Begin VB.TextBox txtGetVal 
         Height          =   315
         Index           =   13
         Left            =   2400
         TabIndex        =   23
         Top             =   1860
         Width           =   2055
      End
      Begin VB.TextBox txtGetVal 
         Height          =   315
         Index           =   12
         Left            =   300
         TabIndex        =   22
         Top             =   1860
         Width           =   2055
      End
      Begin VB.TextBox txtGetVal 
         Height          =   315
         Index           =   11
         Left            =   6600
         TabIndex        =   13
         Top             =   1500
         Width           =   2055
      End
      Begin VB.TextBox txtGetVal 
         Height          =   315
         Index           =   10
         Left            =   4500
         TabIndex        =   12
         Top             =   1500
         Width           =   2055
      End
      Begin VB.TextBox txtGetVal 
         Height          =   315
         Index           =   9
         Left            =   2400
         TabIndex        =   11
         Top             =   1500
         Width           =   2055
      End
      Begin VB.TextBox txtGetVal 
         Height          =   315
         Index           =   8
         Left            =   300
         TabIndex        =   10
         Top             =   1500
         Width           =   2055
      End
      Begin VB.TextBox txtGetVal 
         Height          =   315
         Index           =   7
         Left            =   6600
         TabIndex        =   9
         Top             =   1140
         Width           =   2055
      End
      Begin VB.TextBox txtGetVal 
         Height          =   315
         Index           =   6
         Left            =   4500
         TabIndex        =   8
         Top             =   1140
         Width           =   2055
      End
      Begin VB.TextBox txtGetVal 
         Height          =   315
         Index           =   5
         Left            =   2400
         TabIndex        =   7
         Top             =   1140
         Width           =   2055
      End
      Begin VB.TextBox txtGetVal 
         Height          =   315
         Index           =   4
         Left            =   300
         TabIndex        =   6
         Top             =   1140
         Width           =   2055
      End
      Begin VB.TextBox txtGetVal 
         Height          =   315
         Index           =   0
         Left            =   300
         TabIndex        =   5
         Top             =   780
         Width           =   2055
      End
      Begin VB.TextBox txtGetVal 
         Height          =   315
         Index           =   1
         Left            =   2400
         TabIndex        =   4
         Top             =   780
         Width           =   2055
      End
      Begin VB.TextBox txtGetVal 
         Height          =   315
         Index           =   3
         Left            =   6600
         TabIndex        =   3
         Top             =   780
         Width           =   2055
      End
      Begin VB.TextBox txtGetVal 
         Height          =   315
         Index           =   2
         Left            =   4500
         TabIndex        =   2
         Top             =   780
         Width           =   2055
      End
      Begin VB.ComboBox cmbGet 
         Height          =   300
         ItemData        =   "Form1.frx":0019
         Left            =   300
         List            =   "Form1.frx":005F
         TabIndex        =   1
         Text            =   "cmbGet"
         Top             =   360
         Width           =   2085
      End
   End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private m_eng As CaoEngine
Private m_ctrl As CaoController
Private m_GetVar As CaoVariable
Private m_SetVar As CaoVariable

Private Sub Form_Load()

    Set m_eng = New CaoEngine
    Set m_ctrl = m_eng.Workspaces(0).AddController("TEST", "CaoProv.SensAble.PHANTOM")
    
    cmbGet.ListIndex = 0
    cmbSet.ListIndex = 0

    Timer1.Enabled = True
End Sub

Private Sub cmbGet_Click()
    Set m_GetVar = m_ctrl.AddVariable(cmbGet.Text, "@IfNotMember")
End Sub

Private Sub cmbSet_Click()
    Set m_SetVar = m_ctrl.AddVariable(cmbSet.Text, "@IfNotMember")
End Sub

Private Sub sldForce_Change(Index As Integer)
    txtForce(Index).Text = sldForce(Index).Value
End Sub

Private Sub Timer1_Timer()
    
    Dim vntVal As Variant
    Dim lMaxIndex As Long
    Dim i As Long
        
    If Not m_GetVar Is Nothing Then
        vntVal = m_GetVar.Value
        If Not IsArray(vntVal) Then
            vntVal = Array(vntVal)
        End If
        
        lMaxIndex = UBound(vntVal)
        For i = 0 To 15
            If i <= lMaxIndex Then
                txtGetVal(i).Text = vntVal(i)
            Else
                txtGetVal(i).Text = ""
            End If
        Next
    End If
    
    If Not m_SetVar Is Nothing Then
       m_SetVar.Value = Array(sldForce(0).Value / 1000, sldForce(1).Value / 1000, sldForce(2).Value / 1000)
    End If
    
End Sub

