📄 frmiomapping.frm
字号:
End If
' Fill the input tree.
miFillDataInputTree
End Sub
Public Sub SetLinksReference(ol As COutputLinks)
Dim i As Integer
' Look for the outputlinks object given in the combobox.
For i = 0 To cboSchemas.ListCount - 1
' We found the given outputlinks object, so select it.
If cboSchemas.List(i) = ol.name Then
cboSchemas.ListIndex = i
Set mOutputLinks = ol
FillSchemaOutputTree
End If
Next i
End Sub
Private Sub Form_Resize()
If Me.Width < 2200 Then Exit Sub
If Me.Height < 2200 Then Exit Sub
' Leave about 1000 pixels between the "Links" listbox
' and the output schema tree.
Dim ThirdScreenWidth As Single
Dim InputTreeWidth As Single, InputTreeHeight As Single, InputTreeLeft As Single
Dim LinkListHeight As Single, LinkListWidth As Single, LinkListLeft As Single
Dim OutputTreeWidth As Single, OutputTreeHeight As Single, OutputTreeLeft As Single
Dim BorderWidth As Single
BorderWidth = 120
ThirdScreenWidth = Me.ScaleWidth / 3
' Output tree uses half the screen - the separator.
OutputTreeWidth = ThirdScreenWidth - BorderWidth * 2
OutputTreeLeft = Me.ScaleWidth - ThirdScreenWidth + BorderWidth
OutputTreeHeight = Me.ScaleHeight - wndOutput.top - BorderWidth
' The InputTree gets 70% of the other half,
InputTreeWidth = ThirdScreenWidth - BorderWidth * 2
InputTreeHeight = Me.ScaleHeight - wndInput.top - BorderWidth
InputTreeLeft = BorderWidth
' and the link list window gets the other 30%.
LinkListWidth = ThirdScreenWidth - BorderWidth
LinkListLeft = Me.ScaleWidth / 2 - LinkListWidth / 2
' Set the items in the Input column.
wndInput.left = InputTreeLeft
wndInput.Width = InputTreeWidth
wndInput.Height = InputTreeHeight
lblInputlabel.left = InputTreeLeft
' Set the items in the Link column.
' Keep the same proportion for the column widths.
Dim col1Ratio As Single, col2Ratio As Single
col1Ratio = lstLinks.ColumnHeaders(1).Width / (lstLinks.Width)
col2Ratio = lstLinks.ColumnHeaders(2).Width / (lstLinks.Width)
lstLinks.ColumnHeaders(1).Width = LinkListWidth * col1Ratio
lstLinks.ColumnHeaders(2).Width = LinkListWidth * col2Ratio
lstLinks.left = LinkListLeft
lstLinks.Width = LinkListWidth
Me.lblLinkTop.left = LinkListLeft
Me.lblLinkTop.Width = LinkListWidth
' Center the delete button beow the linklist window.
btnDeleteLink.left = Me.ScaleWidth / 2 - btnDeleteLink.Width / 2
' Set the items in the Output column.
lblSchemaLabel.left = OutputTreeLeft
cboSchemas.left = OutputTreeLeft
cboSchemas.Width = OutputTreeWidth
wndOutput.left = OutputTreeLeft
wndOutput.Width = OutputTreeWidth
wndOutput.Height = OutputTreeHeight
End Sub
Private Sub lstLinks_ItemClick(ByVal item As ComctlLib.ListItem)
' Links are for an item in the InputTree, so highlight the
' selected link to item in the OutputTree.
If mLinksForTree = 1 Then
' Highlight any corresponding link in the input window.
miHighlightItemFromLink item.key, wndOutput, mLinksForTree
' Links are for an item in the OutputTree, so highlight the
' selected link from item in the InputTree.
Else
' Highlight any corresponding link in the input window.
miHighlightItemFromLink item.key, wndInput, mLinksForTree
End If
End Sub
Private Sub wndInput_MouseDown(Button As Integer, Shift As Integer, x As Single, y As Single)
Dim node As ComctlLib.node
Set node = wndInput.HitTest(x, y)
If node Is Nothing Then Exit Sub
Set wndInput.SelectedItem = node
Call wndInput_NodeClick(node)
Set node = Nothing
End Sub
Private Sub wndInput_NodeClick(ByVal node As ComctlLib.node)
Set wndOutput.SelectedItem = Nothing
If node.tag <> etiType.tidataitem Then Exit Sub
' The links represent item in InputTree.
mLinksForTree = 1
' Add the nodes for the selected item to the nodes list.
miFillLinkBox node.parent.Text, node.Text, lstLinks, 1
If Me.lstLinks.ListItems.Count > 0 Then
Set Me.lstLinks.SelectedItem = Me.lstLinks.ListItems(1)
Call lstLinks_ItemClick(Me.lstLinks.SelectedItem)
End If
End Sub
Private Sub FillSchemaOutputTree()
' Fill output tree.
Dim arc As New CArchive
Dim sch As New COutputSchema
' Load the schema.
arc.fileName = GImport.GetOutputLinksManager _
(cboSchemas.ListIndex + 1).SchemaFileLastKnownLocation
If Not arc.OpenFile(True) Then
If MsgBox("Unable to open schema file for '" & GImport.GetOutputLinksManager(cboSchemas.ListIndex + 1).name & "' Would you like to try to locate the file?", vbOKCancel Or vbQuestion, "Error") = vbCancel Then
Exit Sub
Else
If Not arc.BrowseFileOpen("Locate Schema File", arc.fileName, _
"Schema Files (*.sch)|*.sch|All Files (*.*)|*.*", _
True) Then
Exit Sub
End If
GImport.GetOutputLinksManager(cboSchemas.ListIndex + 1).SchemaFileLastKnownLocation = arc.fileName
GImport.dirty = True
End If
End If
If sch.Load(arc) Then
Set mOutputLinks = Nothing
Set mOutputLinks = GImport.GetOutputLinksManager(cboSchemas.ListIndex + 1)
miSetLinksReference mOutputLinks
' Fill the tree.
miSetSchemaReference sch
miFillDataOutputTree
Set sch = Nothing
miRefreshImages "DataItem", "DataItemBlank", "CheckPoint", "CheckPointBlank", Me.wndInput
End If
End Sub
Private Sub GetNodeOffset(ByRef x As Single, ByRef y As Single, node As ComctlLib.node, tree As TreeView)
If node Is Nothing Or tree Is Nothing Then Exit Sub
If node.Visible = True Then
y = tree.top
x = x - tree.Indentation
Dim newnode As ComctlLib.node
Do
Set newnode = tree.HitTest(x, y)
If newnode Is node Then
Exit Do
End If
y = y + tree.Font.Size * Screen.TwipsPerPixelY
Loop While Not newnode Is Nothing
y = y + (tree.Font.Size * Screen.TwipsPerPixelY) / 2
Else
Dim tempnode As ComctlLib.node
y = tree.top + tree.Height
Set tempnode = node
Do While Not tempnode Is Nothing
tempnode = tempnode.Previous
If tempnode.Visible = True Then
y = tree.top
Exit Do
End If
Loop
End If
End Sub
Private Sub wndOutput_MouseDown(Button As Integer, Shift As Integer, x As Single, y As Single)
Dim node As ComctlLib.node
Set node = wndOutput.HitTest(x, y)
If node Is Nothing Then Exit Sub
Set wndOutput.SelectedItem = node
Call wndOutput_NodeClick(node)
Set node = Nothing
End Sub
Private Sub wndOutput_NodeClick(ByVal node As ComctlLib.node)
' Clear the input selection.
Set wndInput.SelectedItem = Nothing
If node.tag <> etiType.tidataitem Then Exit Sub
' The link represents an item in the 2nd tree (OutputTree).
mLinksForTree = 2
' Add the nodes for the selected item to the nodes list.
miFillLinkBox node.parent.Text, node.Text, lstLinks, 2
If Me.lstLinks.ListItems.Count > 0 Then
Set Me.lstLinks.SelectedItem = Me.lstLinks.ListItems(1)
Call lstLinks_ItemClick(Me.lstLinks.SelectedItem)
End If
End Sub
Private Sub wndOutput_OLEDragDrop(Data As ComctlLib.DataObject, Effect As Long, Button As Integer, Shift As Integer, x As Single, y As Single)
' Make sure we know what we are dropping.
'If Not Source Is wndInput Then Exit Sub
Dim ol As COutputLink
If wndOutput.SelectedItem Is Nothing Then Exit Sub
If wndInput.SelectedItem Is Nothing Then Exit Sub
'If Not Source Is wndInput Then Exit Sub
If wndOutput.SelectedItem.tag <> etiType.tidataitem Then Exit Sub
If wndInput.SelectedItem.tag <> etiType.tidataitem Then Exit Sub
Set ol = mOutputLinks.GetLinkFrom(wndInput.SelectedItem.parent.Text, wndInput.SelectedItem.Text)
If val(wndOutput.SelectedItem.tag) <> etiType.tidataitem Then Exit Sub
' Add a new link.
Set ol = mOutputLinks.Add(True)
ol.LinkFromTable = wndInput.SelectedItem.parent.Text
ol.LinkFromField = wndInput.SelectedItem.Text
ol.LinkToTable = wndOutput.SelectedItem.parent.Text
ol.LinkToField = wndOutput.SelectedItem.Text
' Color in the node.
miSetImageForOutput ol.LinkToTable, ol.LinkToField
miSetImageForInput ol.LinkFromTable, ol.LinkFromField
' Add the link to the listbox and select it.
miAddLinkToListBox ol, Me.lstLinks, True
End Sub
Private Sub wndOutput_OLEDragOver(Data As ComctlLib.DataObject, Effect As Long, Button As Integer, Shift As Integer, x As Single, y As Single, State As Integer)
Dim node As ComctlLib.node
' Set the selected item to whatever item is being dragged over.
Set node = wndOutput.HitTest(x, y)
If Not node Is Nothing Then
' Accept data
If node.tag = etiType.tidataitem Then
Effect = vbDropEffectMove
Set wndOutput.SelectedItem = node
Exit Sub
End If
End If
Set wndOutput.SelectedItem = Nothing
Effect = vbDropEffectNone
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -