⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 frmeditosf.frm

📁 AD9954源码
💻 FRM
📖 第 1 页 / 共 2 页
字号:

Private Sub cmdCancel_Click()
    'Release the pointer to the edit box
    Set EditBox = Nothing
    
    'Unload the form
    Unload Me
End Sub

Private Sub cmdOK_Click()
    'Return the value to the textbox
    EditBox.Tag = txtDecVal.Text
    EditBox.Text = txtValue.Text
    
    'Release the pointer to the edit box
    Set EditBox = Nothing
    
    'Unload the form
    Unload Me
    
End Sub

Private Sub Form_Activate()
    'Copy the text box value to the search box
    txtValue.Text = Format(CalculateOSF(EditBox.Tag), "0.00000")
    'Set the decimal value
    txtDecVal.Text = EditBox.Tag
    
    txtValue.SetFocus
    
    'Update all other displays
    UpdateVals txtDecVal.Text
End Sub

Private Sub Form_Load()
'    fraDDL.Move (txtValue.Left + 120), (txtValue.Top + txtValue.Height + 30)
End Sub

'Function that edits the dialog box
Public Sub ShowEditDialog(Tbox As TextBox)
    Dim cntr As Integer
        
    'Calculate the number of phase values
    NumOSFVals = 2 ^ NumOSFBits
    
    Set EditBox = Tbox
    
    Me.Show 1
End Sub

Private Sub txtBinVal_GotFocus(Index As Integer)
    'Select all of the text in the textbox
    SelectAllTxt txtBinVal(Index)
End Sub

Private Sub txtBinVal_KeyPress(Index As Integer, KeyAscii As Integer)
    Dim cncl As Boolean
    
    'Filter out all keys but for the 0 and 1 keys
    KeyAscii = BinKeysFilter(KeyAscii)
    
    Select Case KeyAscii
        Case 13:
            KeyAscii = 0
            txtBinVal_Validate Index, cncl
    End Select
End Sub

Private Sub txtBinVal_Validate(Index As Integer, Cancel As Boolean)
    Dim POBinVal As Variant
    Dim sTWBinVal As String
    
    'Fill any missing digits in with Zeros
    If Index = 0 Then
        txtBinVal(Index).Text = String(8 - Len(txtBinVal(Index).Text), "0") & txtBinVal(Index).Text
    ElseIf Index = 1 Then
        txtBinVal(Index).Text = String(6 - Len(txtBinVal(Index).Text), "0") & txtBinVal(Index).Text
    End If
    
        
    'If something non numeric is entered then zero the control
    If Not IsNumeric(txtBinVal(Index).Text) Then
        If Index = 0 Then
            txtBinVal(Index).Text = String(8, "0")
        ElseIf Index = 1 Then
            txtBinVal(Index).Text = String(6, "0")
        End If
    End If
    
    'Get the value of the textbox
    POBinVal = cbaseBinS2Dec(txtBinVal(1).Text & txtBinVal(0).Text)
        
    'Update the other textboxes
    UpdateVals (POBinVal)
    
    'Set the focus back to the ok button
    cmdOK.SetFocus
End Sub

Private Sub txtDecVal_GotFocus()
    'Select all of the text in the textbox
    SelectAllTxt txtDecVal
End Sub

Private Sub txtDecVal_KeyPress(KeyAscii As Integer)
    Dim cncl As Boolean
    'Filter out keys that arn't needed
    KeyAscii = iNumericKeysFilter(KeyAscii)
    
    Select Case KeyAscii
        Case 13:
            KeyAscii = 0
            txtDecVal_Validate cncl
    End Select
End Sub

Private Sub txtDecVal_Validate(Cancel As Boolean)
    Dim PODecVal As Long
    
    'If something non numeric is entered then zero the control
    If Not IsNumeric(txtDecVal.Text) Then
        txtDecVal.Text = Format(0, "00000")
    End If
    
    'Get the value of the textbox
    PODecVal = CInt(txtDecVal.Text)
    
    If PODecVal <= (NumOSFVals - 1) Then
        'Display the new value
        txtDecVal.Text = Format(PODecVal, "00000")
    Else
        MsgBox "The decimal value of the Phase Offset should not exceed " & (NumOSFVals - 1)
        PODecVal = 0
        txtDecVal.Text = Format(PODecVal, "00000")
        Cancel = True
    End If
    
    'Record the proper output frequency value
    'OutputFreqVal = DecTW2CarrierFreq(TWDecVal, TWBits, CLng(frmMain.txtIntClockFreq.Text))
    
    'Update the other textboxes
    UpdateVals txtDecVal.Text
    
    'Set the focus back to the ok button
    cmdOK.SetFocus
