unit U_FindParams;

interface

uses
  Windows, U_LNG, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, cxLookAndFeelPainters, cxTextEdit, StdCtrls, cxButtons,
  cxControls, cxContainer, cxEdit, cxCheckBox, ExtCtrls, RzPanel, Contnrs,

  U_BaseCommon, U_BaseConstants, U_SCSComponent, cxMaskEdit, cxDropDownEdit, siComp, siLngLnk,
  U_Common_Classes, RzButton, RzRadChk, RzSpnEdt, RzEdit, RzCmboBx, Mask, cxGraphics,
  cxLookAndFeels, Menus;

type
  TCheckBoxParam = class(TObject)
    private
      FOwner: TRzCheckBox;
    public
      ParamEditor: TcxCustomEdit;
      CheckBoxAsBegin: TRzCheckBox;
      OtherControl: TControl;

      Checked: Boolean;
      AsBeginChecked: Boolean;
    constructor Create(AOwner: TRzCheckBox);
  end;

  TF_FindParams = class(TForm)
    RzGroupBox1: TRzGroupBox;
    RzGroupBox2: TRzGroupBox;
    btOk: TcxButton;
    btFalse: TcxButton;
    edName: TcxTextEdit;
    RzPanel1: TRzPanel;
    RzGroupBox3: TRzGroupBox;
    lng_Forms: TsiLangLinked;
    RzGroupBox4: TRzGroupBox;
    edArtDistributor: TcxTextEdit;
    edArtProducer: TcxTextEdit;
    edIzm: TcxTextEdit;
    cbxComponentType: TcxComboBox;
    cbxNetType: TcxComboBox;
    cbxProducer: TcxComboBox;
    cbName: TRzCheckBox;
    cbAsBeginArtDistributor: TRzCheckBox;
    cbAsBeginArtProducer: TRzCheckBox;
    cbAsBeginIzm: TRzCheckBox;
    cbAsBeginName: TRzCheckBox;
    cbArtDistributor: TRzCheckBox;
    cbArtProducer: TRzCheckBox;
    cbIzm: TRzCheckBox;
    cbComponentType: TRzCheckBox;
    cbNetType: TRzCheckBox;
    cbProducer: TRzCheckBox;
    cbFindAsCatalogs: TRzCheckBox;
    cbFindAsComponents: TRzCheckBox;
    cbFindAsLists: TRzCheckBox;
    cbFindAsRooms: TRzCheckBox;
    cbFindAsSCSObject: TRzCheckBox;
    cbDoFindAfterOk: TRzCheckBox;
    cbProperty: TRzCheckBox;
    cbxProperty: TcxComboBox;
    pnPropValue: TPanel;
    cbPropertyValue: TRzCheckBox;
    pnPropValueControls: TPanel;
    cbSectionSideValue: TRzComboBox;
    deValue: TRzDateTimeEdit;
    colorbValue: TRzColorComboBox;
    cbValue: TRzCheckBox;
    edValue: TRzEdit;
    seValue: TRzSpinEdit;
    cbItemList: TRzComboBox;
    lbPropCompareTypes: TLabel;
    cbPropCompareTypes: TRzComboBox;
    lbPropUOM: TLabel;
    cbInCurrentDir: TRzCheckBox;
    cbInPrevResult: TRzCheckBox;
    procedure FormCreate(Sender: TObject);
    procedure cbClick(Sender: TObject);
    procedure btOkClick(Sender: TObject);
    procedure cbFindAsCatalogsClick(Sender: TObject);
    procedure FormDestroy(Sender: TObject);
    procedure cbxPropertyPropertiesChange(Sender: TObject);
    procedure cbPropertyValueClick(Sender: TObject);
  private
    GForm: TForm;
    
    FFindAsCatalogs: Boolean;
    FFindAsComponents: Boolean;
    FFindAsLists: Boolean;
    FFindAsRooms: Boolean;
    FFindAsSCSObject: Boolean;

    FDoFindAfterOkState: Boolean;

    FCheckBoxParamList: TObjectList;
    FComponentCBParamList: TObjectList;
    FPropValueControl: TWinControl;
    FPrevPropCompareTypeDataType: Integer;

    FSpravochnik: TSpravochnik;

    function CreateCheckBoxParam(AcbOwner, AcbAsBegin: TRzCheckBox;
      AParamEditor: TcxCustomEdit; AOtherControl: TControl; AOnlyForComponent: Boolean): TCheckBoxParam;
    function GetCheckBoxParamIfOneChecked: TCheckBoxParam;
    procedure SetControlsForCheckBoxParam(ACheckBoxParam: TCheckBoxParam);

    procedure DefineIDsGUIDs;
    function IsCheckedOneDirFindElement: Boolean;
    procedure SetControls;
    procedure SetControlsByCheckedFindElements(AComponentChecked, ADirChecked: Boolean);
    procedure SetControlsForProps(ACanFocus: Boolean);

    function GetCurrPropDataType: Integer;
    function GetPropertValue: String;
  public
    GUIDComponentType: String;
    GUIDNetType: String;
    GUIDProducer: String;
    GUIDProperty: String;
    IDComponentType: Integer;
    IDNetType: Integer;
    IDProducer: Integer;
    IDProperty: Integer;
    FCurrProp: TNBProperty;
    PropValue: String;
    PropCompareType: Integer;

    constructor Create(AOwner: TComponent; AForm: TForm);
    destructor  Destroy; override;

    function Execute(ASpravochnik: TSpravochnik): Boolean;
    //*** вернет текст из текстового поля, если оно одно отмечено
    function GetTextFromEditIfOneChecked(var ADest: string): Boolean;
    //*** Установит текст в текстовое поле поиска если оно одно
    function SetTextToEditFieldIfOneChecked(AText: String): Boolean;
  end;

