📄 lineandfieldeditingcode.bas
字号:
Attribute VB_Name = "LineAndFieldEditingCode"
' DataMonkey Data Conversion Application. Written by Theodore L. Ward
' Copyright (C) 2002 AstroComma Incorporated.
'
' This program is free software; you can redistribute it and/or
' modify it under the terms of the GNU General Public License
' as published by the Free Software Foundation; either version 2
' of the License, or (at your option) any later version.
'
' This program is distributed in the hope that it will be useful,
' but WITHOUT ANY WARRANTY; without even the implied warranty of
' MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
' GNU General Public License for more details.
'
' You should have received a copy of the GNU General Public License
' along with this program; if not, write to the Free Software
' Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
' The author may be contacted at:
' TheodoreWard@Hotmail.com or TheodoreWard@Yahoo.com
Public Function lfcAddCheckpointAction(cp As CInputRecord, _
actList As ListView, Import As CImport) As Boolean
lfcAddCheckpointAction = False
If cp Is Nothing Or actList Is Nothing Then Exit Function
' Load the form which will add the new action object.
frmSelectActionType.Initialize _
eCmdApplications.appCheckPoint, cp.name, cp.GetActions(), Import
frmSelectActionType.Show vbModal
If GFormReturnValue = vbOK Then
' Update the list of actions.
lfcLoadActionList cp.GetActions(), actList
' Return success.
lfcAddCheckpointAction = True
End If
End Function
Public Function lfcAddFieldAction(di As CInputField, _
actList As ListView, Import As CImport) As Boolean
lfcAddFieldAction = False
If di Is Nothing Or actList Is Nothing Then Exit Function
' Load the form which will add the new action object.
frmSelectActionType.Initialize _
eCmdApplications.appDataItem, di.name, di.GetActions(), Import
frmSelectActionType.Show vbModal
If GFormReturnValue = vbOK Then
' Update the list of actions.
lfcLoadActionList di.GetActions(), actList
' Return success.
lfcAddFieldAction = True
End If
End Function
Public Function lfcAddCheckpoint(Import As CImport, lstLines As ListView) As CInputRecord
On Error GoTo eHandler
Dim cp As CInputRecord
Dim i As Integer
Set lfcAddCheckpoint = Nothing
If Import Is Nothing Or lstLines Is Nothing Then Exit Function
' Create a new CheckPoint and add it to our import object.
Set cp = Import.AddCheckPoint(True)
If cp Is Nothing Then GoTo exitFunction
' Update our CheckPoint list.
Dim newItem As ListItem
Set newItem = lstLines.ListItems.Add(, cp.GetID(), cp.name())
Set lfcAddCheckpoint = cp
exitFunction:
Set cp = Nothing
Exit Function
eHandler:
LogError "LineAndFieldEditingCode", "lfcAddCheckpoint", Error(Err), False
End Function
Public Function lfcAddField(cp As CInputRecord, lstFields As ListView) As CInputField
On Error GoTo eHandler
Dim di As CInputField
Dim i As Integer
Set lfcAddField = Nothing
If cp Is Nothing Or lstFields Is Nothing Then Exit Function
' Create a new DataItem and add it to our import object.
Set di = cp.AddDataPoint(True)
If di Is Nothing Then GoTo exitFunction
' Update our CheckPoint list.
Dim newItem As ListItem
Set newItem = lstFields.ListItems.Add(, di.GetID(), di.name())
Set lfcAddField = di
exitFunction:
Set di = Nothing
Exit Function
eHandler:
LogError "LineAndFieldEditingCode", "lfcAddField", Error(Err), False
End Function
Public Sub lfcLoadActionList(acts As CActions, Actionlist As ListView)
On Error GoTo eHandler
Dim act As Object
Dim ItemsAdded As Boolean
ItemsAdded = False
Actionlist.ListItems.Clear
If acts Is Nothing Or Actionlist Is Nothing Then Exit Sub
For Each act In acts
Dim newItem As ListItem
Set newItem = Actionlist.ListItems.Add(, act.GetID())
newItem.Text = act.GetSpecificDescription
ItemsAdded = True
Next act
' Select the first item in the list.
If ItemsAdded Then
Set Actionlist.SelectedItem = Actionlist.ListItems(1)
End If
Exit Sub
eHandler:
LogError "frmCheckPointEntry", "lfcLoadActionList", Error(Err), False
Exit Sub
End Sub
Public Function lfcDeleteCheckpoint(Import As CImport, lstLines As ListView)
If Import Is Nothing Or lstLines Is Nothing Then Exit Function
' Remove the checkpoint.
Import.GetCheckPoints.Remove lstLines.SelectedItem.index
Import.GetCheckPoints.Reorder
' Remove the selected item from the list.
lstLines.ListItems.Remove lstLines.SelectedItem.index
End Function
Public Function lfcDeleteField(cp As CInputRecord, lstFields As ListView)
lfcDeleteField = False
If cp Is Nothing Or lstFields Is Nothing Then Exit Function
' Remove the checkpoint.
cp.GetDataPoints.Remove lstFields.SelectedItem.index
cp.GetDataPoints.Reorder
' Remove the selected item from the list.
lstFields.ListItems.Remove lstFields.SelectedItem.index
lfcDeleteField = True
End Function
Public Sub lfcLoadFieldList(cp As CInputRecord, lstFields As ListView)
Dim dp As CInputField
Dim ItemsAdded As Boolean
ItemsAdded = False
If cp Is Nothing Or lstFields Is Nothing Then Exit Sub
For Each dp In cp.GetDataPoints()
Dim newItem As ListItem
Set newItem = lstFields.ListItems.Add(, dp.GetID())
newItem.Text = dp.name
ItemsAdded = True
Next dp
If ItemsAdded Then
Set lstFields.SelectedItem = lstFields.ListItems(1)
End If
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -