form_CFGCrystalAfc.cpp
上传用户:gelin96
上传日期:2017-01-08
资源大小:20993k
文件大小:19k
- /*****************************************************************************
- * Copyright Statement:
- * --------------------
- * This software is protected by Copyright and the information contained
- * herein is confidential. The software may not be copied and the information
- * contained herein may not be used or disclosed except with the written
- * permission of MediaTek Inc. (C) 2005
- *
- * BY OPENING THIS FILE, BUYER HEREBY UNEQUIVOCALLY ACKNOWLEDGES AND AGREES
- * THAT THE SOFTWARE/FIRMWARE AND ITS DOCUMENTATIONS ("MEDIATEK SOFTWARE")
- * RECEIVED FROM MEDIATEK AND/OR ITS REPRESENTATIVES ARE PROVIDED TO BUYER ON
- * AN "AS-IS" BASIS ONLY. MEDIATEK EXPRESSLY DISCLAIMS ANY AND ALL WARRANTIES,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR NONINFRINGEMENT.
- * NEITHER DOES MEDIATEK PROVIDE ANY WARRANTY WHATSOEVER WITH RESPECT TO THE
- * SOFTWARE OF ANY THIRD PARTY WHICH MAY BE USED BY, INCORPORATED IN, OR
- * SUPPLIED WITH THE MEDIATEK SOFTWARE, AND BUYER AGREES TO LOOK ONLY TO SUCH
- * THIRD PARTY FOR ANY WARRANTY CLAIM RELATING THERETO. MEDIATEK SHALL ALSO
- * NOT BE RESPONSIBLE FOR ANY MEDIATEK SOFTWARE RELEASES MADE TO BUYER'S
- * SPECIFICATION OR TO CONFORM TO A PARTICULAR STANDARD OR OPEN FORUM.
- *
- * BUYER'S SOLE AND EXCLUSIVE REMEDY AND MEDIATEK'S ENTIRE AND CUMULATIVE
- * LIABILITY WITH RESPECT TO THE MEDIATEK SOFTWARE RELEASED HEREUNDER WILL BE,
- * AT MEDIATEK'S OPTION, TO REVISE OR REPLACE THE MEDIATEK SOFTWARE AT ISSUE,
- * OR REFUND ANY SOFTWARE LICENSE FEES OR SERVICE CHARGE PAID BY BUYER TO
- * MEDIATEK FOR SUCH MEDIATEK SOFTWARE AT ISSUE.
- *
- * THE TRANSACTION CONTEMPLATED HEREUNDER SHALL BE CONSTRUED IN ACCORDANCE
- * WITH THE LAWS OF THE STATE OF CALIFORNIA, USA, EXCLUDING ITS CONFLICT OF
- * LAWS PRINCIPLES. ANY DISPUTES, CONTROVERSIES OR CLAIMS ARISING THEREOF AND
- * RELATED THERETO SHALL BE SETTLED BY ARBITRATION IN SAN FRANCISCO, CA, UNDER
- * THE RULES OF THE INTERNATIONAL CHAMBER OF COMMERCE (ICC).
- *
- *****************************************************************************/
- /*****************************************************************************
- *
- * Filename:
- * ---------
- * form_CFGCrystalAfc.cpp
- *
- * Project:
- * --------
- * Maui META APP
- *
- * Description:
- * ------------
- * Crystal AFC CFG file source
- *
- * Author:
- * -------
- * Andy Ueng (mtk00490)
- *
- *============================================================================
- * HISTORY
- * Below this line, this part is controlled by PVCS VM. DO NOT MODIFY!!
- *------------------------------------------------------------------------------
- * $Revision$
- * $Modtime$
- * $Log$
- *
- *------------------------------------------------------------------------------
- * Upper this line, this part is controlled by PVCS VM. DO NOT MODIFY!!
- *============================================================================
- ****************************************************************************/
- //---------------------------------------------------------------------------
- #include <vcl.h>
- #pragma hdrstop
- #include "form_CFGCrystalAfc.h"
- #include "META_Factory.h"
- #include "misc.h"
- #ifndef _FT_UTILS_H_
- #include "ft_utils.h"
- #endif
- #include "meta_utils.h"
- #ifndef _BAND_UTILS_H_
- #include "band_utils.h"
- #endif
- //---------------------------------------------------------------------------
- #pragma package(smart_init)
- #pragma resource "*.dfm"
- TfrmCFGCrystalAfc *frmCFGCrystalAfc;
- //---------------------------------------------------------------------------
- __fastcall TfrmCFGCrystalAfc::TfrmCFGCrystalAfc(TComponent* Owner)
- : TForm(Owner)
- {
- // iCHECK_DAC[0] = 8000;
- // iCHECK_DAC[1] = 0;
- // dFREQUENCY_ERROR_PPM[0] = 17.0;
- // dFREQUENCY_ERROR_PPM[1] = -17.0;
- edtCHECK_DAC[0] = edtCRYSTAL_AFC_CHECK_DAC1;
- edtCHECK_DAC[1] = edtCRYSTAL_AFC_CHECK_DAC2;
- edtFREQUENCY_ERROR_PPM[0] = edtCRYSTAL_AFC_MAX_FREQ_ERR_PPM;
- edtFREQUENCY_ERROR_PPM[1] = edtCRYSTAL_AFC_MIN_FREQ_ERR_PPM;
- }
- //---------------------------------------------------------------------------
- void __fastcall TfrmCFGCrystalAfc::btnLoadFromCFGFileClick(TObject *Sender)
- {
- bool ok;
- AnsiString asPath, asFileName;
- static bool isFirstOpen = true;
- if( isFirstOpen )
- {
- isFirstOpen = false;
- if( getPathFromStr( frmFatcory->stCFGFile->Caption, asPath ) )
- {
- OpenDlg->InitialDir = asPath;
- if( getFilenameFromStr( frmFatcory->stCFGFile->Caption, asFileName ) )
- {
- OpenDlg->FileName = asFileName;
- }
- }
- else
- {
- if( getPathFromStr(Application->ExeName, asPath) )
- {
- OpenDlg->InitialDir = asPath;
- }
- else
- {
- OpenDlg->InitialDir = "C:\";
- }
- }
- }
- ok = OpenDlg->Execute();
- if( !ok )
- {
- sbCFGCrystalAfc->Panels->Items[0]->Text = (AnsiString) " Load crystal AFC setting from file fail";
- Application->MessageBox( "Execution Failure : Load crystal AFC setting from file fail", "FAILURE", MB_OK );
- return;
- }
- if (!cfg->ReadFromIniFile(OpenDlg->FileName))
- {
- sbCFGCrystalAfc->Panels->Items[0]->Text = (AnsiString) " Read CFG file fail";
- Application->MessageBox( "Execution Failure : Read CFG file", "FAILURE", MB_OK );
- return;
- }
- // CRYSTAL_AFC_BAND
- cfg->get_CRYSTAL_AFC_BAND( as_CRYSTAL_AFC_BAND );
- edtCRYSTAL_AFC_BAND->Text = as_CRYSTAL_AFC_BAND;
- // CRYSTAL_AFC_ARFCN
- cfg->get_CRYSTAL_AFC_ARFCN( m_sCRYSTAL_AFC_ARFCN );
- edtCRYSTAL_AFC_ARFCN->Text = IntToStr( m_sCRYSTAL_AFC_ARFCN );
- // CRYSTAL_AFC_GSM850_PCL
- cfg->get_CRYSTAL_AFC_GSM850_PCL( iCRYSTAL_AFC_GSM850_PCL );
- edtCRYSTAL_AFC_GSM850_PCL->Text = IntToStr( iCRYSTAL_AFC_GSM850_PCL );
- // CRYSTAL_AFC_GSM900_PCL
- cfg->get_CRYSTAL_AFC_GSM900_PCL( iCRYSTAL_AFC_GSM900_PCL );
- edtCRYSTAL_AFC_GSM900_PCL->Text = IntToStr( iCRYSTAL_AFC_GSM900_PCL );
- // CRYSTAL_AFC_DCS1800_PCL
- cfg->get_CRYSTAL_AFC_DCS1800_PCL( iCRYSTAL_AFC_DCS1800_PCL );
- edtCRYSTAL_AFC_DCS1800_PCL->Text = IntToStr( iCRYSTAL_AFC_DCS1800_PCL );
- // CRYSTAL_AFC_PCS1900_PCL
- cfg->get_CRYSTAL_AFC_PCS1900_PCL( iCRYSTAL_AFC_PCS1900_PCL );
- edtCRYSTAL_AFC_PCS1900_PCL->Text = IntToStr( iCRYSTAL_AFC_PCS1900_PCL );
- // CRYSTAL_AFC_CAL_DAC
- cfg->get_CRYSTAL_AFC_CAL_DAC( m_sCRYSTAL_AFC_CAL_DAC );
- edtCRYSTAL_AFC_CAL_DAC->Text = IntToStr( m_sCRYSTAL_AFC_CAL_DAC );
- // MIN_CHECK_DAC
- cfg->get_CRYSTAL_AFC_CHECK_DAC1( m_sCRYSTAL_AFC_CHECK_DAC1 );
- edtCRYSTAL_AFC_CHECK_DAC1->Text = IntToStr( m_sCRYSTAL_AFC_CHECK_DAC1 );
- // CRYSTAL_AFC_CHECK_DAC2
- cfg->get_CRYSTAL_AFC_CHECK_DAC2( m_sCRYSTAL_AFC_CHECK_DAC2 );
- edtCRYSTAL_AFC_CHECK_DAC2->Text = IntToStr( m_sCRYSTAL_AFC_CHECK_DAC2 );
- // CRYSTAL_AFC_MIN_FREQ_ERR_PPM
- cfg->get_CRYSTAL_AFC_MIN_FREQ_ERR_PPM( dCRYSTAL_AFC_MIN_FREQ_ERR_PPM );
- edtCRYSTAL_AFC_MIN_FREQ_ERR_PPM->Text = Double_To_AnsiString( dCRYSTAL_AFC_MIN_FREQ_ERR_PPM );
- // CRYSTAL_AFC_MAX_FREQ_ERR_PPM
- cfg->get_CRYSTAL_AFC_MAX_FREQ_ERR_PPM( dCRYSTAL_AFC_MAX_FREQ_ERR_PPM );
- edtCRYSTAL_AFC_MAX_FREQ_ERR_PPM->Text = Double_To_AnsiString( dCRYSTAL_AFC_MAX_FREQ_ERR_PPM );
- // CRYSTAL_AFC_MAX_AFC_TRACK_INIT_FREQ_ERR
- cfg->get_CRYSTAL_AFC_MAX_AFC_TRACK_INIT_FREQ_ERR( m_dCRYSTAL_AFC_MAX_AFC_TRACK_INIT_FREQ_ERR );
- edtCRYSTAL_AFC_MAX_AFC_TRACK_INIT_FREQ_ERR->Text = Double_To_AnsiString( m_dCRYSTAL_AFC_MAX_AFC_TRACK_INIT_FREQ_ERR );
- // CRYSTAL_AFC_FREQ_ERR_MEASUSE_COUNT
- cfg->get_CRYSTAL_AFC_FREQ_ERR_MEASUSE_COUNT(m_sCRYSTAL_AFC_FREQ_ERR_MEASUSE_COUNT);
- edtCRYSTAL_AFC_FREQ_ERR_MEASUSE_COUNT->Text = IntToStr(m_sCRYSTAL_AFC_FREQ_ERR_MEASUSE_COUNT);
- // CRYSTAL_AFC_RECURSIVE_TIMES
- cfg->get_CRYSTAL_AFC_RECURSIVE_TIMES(m_sCRYSTAL_AFC_RECURSIVE_TIMES );
- edtCRYSTAL_AFC_RECURSIVE_TIMES->Text = IntToStr(m_sCRYSTAL_AFC_RECURSIVE_TIMES);
- }
- //---------------------------------------------------------------------------
- void __fastcall TfrmCFGCrystalAfc::FormClose(TObject *Sender,
- TCloseAction &Action)
- {
- if(cfg != NULL)
- {
- delete cfg;
- cfg = NULL;
- }
- }
- //---------------------------------------------------------------------------
- void __fastcall TfrmCFGCrystalAfc::btnSaveToCFGFileClick(TObject *Sender)
- {
- bool ok;
- AnsiString asPath, asFileName;
- static bool isFirstSave = true;
- if( isFirstSave )
- {
- isFirstSave = false;
- if( getPathFromStr( frmFatcory->stCFGFile->Caption, asPath ) )
- {
- SaveDlg->InitialDir = asPath;
- if( getFilenameFromStr( frmFatcory->stCFGFile->Caption, asFileName ) )
- {
- SaveDlg->FileName = asFileName;
- }
- }
- else
- {
- if( getPathFromStr(Application->ExeName, asPath) )
- {
- SaveDlg->InitialDir = asPath;
- }
- else
- {
- SaveDlg->InitialDir = "C:\";
- }
- }
- }
- if( ! CheckFields() )
- {
- sbCFGCrystalAfc->Panels->Items[0]->Text = (AnsiString) " Save crystal AFC setting to file fail";
- Application->MessageBox( "Execution Failure : Save crystal AFC setting to file", "FAILURE", MB_OK );
- return;
- }
- ok = SaveDlg->Execute();
- if( !ok )
- {
- sbCFGCrystalAfc->Panels->Items[0]->Text = (AnsiString) " Save crystal AFC setting to file fail";
- Application->MessageBox( "Execution Failure : Save crystal AFC setting to file", "FAILURE", MB_OK );
- return;
- }
- cfg->SaveCrystalAfcToCfgFile( SaveDlg->FileName );
- }
- //---------------------------------------------------------------------------
- bool TfrmCFGCrystalAfc::CheckFields( void )
- {
- AnsiString text;
- text = edtCRYSTAL_AFC_BAND->Text; if( !IsValidBand( text ) ) { edtCRYSTAL_AFC_BANCheck(edtCRYSTAL_AFC_BAND); return(false); }
- as_CRYSTAL_AFC_BAND = text;
- cfg->setAFC_BAND( as_CRYSTAL_AFC_BAND );
- E_BANDSEL band_index = String_To_BandIdx(as_CRYSTAL_AFC_BAND);
- text = edtCRYSTAL_AFC_ARFCN->Text; if( !IsValidARFCN( text, band_index, m_sCRYSTAL_AFC_ARFCN ) ) { edtArfcnCheck(edtCRYSTAL_AFC_ARFCN); return(false); }
- cfg->set_CRYSTAL_AFC_ARFCN( m_sCRYSTAL_AFC_ARFCN );
- text = edtCRYSTAL_AFC_GSM850_PCL->Text; if( !IsValidPCL( text, BANDSEL_GSM850, iCRYSTAL_AFC_GSM850_PCL ) ) { edtPclCheck(edtCRYSTAL_AFC_GSM850_PCL); return(false); }
- cfg->set_CRYSTAL_AFC_GSM850_PCL( iCRYSTAL_AFC_GSM850_PCL );
- text = edtCRYSTAL_AFC_GSM900_PCL->Text; if( !IsValidPCL( text, BANDSEL_GSM900, iCRYSTAL_AFC_GSM900_PCL ) ) { edtPclCheck(edtCRYSTAL_AFC_GSM900_PCL); return(false); }
- cfg->set_CRYSTAL_AFC_GSM900_PCL( iCRYSTAL_AFC_GSM900_PCL );
- text = edtCRYSTAL_AFC_DCS1800_PCL->Text; if( !IsValidPCL( text, BANDSEL_DCS1800, iCRYSTAL_AFC_DCS1800_PCL ) ) { edtPclCheck(edtCRYSTAL_AFC_DCS1800_PCL); return(false); }
- cfg->set_CRYSTAL_AFC_DCS1800_PCL( iCRYSTAL_AFC_DCS1800_PCL );
- text = edtCRYSTAL_AFC_PCS1900_PCL->Text; if( !IsValidPCL( text, BANDSEL_PCS1900, iCRYSTAL_AFC_PCS1900_PCL ) ) { edtPclCheck(edtCRYSTAL_AFC_PCS1900_PCL); return(false); }
- cfg->set_CRYSTAL_AFC_PCS1900_PCL( iCRYSTAL_AFC_PCS1900_PCL );
- text = edtCRYSTAL_AFC_CAL_DAC->Text; if( !IsValidAFC( text, m_sCRYSTAL_AFC_CAL_DAC ) ) { edtAfcDacCheck(edtCRYSTAL_AFC_CAL_DAC); return(false); }
- cfg->set_CRYSTAL_AFC_CAL_DAC( m_sCRYSTAL_AFC_CAL_DAC );
- text = edtCRYSTAL_AFC_CHECK_DAC2->Text; if( !IsValidAFC( text, m_sCRYSTAL_AFC_CHECK_DAC2 ) ) { edtAfcDacCheck(edtCRYSTAL_AFC_CHECK_DAC2); return(false); }
- cfg->set_CRYSTAL_AFC_CHECK_DAC2( m_sCRYSTAL_AFC_CHECK_DAC2 );
- text = edtCRYSTAL_AFC_CHECK_DAC1->Text; if( !IsValidAFC( text, m_sCRYSTAL_AFC_CHECK_DAC1 ) ) { edtAfcDacCheck(edtCRYSTAL_AFC_CHECK_DAC1); return(false); }
- cfg->set_CRYSTAL_AFC_CHECK_DAC1( m_sCRYSTAL_AFC_CHECK_DAC1 );
- text = edtCRYSTAL_AFC_MAX_FREQ_ERR_PPM->Text; if( !IsValidCFGFrequencyErrorPPM( text, dCRYSTAL_AFC_MAX_FREQ_ERR_PPM ) ) { edtFreqErrPPMCheck(edtCRYSTAL_AFC_MAX_FREQ_ERR_PPM); return false; }
- cfg->set_CRYSTAL_AFC_MAX_FREQ_ERR_PPM( dCRYSTAL_AFC_MAX_FREQ_ERR_PPM );
- text = edtCRYSTAL_AFC_MIN_FREQ_ERR_PPM->Text; if( !IsValidCFGFrequencyErrorPPM( text, dCRYSTAL_AFC_MIN_FREQ_ERR_PPM ) ) { edtFreqErrPPMCheck(edtCRYSTAL_AFC_MIN_FREQ_ERR_PPM); return false; }
- cfg->set_CRYSTAL_AFC_MIN_FREQ_ERR_PPM( dCRYSTAL_AFC_MIN_FREQ_ERR_PPM );
- text = edtCRYSTAL_AFC_MAX_AFC_TRACK_INIT_FREQ_ERR->Text; if( !IsValidCFGFrequencyError( text, m_dCRYSTAL_AFC_MAX_AFC_TRACK_INIT_FREQ_ERR ) ) { edtFreqErrCheck(edtCRYSTAL_AFC_MAX_AFC_TRACK_INIT_FREQ_ERR); return(false); }
- cfg->set_CRYSTAL_AFC_MAX_AFC_TRACK_INIT_FREQ_ERR( m_dCRYSTAL_AFC_MAX_AFC_TRACK_INIT_FREQ_ERR );
- text = edtCRYSTAL_AFC_FREQ_ERR_MEASUSE_COUNT->Text; if( !IsValidAFCCount(text, m_sCRYSTAL_AFC_FREQ_ERR_MEASUSE_COUNT)) { edtFreqErrMeasCountCheck(edtCRYSTAL_AFC_FREQ_ERR_MEASUSE_COUNT); return false; }
- cfg->set_CRYSTAL_AFC_FREQ_ERR_MEASUSE_COUNT(m_sCRYSTAL_AFC_FREQ_ERR_MEASUSE_COUNT);
- text = edtCRYSTAL_AFC_RECURSIVE_TIMES->Text; if (!IsValidAFCCount(text, m_sCRYSTAL_AFC_RECURSIVE_TIMES)) { edtFreqErrRecursiveTimesCheck(edtCRYSTAL_AFC_RECURSIVE_TIMES); return(false); }
- cfg->set_CRYSTAL_AFC_RECURSIVE_TIMES(m_sCRYSTAL_AFC_RECURSIVE_TIMES);
- return true;
- }
- //---------------------------------------------------------------------------
- void __fastcall TfrmCFGCrystalAfc::edtArfcnCheck(TObject *Sender)
- {
- short sdata;
- AnsiString text;
- TEdit *edit = (TEdit*)Sender;
- char hint[][256] =
- { " value shall be 0~124 or 975~1023 ",
- " value shall be 512~885 ",
- " value shall be 512~810 ",
- " value shall be 128~251 ",
- };
- E_BANDSEL CurBand = String_To_BandIdx(as_CRYSTAL_AFC_BAND);
- text = edit->Text;
- if (!IsValidARFCN(text, CurBand, sdata))
- {
- edit->Text = IntToStr(Default_ARFCN[CurBand]);
- ShowHintLabel(edit, hint[CurBand]);
- edit->SetFocus();
- return;
- }
- }
- //---------------------------------------------------------------------------
- void TfrmCFGCrystalAfc::ShowHintLabel( TControl *sender, char* hint )
- {
- TPoint pt0 = this->ClientOrigin;
- TPoint pt1 = sender->ClientOrigin;
- lblHint->Left = (pt1.x-pt0.x);
- lblHint->Top = (pt1.y-pt0.y)+sender->Height+3;
- lblHint->Caption = hint;
- lblHint->Visible = true;
- HintTimer->Enabled = true;
- }
- //---------------------------------------------------------------------------
- void __fastcall TfrmCFGCrystalAfc::HintTimerTimer(TObject *Sender)
- {
- HintTimer->Enabled = false;
- lblHint->Visible = false;
- }
- //---------------------------------------------------------------------------
- void __fastcall TfrmCFGCrystalAfc::edtPclCheck(TObject *Sender)
- {
- int i;
- int data;
- AnsiString text;
- TEdit *edit = (TEdit*)Sender;
- char hint[][256] =
- { " value shall be 4~31 ",
- " value shall be 0~28 ",
- " value shall be 0~15 ",
- " value shall be 4~31 ",
- };
- int CurBand = 0;
-
- text = edit->Text;
- if( !IsValidPCL( text, CurBand, data ) )
- {
- ShowHintLabel( edit, hint[CurBand] );
- edit->Text = IntToStr( Default_PCL );
- edit->SetFocus();
- return;
- }
- }
- //---------------------------------------------------------------------------
- void __fastcall TfrmCFGCrystalAfc::edtAfcDacCheck(TObject *Sender)
- {
- short sdata;
- AnsiString text;
- TEdit *edit = (TEdit*)Sender;
- char hint[] = " value shall be 0~8191 ";
- text = edit->Text;
- if (!IsValidAFC( text, sdata ) )
- {
- ShowHintLabel( edit, hint );
- edit->Text = IntToStr( Default_AFC );
- edit->SetFocus();
- return;
- }
- //iCHECK_DAC[edit->Tag] = data;
- }
- //---------------------------------------------------------------------------
- void __fastcall TfrmCFGCrystalAfc::edtFreqErrPPMCheck(TObject *Sender)
- {
- double data;
- AnsiString text;
- TEdit *edit = (TEdit*)Sender;
- char hint[] = " value is not valid ";
- text = edit->Text;
- if( !IsValidCFGFrequencyErrorPPM( text, data ) )
- {
- ShowHintLabel( edit, hint );
- edit->Text = IntToStr( 0 );
- edit->SetFocus();
- return;
- }
- // dFREQUENCY_ERROR_PPM[edit->Tag] = dCRYSTAL_AFC_MAX_FREQ_ERR_PPM;
- // dFREQUENCY_ERROR_PPM[1] = dCRYSTAL_AFC_MIN_FREQ_ERR_PPM;
- }
- //---------------------------------------------------------------------------
- void __fastcall TfrmCFGCrystalAfc::FormShow(TObject *Sender)
- {
- if(cfg == NULL)
- {
- cfg = new TMETA_factory_cfg();
- }
- }
- //---------------------------------------------------------------------------
- void __fastcall TfrmCFGCrystalAfc::edtCRYSTAL_AFC_BANCheck(TObject *Sender)
- {
- int i;
- AnsiString text;
- TEdit *edit = (TEdit*)Sender;
- char hint[] = " Support band: GSM850, GSM, DCS, PCS ";
- text = edit->Text;
- if( !IsValidBand( text ) )
- {
- ShowHintLabel( edit, hint );
- edit->Text = "GSM";
- edit->SetFocus();
- return;
- }
- }
- //---------------------------------------------------------------------------
- void __fastcall TfrmCFGCrystalAfc::edtFreqErrMeasCountCheck(
- TObject *Sender)
- {
- short s_data;
- AnsiString text;
- TEdit *edit = (TEdit*)Sender;
- char hint[] = "value shall be 0~32767 ";
- text = edit->Text;
- if (!IsValidAFCCount(text, s_data))
- {
- ShowHintLabel(edit, hint);
- edit->Text = IntToStr(10);
- edit->SetFocus();
- return;
- }
- }
- //---------------------------------------------------------------------------
- void __fastcall TfrmCFGCrystalAfc::edtFreqErrRecursiveTimesCheck(
- TObject *Sender)
- {
- short s_data;
- AnsiString text;
- TEdit *edit = (TEdit*)Sender;
- char hint[] = "value shall be 0~32767 ";
- text = edit->Text;
- if (!IsValidAFCCount(text, s_data))
- {
- ShowHintLabel(edit, hint);
- edit->Text = IntToStr(20);
- edit->SetFocus();
- return;
- }
- }
- //---------------------------------------------------------------------------
- void __fastcall TfrmCFGCrystalAfc::edtFreqErrCheck(TObject *Sender)
- {
- double data;
- AnsiString text;
- TEdit *edit = (TEdit*)Sender;
- char hint[] = " value is not valid ";
- text = edit->Text;
- if( !IsValidCFGFrequencyError( text, data ) )
- {
- ShowHintLabel( edit, hint );
- edit->Text = Double_To_AnsiString( 100.0 );
- edit->SetFocus();
- return;
- }
- }
- //---------------------------------------------------------------------------