clipboardinside.bas

来自「金算盘软件代码」· BAS 代码 · 共 93 行

BAS
93
字号
Attribute VB_Name = "ClipBoardInSide"
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'
'  编辑菜单控制
'  作者:魏 然
'  日期:1998.05.12
'
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Option Explicit

'设置 CUT、COPY、PASTE 菜单的 ENABLED 属性
Public Sub SetEditEnabled()
   Dim ctlInclude As Control
   
   On Error GoTo ErrHandle
   If gclsSys.MainControls(gclsSys.CurrFormName).Form Is Nothing Then
      Exit Sub
   End If
   
   frmMain.mnuEditCopy.Enabled = False
   frmMain.mnuEditCut.Enabled = False
   frmMain.mnuEditPaste.Enabled = False
   
   'IF 当前控件为:TextBox,ReferText,ComboBox
   'Screen.ActiveForm.ActiveControl
   If TypeOf gclsSys.MainControls(gclsSys.CurrFormName).Form.ActiveControl Is TextBox _
      Or TypeOf gclsSys.MainControls(gclsSys.CurrFormName).Form.ActiveControl Is ListText _
      Or TypeOf gclsSys.MainControls(gclsSys.CurrFormName).Form.ActiveControl Is TEdit _
      Or TypeOf gclsSys.MainControls(gclsSys.CurrFormName).Form.ActiveControl Is ComboBox Then
      
      
      If gclsSys.MainControls(gclsSys.CurrFormName).Form.ActiveControl.SelText <> "" Then
        frmMain.mnuEditCopy.Enabled = True
        frmMain.mnuEditCut.Enabled = True
      End If
      
      If gclsSys.MainControls(gclsSys.CurrFormName).Form.ActiveControl.Enabled _
         And TypeOf gclsSys.MainControls(gclsSys.CurrFormName).Form.ActiveControl Is TEdit _
         And Trim(Clipboard.GetText) <> "" Then
             frmMain.mnuEditPaste.Enabled = True
      End If
      
      If gclsSys.MainControls(gclsSys.CurrFormName).Form.ActiveControl.Enabled _
         And Not gclsSys.MainControls(gclsSys.CurrFormName).Form.ActiveControl.Locked _
         And Trim(Clipboard.GetText) <> "" Then
             frmMain.mnuEditPaste.Enabled = True
      End If
      
      If TypeOf gclsSys.MainControls(gclsSys.CurrFormName).Form.ActiveControl Is ComboBox Then
         If gclsSys.MainControls(gclsSys.CurrFormName).Form.ActiveControl.Style = 2 Then
             frmMain.mnuEditPaste.Enabled = False
         End If
      End If
      
      Exit Sub
   
   'END OF IF 当前控件为:TextBox,ReferText,ComboBox
   End If
   
   For Each ctlInclude In gclsSys.MainControls(gclsSys.CurrFormName).Form.Controls
         If TypeOf ctlInclude Is MSFlexGrid Then
            If ctlInclude.ColSel > 0 And GetNoXString(ctlInclude.Tag, 1, "/") <> "" Then
                frmMain.mnuEditCopy.Enabled = True
            End If
         End If
   Next
ErrHandle:
End Sub

'引用编码
Public Function UseCode(CodeType As Message, id As Long, Optional Code As String, Optional Name As String) As Boolean
    On Error GoTo ErrHandle
    If TypeOf gclsSys.MainControls(gclsSys.PrevFormName).Form.ActiveControl Is ListText Then
         If Val(gclsSys.MainControls(gclsSys.PrevFormName).Form.ActiveControl.Tag) = CodeType Then
              If gclsSys.MainControls(gclsSys.PrevFormName).Form.ActiveControl.SeekId(id) Then
                  UseCode = True
              End If
         End If
    End If
ErrHandle:
End Function

'关联编码
Public Function ShowRelationList()
    On Error GoTo ErrHandle
    If TypeOf gclsSys.MainControls(gclsSys.CurrFormName).Form.ActiveControl Is ListText Then
        If Val(gclsSys.MainControls(gclsSys.CurrFormName).Form.ActiveControl.Tag) > 0 Then
            Card.ShowList Val(gclsSys.MainControls(gclsSys.CurrFormName).Form.ActiveControl.Tag), gclsSys.MainControls(gclsSys.CurrFormName).Form.ActiveControl.id
        End If
    End If
ErrHandle:
End Function

⌨️ 快捷键说明

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