📄 mappingformcode.bas
字号:
' Find links that match our input data, and add the links to the given listbox.
For Each ol In mOutputLinks
' Check for links FROM an input item.
If ToOrFrom = 1 Then
If ol.LinkFromTable = Table And ol.LinkFromField = Field Then
' Add this link to the link box.
miAddLinkToListBox ol, lst
End If
' Check for links TO an output item.
Else
If ol.LinkToTable = Table And ol.LinkToField = Field Then
' Add this link to the link box.
miAddLinkToListBox ol, lst
End If
End If
Next ol
Exit Sub
eHandler:
' Element not found in treeview.nodes
If Err = 35601 Then Exit Sub
LogError "MappingFormCode", "miHighlightOutputLink", Error(Err), False
End Sub
Public Sub miAddLinkToListBox(ol As COutputLink, lst As ListView, Optional SelectItem As Boolean = False)
Dim item As ListItem
Dim ListToText As String, ListFromText As String
If ol Is Nothing Or lst Is Nothing Then Exit Sub
ListFromText = ol.LinkFromTable & "," & ol.LinkFromField
ListToText = ol.LinkToTable & "," & ol.LinkToField
' Add the first column information.
Set item = lst.ListItems.Add(, ol.GetID, ListFromText)
' Add the 2nd column information.
item.SubItems(1) = ListToText
If SelectItem Then
Set lst.SelectedItem = item
End If
Set item = Nothing
End Sub
Public Sub miHighlightItemFromLink(LinkKey As String, tree As TreeView, LinkType As Integer)
On Error GoTo done
Dim ol As COutputLink
Set tree.SelectedItem = Nothing
Set ol = mOutputLinks(LinkKey)
If ol Is Nothing Then Exit Sub
' Get the output target item that is linked to.
If LinkType = 1 Then
Dim ot As COutputTargetTable, of As COutputTargetField
Set ot = mSchema.GetOutputTables.ItemByName(ol.LinkToTable)
Set of = ot.GetFields.ItemByName(ol.LinkToField)
' Select the tree item.
Set tree.SelectedItem = tree.Nodes(of.GetID)
' Get the data item that is linked from.
Else
Dim cp As CInputRecord, di As CInputField
Set cp = mImport.GetCheckPointByName(ol.LinkFromTable)
Set di = cp.GetDataPointByName(ol.LinkFromField)
' Select the tree item.
Set tree.SelectedItem = tree.Nodes(di.GetID)
End If
done:
End Sub
Public Sub miHighlightInputLink(OutputTable As String, OutputField As String)
On Error GoTo eHandler
' Let the user know the current link information
' for the selected item.
Dim ol As COutputLink
Dim cp As CInputRecord
Dim di As CInputField
fMainForm.sbStatusBar.Panels(1).Text = ""
' Get the link.
Set ol = mOutputLinks.GetLinkTo(OutputTable, OutputField)
If ol Is Nothing Then Exit Sub
' Get the object that we are linking from.
Set cp = GImport.GetCheckPoints.ItemByName(ol.LinkFromTable)
If cp Is Nothing Then Exit Sub
' And the field.
Set di = cp.GetDataPointByName(ol.LinkFromField)
If di Is Nothing Then Exit Sub
' If the item exists in the tree, select it.
If mInputTree.Nodes(di.GetID) Is Nothing Then Exit Sub
Set mInputTree.SelectedItem = mInputTree.Nodes(di.GetID)
' Update the display with this links status.
' Let the user know what the selected item is linked to.
fMainForm.sbStatusBar.Panels(1).Text = ol.LinkFromTable & "," & ol.LinkFromField + " -> " + ol.LinkToTable + "," + ol.LinkToField
Exit Sub
eHandler:
' Element not found.
If Error = 35601 Then Exit Sub
LogError "MappingFormCode", "miHighlightOutputLink", Error(Err), False
End Sub
Public Sub miSetImageForOutput(OutTbl As String, OutFld As String)
Dim ot As COutputTargetTable
Dim of As COutputTargetField
' Set the image to the desired specs.
Set ot = mSchema.GetOutputTables.ItemByName(OutTbl)
If ot Is Nothing Then Exit Sub
Set of = ot.GetFields.ItemByName(OutFld)
If of Is Nothing Then Exit Sub
If mOutputLinks.GetLinkTo(OutTbl, OutFld) Is Nothing Then
mOutputTree.Nodes(of.GetID).Image = "DataItemBlank"
If mOutputLinks.GetLinkTo(OutTbl) Is Nothing Then
' Blank out the table.
mOutputTree.Nodes(ot.GetID).Image = "CheckPointBlank"
Else
' Color in the table.
mOutputTree.Nodes(ot.GetID).Image = "CheckPoint"
End If
Else
mOutputTree.Nodes(of.GetID).Image = "DataItem"
' Color in the table.
mOutputTree.Nodes(ot.GetID).Image = "CheckPoint"
End If
Set ot = Nothing
Set of = Nothing
End Sub
Public Sub miSetImageForInput(InTbl As String, InFld As String)
Dim cp As CInputRecord
Dim di As CInputField
' Set the image to the desired specs.
Set cp = mImport.GetCheckPoints.ItemByName(InTbl)
If cp Is Nothing Then
' The Line for this link has been deleted.
Exit Sub
End If
Set di = cp.GetDataPoints.ItemByName(InFld)
If di Is Nothing Then
' The Field for this link has been deleted.
Exit Sub
End If
If mOutputLinks.GetLinkFrom(InTbl, InFld) Is Nothing Then
mInputTree.Nodes(di.GetID).Image = "DataItemBlank"
If mOutputLinks.GetLinkFrom(InTbl) Is Nothing Then
' Blank out the table.
mInputTree.Nodes(cp.GetID).Image = "CheckPointBlank"
Else
' Color in the table.
mInputTree.Nodes(cp.GetID).Image = "CheckPoint"
End If
Else
mInputTree.Nodes(di.GetID).Image = "DataItem"
mInputTree.Nodes(cp.GetID).Image = "CheckPoint"
End If
Set cp = Nothing
Set di = Nothing
End Sub
' Refresh the images in the Input tree.
Public Sub miRefreshImages(diImg As String, diImgBlank As String, _
cpImg As String, cpImgBlank As String, _
tree As TreeView)
If tree Is Nothing Then Exit Sub
If tree.Nodes.Count < 1 Then Exit Sub
Dim node As ComctlLib.node
Set node = tree.Nodes(1)
Do While Not node Is Nothing
If node.tag = etiType.ticheckpoint Then
If mOutputLinks.GetLinkFrom(node.Text) Is Nothing Then
node.Image = cpImgBlank
' Blank all the children as well.
Dim tmp As ComctlLib.node
Set tmp = node.Child
While Not tmp Is Nothing
tmp.Image = diImgBlank
Set tmp = tmp.Next
Wend
Set node = node.Next
Else
node.Image = cpImg
If node.Child Is Nothing Then
Set node = node.Next
Else
Set node = node.Child
End If
End If
ElseIf node.tag = etiType.tidataitem Then
If mOutputLinks.GetLinkFrom(node.parent.Text, node.Text) Is Nothing Then
node.Image = diImgBlank
Else
node.Image = diImg
End If
If node.Next Is Nothing Then
Set node = node.parent.Next
Else
Set node = node.Next
End If
Else
If node.Child Is Nothing Then
Set node = node.Next
Else
Set node = node.Child
End If
End If
Loop
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -