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

  1. VERSION 4.00
  2. Begin VB.Form Form1 
  3.    Caption         =   "03_03 Naming"
  4.    ClientHeight    =   5655
  5.    ClientLeft      =   915
  6.    ClientTop       =   1230
  7.    ClientWidth     =   5625
  8.    Height          =   6030
  9.    Left            =   855
  10.    LinkTopic       =   "Form1"
  11.    ScaleHeight     =   5655
  12.    ScaleWidth      =   5625
  13.    Top             =   915
  14.    Width           =   5745
  15.    Begin VB.CommandButton Command2 
  16.       Caption         =   "Remove Cube"
  17.       Height          =   612
  18.       Left            =   0
  19.       TabIndex        =   2
  20.       Top             =   4920
  21.       Width           =   2532
  22.    End
  23.    Begin VB.CommandButton Command1 
  24.       Caption         =   "Add Cube"
  25.       Height          =   612
  26.       Left            =   3000
  27.       TabIndex        =   1
  28.       Top             =   4920
  29.       Width           =   2532
  30.    End
  31.    Begin TgsVisual3SpaceLibCtl.V3Space V3Space1 
  32.       Height          =   4812
  33.       Left            =   0
  34.       TabIndex        =   0
  35.       Top             =   0
  36.       Width           =   5532
  37.       _Version        =   131072
  38.       _ExtentX        =   9758
  39.       _ExtentY        =   8488
  40.       _StockProps     =   0
  41.    End
  42. Attribute VB_Name = "Form1"
  43. Attribute VB_Creatable = False
  44. Attribute VB_Exposed = False
  45. Dim cubePresent As Boolean
  46. Private Sub Command1_Click()
  47.     If cubePresent Then
  48.         Exit Sub
  49.     Else
  50.         cubePresent = True
  51.     End If
  52.     Dim sceneRoot As SoSelection
  53.     Set sceneRoot = V3Space1.getSceneRoot
  54.     Dim myRoot As SoSeparator
  55.     Set myRoot = sceneRoot.getByName("Root")
  56.     If (myRoot Is Nothing) Then
  57.         Exit Sub
  58.     End If
  59.     Dim myCube As SoCube
  60.     Set myCube = New SoCube
  61.     Call myCube.setName("MyCube")
  62.     Call myRoot.insertChild(myCube, 0)
  63.     'clean up
  64.     Set sceneRoot = Nothing
  65.     Set myRoot = Nothing
  66.     Set myCube = Nothing
  67. End Sub
  68. Private Sub Command2_Click()
  69.     If Not cubePresent Then
  70.         Exit Sub
  71.     Else
  72.         cubePresent = False
  73.     End If
  74.     Dim sceneRoot As SoSelection
  75.     Set sceneRoot = V3Space1.getSceneRoot
  76.     Dim myRoot As SoSeparator
  77.     Set myRoot = sceneRoot.getByName("Root")
  78.     Dim myCube As SoCube
  79.     Set myCube = myRoot.getByName("MyCube")
  80.         
  81.     Call myRoot.removeChildNode(myCube)
  82. End Sub
  83. Private Sub Form_Initialize()
  84.     Call V3Space1.deleteSceneGraph
  85.     'Create some objects and give them names:
  86.     Dim root As SoSeparator
  87.     Set root = New SoSeparator
  88.     Call root.ref
  89.     Call root.setName("Root")
  90.     Dim myCube As SoCube
  91.     Set myCube = New SoCube
  92.     Call root.addChild(myCube)
  93.     Call myCube.setName("MyCube")
  94.     Dim mySphere As SoSphere
  95.     Set mySphere = New SoSphere
  96.     Call root.addChild(mySphere)
  97.     Call mySphere.setName("MySphere")
  98.     Call V3Space1.setSceneRoot(root)
  99.     Call V3Space1.viewAll
  100.     Call V3Space1.setDecorations(False)
  101.     cubePresent = True
  102. End Sub
  103.