//var
  //F_FindParams: TF_FindParams;

implementation
Uses U_Main, Unit_DM_SCS;
{$R *.dfm}

{ TCheckBoxControls }

constructor TCheckBoxParam.Create(AOwner: TRzCheckBox);
begin
  FOwner := AOwner;
  ParamEditor := nil;
  CheckBoxAsBegin := nil;
  OtherControl := nil;

  Checked := false;
  AsBeginChecked := false;
end;


{ TF_FindParams }

constructor TF_FindParams.Create(AOwner: TComponent; AForm: TForm);
begin
  GForm := AForm;
  inherited Create(AOwner);
end;

destructor TF_FindParams.Destroy;
begin
  inherited;
end;

function TF_FindParams.CreateCheckBoxParam(AcbOwner, AcbAsBegin: TRzCheckBox;
  AParamEditor: TcxCustomEdit; AOtherControl: TControl; AOnlyForComponent: Boolean): TCheckBoxParam;
begin
  Result := TCheckBoxParam.Create(AcbOwner);
  AcbOwner.Tag := Integer(Result);

  Result.ParamEditor := AParamEditor;
  Result.CheckBoxAsBegin := AcbAsBegin;
  Result.OtherControl := AOtherControl;

  FCheckBoxParamList.Add(Result);
  if AOnlyForComponent then
    FComponentCBParamList.Add(Result);
end;

function TF_FindParams.GetCheckBoxParamIfOneChecked: TCheckBoxParam;
var
  i: Integer;
  CheckBoxParam: TCheckBoxParam;
  LastCheckBoxParam: TCheckBoxParam;
  CheckedCount: Integer;
begin
  Result := nil;
  CheckedCount := 0;
  LastCheckBoxParam := nil;
  for i := 0 to FCheckBoxParamList.Count - 1 do
  begin
    CheckBoxParam := TCheckBoxParam(FCheckBoxParamList[i]);
    if CheckBoxParam.FOwner.Checked then
    begin
      Inc(CheckedCount);
      LastCheckBoxParam := CheckBoxParam;
    end;
  end;
  //*** Если отмечено только одно поле
  if (CheckedCount = 1) and (LastCheckBoxParam <> nil) then
    Result := LastCheckBoxParam;
end;

procedure TF_FindParams.SetControlsForCheckBoxParam(ACheckBoxParam: TCheckBoxParam);
begin
  ACheckBoxParam.ParamEditor.Enabled := ACheckBoxParam.FOwner.Enabled and ACheckBoxParam.FOwner.Checked;
  if ACheckBoxParam.CheckBoxAsBegin <> nil then
    ACheckBoxParam.CheckBoxAsBegin.Enabled := ACheckBoxParam.FOwner.Enabled and ACheckBoxParam.FOwner.Checked;
  if ACheckBoxParam.OtherControl <> nil then
    ACheckBoxParam.OtherControl.Enabled := ACheckBoxParam.FOwner.Enabled and ACheckBoxParam.FOwner.Checked;
end;

function TF_FindParams.Execute(ASpravochnik: TSpravochnik): Boolean;
var
  OldText: string;
  i: Integer;
  CheckBoxParam: TCheckBoxParam;
