CopyParamCustom.cpp 2.0 KB

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