End Sub

Private Sub txtHexVal_GotFocus()
    'Select all of the text in the textbox
    SelectAllTxt txtHexVal
End Sub

Private Sub txtHexVal_KeyPress(KeyAscii As Integer)
    Dim cncl As Boolean
        
    'Filter out all unwanted keys
    KeyAscii = HexKeysFilter(KeyAscii)
    
    If KeyAscii = 13 Then
        'Throw the key away
        KeyAscii = 0
        
        'Validate the textbox
        txtHexVal_Validate cncl
    End If
End Sub

Private Sub txtHexVal_Validate(Cancel As Boolean)
    Dim POHexVal As Variant
        
    POHexVal = CDec(0)
    'If something non numeric is entered then zero the control
'    If Not IsNumeric(txtTWHex.Text) Then
'        txtTWHex.Text = cbaseHex(0, 8)
'    End If
    
    'Get the decimal value of the hex text box
    POHexVal = cbaseHexStr2Dec(txtHexVal.Text)
    
    If POHexVal <= (NumOSFVals - 1) Then
        'Display the new value
        txtHexVal.Text = cbaseHex(POHexVal, 4)
    Else
        MsgBox "The hex value of the Phase Offset should not exceed " & cbaseHex(NumOSFVals - 1, 2)
        POHexVal = 0
        txtHexVal.Text = cbaseHex(POHexVal, 4)
        Cancel = True
    End If
    
    'Update the other textboxes
    UpdateVals (POHexVal)
    
    'Set the focus back to the ok button
    cmdOK.SetFocus
End Sub

Private Sub txtValue_GotFocus()
    'Select all of the text in the textbox
    SelectAllTxt txtValue
End Sub

Private Sub txtValue_KeyPress(KeyAscii As Integer)
    Dim cncl As Boolean
    'Trash all unwanted keys
    KeyAscii = NumericKeysFilter(KeyAscii)
    KeyAscii = PlusMinusKeysFilter(KeyAscii)
    If KeyAscii = GetDecSeparator(True) Then
        If InStr(1, txtValue.Text, sDecSep) And InStr(1, txtValue.SelText, sDecSep) = 0 Then
            KeyAscii = 0
        End If
    End If
    
    If KeyAscii = 13 Then
        KeyAscii = 0
        
        txtValue_Validate cncl
    End If
End Sub

Private Sub txtValue_Validate(Cancel As Boolean)
    Dim dblval As Double
    Dim DecVal As Long
    Dim MaxVal As Double
    
    MaxVal = CalculateOSF(16383)
    
    'Make sure that the value entered is numeric
    If Not IsNumeric(txtValue.Text) Then
        txtValue.Text = Format("0.00000", 0)
    End If
        
    'Make sure that the value typed isn't greater than the maximum value
    If CDbl(txtValue.Text) > MaxVal Then
        'Set it to the max
        txtValue.Text = Format("0.00000", CalculateOSF(16383))
    End If
    
    'Calculate the decimal value of the phase offset
    DecVal = CalculateOSFWord(txtValue.Text)
    
    'Calculate the actual phase offset that the part can do and display it.
    txtValue.Text = CalculateOSF(DecVal)
    
    'Format the text
    txtValue.Text = Format(txtValue.Text, "0.00000")
    
    'Update other controls
    UpdateVals DecVal
    
    'Set the focus back to the ok button
    cmdOK.SetFocus
End Sub


Private Sub vscvalue_Change()
    Dim NewVal As Double
    
    'Calculate the new value
    NewVal = txtDecVal.Text + vscValue.value
    If NewVal >= 0 And NewVal <= (NumOSFVals - 1) Then
        'Update the new values
        UpdateVals NewVal
    End If
    vscValue.value = 0
End Sub

⌨️ 快捷键说明

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