begin
  Result := false;

  GUIDComponentType := '';
  GUIDNetType := '';
  GUIDProducer := '';
  GUIDProperty := '';

  FPropValueControl := nil;
  if ASpravochnik <> nil then
  begin
    cbxComponentType.Properties.BeginUpdate;
    cbxNetType.Properties.BeginUpdate;
    cbxProducer.Properties.BeginUpdate;
    cbxProperty.Properties.BeginUpdate;
    try
      OldText := cbxComponentType.Text;
      ASpravochnik.LoadComponentTypesToStrings(cbxComponentType.Properties.Items, true);
      SelectItemByTextinCombo(cbxComponentType, OldText);

      OldText := cbxNetType.Text;
      ASpravochnik.LoadNetTypesToStrings(cbxNetType.Properties.Items, true);
      SelectItemByTextinCombo(cbxNetType, OldText);

      OldText := cbxProducer.Text;
      ASpravochnik.LoadProducersToStrings(cbxProducer.Properties.Items, true);
      SelectItemByTextinCombo(cbxProducer, OldText);

      OldText := cbxProperty.Text;
      ASpravochnik.LoadPropertiesToStrings(cbxProperty.Properties.Items, true);
      SelectItemByTextinCombo(cbxProperty, OldText);
    finally
      cbxProperty.Properties.EndUpdate;
      cbxProducer.Properties.EndUpdate;
      cbxNetType.Properties.EndUpdate;
      cbxComponentType.Properties.EndUpdate;
    end;
  end;
  FSpravochnik := ASpravochnik;
  FCurrProp := nil;

  cbInPrevResult.Checked := false;
  SetControls;
  SetControlsForProps(false);
  TF_Main(GForm).FNormBase.DM.LoadInputStringsToTStrings(cbSectionSideValue.Items, stDimensions);

  if ShowModal = mrOk then
  begin
    Result := true;
    
    for i := 0 to FCheckBoxParamList.Count - 1 do
    begin
      CheckBoxParam := TCheckBoxParam(FCheckBoxParamList[i]);
      CheckBoxParam.Checked := CheckBoxParam.FOwner.Checked;
      if CheckBoxParam.CheckBoxAsBegin <> nil then
        CheckBoxParam.AsBeginChecked := CheckBoxParam.CheckBoxAsBegin.Checked;
    end;

    FFindAsCatalogs := cbFindAsCatalogs.Checked;
    FFindAsComponents := cbFindAsComponents.Checked;
    FFindAsLists := cbFindAsLists.Checked;
    FFindAsRooms := cbFindAsRooms.Checked;
    FFindAsSCSObject := cbFindAsSCSObject.Checked;

    DefineIDsGUIDs;

    FDoFindAfterOkState := cbDoFindAfterOk.Checked;
  end;
end;

function TF_FindParams.GetTextFromEditIfOneChecked(var ADest: string): Boolean;
var
  CheckBoxParam: TCheckBoxParam;
begin
  Result := false;
  ADest := '';

  //*** найти параметры тольно одного отмеченного поля
  CheckBoxParam := GetCheckBoxParamIfOneChecked;

  if CheckBoxParam <> nil then
  begin
    Result := true;
    //*** Если обычный текстовый эдит
    if CheckBoxParam.ParamEditor is TcxTextEdit then
      ADest := TcxTextEdit(CheckBoxParam.ParamEditor).Text
    else
    //*** если комбобокс, то устанавливаем текст тогда когда он есть в списке
    if CheckBoxParam.ParamEditor is TcxComboBox then
      ADest := TcxComboBox(CheckBoxParam.ParamEditor).Text;
  end;
end;

function TF_FindParams.SetTextToEditFieldIfOneChecked(AText: String): Boolean;
var
  CheckBoxParam: TCheckBoxParam;
begin
  Result := false;

  //*** найти параметры тольно одного отмеченного поля
  CheckBoxParam := GetCheckBoxParamIfOneChecked;

  if CheckBoxParam <> nil then
  begin
    Result := true;
    //*** Если обычный текстовый эдит
    if CheckBoxParam.ParamEditor is TcxTextEdit then
      TcxTextEdit(CheckBoxParam.ParamEditor).Text := AText
    else
    //*** если комбобокс, то устанавливаем текст тогда когда он есть в списке
    if (CheckBoxParam.ParamEditor is TcxComboBox) and (AText <> '') then
      if TcxComboBox(CheckBoxParam.ParamEditor).Properties.Items.IndexOf(AText) <> -1 then
        SelectItemByTextinCombo(TcxComboBox(CheckBoxParam.ParamEditor), AText, false)
      else
      if Not SelectItemByGUIDinCombo(TcxComboBox(CheckBoxParam.ParamEditor), '') then
        if TcxComboBox(CheckBoxParam.ParamEditor).Properties.Items.Count > 0 then
          TcxComboBox(CheckBoxParam.ParamEditor).ItemIndex := 0;
    DefineIDsGUIDs;
  end;
end;

procedure TF_FindParams.FormCreate(Sender: TObject);
begin
  // Tolik 01/11/2019 --
  seValue.Min := 0;
  seValue.Max := 0;
  //
  FFindAsCatalogs := false;
  FFindAsComponents := true;
  FFindAsLists := false;
  FFindAsRooms := false;
  FFindAsSCSObject := false;

  FDoFindAfterOkState := true;

  edName.Text := '';
  edArtDistributor.Text := '';
  edArtProducer.Text := '';
  edIzm.Text := '';
  cbxComponentType.Text := '';
  cbxNetType.Text := '';
  cbxProducer.Text := '';

  if TF_Main(GForm).GDBMode <> bkProjectManager then
  begin
    cbFindAsLists.Visible := false;
    cbFindAsRooms.Visible := false;
    cbFindAsSCSObject.Visible := false;
  end
  else
    cbInCurrentDir.Caption := cFindParams_Msg3;

  FCheckBoxParamList := TObjectList.Create(true);
  FComponentCBParamList := TObjectList.Create(false);

  CreateCheckBoxParam(cbName, cbAsBeginName, edName, nil, false);
  CreateCheckBoxParam(cbArtDistributor, cbAsBeginArtDistributor, edArtDistributor, nil, true);
  CreateCheckBoxParam(cbArtProducer, cbAsBeginArtProducer, edArtProducer, nil, true);
  CreateCheckBoxParam(cbIzm, cbAsBeginIzm, edIzm, nil, true);
  CreateCheckBoxParam(cbComponentType, nil, cbxComponentType, nil, true);
  CreateCheckBoxParam(cbNetType, nil, cbxNetType, nil, true);
  CreateCheckBoxParam(cbProducer, nil, cbxProducer, nil, true);
  CreateCheckBoxParam(cbProperty, nil, cbxProperty, pnPropValue, true);

  TCheckBoxParam(cbName.Tag).Checked := true;
  TCheckBoxParam(cbArtDistributor.Tag).AsBeginChecked := true;
  TCheckBoxParam(cbArtProducer.Tag).AsBeginChecked := true;

  FPrevPropCompareTypeDataType := dtNone;
  SetControls;
end;

procedure TF_FindParams.cbClick(Sender: TObject);
var
  CheckBoxParam: TCheckBoxParam;
begin
  //SetControlsForName;
  CheckBoxParam := TCheckBoxParam(TRzCheckBox(Sender).Tag);
  if CheckBoxParam <> nil then
  begin
    SetControlsForCheckBoxParam(CheckBoxParam);
    if (CheckBoxParam.FOwner.Checked) and Visible then
      CheckBoxParam.ParamEditor.SetFocus;

    if CheckBoxParam.ParamEditor is TcxComboBox then
      if Assigned(TcxComboBox(CheckBoxParam.ParamEditor).Properties.OnChange) then
        TcxComboBox(CheckBoxParam.ParamEditor).Properties.OnChange(CheckBoxParam.ParamEditor);

    //if Sender = cbProperty then
    //  cbxPropertyPropertiesChange(cbxProperty);
  end;
end;

procedure TF_FindParams.DefineIDsGUIDs;
begin
  GUIDComponentType := GetGUIDFromComboBox(cbxComponentType);
  GUIDNetType := GetGUIDFromComboBox(cbxNetType);
  GUIDProducer := GetGUIDFromComboBox(cbxProducer);
  IDComponentType := GetIDFromComboBox(cbxComponentType);
  IDNetType := GetIDFromComboBox(cbxNetType);
  IDProducer := GetIDFromComboBox(cbxProducer);

  GUIDProperty := GetGUIDFromComboBox(cbxProperty);
  IDProperty := GetIDFromComboBox(cbxProperty);

  PropValue := GetPropertValue;
  PropCompareType := GetIDFromComboBoxRz(cbPropCompareTypes);
end;

