📄 frmhwfl.frm
字号:
Dim mCurColOldValue As String
Dim mOldHwFlYear As String
Dim OHwFl As HwFl
Dim OHwFls As HwFls
Private Sub Flex_AfterEdit(Index As Integer, ByVal Row As Long, ByVal Col As Long)
On Error GoTo Errorhandle
SetControlToFlex
Exit Sub
Errorhandle:
MsgBox Err.Description
End Sub
Private Sub Flex_BeforeEdit(Index As Integer, ByVal Row As Long, ByVal Col As Long, Cancel As Boolean)
On Error GoTo Errorhandle
mCurColOldValue = Trim(Flex(FlexHwFl).TextMatrix(Flex(FlexHwFl).Row, Flex(FlexHwFl).Col))
If Tlbaction(TlbHwFl).Tag = "" Then
Cancel = True
End If
If Tlbaction(TlbHwFl).Tag <> "" Then
Select Case Flex(FlexHwFl).ColKey(Col)
Case "HWFLCODE"
Case "HWFlMC"
If OHwFl Is Nothing Then
Cancel = True
End If
End Select
End If
Exit Sub
Errorhandle:
MsgBox Err.Description
End Sub
Private Sub Flex_Click(Index As Integer)
On Error GoTo Errorhandle
If Tlbaction(TlbHwFl).Tag = "" Then
Exit Sub
End If
If OHwFl Is Nothing Then
Exit Sub
End If
Select Case Index
Case FlexHwFl
If Flex(Index).Col = Flex(Index).ColIndex("HWFLISSTOP") Then
If Flex(Index).TextMatrix(Flex(Index).Row, Flex(FlexHwFl).Col) = "" Then
Flex(Index).TextMatrix(Flex(Index).Row, Flex(FlexHwFl).Col) = "√"
Else
Flex(Index).TextMatrix(Flex(Index).Row, Flex(FlexHwFl).Col) = ""
End If
End If
End Select
Exit Sub
Errorhandle:
MsgBox Err.Description
End Sub
Private Sub Flex_KeyDown(Index As Integer, KeyCode As Integer, Shift As Integer)
On Error GoTo Errorhandle
gPublicFunction.FlexKeyDown Flex(Index), KeyCode
Exit Sub
Errorhandle:
MsgBox Err.Description
End Sub
Private Sub Flex_KeyDownEdit(Index As Integer, ByVal Row As Long, ByVal Col As Long, KeyCode As Integer, ByVal Shift As Integer)
On Error GoTo Errorhandle
gPublicFunction.FlexKeyDown Flex(Index), KeyCode
Exit Sub
Errorhandle:
MsgBox Err.Description
End Sub
Private Sub Flex_KeyPressEdit(Index As Integer, ByVal Row As Long, ByVal Col As Long, KeyAscii As Integer)
On Error GoTo Errorhandle
gPublicFunction.FlexInputCheck Me, Flex(Index), KeyAscii
Exit Sub
Errorhandle:
MsgBox Err.Description
End Sub
Private Sub Flex_RowColChange(Index As Integer)
On Error GoTo Errorhandle
Select Case Index
Case FlexHwFl
If Flex(Index).Rows > 2 And Flex(FlexHwFl).Row <> Flex(FlexHwFl).Rows - 1 Then
Set OHwFl = OHwFls(CStr(Flex(FlexHwFl).RowData(Flex(FlexHwFl).Row)))
Else
Set OHwFl = Nothing
End If
End Select
Exit Sub
Errorhandle:
MsgBox Err.Description
End Sub
Private Sub SetControlToFlex()
Dim mCurCol As Integer
Dim mCurRow As Integer
On Error GoTo Errorhandle
If Tlbaction(TlbHwFl).Tag = "" Then
Exit Sub
End If
mCurRow = Flex(FlexHwFl).Row
mCurCol = Flex(FlexHwFl).Col
Select Case Flex(FlexHwFl).ColKey(Flex(FlexHwFl).Col)
Case "HWFLCODE"
If OHwFl Is Nothing Then
AddNewRecord
Else
OHwFl.HwFlCode = Trim(Flex(FlexHwFl).TextMatrix(mCurRow, mCurCol))
End If
Case "HWFlMC"
If Not OHwFl Is Nothing Then
OHwFl.HwFlMc = Trim(Flex(FlexHwFl).TextMatrix(mCurRow, mCurCol))
End If
End Select
Exit Sub
Errorhandle:
Flex(FlexHwFl).TextMatrix(mCurRow, mCurCol) = mCurColOldValue
Err.Raise vbObjectError + 1, , Err.Description
End Sub
Private Sub AddNewRecord()
On Error GoTo Errorhandle
If Trim(Flex(FlexHwFl).TextMatrix(Flex(FlexHwFl).Row, Flex(FlexHwFl).Col)) <> "" Then
Set OHwFl = New HwFl
OHwFl.HwFlCode = Trim(Flex(FlexHwFl).TextMatrix(Flex(FlexHwFl).Row, Flex(FlexHwFl).Col))
OHwFls.Add OHwFl
Flex(FlexHwFl).RowData(Flex(FlexHwFl).Rows - 1) = OHwFl.HwFl_Key
Flex(FlexHwFl).AddItem ""
End If
Exit Sub
Errorhandle:
Set OHwFl = Nothing
Err.Raise vbObjectError + 1, , Err.Description
End Sub
Private Sub Form_Load()
On Error GoTo Errorhandle
Flex(FlexHwFl).Editable = flexEDKbdMouse
Flex(FlexHwFl).ColKey(1) = "HWFLCODE"
Flex(FlexHwFl).ColKey(2) = "HWFLMC"
Flex(FlexHwFl).ColKey(3) = "HWFLISSTOP"
gPublicCommon.PublicFunction.LoadFormSet Me, Tlbaction(TlbHwFl), Img(ImgHwFl), SBar(SBarHwFl)
gPublicCommon.gForms(UCase(Me.Name)).ControlStatus.Add "", Flex(FlexHwFl)
gPublicCommon.PublicFunction.EnableControl Me, ""
LoadDataIntoGrid
Exit Sub
Errorhandle:
MsgBox Err.Description
End Sub
Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
Dim mButton As Button
On Error GoTo Errorhandle
Set mButton = gPublicFunction.GetToolBarButton(Me, KeyCode)
If Not mButton Is Nothing Then
Tlbaction_ButtonClick TlbHwFl, mButton
End If
Exit Sub
Errorhandle:
MsgBox Err.Description
End Sub
Private Sub LoadDataIntoGrid()
Dim ItemStr As String
Dim m_HwFl As HwFl
On Error GoTo Errorhandle
Flex(FlexHwFl).Rows = 1
Flex(FlexHwFl).AddItem ""
Set OHwFls = New HwFls
OHwFls.FillbyDb
For Each m_HwFl In OHwFls
ItemStr = vbTab & m_HwFl.HwFlCode & vbTab & m_HwFl.HwFlMc & vbTab & IIf(m_HwFl.HwFlIsStop = 1, "√", "")
Flex(FlexHwFl).AddItem ItemStr, Flex(FlexHwFl).Rows - 1
Flex(FlexHwFl).RowData(Flex(FlexHwFl).Rows - 2) = m_HwFl.HwFl_Key
Next
If Flex(FlexHwFl).Rows > 2 Then
Flex(FlexHwFl).Row = 1
Set OHwFl = OHwFls(CStr(Flex(FlexHwFl).RowData(1)))
Else
Set OHwFl = Nothing
End If
Exit Sub
Errorhandle:
Err.Raise vbObjectError + 1, , Err.Description
End Sub
Private Sub AddRecord(RecordName As String)
On Error GoTo Errorhandle
Flex(FlexHwFl).Row = Flex(FlexHwFl).Rows - 1
Flex(FlexHwFl).Col = Flex(FlexHwFl).ColIndex("HWFLCODE")
gPublicFunction.SetToolbarStatu Me, Tlbaction(TlbHwFl), RecordName
Exit Sub
Errorhandle:
Err.Raise vbObjectError + 1, , Err.Description
End Sub
Private Sub CancelRecord(RecordName As String)
On Error GoTo Errorhandle
If Tlbaction(TlbHwFl).Tag <> "" Then
gPublicFunction.SetToolbarStatu Me, Tlbaction(TlbHwFl), RecordName
LoadDataIntoGrid
End If
Exit Sub
Errorhandle:
Err.Raise vbObjectError + 1, , Err.Description
End Sub
Private Sub Delrecord(RecordName As String)
On Error GoTo Errorhandle
If OHwFls Is Nothing Then
Exit Sub
End If
If OHwFl Is Nothing Then
Exit Sub
End If
If Flex(FlexHwFl).Rows <= 2 Then
Exit Sub
End If
If MsgBox("您真的要删除吗?", vbYesNo) = vbYes Then
OHwFls.Remove CStr(OHwFl.HwFl_Key)
gPublicFunction.RemoveFlexItem Flex(FlexHwFl).Row, Flex(FlexHwFl)
If Flex(FlexHwFl).Rows = 2 Then
Set OHwFl = Nothing
Else
Set OHwFl = OHwFls(CStr(Flex(FlexHwFl).RowData(Flex(FlexHwFl).Row)))
End If
End If
Exit Sub
Errorhandle:
Err.Raise vbObjectError + 1, , Err.Description
End Sub
Private Sub SaveRecord(RecordName As String)
On Error GoTo Errorhandle
SetValueToObject RecordName
OHwFls.DbSave
gPublicFunction.SetToolbarStatu Me, Tlbaction(TlbHwFl), RecordName
Exit Sub
Errorhandle:
Err.Raise vbObjectError + 1, , Err.Description
End Sub
Private Sub SetValueToObject(ObjectName As String)
Dim I As Integer
On Error GoTo Errorhandle
For I = 1 To Flex(FlexHwFl).Rows - 2
Set OHwFl = OHwFls.Item(CStr(Flex(FlexHwFl).RowData(I)))
OHwFl.HwFlCode = Trim(Flex(FlexHwFl).TextMatrix(I, Flex(FlexHwFl).ColIndex("HWFLCODE")))
OHwFl.HwFlMc = Trim(Flex(FlexHwFl).TextMatrix(I, Flex(FlexHwFl).ColIndex("HWFLMC")))
OHwFl.HwFlIsStop = IIf(Trim(Flex(FlexHwFl).TextMatrix(I, Flex(FlexHwFl).ColIndex("HWFLISSTOP"))) <> "", 1, 0)
Next
Exit Sub
Errorhandle:
Err.Raise vbObjectError + 1, , Err.Description
End Sub
Private Sub Form_Unload(Cancel As Integer)
On Error GoTo Errorhandle
Set OHwFl = Nothing
Set OHwFls = Nothing
gPublicCommon.PublicFunction.SaveFormSet Me
Exit Sub
Errorhandle:
MsgBox Err.Description
End Sub
Private Sub Tlbaction_ButtonClick(Index As Integer, ByVal Button As MSComctlLib.Button)
Dim Action, RecordName As String
On Error GoTo Errorhandle
Action = (Mid(Button.Key, 1, 3))
RecordName = Button.Key
If Trim(Flex(FlexHwFl).EditText) <> "" Then
Flex(FlexHwFl).TextMatrix(Flex(FlexHwFl).Row, Flex(FlexHwFl).Col) = Trim(Flex(FlexHwFl).EditText)
End If
Select Case Action
Case "EDI"
AddRecord RecordName
Case "CAN"
CancelRecord RecordName
Case "SAV"
SaveRecord RecordName
Case "DEF"
Delrecord RecordName
Case "EXI"
Unload Me
End Select
Exit Sub
Errorhandle:
MsgBox Err.Description
End Sub
Private Sub Form_Resize()
On Error GoTo Errorhandle
gPublicCommon.PublicFunction.ResizeForm Me
Exit Sub
Errorhandle:
MsgBox Err.Description
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -