home *** CD-ROM | disk | FTP | other *** search
/ Chip 1998 March / Chip_1998-03_cd.bin / tema / jpcad / ACC / SAMPLES / XDVIEW / XDSELECT.FR_ / XDSELECT.FR (.txt)
Encoding:
Visual Basic Form  |  1998-01-21  |  3.1 KB  |  110 lines

  1. VERSION 4.00
  2. Begin VB.Form frmSelectXData 
  3.    BorderStyle     =   3  'Fixed Dialog
  4.    Caption         =   "Select XData structure"
  5.    ClientHeight    =   2175
  6.    ClientLeft      =   1140
  7.    ClientTop       =   1515
  8.    ClientWidth     =   5190
  9.    Height          =   2580
  10.    Left            =   1080
  11.    LinkTopic       =   "Form1"
  12.    MaxButton       =   0   'False
  13.    MinButton       =   0   'False
  14.    ScaleHeight     =   2175
  15.    ScaleWidth      =   5190
  16.    Top             =   1170
  17.    Width           =   5310
  18.    Begin VB.CommandButton bClose 
  19.       Caption         =   "Close"
  20.       Height          =   375
  21.       Left            =   3840
  22.       TabIndex        =   3
  23.       Top             =   1440
  24.       Width           =   1095
  25.    End
  26.    Begin VB.CommandButton bDelete 
  27.       Caption         =   "Delete"
  28.       Height          =   375
  29.       Left            =   3840
  30.       TabIndex        =   2
  31.       Top             =   840
  32.       Width           =   1095
  33.    End
  34.    Begin VB.CommandButton bOK 
  35.       Caption         =   "View"
  36.       Default         =   -1  'True
  37.       Height          =   375
  38.       Left            =   3840
  39.       TabIndex        =   1
  40.       Top             =   240
  41.       Width           =   1095
  42.    End
  43.    Begin VB.ListBox XDataList 
  44.       Height          =   1620
  45.       Left            =   240
  46.       TabIndex        =   0
  47.       Top             =   240
  48.       Width           =   3255
  49.    End
  50. Attribute VB_Name = "frmSelectXData"
  51. Attribute VB_Creatable = False
  52. Attribute VB_Exposed = False
  53. Private Sub bClose_Click()
  54. 'Quit and don't display any X-Data items
  55.  m_quitting = True
  56.  Unload frmSelectXData
  57. End Sub
  58. Private Sub bDelete_Click()
  59.  'delete selected X-Data structure
  60.  Dim i As Long
  61.  Dim response As Long
  62.  i = XDataList.ListIndex
  63.  If i > -1 Then
  64.    response = MsgBox("Do you really want to delete this X-Data structure?", vbYesNo + vbQuestion)
  65.    If response = vbYes Then
  66.      If BaseFrm.Amoeba.X_DeleteData(pEntity, XDataList.ItemData(i)) = -1 Then
  67.        MsgBox "Could not delete X-Data structure", vbExclamation
  68.      Else
  69.        XDataList.RemoveItem (i)
  70.        If XDataList.ListCount = 0 Then
  71.           Unload frmSelectXData
  72.        End If
  73.      End If
  74.    End If
  75.  End If
  76. End Sub
  77. Private Sub bOK_Click()
  78.  pStruct = XDataList.ItemData(XDataList.ListIndex)
  79.  If XDataList.ListCount > 1 Then
  80.      m_quitting = False
  81.  Else
  82.     'no X-Data structure left, so quit
  83.     m_quitting = True
  84.  End If
  85.  Unload frmSelectXData
  86. End Sub
  87. Private Sub Form_Activate()
  88.  frmSelectXData.SetFocus
  89. End Sub
  90. Private Sub Form_Load()
  91.  Dim i As Long
  92.  Dim description As String
  93.  m_quitting = True
  94.  i = 0
  95.  'load all X-Data descriptions
  96.  Do While BaseFrm.Amoeba.X_GetStruct(pEntity, i, pStruct) <> -1
  97.    i = i + 1
  98.    If BaseFrm.Amoeba.X_GetDesc(pStruct, description) = -1 Then
  99.     BaseFrm.Prompt "Could not read X-Data description"
  100.     Unload frmSelectXData
  101.    End If
  102.    frmSelectXData.XDataList.AddItem description
  103.    frmSelectXData.XDataList.ItemData(XDataList.NewIndex) = pStruct
  104.  Loop
  105.  XDataList.ListIndex = 0
  106. End Sub
  107. Private Sub XDataList_DblClick()
  108.  bOK_Click
  109. End Sub
  110.