function TF_FindParams.IsCheckedOneDirFindElement: Boolean;
begin
  Result := false;
  if cbFindAsCatalogs.Checked or
     cbFindAsLists.Checked or
     cbFindAsRooms.Checked or
     cbFindAsSCSObject.Checked then
    Result := true;
end;

procedure TF_FindParams.SetControls;
var
  i: Integer;
  CheckBoxParam: TCheckBoxParam;
begin                         
  for i := 0 to FCheckBoxParamList.Count - 1 do
  begin
    CheckBoxParam := TCheckBoxParam(FCheckBoxParamList[i]);
    CheckBoxParam.FOwner.Checked := CheckBoxParam.Checked;
    if CheckBoxParam.CheckBoxAsBegin <> nil then
      CheckBoxParam.CheckBoxAsBegin.Checked := CheckBoxParam.AsBeginChecked;
  end;


  cbFindAsCatalogs.Checked := FFindAsCatalogs;
  cbFindAsComponents.Checked := FFindAsComponents;
  cbFindAsLists.Checked := FFindAsLists;
  cbFindAsRooms.Checked := FFindAsRooms;
  cbFindAsSCSObject.Checked := FFindAsSCSObject;
  SetControlsByCheckedFindElements(cbFindAsComponents.Checked, IsCheckedOneDirFindElement);

  cbDoFindAfterOk.Checked := FDoFindAfterOkState;
end;

procedure TF_FindParams.SetControlsByCheckedFindElements(AComponentChecked, ADirChecked: Boolean);
var
  ComponentChecked: Boolean;
  CheckBoxParam: TCheckBoxParam;
  i: integer;
begin
  ComponentChecked := AComponentChecked;

  //if Not AComponentChecked and
  //   Not ADirChecked then
  //  ComponentChecked := true;

  if ADirChecked then
    cbName.Checked := true;
  cbName.Enabled := ComponentChecked and Not ADirChecked;
  edName.Enabled := (cbName.Checked and AComponentChecked) or ADirChecked;

  for i := 0 to FComponentCBParamList.Count - 1 do
  begin
    CheckBoxParam := TCheckBoxParam(FComponentCBParamList[i]);
    CheckBoxParam.FOwner.Enabled := ComponentChecked;
    SetControlsForCheckBoxParam(CheckBoxParam);
  end;
end;

procedure TF_FindParams.SetControlsForProps(ACanFocus: Boolean);
var
  DataType: Integer;
begin
  try
    if FCurrProp <> nil then
      FPrevPropCompareTypeDataType := FCurrProp.PropertyData.IDDataType;

    DataType := GetCurrPropDataType;

    edValue.Visible := false;
    cbValue.Visible := false;
    seValue.Visible := false;
    colorbValue.Visible := false;
    deValue.Visible := false;
    cbSectionSideValue.Visible := false;
    cbItemList.Visible := false;

    if FPrevPropCompareTypeDataType <> DataType then
      cbPropCompareTypes.ItemIndex := FillPropCompareTypesByDataType(cbPropCompareTypes.Items, DataType);
    pnPropValue.Visible := cbProperty.Checked and (DataType <> dtNone);
    pnPropValueControls.Visible := cbPropertyValue.Checked and pnPropValue.Visible;
    lbPropCompareTypes.Visible := pnPropValueControls.Visible and (cbPropCompareTypes.Items.Count > 0);
    cbPropCompareTypes.Visible := pnPropValueControls.Visible and (cbPropCompareTypes.Items.Count > 0);

    if FCurrProp <> nil then
      lbPropUOM.Caption := GetNameUOMForProperty(FCurrProp.PropertyData.Izm, FCurrProp.PropertyData.SysName, TF_Main(GForm).FUOM)
    else
      lbPropUOM.Caption := '';
    lbPropUOM.Visible := lbPropUOM.Caption <> '';

    FPropValueControl := nil;
    case DataType of
      dtFloat:
        begin
          seValue.Visible := true;
          seValue.IntegersOnly := false;
          seValue.Decimals := FloatPrecision;
          FPropValueControl := seValue;
        end;
      dtInteger:
        begin
          seValue.Visible := true;
          seValue.IntegersOnly := true;
          seValue.Decimals := 0;
          FPropValueControl := seValue;
        end;
      dtBoolean:
        begin
          cbValue.Visible := true;
          cbValue.Checked := true;
          FPropValueControl := cbValue;
        end;
      dtString, dtStringList:
        begin
          edValue.Visible := true;
          FPropValueControl := edValue;
        end;
      dtDate:
        begin
          deValue.Visible := true;
          FPropValueControl := deValue;
        end;
      dtColor:
        begin
          colorbValue.Visible := true;
          FPropValueControl := colorbValue;
        end;
      dtDimensions:
        begin
          cbSectionSideValue.Visible := true;
          FPropValueControl := cbSectionSideValue;
        end;
      dtCompStateType, dtCableCanalElementType, dtConnectionKind:
        begin
          FillPropValuesByDataType(cbItemList.Items, DataType);

          cbItemList.Visible := true;
          FPropValueControl := cbItemList;
        end;
    end;

    if FPropValueControl <> nil then
      if ACanFocus and FPropValueControl.Showing then
      begin
        FPropValueControl.SetFocus;
        if FPropValueControl is TCustomEdit then
          TCustomEdit(FPropValueControl).SelectAll;
      end;
  except
    on E: Exception do AddExceptionToLogExt(ClassName, 'SetControlsForProps', E.Message);
  end;
end;

function TF_FindParams.GetCurrPropDataType: Integer;
begin
  Result := 0;

  FCurrProp := nil;
  GUIDProperty := GetGUIDFromComboBox(cbxProperty);
  if GUIDProperty <> '' then
  begin
    FCurrProp := FSpravochnik.GetPropertyByGUID(GUIDProperty);
    if FCurrProp <> nil then
      Result := FCurrProp.PropertyData.IDDataType;
  end;
end;

function TF_FindParams.GetPropertValue: String;
var
  DataType: Integer;
  ValueFloat: Double;
begin
  Result := '';
  DataType := GetCurrPropDataType;
  try
    case DataType of
      dtFloat:
        begin
          ValueFloat := seValue.Value;
          PropValueInUOM(ValueFloat, FCurrProp.PropertyData.SysName, TF_Main(GForm).FUOM, umMetr);
          Result := FloatToStrU(ValueFloat);
        end;
      dtInteger:
        begin
          ValueFloat := Int(seValue.Value);
          PropValueInUOM(ValueFloat, FCurrProp.PropertyData.SysName, TF_Main(GForm).FUOM, umMetr);
          Result := FloatToStrU(Int(ValueFloat));
        end;
      dtBoolean:
        begin
          Result := IntToStr(BoolToInt(cbValue.Checked));
        end;
      dtString, dtStringList:
        begin
          Result := edValue.Text;
        end;
      dtDate:
        begin
          Result := DateToStrU(deValue.Date);
        end;
      dtColor:
        begin
          Result := IntToStr(colorbValue.SelectedColor);
        end;
      dtDimensions:
        Result := cbSectionSideValue.Text;
      dtCompStateType, dtCableCanalElementType, dtConnectionKind, dtBasementType:
        Result := IntToStr(GetIDFromComboBoxRz(cbItemList));
    end;
  except
  end;
end;


procedure TF_FindParams.btOkClick(Sender: TObject);
begin
  if Not cbName.Checked and
     Not cbArtDistributor.Checked and
     Not cbArtProducer.Checked and
     Not cbIzm.Checked and
     Not cbComponentType.Checked and
     Not cbNetType.Checked and
     Not cbProducer.Checked and
     Not cbProperty.Checked 
      then
  begin
    ModalResult := mrNone;
    MessageModal(cFindParams_Msg1, ApplicationName, MB_OK or MB_ICONINFORMATION);
    Exit; ///// EXIT /////
  end;

  if Not cbFindAsCatalogs.Checked and
     Not cbFindAsComponents.Checked and
     Not cbFindAsLists.Checked and
     Not cbFindAsRooms.Checked and
     Not cbFindAsSCSObject.Checked then
  begin
    ModalResult := mrNone;
    MessageModal(cFindParams_Msg2, ApplicationName, MB_OK or MB_ICONINFORMATION);
  end;
end;

procedure TF_FindParams.cbFindAsCatalogsClick(Sender: TObject);
begin
  SetControlsByCheckedFindElements(cbFindAsComponents.Checked, IsCheckedOneDirFindElement);
end;

procedure TF_FindParams.FormDestroy(Sender: TObject);
begin
  FreeAndNil(FCheckBoxParamList);
  FreeAndNil(FComponentCBParamList);
end;

procedure TF_FindParams.cbxPropertyPropertiesChange(Sender: TObject);
begin
  SetControlsForProps(true);
end;

procedure TF_FindParams.cbPropertyValueClick(Sender: TObject);
begin
  SetControlsForProps(true);
end;

end.
