ybcommdesigneditors.cpp

来自「简单实用, 功能强大的 C++ Builder 串口控件! 本控件是免费的, 」· C++ 代码 · 共 63 行

CPP
63 行
字号
//---------------------------------------------------------------------------


#pragma hdrstop

#include "YbCommDesignEditors.h"
#include "Unit_YBComm32_About.h"
#include "Unit_YbCommDevice_Settings.h"
//---------------------------------------------------------------------------

#pragma package(smart_init)
//---------------------------------------------------------------------------
namespace Ybcommdevice
{
    void __fastcall PACKAGE Register()
    {
         TComponentClass classes[1] = {__classid(TYbCommDevice)};
         RegisterComponents("Victor", classes, 0);
         RegisterComponentEditor(__classid(TYbCommDevice),__classid(TYbCommDeviceEditor));
    }
}
//---------------------------------------------------------------------------
void __fastcall TYbCommDeviceEditor::ExecuteVerb(int Index)
{
  if(Index == 0)
   {
     bool bPressedBtnOK;
     TForm_YbCommDevice_Settings *FormSettings;
     TYbCommDevice *lpComm = dynamic_cast<TYbCommDevice*>(Component);

     if(lpComm)
      {
        FormSettings = new TForm_YbCommDevice_Settings(NULL,lpComm,false);
        bPressedBtnOK = FormSettings->ShowModal() == IDOK;
        delete FormSettings;

        if(bPressedBtnOK)
         {
           Designer->Modified();
         }
      }
   }
  else
   {
     TForm_YBComm32_About *FormAbout = new TForm_YBComm32_About(NULL,Component->ClassName());
     FormAbout->ShowModal();
     delete FormAbout;
   }
}
//---------------------------------------------------------------------------
AnsiString __fastcall TYbCommDeviceEditor::GetVerb(int Index)
{
  if(Index == 0)
    return TForm_YBComm32_About::TMsgStrings().Str_Settings;
  return TForm_YBComm32_About::TMsgStrings().Str_MenuAbout;
}
//---------------------------------------------------------------------------
int __fastcall TYbCommDeviceEditor::GetVerbCount(void)
{
  return 2;
}
//---------------------------------------------------------------------------

⌨️ 快捷键说明

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