1
0

CopyParamCustom.cpp 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  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. #pragma resource "*.dfm"
  15. //---------------------------------------------------------------------------
  16. bool __fastcall DoCopyParamCustomDialog(TCopyParamType & CopyParam,
  17. int CopyParamAttrs)
  18. {
  19. bool Result;
  20. TCopyParamCustomDialog * Dialog = new TCopyParamCustomDialog(
  21. GetFormOwner(), CopyParamAttrs, 0);
  22. try
  23. {
  24. Result = Dialog->Execute(CopyParam);
  25. }
  26. __finally
  27. {
  28. delete Dialog;
  29. }
  30. return Result;
  31. }
  32. //---------------------------------------------------------------------------
  33. // Dummy parameter distinguishes the constructor from Object Pascals TForm::CreateNew
  34. __fastcall TCopyParamCustomDialog::TCopyParamCustomDialog(TComponent * Owner,
  35. int CopyParamAttrs, int /*Dummy*/)
  36. : TForm(Owner)
  37. {
  38. UseSystemSettings(this);
  39. CopyParamsFrame->CopyParamAttrs = CopyParamAttrs;
  40. }
  41. //---------------------------------------------------------------------------
  42. bool __fastcall TCopyParamCustomDialog::Execute(TCopyParamType & CopyParam)
  43. {
  44. CopyParamsFrame->Params = CopyParam;
  45. CopyParamsFrame->BeforeExecute();
  46. bool Result = (ShowModal() == DefaultResult(this));
  47. if (Result)
  48. {
  49. CopyParamsFrame->AfterExecute();
  50. CopyParam = CopyParamsFrame->Params;
  51. }
  52. return Result;
  53. }
  54. //---------------------------------------------------------------------------
  55. void __fastcall TCopyParamCustomDialog::FormCloseQuery(TObject * /*Sender*/,
  56. bool & /*CanClose*/)
  57. {
  58. if (ModalResult == DefaultResult(this))
  59. {
  60. ExitActiveControl(this);
  61. }
  62. }
  63. //---------------------------------------------------------------------------
  64. void __fastcall TCopyParamCustomDialog::HelpButtonClick(TObject * /*Sender*/)
  65. {
  66. FormHelp(this);
  67. }
  68. //---------------------------------------------------------------------------