📄 search.cpp
字号:
//---------------------------------------------------------------------------
#include <vcl.h>
#pragma hdrstop
#include "Search.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma link "CoolCtrls"
#pragma resource "*.dfm"
TSearchText *SearchText;
//---------------------------------------------------------------------------
__fastcall TSearchText::TSearchText(TComponent* Owner)
: TForm(Owner)
{
//CoolCheckRadioGroup1->ItemIndex=0;
}
//---------------------------------------------------------------------------
void __fastcall TSearchText::BitBtn1Click(TObject *Sender)
{
if( CoolCheckRadioGroup1->ItemIndex == 0 )
{
if( Edit1->Text.IsEmpty() )
{
MessageBeep( 0xFFFFFFFF );
Application->MessageBox( "请先输入要查找的代码","提示", MB_OK | MB_ICONQUESTION );
return ;
}
}
else
{
if( Edit2->Text.IsEmpty() )
{
MessageBeep( 0xFFFFFFFF );
Application->MessageBox( "请先输入要查找的名称","提示", MB_OK | MB_ICONQUESTION );
return ;
}
}
IsTrue = true;
Close();
}
//---------------------------------------------------------------------------
void __fastcall TSearchText::BitBtn2Click(TObject *Sender)
{
IsTrue = false;
Close();
}
//---------------------------------------------------------------------------
void __fastcall TSearchText::CoolRadioGroup1Click(TObject *Sender)
{
if( CoolCheckRadioGroup1->ItemIndex == 0 )
{
Edit1->SetFocus();
// Edit1->Enabled = true;
// Edit2->Enabled = false;
}
else if (CoolCheckRadioGroup1->ItemIndex == 1)
{
Edit2->SetFocus();
// Edit1->Enabled = false;
// Edit2->Enabled = true;
}
}
//---------------------------------------------------------------------------
void __fastcall TSearchText::FormShow(TObject *Sender)
{
CoolCheckRadioGroup1->ItemIndex == 0;
Edit1->SetFocus();
// Edit1->Enabled = true;
// Edit2->Enabled = false;
}
//---------------------------------------------------------------------------
void __fastcall TSearchText::Edit1KeyPress(TObject *Sender, char &Key)
{
if (Key == '\r')
{
Key = 0;
SelectNext(ActiveControl, true, true);
}
if(!(isdigit(Key)||iscntrl(Key)))
Application->MessageBox("您的输入错误,请输入0-9之间的数!", "错误",MB_OK |MB_ICONERROR);
}
//---------------------------------------------------------------------------
void __fastcall TSearchText::Edit2KeyPress(TObject *Sender, char &Key)
{
if (Key == '\r')
{
Key = 0;
SelectNext(ActiveControl, true, true);
}
}
//---------------------------------------------------------------------------
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -