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

📄 softkey.cpp

📁 是自己开发的程序
💻 CPP
字号:
#include "SoftKey.h"BEGIN_EVENT_TABLE(SoftKey, wxDialog)    EVT_PAINT(SoftKey::OnPaint)    EVT_BUTTON(ID_Button_SoftKey0, SoftKey::OnButtonKey0)    EVT_BUTTON(ID_Button_SoftKey1, SoftKey::OnButtonKey1)    EVT_BUTTON(ID_Button_SoftKey2, SoftKey::OnButtonKey2)    EVT_BUTTON(ID_Button_SoftKey3, SoftKey::OnButtonKey3)    EVT_BUTTON(ID_Button_SoftKey4, SoftKey::OnButtonKey4)    EVT_BUTTON(ID_Button_SoftKey5, SoftKey::OnButtonKey5)    EVT_BUTTON(ID_Button_SoftKey6, SoftKey::OnButtonKey6)    EVT_BUTTON(ID_Button_SoftKey7, SoftKey::OnButtonKey7)    EVT_BUTTON(ID_Button_SoftKey8, SoftKey::OnButtonKey8)    EVT_BUTTON(ID_Button_SoftKey9, SoftKey::OnButtonKey9)    EVT_BUTTON(ID_Button_SoftKey11, SoftKey::OnButtonKey11)    EVT_BUTTON(ID_Button_SoftKey12, SoftKey::OnButtonKey12)    EVT_BUTTON(ID_Button_SoftKey13, SoftKey::OnButtonKey13)    EVT_BUTTON(ID_Button_SoftKey14, SoftKey::OnButtonKey14)    EVT_BUTTON(ID_Button_SoftKey15, SoftKey::OnButtonKey15)END_EVENT_TABLE()SoftKey::SoftKey(wxWindow *parent,		        const wxPoint& point,                const wxSize& size)                : wxDialog(parent, wxID_ANY,_("软键盘"),point,size,(wxSTAY_ON_TOP|wxCLOSE_BOX|wxCAPTION)){    pInputCtrl = NULL;    new wxButton(this,ID_Button_SoftKey0,_("0"),wxPoint(0,0),wxSize(25,25));    new wxButton(this,ID_Button_SoftKey1,_("1"),wxPoint(25,0),wxSize(25,25));    new wxButton(this,ID_Button_SoftKey2,_("2"),wxPoint(50,0),wxSize(25,25));    new wxButton(this,ID_Button_SoftKey3,_("3"),wxPoint(75,0),wxSize(25,25));    new wxButton(this,ID_Button_SoftKey4,_("4"),wxPoint(100,0),wxSize(25,25));    new wxButton(this,ID_Button_SoftKey5,_("5"),wxPoint(0,25),wxSize(25,25));    new wxButton(this,ID_Button_SoftKey6,_("6"),wxPoint(25,25),wxSize(25,25));    new wxButton(this,ID_Button_SoftKey7,_("7"),wxPoint(50,25),wxSize(25,25));    new wxButton(this,ID_Button_SoftKey8,_("8"),wxPoint(75,25),wxSize(25,25));    new wxButton(this,ID_Button_SoftKey9,_("9"),wxPoint(100,25),wxSize(25,25));    new wxButton(this,ID_Button_SoftKey11,_("*"),wxPoint(0,50),wxSize(25,25));    new wxButton(this,ID_Button_SoftKey12,_("."),wxPoint(25,50),wxSize(25,25));    new wxButton(this,ID_Button_SoftKey13,_("#"),wxPoint(50,50),wxSize(25,25));    new wxButton(this,ID_Button_SoftKey14,_("<-"),wxPoint(75,50),wxSize(25,25));    new wxButton(this,ID_Button_SoftKey15,_("H"),wxPoint(100,50),wxSize(25,25));}SoftKey::~SoftKey(){}void SoftKey::OnPaint(wxPaintEvent& event){}bool SoftKey::DoOK(){    Show(0);    return false;}void SoftKey::OnButtonKey0(wxCommandEvent& event){    if(pInputCtrl != NULL)    {        pInputCtrl->AppendText(_("0"));    }}void SoftKey::OnButtonKey1(wxCommandEvent& event){    if(pInputCtrl != NULL)    {        pInputCtrl->AppendText(_("1"));    }}void SoftKey::OnButtonKey2(wxCommandEvent& event){    if(pInputCtrl != NULL)    {        pInputCtrl->AppendText(_("2"));    }}void SoftKey::OnButtonKey3(wxCommandEvent& event){    if(pInputCtrl != NULL)    {        pInputCtrl->AppendText(_("3"));    }}void SoftKey::OnButtonKey4(wxCommandEvent& event){    if(pInputCtrl != NULL)    {        pInputCtrl->AppendText(_("4"));    }}void SoftKey::OnButtonKey5(wxCommandEvent& event){    if(pInputCtrl != NULL)    {        pInputCtrl->AppendText(_("5"));    }}void SoftKey::OnButtonKey6(wxCommandEvent& event){    if(pInputCtrl != NULL)    {        pInputCtrl->AppendText(_("6"));    }}void SoftKey::OnButtonKey7(wxCommandEvent& event){    if(pInputCtrl != NULL)    {        pInputCtrl->AppendText(_("7"));    }}void SoftKey::OnButtonKey8(wxCommandEvent& event){    if(pInputCtrl != NULL)    {        pInputCtrl->AppendText(_("8"));    }}void SoftKey::OnButtonKey9(wxCommandEvent& event){    if(pInputCtrl != NULL)    {        pInputCtrl->AppendText(_("9"));    }}void SoftKey::OnButtonKey11(wxCommandEvent& event){    if(pInputCtrl != NULL)    {        pInputCtrl->AppendText(_("*"));    }}void SoftKey::OnButtonKey12(wxCommandEvent& event){    if(pInputCtrl != NULL)    {        pInputCtrl->AppendText(_("."));    }}void SoftKey::OnButtonKey13(wxCommandEvent& event){    if(pInputCtrl != NULL)    {        pInputCtrl->AppendText(_("#"));    }}void SoftKey::OnButtonKey14(wxCommandEvent& event){    long last;    if(pInputCtrl != NULL)    {        last = pInputCtrl->GetLastPosition();        if(last > 0)        {            pInputCtrl->Remove(last-1,last);        }    }}void SoftKey::OnButtonKey15(wxCommandEvent& event){    Show(0);}void SoftKey::SetInputCtrl(wxTextCtrl *pTextCtrl){    pInputCtrl = pTextCtrl;}

⌨️ 快捷键说明

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