CopyParamCustom.cpp 2.0 KB

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