home *** CD-ROM | disk | FTP | other *** search
/ Using Visual Basic 5 (Platinum Edition) / vb5.iso / ACTIVEX / VIS3SPAC / DATA.9 / examples / vb / SelectionEx / SelectionEx.frm (.txt) next >
Encoding:
Visual Basic Form  |  1996-11-12  |  3.2 KB  |  104 lines

  1. VERSION 4.00
  2. Begin VB.Form Form1 
  3.    Caption         =   "Selection Example"
  4.    ClientHeight    =   5835
  5.    ClientLeft      =   1140
  6.    ClientTop       =   1425
  7.    ClientWidth     =   5805
  8.    Height          =   6210
  9.    Left            =   1080
  10.    LinkTopic       =   "Form1"
  11.    ScaleHeight     =   5835
  12.    ScaleWidth      =   5805
  13.    Top             =   1110
  14.    Width           =   5925
  15.    Begin VB.TextBox Text1 
  16.       Height          =   495
  17.       Left            =   0
  18.       TabIndex        =   1
  19.       Top             =   5280
  20.       Width           =   5775
  21.    End
  22.    Begin VB.Label Label1 
  23.       Caption         =   "Please select an object in the scene:"
  24.       BeginProperty Font 
  25.          name            =   "MS Sans Serif"
  26.          charset         =   0
  27.          weight          =   700
  28.          size            =   13.5
  29.          underline       =   0   'False
  30.          italic          =   0   'False
  31.          strikethrough   =   0   'False
  32.       EndProperty
  33.       Height          =   615
  34.       Left            =   0
  35.       TabIndex        =   2
  36.       Top             =   0
  37.       Width           =   5775
  38.    End
  39.    Begin TgsVisual3SpaceLibCtl.V3Space V3Space1 
  40.       Height          =   4695
  41.       Left            =   0
  42.       TabIndex        =   0
  43.       Top             =   600
  44.       Width           =   5775
  45.       _Version        =   131072
  46.       _ExtentX        =   10186
  47.       _ExtentY        =   8281
  48.       _StockProps     =   0
  49.       viewingOn       =   0   'False
  50.       urlPickEnable   =   0   'False
  51.    End
  52. Attribute VB_Name = "Form1"
  53. Attribute VB_Creatable = False
  54. Attribute VB_Exposed = False
  55.     Dim cone As SoCone
  56.     Dim cube As SoCube
  57.     Dim cubeType As SoType
  58.     Dim g_selCB As SoSelectionPathCB
  59.     Dim g_dselCB As SoSelectionPathCB
  60. Private Sub Form_Initialize()
  61.     Dim rootNode As SoSelection
  62.     Dim tran As SoTransform
  63.     Set g_selCB = New SoSelectionPathCB
  64.     Set g_dselCB = New SoSelectionPathCB
  65.     Set cone = New SoCone
  66.     Set cube = New SoCube
  67.     Set cubeType = cube.getClassTypeId
  68.     Set tran = New SoTransform
  69.     Call tran.translation.setValue(2.25, 0#, 0#)
  70.     Set rootNode = V3Space1.getSceneRoot
  71.         
  72.     Call rootNode.addChild(cone)
  73.     Call rootNode.addChild(tran)
  74.     Call rootNode.addChild(cube)
  75.     Call V3Space1.viewAll
  76.         
  77.     Call rootNode.addSelectionCallback(V3Space1.GetIDispatch(), g_selCB)
  78.     Call rootNode.addDeselectionCallback(V3Space1.GetIDispatch(), g_dselCB)
  79.         
  80.     Set rootNode = Nothing
  81.     Set cone = Nothing
  82.     Set cube = Nothing
  83.     Set tran = Nothing
  84. End Sub
  85. Private Sub V3Space1_DeselectionCallback(ByVal pathCB As Object, ByVal path As Object)
  86.     Text1.Text = "Deselect"
  87. End Sub
  88. Private Sub V3Space1_SelectionCallback(ByVal pathCB As Object, ByVal path As Object)
  89.         
  90.     Dim pathTail
  91.     Dim pathType As SoType
  92.     Set pathTail = path.getTail
  93.     Set pathType = pathTail.getClassTypeId
  94.     Dim flag As Boolean
  95.     flag = cubeType.equals(pathType)
  96.     If (flag) Then
  97.       Text1.Text = "Select Cube"
  98.     Else
  99.       Text1.Text = "Select Cone"
  100.     End If
  101.     Set pathType = Nothing
  102.     Set pathTail = Nothing
  103. End Sub
  104.