CopyParamCustom.cpp 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. //---------------------------------------------------------------------------
  2. #include <vcl.h>
  3. #pragma hdrstop
  4. #include <Common.h>
  5. #include <TextsWin.h>
  6. #include <GUIConfiguration.h>
  7. #include <GUITools.h>
  8. #include <Tools.h>
  9. #include "CopyParamCustom.h"
  10. #include "VCLCommon.h"
  11. //---------------------------------------------------------------------------
  12. #pragma package(smart_init)
  13. #pragma link "CopyParams"
  14. #ifndef NO_RESOURCES
  15. #pragma resource "*.dfm"
  16. #endif
  17. //---------------------------------------------------------------------------
  18. bool __fastcall DoCopyParamCustomDialog(TCopyParamType & CopyParam,
  19. int CopyParamAttrs)
  20. {
  21. bool Result;
  22. TCopyParamCustomDialog * Dialog = new TCopyParamCustomDialog(
  23. GetFormOwner(), CopyParamAttrs, 0);
  24. try
  25. {
  26. Result = Dialog->Execute(CopyParam);
  27. }
  28. __finally
  29. {
  30. delete Dialog;
  31. }
  32. return Result;
  33. }
  34. //---------------------------------------------------------------------------
  35. // Dummy parameter distinguishes the constructor from Object Pascals TForm::CreateNew
  36. __fastcall TCopyParamCustomDialog::TCopyParamCustomDialog(TComponent * Owner,
  37. int CopyParamAttrs, int /*Dummy*/)
  38. : TForm(Owner)
  39. {
  40. UseSystemSettings(this);
  41. CopyParamsFrame->CopyParamAttrs = CopyParamAttrs;
  42. }
  43. //---------------------------------------------------------------------------
  44. bool __fastcall TCopyParamCustomDialog::Execute(TCopyParamType & CopyParam)
  45. {
  46. CopyParamsFrame->Params = CopyParam;
  47. CopyParamsFrame->BeforeExecute();
  48. bool Result = (ShowModal() == DefaultResult(this));
  49. if (Result)
  50. {
  51. CopyParamsFrame->AfterExecute();
  52. CopyParam = CopyParamsFrame->Params;
  53. }
  54. return Result;
  55. }
  56. //---------------------------------------------------------------------------
  57. void __fastcall TCopyParamCustomDialog::FormCloseQuery(TObject * /*Sender*/,
  58. bool & /*CanClose*/)
  59. {
  60. if (ModalResult == DefaultResult(this))
  61. {
  62. ExitActiveControl(this);
  63. }
  64. }
  65. //---------------------------------------------------------------------------
  66. void __fastcall TCopyParamCustomDialog::HelpButtonClick(TObject * /*Sender*/)
  67. {
  68. FormHelp(this);
  69. }
  70. //---------------------------------------------------------------------------