📄 newmenu.cpp
字号:
//---------------------------------------------------------------------------
#include <vcl.h>
#pragma hdrstop
#include "NewMenu.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma link "CoolCtrls"
#pragma resource "*.dfm"
TENewMenu *ENewMenu;
//---------------------------------------------------------------------------
__fastcall TENewMenu::TENewMenu(TComponent* Owner)
: TForm(Owner)
{
}
//---------------------------------------------------------------------------
void __fastcall TENewMenu::FormShow(TObject *Sender)
{
Edit1->SetFocus();
IsNew = false;
}
//---------------------------------------------------------------------------
void __fastcall TENewMenu::BitBtn1Click(TObject *Sender)
{
if( Edit1->Text == "" )
{
MessageBeep(0xFFFFFFFF);
Application->MessageBox("菜单代码不能为空!","提示", MB_OK | MB_ICONQUESTION);
Edit1->SetFocus();
}
else if( Edit2->Text == "")
{
MessageBeep(0xFFFFFFFF);
Application->MessageBox("菜单名称不能为空!","提示", MB_OK | MB_ICONQUESTION);
Edit2->SetFocus();
}
else if(ComboBox1->Text == "")
{
MessageBeep(0xFFFFFFFF);
Application->MessageBox("按键选择不能为空!","提示", MB_OK | MB_ICONQUESTION);
ComboBox1->SetFocus();
}
else
{
IsNew = true;
Close();
}
}
//---------------------------------------------------------------------------
void __fastcall TENewMenu::BitBtn2Click(TObject *Sender)
{
IsNew = false;
Close();
}
//---------------------------------------------------------------------------
void __fastcall TENewMenu::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 TENewMenu::Edit1Change(TObject *Sender)
{
Edit4->Text=Edit1->Text;
}
//---------------------------------------------------------------------------
void __fastcall TENewMenu::SpeedButton1Click(TObject *Sender)
{
ENewMenu->OpenDialog1->Filter = "Wave files (*.vox)|*.VOX";
ENewMenu->OpenDialog1->Execute();
TENewMenu::Edit5->Text=ChangeFileExt(ExtractFileName(ENewMenu->OpenDialog1->FileName),"");
}
//---------------------------------------------------------------------------
void __fastcall TENewMenu::Edit4KeyPress(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 TENewMenu::ComboBox1KeyPress(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 TENewMenu::Edit2KeyPress(TObject *Sender, char &Key)
{
if (Key == '\r')
{
Key = 0;
SelectNext(ActiveControl, true, true);
}
}
//---------------------------------------------------------------------------
void __fastcall TENewMenu::Edit5KeyPress(TObject *Sender, char &Key)
{
if (Key == '\r')
{
Key = 0;
SelectNext(ActiveControl, true, true);
}
}
//---------------------------------------------------------------------------
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -