⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 frmdataitementry.frm

📁 Data monkey是一个强大的是数据传输和转换应用程序。使用DataMonkey用户可以把复杂的文本文件格式
💻 FRM
📖 第 1 页 / 共 2 页
字号:
    Set di = Nothing
    Set cp = Nothing
End Sub

Private Sub btnEdit_Click()
    Dim cp As CInputRecord
    Dim di As CInputField
    Dim act As Object
    
    Set cp = GImport.GetCheckPointByName(cboCheckpoints.Text)
    Set di = cp.GetDataPointByName(Me.lstDataPoints.SelectedItem.Text)
    Set act = di.GetAction(Me.lstActions.SelectedItem.index)

    act.EditProperties di.name, GImport

    Set act = Nothing
    Set di = Nothing
    Set cp = Nothing
End Sub

Private Sub cboCheckpoints_Click()
    lstDataPoints.ListItems.Clear
    FillDataPointList GImport.GetCheckPointByName(cboCheckpoints.Text)
    ChangeActionList
End Sub


Private Sub Form_Load()
    
    Dim cp As CInputRecord
    
    For Each cp In GImport.GetCheckPoints()
        cboCheckpoints.AddItem cp.name
    Next cp
    
    'cboCheckpoints.ListIndex = 0
    
End Sub
Private Sub FillDataPointList(cp As CInputRecord)
    If cp Is Nothing Then Exit Sub
    
    Dim dp As CInputField
    For Each dp In cp.GetDataPoints()
        Dim newItem As ListItem
    
        Set newItem = lstDataPoints.ListItems.Add(, dp.GetID())
        newItem.Text = dp.name
        newItem.SubItems(1) = dp.index
        
    Next dp
End Sub

Private Sub lstDataPoints_AfterLabelEdit(Cancel As Integer, NewString As String)
    
    Dim cp As CInputRecord
    Set cp = GImport.GetCheckPoint(cboCheckpoints.Text)
    Cancel = Not cp.ChangeDataPointName(mDataPointBeingEdited, NewString)
    mDataPointBeingEdited = ""
    
End Sub

Private Sub lstDataPoints_BeforeLabelEdit(Cancel As Integer)
    mDataPointBeingEdited = lstDataPoints.SelectedItem.Text
End Sub

Private Sub ChangeActionList()
    On Error GoTo eHandler
    
    Dim cp As CInputRecord
    Dim dp As CInputField
    Dim act As Object
    
    lstActions.ListItems.Clear
    
    Set cp = GImport.GetCheckPointByName(cboCheckpoints.Text)
    
    '********************************************************************
    ' If there are any datapoints, display the actions for the first one.
    '********************************************************************
    
    If cp.GetDataPoints.Count > 0 Then
        Set dp = cp.GetDataPointByName(lstDataPoints.SelectedItem.Text)
        
        For Each act In dp.GetActions
            Dim newItem As ListItem
            Set newItem = lstActions.ListItems.Add(, act.GetID())
            newItem.Text = act.GetSpecificDescription
            newItem.SubItems(1) = act.index
        Next act
    End If
    
    Exit Sub

eHandler:
    LogError "frmDataItemEntry", "ChangeActionList", Error(Err), False
'
End Sub
Private Sub lstDataPoints_ColumnClick(ByVal ColumnHeader As ComctlLib.ColumnHeader)
    ' When a ColumnHeader object is clicked, the ListView control is
    ' sorted by the subitems of that column.
    ' Set the SortKey to the Index of the ColumnHeader - 1

    If ColumnHeader.index = 2 Then
        lstDataPoints.Sorted = False
        
        lstDataPoints.ListItems.Clear
        FillDataPointList GImport.GetCheckPoint(cboCheckpoints.Text)
    Else
        ' Sort on the first column.
        lstDataPoints.SortKey = 0
        
        ' Set Sorted to True to sort the list.
        lstDataPoints.Sorted = True
    End If

End Sub

Private Sub lstDataPoints_ItemClick(ByVal item As ComctlLib.ListItem)
    ChangeActionList
End Sub

Private Sub picDnAction_Click()
    With lstActions
    
    '********************************************************
    ' First, change the item order in our internal structure.
    '********************************************************
    
    Dim top As Object, bottom As Object
    Dim topIndex As Integer, bottomIndex As Integer
    Dim cp As CInputRecord
    Dim acts As CActions
    
    ' Make sure something is selected.
    If .SelectedItem Is Nothing Then GoTo done

    Set cp = GImport.GetCheckPointByName(cboCheckpoints.Text)
    If cp Is Nothing Then GoTo done
    Set acts = cp.GetDataPoint(lstDataPoints.SelectedItem.key).GetActions
    If acts Is Nothing Then GoTo done

    ' Get the item we want to move down.
    Set top = acts(.SelectedItem.key)
    If top.index = acts.Count Then GoTo done
    
    ' Get the item above the item we want to move up.
    Set bottom = acts(top.index + 1)
    If bottom Is Nothing Then GoTo done
    
    ' Change the indexes so bottom becoms top, and top bottom.
    topIndex = top.index
    bottomIndex = bottom.index
    top.index = bottomIndex
    bottom.index = topIndex
    acts.Reorder

    '*******************************************
    ' Fix the list so top is bottom, bottom top.
    '*******************************************
    
    lvSwapItems lstActions, topIndex, bottomIndex
    
    ' Fix the displayed indexes.
    .ListItems(topIndex).SubItems(1) = topIndex
    .ListItems(bottomIndex).SubItems(1) = bottomIndex
    
    ' Keep the newly moved item as the selected item.
    Set .SelectedItem = .ListItems(bottomIndex)

done:
    Set cp = Nothing
    Set acts = Nothing
    Set top = Nothing
    Set bottom = Nothing

    End With

End Sub

Private Sub picDnDataItem_Click()
    With lstDataPoints

    '********************************************************
    ' First, change the item order in our internal structure.
    '********************************************************
    
    Dim top As CInputField, bottom As CInputField
    Dim topIndex As Integer, bottomIndex As Integer
    Dim DIs As CInputFields
    
    ' Make sure something is selected.
    If .SelectedItem Is Nothing Then GoTo done
    
    Set DIs = GImport.GetCheckPointByName(cboCheckpoints.Text).GetDataPoints()
    If DIs Is Nothing Then GoTo done

    ' Get the item we want to move down.
    Set top = DIs(.SelectedItem.key)
    If top.index = DIs.Count() Then GoTo done
    
    ' Get the item above the item we want to move up.
    Set bottom = DIs(top.index + 1)
    If bottom Is Nothing Then GoTo done
    
    ' Change the indexes so bottom becoms top, and top bottom.
    topIndex = top.index
    bottomIndex = bottom.index
    top.index = bottomIndex
    bottom.index = topIndex
    DIs.Reorder

    '*******************************************
    ' Fix the list so top is bottom, bottom top.
    '*******************************************
    
    lvSwapItems lstDataPoints, topIndex, bottomIndex
    
    ' Fix the displayed indexes.
    .ListItems(topIndex).SubItems(1) = topIndex
    .ListItems(bottomIndex).SubItems(1) = bottomIndex
    
    ' Keep the newly moved item as the selected item.
    Set .SelectedItem = .ListItems(bottomIndex)
    
    End With
done:
    Set DIs = Nothing
    Set top = Nothing
    Set bottom = Nothing

End Sub

Private Sub picUpAction_Click()
    With lstActions
    
    '********************************************************
    ' First, change the item order in our internal structure.
    '********************************************************
    
    Dim top As Object, bottom As Object
    Dim topIndex As Integer, bottomIndex As Integer
    Dim cp As CInputRecord
    Dim acts As CActions
    
    ' Make sure something is selected.
    If .SelectedItem Is Nothing Then GoTo done
    
    Set cp = GImport.GetCheckPointByName(cboCheckpoints.Text)
    If cp Is Nothing Then GoTo done
    Set acts = cp.GetDataPoint(lstDataPoints.SelectedItem.key).GetActions
    If acts Is Nothing Then GoTo done

    ' Get the item we want to move up.
    Set bottom = acts(.SelectedItem.key)
    If bottom.index = 1 Then GoTo done
    
    ' Get the item above the item we want to move up.
    Set top = acts(bottom.index - 1)
    If top Is Nothing Then GoTo done
    
    ' Change the indexes so bottom becoms top, and top bottom.
    topIndex = top.index
    bottomIndex = bottom.index
    top.index = bottomIndex
    bottom.index = topIndex
    acts.Reorder
    
    '*******************************************
    ' Fix the list so top is bottom, bottom top.
    '*******************************************
    
    lvSwapItems lstActions, topIndex, bottomIndex
    
    ' Fix the displayed indexes.
    .ListItems(topIndex).SubItems(1) = topIndex
    .ListItems(bottomIndex).SubItems(1) = bottomIndex
    
    ' Keep the newly moved item as the selected item.
    Set .SelectedItem = .ListItems(topIndex)

done:
    Set cp = Nothing
    Set acts = Nothing
    Set top = Nothing
    Set bottom = Nothing

    End With

End Sub

Private Sub picUpDataItem_Click()
    
    With lstDataPoints

    '********************************************************
    ' First, change the item order in our internal structure.
    '********************************************************
    
    Dim top As CInputField, bottom As CInputField
    Dim topIndex As Integer, bottomIndex As Integer
    Dim DIs As CInputFields
    
    ' Make sure something is selected.
    If .SelectedItem Is Nothing Then GoTo done
    
    Set DIs = GImport.GetCheckPointByName(cboCheckpoints.Text).GetDataPoints()
    If DIs Is Nothing Then GoTo done

    ' Get the item we want to move up.
    Set bottom = DIs(.SelectedItem.key)
    If bottom.index = 1 Then GoTo done
    
    ' Get the item above the item we want to move up.
    Set top = DIs(bottom.index - 1)
    If top Is Nothing Then GoTo done
    
    ' Change the indexes so bottom becoms top, and top bottom.
    topIndex = top.index
    bottomIndex = bottom.index
    top.index = bottomIndex
    bottom.index = topIndex
    DIs.Reorder

    '*******************************************
    ' Fix the list so top is bottom, bottom top.
    '*******************************************
    
    lvSwapItems lstDataPoints, topIndex, bottomIndex
    
    ' Fix the displayed indexes.
    .ListItems(topIndex).SubItems(1) = topIndex
    .ListItems(bottomIndex).SubItems(1) = bottomIndex
    
    ' Keep the newly moved item as the selected item.
    Set .SelectedItem = .ListItems(topIndex)
    
    End With
done:
    Set DIs = Nothing
    Set top = Nothing
    Set bottom = Nothing

End Sub

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -