unit U_MakeProperty; interface uses Windows, U_LNG, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, cxLookAndFeelPainters, StdCtrls, cxButtons, cxDropDownEdit, cxCalendar, cxSpinEdit, cxMaskEdit, cxCheckBox, cxControls, cxContainer, cxEdit, cxTextEdit, U_BaseCommon, kbmMemTable, Mask, RzEdit, ExtCtrls, RzPanel, siComp, siLngLnk, Buttons, RzButton, RzRadChk, U_BaseConstants, U_SCSLists, cxStyles, cxCustomData, cxGraphics, cxFilter, cxData, cxDataStorage, DB, cxDBData, cxGridLevel, cxClasses, cxGridCustomView, cxGridCustomTableView, cxGridTableView, cxGridDBTableView, cxGrid, cxCurrencyEdit, cxColorComboBox, cxMemo, cxEditRepositoryItems, ActnList, Menus, ComCtrls, ToolWin, XPMenu, FIBQuery, pFIBQuery, cxDBLookupComboBox, cxLookAndFeels, dxCore, cxDateUtils, cxNavigator; {const // DataTypes dtFloat = 1; dtInteger = 2; dtBoolean = 3; dtString = 4; dtDate = 5;} type TF_MakeProperty = class(TForm) RzGroupBox2: TRzGroupBox; lng_Forms: TsiLangLinked; Button_Ok: TRzBitBtn; Button_Cancel: TRzBitBtn; mtPropValRel: TkbmMemTable; dsrcPropValRel: TDataSource; cxEditRepository1: TcxEditRepository; erSpinItemPropValRel: TcxEditRepositorySpinItem; Timer_EditValueChanged: TTimer; ActionList1: TActionList; Act_AddValue: TAction; Act_DeleteValue: TAction; PopupMenu1: TPopupMenu; N1: TMenuItem; N2: TMenuItem; mtPropValNormRes: TkbmMemTable; dsrcPropValNormRes: TDataSource; Act_AddPropValAccessory: TAction; Act_EditPropValNormRes: TAction; Act_DelPropValNormRes: TAction; PopupMenu2: TPopupMenu; ActAddPropValAccessory1: TMenuItem; ActEditPropValNormRes1: TMenuItem; ActDelPropValNormRes1: TMenuItem; pnMain: TRzPanel; pnPropData: TRzPanel; Label2: TLabel; Label_SysName: TLabel; Label4: TLabel; Label5: TLabel; Label6: TLabel; lbMinValue: TLabel; lbMaxValue: TLabel; Label9: TLabel; Label10: TLabel; Label_ItemType: TLabel; pnSectionSideDefault: TRzPanel; btSendSectionSideToBase: TSpeedButton; cbSectionSideDefault: TcxComboBox; DateEdit_PDefault: TcxDateEdit; SpinEdit_PDefault: TcxSpinEdit; Edit_PDefault: TcxTextEdit; ComboBox_PCompStateType: TcxComboBox; SpinEdit_PMax: TcxSpinEdit; SpinEdit_PMin: TcxSpinEdit; DateEdit_PMax: TcxDateEdit; DateEdit_PMin: TcxDateEdit; CheckBox_PDefault: TRzCheckBox; ColorEdit_PDefault: TRzColorEdit; Edit_PName: TcxTextEdit; Edit_PSysName: TcxTextEdit; Edit_PIzm: TcxTextEdit; ComboBox_PDataType: TcxComboBox; Edit_PDescription: TcxTextEdit; ComboBox_ItemType: TcxComboBox; RzGroupBox1: TRzGroupBox; CheckBox_IsList: TRzCheckBox; CheckBox_IsProject: TRzCheckBox; Button_IsStateForAll: TcxButton; Button_IsStateForNone: TcxButton; CheckBox_IsFolder: TRzCheckBox; CheckBox_IsRoom: TRzCheckBox; CheckBox_IsSCSLine: TRzCheckBox; CheckBox_IsSCSConnector: TRzCheckBox; CheckBox_IsComponLine: TRzCheckBox; CheckBox_IsComponConn: TRzCheckBox; cxTextEdit1: TcxTextEdit; cxButton1: TcxButton; CheckBox_PNotNull: TRzCheckBox; cbIsForWholeComponent: TRzCheckBox; cbCableCanalElemntTypes: TcxComboBox; cbItemList: TcxComboBox; cbIsValueRelToObj: TRzCheckBox; pnValueObjects: TRzPanel; Splitter1: TSplitter; RzGroupBox3: TRzGroupBox; gridPropValRel: TcxGrid; GT_PropValRel: TcxGridDBTableView; GT_PropValRelValue: TcxGridDBColumn; GT_PropValRelMinValue: TcxGridDBColumn; GT_PropValRelMaxValue: TcxGridDBColumn; GL_PropValRel: TcxGridLevel; RzGroupBox4: TRzGroupBox; gridPropValNormRes: TcxGrid; GT_PropValNormRes: TcxGridDBTableView; GT_PropValNormResCypher: TcxGridDBColumn; GT_PropValNormResName: TcxGridDBColumn; GT_PropValNormResKolvo: TcxGridDBColumn; GT_PropValNormResExpenseForLength: TcxGridDBColumn; GT_PropValNormResCountForPoint: TcxGridDBColumn; GT_PropValNormResStepOfPoint: TcxGridDBColumn; GL_PropValNormRes: TcxGridLevel; ToolBar1: TToolBar; ToolButton1: TToolButton; ToolButton2: TToolButton; ToolButton3: TToolButton; meStringListDef: TRzMemo; XPMenu1: TXPMenu; procedure ComboBox_PDataTypePropertiesChange(Sender: TObject); procedure Button_OkClick(Sender: TObject); procedure FormShow(Sender: TObject); procedure ComboBox_PDataTypeKeyPress(Sender: TObject; var Key: Char); procedure FormHide(Sender: TObject); procedure FormCreate(Sender: TObject); procedure ComboBox_ItemTypeKeyPress(Sender: TObject; var Key: Char); procedure FormDestroy(Sender: TObject); procedure Button_IsStateForAllClick(Sender: TObject); procedure Button_IsStateForNoneClick(Sender: TObject); procedure CheckBox_IsComponLineClick(Sender: TObject); procedure cxButton1Click(Sender: TObject); procedure btSendSectionSideToBaseClick(Sender: TObject); procedure RzGroupBox2Resize(Sender: TObject); procedure cbItemListPropertiesChange(Sender: TObject); procedure erSpinItemMinMaxPropertiesValidate(Sender: TObject; var DisplayValue: Variant; var ErrorText: TCaption; var Error: Boolean); procedure GT_PropValRelEditValueChanged(Sender: TcxCustomGridTableView; AItem: TcxCustomGridTableItem); procedure Timer_EditValueChangedTimer(Sender: TObject); procedure Act_AddValueExecute(Sender: TObject); procedure Act_DeleteValueExecute(Sender: TObject); procedure Act_AddPropValAccessoryExecute(Sender: TObject); procedure Act_EditPropValNormResExecute(Sender: TObject); procedure Act_DelPropValNormResExecute(Sender: TObject); procedure GT_PropValNormResKolvoPropertiesValidate(Sender: TObject; var DisplayValue: Variant; var ErrorText: TCaption; var Error: Boolean); procedure GT_PropValNormResExpenseForLengthPropertiesValidate( Sender: TObject; var DisplayValue: Variant; var ErrorText: TCaption; var Error: Boolean); procedure GT_PropValNormResCountForPointPropertiesValidate( Sender: TObject; var DisplayValue: Variant; var ErrorText: TCaption; var Error: Boolean); procedure GT_PropValNormResStepOfPointPropertiesValidate( Sender: TObject; var DisplayValue: Variant; var ErrorText: TCaption; var Error: Boolean); procedure GT_PropValNormResExpenseForLengthGetDisplayText( Sender: TcxCustomGridTableItem; ARecord: TcxCustomGridRecord; var AText: String); procedure GT_PropValNormResStepOfPointGetDisplayText( Sender: TcxCustomGridTableItem; ARecord: TcxCustomGridRecord; var AText: String); procedure GT_PropValNormResInitEdit(Sender: TcxCustomGridTableView; AItem: TcxCustomGridTableItem; AEdit: TcxCustomEdit); procedure mtPropValRelBeforePost(DataSet: TDataSet); procedure GT_PropValRelEditing(Sender: TcxCustomGridTableView; AItem: TcxCustomGridTableItem; var AAllow: Boolean); procedure GT_PropValNormResEditing(Sender: TcxCustomGridTableView; AItem: TcxCustomGridTableItem; var AAllow: Boolean); procedure GT_PropValRelFocusedRecordChanged( Sender: TcxCustomGridTableView; APrevFocusedRecord, AFocusedRecord: TcxCustomGridRecord; ANewItemRecordFocusingChanged: Boolean); procedure cbIsValueRelToObjClick(Sender: TObject); private { Private declarations } GForm: TForm; FID: Integer; FMemTable: TkbmMemTable; FmtPropValRel: TkbmMemTable; FmtPropValNormRes: TkbmMemTable; FLastTubeConnectcKind: Integer; FLastBasementType: Integer; FLastTypeItem: TIntList; FEditedTableView: TcxCustomGridTableView; FEditedItem: TcxCustomGridTableItem; FSysNameBeforeEdit: String; FDeletedPropValGUIDs: TStringList; FDeletedPropValNormResGUIDs: TStringList; FUOM: Integer; procedure AddEditResource(AMakeEdit: TMakeEdit; AMakeFromCompon, AMakeFromRes, AMakeFromNorm: Boolean); procedure EnableDisableControls; function GetPropValue(AConvertToMetr: Boolean): string; procedure SendPropValRelFromBaseToMemTables; procedure SendPropValRelFromMemTablesToBase; procedure SetControlsByUOM; procedure SetIsStateForValue(AValue: Boolean); procedure SetMinMaxValues(AMinValue, AMaxValue: Double; ADataType: Integer; ASysName: String); public { Public declarations } GFormMode: TFormMode; GItemType: TItemType; GValue: String; GID: Integer; //GItemType: TItemType; function MinMaxControl(AValue: String): Boolean; procedure ChoiceEdit; function MakeEditProperty(AEditMode: TMakeEdit; AItemType: TItemType; AMemTable, AmtPropValRel, AmtPropValNormRes: TkbmMemTable): Boolean; Constructor Create(AOwner: TComponent; AForm: TForm); Destructor Destroy; override; end; { var F_MakeProperty: TF_MakeProperty; } implementation uses Unit_DM_SCS, U_Main, U_SCSComponent, U_Common; {$R *.dfm} procedure TF_MakeProperty.ChoiceEdit; var DataType : Integer; ValueFloat: Double; IsVisibleMinMax: Boolean; //BookmarkMT: String; BookmarkMT: TBookMark; LastItem: Integer; Procedure EnabledMinMax(AEnabled: Boolean; AValueType: TcxSpinEditValueType); begin SpinEdit_PMin.Enabled := AEnabled; SpinEdit_PMax.Enabled := AEnabled; SpinEdit_PMin.Properties.ValueType := AValueType; SpinEdit_PMax.Properties.ValueType := AValueType; if AEnabled then IsVisibleMinMax := true; end; begin Edit_PDefault.Visible := false; SpinEdit_PDefault.Visible := false; CheckBox_PDefault.Visible := False; DateEdit_PDefault.Visible := false; ComboBox_PCompStateType.Visible := false; ColorEdit_PDefault.Visible := false; cbCableCanalElemntTypes.Visible := false; pnSectionSideDefault.Visible := false; //meSectionSideDefault.Visible := false; cbItemList.Visible := false; meStringListDef.Visible := false; //CheckBox_PNotNull.Enabled := true; //CheckBox_PNotNull.Checked := true; GT_PropValRelValue.RepositoryItem := nil; GT_PropValRelMinValue.RepositoryItem := nil; GT_PropValRelMaxValue.RepositoryItem := nil; IsVisibleMinMax := false; lbMinValue.Visible := true; lbMaxValue.Visible := true; DataType := GetIDFromComboBox(ComboBox_PDataType); Case DataType of dtFloat: begin EnabledMinMax(true, vtFloat); SpinEdit_PDefault.Visible := true; SpinEdit_PDefault.Properties.ValueType := vtFloat; if GValue <> '' then begin ValueFloat := StrToFloatU(CorrectStrToFloat(GValue)); PropValueInUOM(ValueFloat, Edit_PSysName.Text, umMetr, FUOM); SpinEdit_PDefault.Value := RoundCP(ValueFloat); end; GT_PropValRelValue.RepositoryItem := TF_Main(GForm).DM.EditRepositorySpinItem; GT_PropValRelMinValue.RepositoryItem := GT_PropValRelValue.RepositoryItem; GT_PropValRelMaxValue.RepositoryItem := GT_PropValRelValue.RepositoryItem; end; dtInteger: begin EnabledMinMax(true, vtInt); SpinEdit_PDefault.Visible := true; SpinEdit_PDefault.Properties.ValueType := vtInt; if GValue <> '' then begin ValueFloat := StrToInt(GValue); PropValueInUOM(ValueFloat, Edit_PSysName.Text, umMetr, FUOM); SpinEdit_PDefault.Value := Int(ValueFloat); end; GT_PropValRelValue.RepositoryItem := TF_Main(GForm).DM.EditRepositorySpinItemInt; //erSpinItemPropValRel; GT_PropValRelMinValue.RepositoryItem := GT_PropValRelValue.RepositoryItem; GT_PropValRelMaxValue.RepositoryItem := GT_PropValRelValue.RepositoryItem; end; dtBoolean: begin EnabledMinMax(false, vtInt); CheckBox_PDefault.Visible := true; if GValue = '1' then CheckBox_PDefault.Checked := true else CheckBox_PDefault.Checked := false; GT_PropValRelValue.RepositoryItem := TF_Main(GForm).DM.EditRepositoryCheckBoxItem; end; dtString: begin EnabledMinMax(false, vtInt); Edit_PDefault.Visible := true; Edit_PDefault.Text := GValue; end; dtDate: begin EnabledMinMax(true, vtInt); DateEdit_PDefault.Visible := true; //DateEdit_PDefault.Text := ''; if GValue <> '' then DateEdit_PDefault.Date := StrToDateS(GValue); GT_PropValRelValue.RepositoryItem := TF_Main(GForm).DM.EditRepositoryDateItem; GT_PropValRelMinValue.RepositoryItem := GT_PropValRelValue.RepositoryItem; GT_PropValRelMaxValue.RepositoryItem := GT_PropValRelValue.RepositoryItem; end; dtCompStateType: begin EnabledMinMax(false, vtInt); ComboBox_PCompStateType.Visible := true; if GValue <> '' then SelectItemByIDinCombo(ComboBox_PCompStateType, StrToInt(GValue)); if ComboBox_PCompStateType.Text = '' then SelectItemByIDinCombo(ComboBox_PCompStateType, oitProjectible); GT_PropValRelValue.RepositoryItem := TF_Main(GForm).DM.EditRepositoryLookupCompSateType; end; dtColor: begin EnabledMinMax(false, vtInt); ColorEdit_PDefault.Visible := true; if GValue <> '' then ColorEdit_PDefault.SelectedColor := StrToInt(GValue); GT_PropValRelValue.RepositoryItem := TF_Main(GForm).DM.EditRepositoryColorComboBox; end; dtCableCanalElementType: begin EnabledMinMax(false, vtInt); cbCableCanalElemntTypes.Visible := true; if GValue <> '' then SelectItemByIDinCombo(cbCableCanalElemntTypes, StrToInt(GValue)); if cbCableCanalElemntTypes.Text = '' then SelectItemByIDinCombo(cbCableCanalElemntTypes, contCork); GT_PropValRelValue.RepositoryItem := TF_Main(GForm).DM.EditRepositoryLookupCableCanalElementType; end; dtDimensions: begin EnabledMinMax(false, vtInt); pnSectionSideDefault.Visible := true; cbSectionSideDefault.Text := GValue; //08.05.2009 if cbSectionSideDefault.Text = '' then //08.05.2009 cbSectionSideDefault.Text := cSectionSideDefValue; {meSectionSideDefault.Visible := true; meSectionSideDefault.Text := GValue; if meSectionSideDefault.Text = '' then meSectionSideDefault.Text := cSectionSideDefValue;} end; dtConnectionKind: begin EnabledMinMax(false, vtInt); ClearComboBox(cbItemList); AddIDToCombo(-1, '', cbItemList); AddIDToCombo(tckHubOfPipe, tcknHubOfPipe, cbItemList); AddIDToCombo(tckCapillarySoldering, tcknCapillarySoldering, cbItemList); AddIDToCombo(tckMechanicalCompressive, tcknMechanicalCompressive, cbItemList); AddIDToCombo(tckMechanicalPress, tcknMechanicalPress, cbItemList); AddIDToCombo(tckMechanicalTread, tcknMechanicalTread, cbItemList); AddIDToCombo(tckPress, tcknPress, cbItemList); AddIDToCombo(tckWeldingConnection, tcknWeldingConnection, cbItemList); AddIDToCombo(tckWeldingButt, tcknWeldingButt, cbItemList); AddIDToCombo(tckWeldHubOfPipe, tcknWeldHubOfPipe, cbItemList); AddIDToCombo(tckWeldElectric, tcknWeldElectric, cbItemList); cbItemList.Visible := true; if FLastTubeConnectcKind <> -1 then SelectItemByIDinCombo(cbItemList, FLastTubeConnectcKind) else if GValue <> '' then SelectItemByIDinCombo(cbItemList, StrToInt(GValue)) else SelectItemByIDinCombo(cbItemList, FLastTubeConnectcKind); //if cbCableCanalElemntTypes.Text = '' then // SelectItemByIDinCombo(cbItemList, tccnCapillarySoldering); GT_PropValRelValue.RepositoryItem := TF_Main(GForm).DM.EditRepositoryImageComboBoxTubeConnectKind; end; dtStringList: begin EnabledMinMax(false, vtInt); lbMinValue.Visible := false; lbMaxValue.Visible := false; meStringListDef.Visible := true; meStringListDef.BringToFront; meStringListDef.Lines.Text := GValue; end; //dtBasementType: // begin // EnabledMinMax(false, vtInt); // ClearComboBox(cbItemList); // AddIDToCombo(-1, '', cbItemList); // AddIDToCombo(btnStrip, btnStrip, cbItemList); // AddIDToCombo(btnColumnar, btnColumnar, cbItemList); // // if FLastBasementType <> -1 then // SelectItemByIDinCombo(cbItemList, FLastBasementType) // else // if GValue <> '' then // SelectItemByIDinCombo(cbItemList, StrToInt(GValue)) // else // SelectItemByIDinCombo(cbItemList, FLastBasementType); // cbItemList.Visible := true; // end; dtPlaneMaterialType, dtRoofHipType, dtRoofHipApexType, dtRoofHipValleyType: begin EnabledMinMax(false, vtInt); lbMinValue.Visible := false; lbMaxValue.Visible := false; FillPropValuesByDataType(cbItemList.Properties.Items, DataType); cbItemList.Visible := true; LastItem := FLastTypeItem[DataType]; if LastItem <> -1 then SelectItemByIDinCombo(cbItemList, LastItem) else if GValue <> '' then SelectItemByIDinCombo(cbItemList, StrToInt(GValue)); FLastTypeItem[DataType] := GetIDFromComboBox(cbItemList); end; end; if DataType = dtDate then begin SpinEdit_PMin.Visible := false; SpinEdit_PMax.Visible := false; DateEdit_PMin.Visible := true; DateEdit_PMax.Visible := true; end else begin SpinEdit_PMin.Visible := true; SpinEdit_PMax.Visible := true; DateEdit_PMin.Visible := false; DateEdit_PMax.Visible := false; end; GT_PropValRelMinValue.Visible := IsVisibleMinMax; GT_PropValRelMaxValue.Visible := IsVisibleMinMax; {if IsVisibleMinMax then begin //GT_PropValRelMinValue.RepositoryItem := GT_PropValRelValue.RepositoryItem; //GT_PropValRelMaxValue.RepositoryItem := GT_PropValRelValue.RepositoryItem; erSpinItemPropValRel.Properties.ValueType := SpinEdit_PDefault.Properties.ValueType; end;} mtPropValRel.DisableControls; //BookmarkMT := mtPropValRel.Bookmark; BookmarkMT := mtPropValRel.getBookmark; try mtPropValRel.First; while Not mtPropValRel.Eof do begin mtPropValRel.Edit; mtPropValRel.FieldByName(fnPValue).AsString := ''; mtPropValRel.FieldByName(fnMinValue).AsString := ''; mtPropValRel.FieldByName(fnMaxValue).AsString := ''; mtPropValRel.Post; mtPropValRel.Next; end; finally mtPropValRel.EnableControls; end; //mtPropValRel.Bookmark := BookmarkMT; if BookmarkMT <> nil then begin mtPropValRel.GotoBookmark(BookmarkMT); mtPropValRel.FreeBookmark(BookmarkMT); end; end; procedure TF_MakeProperty.AddEditResource(AMakeEdit: TMakeEdit; AMakeFromCompon, AMakeFromRes, AMakeFromNorm: Boolean); var IsCompon: Boolean; IsResource: Boolean; IsNorm: Boolean; GUIDEditingObject: String; IDEditingObject: Integer; NBComponent: TSCSComponent; begin IsCompon := false; IsResource := false; IsNorm := false; GUIDEditingObject := ''; if AMakeEdit = meMake then begin if AMakeFromCompon then IsCompon := true else if AMakeFromRes then IsResource := true else if AMakeFromNorm then IsNorm := true; end else if AMakeEdit = meEdit then begin if mtPropValNormRes.FieldByName(fnGuidNBComponent).AsString <> '' then begin GUIDEditingObject := mtPropValNormRes.FieldByName(fnGuidNBComponent).AsString; IsCompon := true end else if mtPropValNormRes.FieldByName(fnGuidNBRes).AsString <> '' then begin GUIDEditingObject := mtPropValNormRes.FieldByName(fnGuidNBRes).AsString; IsResource := true; end else if mtPropValNormRes.FieldByName(fnGuidNBNorm).AsString <> '' then begin GUIDEditingObject := mtPropValNormRes.FieldByName(fnGuidNBNorm).AsString; IsNorm := true; end; end; if IsCompon then begin IDEditingObject := 0; if GUIDEditingObject <> '' then IDEditingObject := F_NormBase.DM.GetIntFromTableByGUID(tnComponent, fnID, GUIDEditingObject, qmPhisical); NBComponent := F_NormBase.CreateFConnectComplWith.GetComponentFromNB(IDEditingObject, ''); if NBComponent <> nil then begin if AMakeEdit = meMake then begin mtPropValNormRes.Append; mtPropValNormRes.FieldByName(fnGuid).AsString := CreateGUID; mtPropValNormRes.FieldByName(fnGuidPropValRel).AsString := mtPropValRel.FieldByName(fnGuid).AsString; mtPropValNormRes.FieldByName(fnKolvo).AsFloat := 1; mtPropValNormRes.FieldByName(fnExpenseForLength).AsFloat := 0; mtPropValNormRes.FieldByName(fnStepOfPoint).AsFloat := 0; mtPropValNormRes.FieldByName(fnCountForPoint).AsFloat := 0; mtPropValNormRes.FieldByName(fnIsNew).AsBoolean := true; end else if AMakeEdit = meEdit then begin mtPropValNormRes.Edit; mtPropValNormRes.FieldByName(fnIsModified).AsBoolean := true; end; mtPropValNormRes.FieldByName(fnGuidNBComponent).AsString := NBComponent.GuidNB; mtPropValNormRes.FieldByName(fnIDNBComponent).AsInteger := NBComponent.ID; mtPropValNormRes.FieldByName(fnName).AsString := NBComponent.Name; mtPropValNormRes.Post; FreeAndNil(NBComponent); end; end else if IsResource then begin end else if IsNorm then begin end; EnableDisableControls; end; procedure TF_MakeProperty.EnableDisableControls; begin try Act_DeleteValue.Enabled := (mtPropValRel.RecNo > 0); Act_AddPropValAccessory.Enabled := (mtPropValRel.RecNo > 0); Act_EditPropValNormRes.Enabled := (mtPropValNormRes.RecNo > 0); Act_DelPropValNormRes.Enabled := (mtPropValNormRes.RecNo > 0); except on E: Exception do AddExceptionToLogEx('TF_MakeProperty.EnableDisableControls', E.Message); end; end; function TF_MakeProperty.GetPropValue(AConvertToMetr: Boolean): string; var DataType: Integer; ValueFloat: Double; begin Result := ''; DataType := GetIDFromComboBox(ComboBox_PDataType); case DataType of dtFloat: begin ValueFloat := SpinEdit_PDefault.Value; if AConvertToMetr then PropValueInUOM(ValueFloat, Edit_PSysName.Text, FUOM, umMetr); Result := FloatToStrU(ValueFloat); end; dtInteger: begin ValueFloat := Int(SpinEdit_PDefault.Value); if AConvertToMetr then PropValueInUOM(ValueFloat, Edit_PSysName.Text, FUOM, umMetr); Result := IntToStr(Round(ValueFloat)); end; dtBoolean: if CheckBox_PDefault.Checked then Result := '1' else Result := '0'; dtString: Result := Edit_PDefault.Text; dtDate: Result := DateToStrU(DateEdit_PDefault.Date); dtCompStateType: Result := IntToStr(GetIDFromComboBox(ComboBox_PCompStateType)); dtColor: Result := IntToStr(ColorEdit_PDefault.SelectedColor); dtCableCanalElementType: Result := IntToStr(GetIDFromComboBox(cbCableCanalElemntTypes)); dtDimensions: Result := cbSectionSideDefault.Text; //meSectionSideDefault.Text; dtConnectionKind, dtBasementType, dtPlaneMaterialType, dtRoofHipType, dtRoofHipApexType, dtRoofHipValleyType: Result := IntToStr(GetIDFromComboBox(cbItemList)); dtStringList: Result := meStringListDef.Lines.Text; end; end; procedure TF_MakeProperty.SendPropValRelFromBaseToMemTables; var //BookMarkMT: String; BookMarkMT: TBookMark; QSelect: TpFIBQuery; PropValRelData: TPropValRelData; DataType: Integer; ValueFloat: Double; NormResName: String; IDNBCompon: Integer; SprCompon: TSCSComponent; begin try DataType := GetIDFromComboBox(ComboBox_PDataType); if FmtPropValRel <> nil then begin //BookMarkMT := FmtPropValRel.Bookmark; BookMarkMT := FmtPropValRel.GetBookmark; try FmtPropValRel.First; while Not FmtPropValRel.Eof do begin AssignDataSetRecord(meMake, mtPropValRel, FmtPropValRel, fnIsModified+';'+fnIsNew); FmtPropValNormRes.First; while Not FmtPropValNormRes.Eof do begin AssignDataSetRecord(meMake, mtPropValNormRes, FmtPropValNormRes, fnIsModified+';'+fnIsNew); // Подгружаем наимнование NormResName := ''; mtPropValNormRes.Edit; if mtPropValNormRes.FieldByName(fnGUIDNBComponent).AsString <> '' then begin IDNBCompon := F_NormBase.DM.GetIntFromTableByGUID(tnComponent, fnID, mtPropValNormRes.FieldByName(fnGUIDNBComponent).AsString, qmPhisical); if IDNBCompon <> 0 then NormResName := F_NormBase.DM.GetStringFromTableByID(tnComponent, fnName, IDNBCompon, qmPhisical) else begin SprCompon := TF_Main(GForm).GSCSBase.CurrProject.GetSprComponentByGUID(mtPropValNormRes.FieldByName(fnGUIDNBComponent).AsString); if SprCompon <> nil then NormResName := SprCompon.Name; end; end else if mtPropValNormRes.FieldByName(fnGuidNBRES).AsString <> '' then begin AddExceptionToLogEx('', cNoWriteCode); end else if mtPropValNormRes.FieldByName(fnGuidNBNorm).AsString <> '' then begin AddExceptionToLogEx('', cNoWriteCode); end; mtPropValNormRes.FieldByName(fnName).AsString := NormResName; mtPropValNormRes.Post; FmtPropValNormRes.Next; end; FmtPropValRel.Next; end; finally //FmtPropValRel.Bookmark := BookMarkMT; if BookMarkMT <> nil then begin FmtPropValRel.GotoBookmark(BookMarkMT); FmtPropValRel.FreeBookmark(BookMarkMT); end; end; end else begin QSelect := TF_Main(GForm).DM.Query_Select; // Подгружаем все связи значений свойств SetSQLToFIBQuery(QSelect, GetSQLByParams(qtSelect, tnPropValRel, fnIDProperty+' = :'+fnIDProperty, nil, fnAll), false); QSelect.Close; QSelect.Params[0].AsInteger := FID; QSelect.ExecQuery; while Not QSelect.Eof do begin AssignDataSetRecordFromFIBQuery(meMake, mtPropValRel, QSelect); QSelect.Next; end; // Подгружаем все связи значений свойств с аксессуарами SetSQLToFIBQuery(QSelect, GetSQLByParams(qtSelect, tnPropValNormRes, fnIDPropValRel+' = :'+fnIDPropValRel, nil, fnAll), false); mtPropValRel.First; while Not mtPropValRel.Eof do begin QSelect.Close; QSelect.Params[0].AsInteger := mtPropValRel.FieldByName(fnID).AsInteger; QSelect.ExecQuery; while Not QSelect.Eof do begin AssignDataSetRecordFromFIBQuery(meMake, mtPropValNormRes, QSelect); QSelect.Next; end; mtPropValRel.Next; end; // Подгружаем GUID и наименования mtPropValRel.First; while Not mtPropValRel.Eof do begin mtPropValNormRes.First; while Not mtPropValNormRes.Eof do begin mtPropValNormRes.Edit; if mtPropValNormRes.FieldByName(fnIDNBComponent).AsInteger <> 0 then begin mtPropValNormRes.FieldByName(fnGUIDNBComponent).AsString := TF_Main(GForm).DM.GetStringFromTableByID(tnComponent, fnGuid, mtPropValNormRes.FieldByName(fnIDNBComponent).AsInteger, qmPhisical); NormResName := TF_Main(GForm).DM.GetStringFromTableByID(tnComponent, fnName, mtPropValNormRes.FieldByName(fnIDNBComponent).AsInteger, qmPhisical); mtPropValNormRes.FieldByName(fnName).AsString := NormResName; end; if mtPropValNormRes.FieldByName(fnIDNBRES).AsInteger <> 0 then begin mtPropValNormRes.FieldByName(fnGuidNBRES).AsString := TF_Main(GForm).DM.GetStringFromTableByID(tnNBResources, fnGuid, mtPropValNormRes.FieldByName(fnIDNBRES).AsInteger, qmPhisical); NormResName := TF_Main(GForm).DM.GetStringFromTableByID(tnNBResources, fnName, mtPropValNormRes.FieldByName(fnIDNBComponent).AsInteger, qmPhisical); mtPropValNormRes.FieldByName(fnName).AsString := NormResName; end; if mtPropValNormRes.FieldByName(fnIDNBNorm).AsInteger <> 0 then begin mtPropValNormRes.FieldByName(fnGuidNBNorm).AsString := TF_Main(GForm).DM.GetStringFromTableByID(tnNBNorms, fnGuid, mtPropValNormRes.FieldByName(fnIDNBNorm).AsInteger, qmPhisical); NormResName := TF_Main(GForm).DM.GetStringFromTableByID(tnNBNorms, fnName, mtPropValNormRes.FieldByName(fnIDNBComponent).AsInteger, qmPhisical); mtPropValNormRes.FieldByName(fnName).AsString := NormResName; end; mtPropValNormRes.Post; mtPropValNormRes.Next; end; mtPropValRel.Next; end; end; if (DataType = dtFloat) or (DataType = dtInteger) then begin mtPropValRel.First; while Not mtPropValRel.Eof do begin // Подгонка значения под СИ mtPropValRel.Edit; if mtPropValRel.FieldByName(fnPValue).AsString <> '' then try ValueFloat := StrToFloatU(CorrectStrToFloat(mtPropValRel.FieldByName(fnPValue).AsString)); PropValueInUOM(ValueFloat, Edit_PSysName.Text, umMetr, FUOM); mtPropValRel.FieldByName(fnPValue).AsString := FloatToStr(RoundCP(ValueFloat)); except end; if mtPropValRel.FieldByName(fnMinValue).AsString <> '' then try ValueFloat := StrToFloatU(CorrectStrToFloat(mtPropValRel.FieldByName(fnMinValue).AsString)); PropValueInUOM(ValueFloat, Edit_PSysName.Text, umMetr, FUOM); mtPropValRel.FieldByName(fnMinValue).AsString := FloatToStr(RoundCP(ValueFloat)); except end; if mtPropValRel.FieldByName(fnMaxValue).AsString <> '' then try ValueFloat := StrToFloatU(CorrectStrToFloat(mtPropValRel.FieldByName(fnMaxValue).AsString)); PropValueInUOM(ValueFloat, Edit_PSysName.Text, umMetr, FUOM); mtPropValRel.FieldByName(fnMaxValue).AsString := FloatToStr(RoundCP(ValueFloat)); except end; mtPropValRel.Post; mtPropValRel.Next; end; end; mtPropValRel.First; mtPropValNormRes.First; except on E: Exception do AddExceptionToLogEx('TF_MakeProperty.SendPropValRelFromBaseToMemTables', E.Message); end; end; procedure TF_MakeProperty.SendPropValRelFromMemTablesToBase; var MakeEdit: TMakeEdit; PropValRelData: TPropValRelData; PropValNormResData: TPropValNormResData; DataType: Integer; ValueFloat: Double; SavedMasterSource: TDataSource; SavedMasterFields: String; SavedDetailFields: String; i: Integer; begin try DataType := GetIDFromComboBox(ComboBox_PDataType); mtPropValRel.First; while Not mtPropValRel.Eof do begin // Подгонка значения под СИ if (DataType = dtFloat) or (DataType = dtInteger) then begin mtPropValRel.Edit; if mtPropValRel.FieldByName(fnPValue).AsString <> '' then try ValueFloat := StrToFloat_My(mtPropValRel.FieldByName(fnPValue).AsString); PropValueInUOM(ValueFloat, Edit_PSysName.Text, FUOM, umMetr); mtPropValRel.FieldByName(fnPValue).AsString := FloatToStrU(ValueFloat); except end; if mtPropValRel.FieldByName(fnMinValue).AsString <> '' then try ValueFloat := StrToFloat_My(mtPropValRel.FieldByName(fnMinValue).AsString); PropValueInUOM(ValueFloat, Edit_PSysName.Text, FUOM, umMetr); mtPropValRel.FieldByName(fnMinValue).AsString := FloatToStrU(ValueFloat); except end; if mtPropValRel.FieldByName(fnMaxValue).AsString <> '' then try ValueFloat := StrToFloat_My(mtPropValRel.FieldByName(fnMaxValue).AsString); PropValueInUOM(ValueFloat, Edit_PSysName.Text, FUOM, umMetr); mtPropValRel.FieldByName(fnMaxValue).AsString := FloatToStrU(ValueFloat); except end; mtPropValRel.Post; end; MakeEdit := meNone; if mtPropValRel.FieldByName(fnIsNew).AsBoolean then MakeEdit := meMake else if mtPropValRel.FieldByName(fnIsModified).AsBoolean then MakeEdit := meEdit; if MakeEdit <> meNone then begin if FmtPropValRel <> nil then begin if MakeEdit = meEdit then if Not FmtPropValRel.Locate(fnGuid, mtPropValRel.FieldByName(fnGuid).AsString, []) then MakeEdit := meNone; if MakeEdit <> meNone then begin AssignDataSetRecord(MakeEdit, FmtPropValRel, mtPropValRel, fnIsModified+';'+fnIsNew); FmtPropValRel.Edit; if MakeEdit = meMake then FmtPropValRel.FieldByName(fnIsNew).AsBoolean := true else if MakeEdit = meEdit then FmtPropValRel.FieldByName(fnIsModified).AsBoolean := true; FmtPropValRel.Post; end; end else begin ZeroMemory(@PropValRelData, SizeOf(TPropValRelData)); PropValRelData.ID := mtPropValRel.FieldByName(fnID).AsInteger; PropValRelData.GUID := mtPropValRel.FieldByName(fnGUID).AsString; PropValRelData.IDProperty := FID; PropValRelData.PValue := mtPropValRel.FieldByName(fnPValue).AsString; PropValRelData.MinValue := mtPropValRel.FieldByName(fnMinValue).AsString; PropValRelData.MaxValue := mtPropValRel.FieldByName(fnMaxValue).AsString; TF_Main(GForm).DM.SavePropValRel(MakeEdit, @PropValRelData); if MakeEdit = meMake then begin mtPropValRel.Edit; mtPropValRel.FieldByName(fnID).AsInteger := PropValRelData.ID; mtPropValRel.Post; end; end; end; if FmtPropValRel <> nil then if FmtPropValRel.FieldByName(fnGuid).AsString <> mtPropValRel.FieldByName(fnGuid).AsString then FmtPropValRel.Locate(fnGuid, mtPropValRel.FieldByName(fnGuid).AsString, []); mtPropValNormRes.First; while Not mtPropValNormRes.Eof do begin MakeEdit := meNone; if mtPropValNormRes.FieldByName(fnIsNew).AsBoolean then MakeEdit := meMake else if mtPropValNormRes.FieldByName(fnIsModified).AsBoolean then MakeEdit := meEdit; if MakeEdit <> meNone then begin if FmtPropValRel <> nil then begin if MakeEdit = meEdit then if Not FmtPropValNormRes.Locate(fnGuid, mtPropValNormRes.FieldByName(fnGuid).AsString, []) then MakeEdit := meNone; if MakeEdit <> meNone then begin AssignDataSetRecord(MakeEdit, FmtPropValNormRes, mtPropValNormRes, fnIsModified+';'+fnIsNew); FmtPropValNormRes.Edit; if MakeEdit = meMake then FmtPropValNormRes.FieldByName(fnIsNew).AsBoolean := true else if MakeEdit = meEdit then FmtPropValNormRes.FieldByName(fnIsModified).AsBoolean := true; FmtPropValNormRes.Post; end; end else begin ZeroMemory(@PropValNormResData, SizeOf(TPropValNormResData)); PropValNormResData.ID := mtPropValNormRes.FieldByName(fnID).AsInteger; PropValNormResData.GUID := mtPropValNormRes.FieldByName(fnGUID).AsString; PropValNormResData.IDPropValRel := mtPropValRel.FieldByName(fnID).AsInteger; PropValNormResData.IDNBComponent := mtPropValNormRes.FieldByName(fnIDNBComponent).AsInteger; PropValNormResData.IDNBRes := mtPropValNormRes.FieldByName(fnIDNBRES).AsInteger; PropValNormResData.IDNBNorm := mtPropValNormRes.FieldByName(fnIDNBNorm).AsInteger; PropValNormResData.Kolvo := mtPropValNormRes.FieldByName(fnKolvo).AsFloat; PropValNormResData.ExpenseForLength := mtPropValNormRes.FieldByName(fnExpenseForLength).AsFloat; PropValNormResData.CountForPoint := mtPropValNormRes.FieldByName(fnCountForPoint).AsFloat; PropValNormResData.StepOfPoint := mtPropValNormRes.FieldByName(fnStepOfPoint).AsFloat; TF_Main(GForm).DM.SavePropValNormRes(MakeEdit, @PropValNormResData); end; end; mtPropValNormRes.Next; end; mtPropValRel.Next; end; // Удалить удаленные if FmtPropValRel <> nil then begin for i := 0 to FDeletedPropValGUIDs.Count - 1 do if FmtPropValRel.Locate(fnGUID, FDeletedPropValGUIDs[i], []) then FmtPropValRel.Delete; if FDeletedPropValNormResGUIDs.Count > 0 then begin SavedMasterSource := FmtPropValNormRes.MasterSource; SavedMasterFields := FmtPropValNormRes.MasterFields; SavedDetailFields := FmtPropValNormRes.DetailFields; FmtPropValNormRes.MasterSource := nil; FmtPropValNormRes.MasterFields := ''; FmtPropValNormRes.DetailFields := ''; try for i := 0 to FDeletedPropValNormResGUIDs.Count - 1 do if FmtPropValNormRes.Locate(fnGUID, FDeletedPropValNormResGUIDs[i], []) then FmtPropValNormRes.Delete; finally FmtPropValNormRes.MasterSource := SavedMasterSource; FmtPropValNormRes.MasterFields := SavedMasterFields; FmtPropValNormRes.DetailFields := SavedDetailFields; end; end; end else begin TF_Main(GForm).DM.DeleteRecordsByGUIDList(tnPropValRel, FDeletedPropValGUIDs); TF_Main(GForm).DM.DeleteRecordsByGUIDList(tnPropValNormRes, FDeletedPropValNormResGUIDs); end; except on E: Exception do AddExceptionToLogEx('TF_MakeProperty.SendPropValRelFromMemTablesToBase', E.Message); end; end; procedure TF_MakeProperty.SetControlsByUOM; begin FUOM := TF_Main(GForm).FUOM; // Расход на метр GT_PropValNormResExpenseForLength.Caption := cNameExpenseFor +' '+ IntToStr(1)+GetNameUOM(FUOM, true); // Шаг точки GT_PropValNormResStepOfPoint.Caption := cNameStepOfPoint +', '+ GetNameUOM(FUOM, true); end; procedure TF_MakeProperty.SetIsStateForValue(AValue: Boolean); begin CheckBox_IsProject.Checked := AValue; CheckBox_IsFolder.Checked := AValue; CheckBox_IsList.Checked := AValue; CheckBox_IsRoom.Checked := AValue; CheckBox_IsSCSLine.Checked := AValue; CheckBox_IsSCSConnector.Checked := AValue; CheckBox_IsComponLine.Checked := AValue; CheckBox_IsComponConn.Checked := AValue; end; procedure TF_MakeProperty.SetMinMaxValues(AMinValue, AMaxValue: Double; ADataType: Integer; ASysName: String); var ValueFloat: Double; begin case ADataType of // DataType dtDate: begin DateEdit_PMin.Date := AMinValue; DateEdit_PMax.Date := AMaxValue; end; else begin ValueFloat := AMinValue; PropValueInUOM(ValueFloat, ASysName, umMetr, FUOM); SpinEdit_PMin.Value := RoundCP(ValueFloat); ValueFloat := AMaxValue; PropValueInUOM(ValueFloat, ASysName, umMetr, FUOM); SpinEdit_PMax.Value := RoundCP(ValueFloat); end; end; end; Function TF_MakeProperty.MinMaxControl(AValue: String): Boolean; //Var Len: Integer; begin Result := True; if (SpinEdit_PMin.Enabled) and (SpinEdit_PMax.Enabled) then case GetIDFromComboBox(ComboBox_PDataType) of dtFloat .. dtInteger: // 0 or 1 begin if SpinEdit_PMin.Value <> 0 then if RoundCP(StrToFloatU(AValue)) < SpinEdit_PMin.Value then begin MessageDlg(cMinMaxControl_Msg1_1+' ', mtInformation, [mbOK], 0); Result := false; end; if SpinEdit_PMax.Value <> 0 then if RoundCP(StrToFloatU(AValue)) > SpinEdit_PMax.Value then begin MessageDlg(cMinMaxControl_Msg1_2+' ', mtInformation, [mbOK], 0); Result := false; end; end; dtDate: begin if DateEdit_PMin.Text = '' then DateEdit_PMin.Date := 0; if DateEdit_PMax.Text = '' then DateEdit_PMax.Date := 0; if DateEdit_PMin.Date <> 0 then if (StrToDateU(AValue) < DateEdit_PMin.Date) and (DateEdit_PMin.Text <> '') then begin MessageDlg(cMinMaxControl_Msg1_1+' ', mtInformation, [mbOK], 0); Result := false; end; if (DateEdit_PMax.Date <> 0) and (DateEdit_PMax.Text <> '') then if StrToDateU(AValue) > DateEdit_PMax.Date then begin MessageDlg(cMinMaxControl_Msg1_2+' ', mtInformation, [mbOK], 0); Result := false; end; end; end; end; function TF_MakeProperty.MakeEditProperty(AEditMode: TMakeEdit; AItemType: TItemType; AMemTable, AmtPropValRel, AmtPropValNormRes: TkbmMemTable): Boolean; var DataType: Integer; ValueFloat: Double; _Value: String; PropertyID: Integer; PropertyData: TPropertyData; begin Result := false; FMemTable := AMemTable; FmtPropValRel := AmtPropValRel; FmtPropValNormRes := AmtPropValNormRes; GFormMode := fmNone; GItemType := AItemType; GID := -1; FID := 0; PropertyID := 0; FLastTubeConnectcKind := -1; FLastBasementType := -1; FLastTypeItem.Fill(-1, dtLast); case AEditMode of meMake: GFormMode := fmMake; meEdit: GFormMode := fmEdit; end; //edTest.Text := 'яТест'; {if TF_Main(GForm).GDBMode = bkNormBase then begin Label_ItemType.Visible := false; ComboBox_ItemType.Visible := false; end;} //*** Обнулить значения Edit_PDefault.Text := ''; DateEdit_PDefault.Text := ''; SpinEdit_PDefault.Value := 0; SpinEdit_PMax.Value := 0; SpinEdit_PMin.Value := 0; DateEdit_PMax.Text := ''; DateEdit_PMin.Text := ''; FLastTubeConnectcKind := -1; FLastBasementType := -1; FEditedTableView := nil; FEditedItem := nil; FDeletedPropValGUIDs.Clear; FDeletedPropValNormResGUIDs.Clear; mtPropValNormRes.Active := false; mtPropValRel.Active := false; mtPropValRel.Active := true; mtPropValNormRes.Active := true; SetControlsByUOM; FSysNameBeforeEdit := ''; //FillComboBox(ComboBox_PCompStateType, F_NormBase.DM.DataSet_MT_COMP_STATE_TYPE, false, 'ID', 'Name'); cbSectionSideDefault.Properties.BeginUpdate; try TF_Main(GForm).FNormBase.DM.LoadInputStringsToTStrings(cbSectionSideDefault.Properties.Items, stDimensions); finally cbSectionSideDefault.Properties.EndUpdate; end; case GFormMode of fmMake: begin GFormMode := fmMake; Caption := cMinMaxControl_Msg4_1; Edit_PName.Text := ''; Edit_PSysName.Text := ''; Edit_PIzm.Text := ''; CheckBox_PNotNull.Checked := true; SelectItemByIDinCombo(ComboBox_PDataType, dtFloat); //ComboBox_PDataType.ItemIndex := 0; SpinEdit_PMin.Value := null; SpinEdit_PMax.Value := null; GValue := ''; Edit_PDescription.Text := ''; cbIsForWholeComponent.Checked := true; SetIsStateForValue(false); cbIsValueRelToObj.Checked := false; //if TF_Main(GForm).GDBMode = bkProjectManager then //ComboBox_ItemType.ItemIndex := GItemType; //PObjectData(TF_Main(GForm).Tree_Catalog.Selected.Data).ItemType; end; fmEdit: begin GFormMode := fmEdit; Caption := cMinMaxControl_Msg4_2; if AMemTable <> nil then begin PropertyID := AMemTable.FieldByName(fnID).AsInteger; Edit_PName.Text := AMemTable.FieldByName(fnName).AsString; Edit_PSysName.Text := AMemTable.FieldByName(fnSysName).AsString;; Edit_PIzm.Text := AMemTable.FieldByName(fnIzm).AsString; CheckBox_PNotNull.Checked := IntToBool(AMemTable.FieldByName(fnValueReq).AsInteger); SelectItemByIDinCombo(ComboBox_PDataType, AMemTable.FieldByName(fnIDDataType).AsInteger); {case AMemTable.FieldByName(fnIDDataType).AsInteger of // DataType dtDate: begin DateEdit_PMin.Date := AMemTable.FieldByName(fnMinValue).AsFloat; DateEdit_PMax.Date := AMemTable.FieldByName(fnMaxValue).AsFloat; end; else begin SpinEdit_PMin.Value := RoundCP(AMemTable.FieldByName(fnMinValue).AsFloat); SpinEdit_PMax.Value := RoundCP(AMemTable.FieldByName(fnMaxValue).AsFloat); end; end;} SetMinMaxValues(AMemTable.FieldByName(fnMinValue).AsFloat, AMemTable.FieldByName(fnMaxValue).AsFloat, AMemTable.FieldByName(fnIDDataType).AsInteger, AMemTable.FieldByName(fnSysName).AsString); GValue := AMemTable.FieldByName(fnDefValue).AsString; Edit_PDescription.Text := AMemTable.FieldByName(fnDescription).AsString; CheckBox_IsProject.Checked := IntToBool(AMemTable.FieldByName(fnIsProject).AsInteger); CheckBox_IsFolder.Checked := IntToBool(AMemTable.FieldByName(fnIsFolder).AsInteger); CheckBox_IsList.Checked := IntToBool(AMemTable.FieldByName(fnIsList).AsInteger); CheckBox_IsRoom.Checked := IntToBool(AMemTable.FieldByName(fnIsRoom).AsInteger); CheckBox_IsSCSLine.Checked := IntToBool(AMemTable.FieldByName(fnIsSCSline).AsInteger); CheckBox_IsSCSConnector.Checked := IntToBool(AMemTable.FieldByName(fnIsSCSConnector).AsInteger); CheckBox_IsComponLine.Checked := IntToBool(AMemTable.FieldByName(fnIsComponLine).AsInteger); CheckBox_IsComponConn.Checked := IntToBool(AMemTable.FieldByName(fnIsComponConn).AsInteger); cbIsForWholeComponent.Checked := IntToBool(AMemTable.FieldByName(fnIsForWholeComponent).AsInteger); cbIsValueRelToObj.Checked := IntToBool(AMemTable.FieldByName(fnIsValueRelToObj).AsInteger); end else with TF_Main(GForm).DM do begin PropertyID := DataSet_PROPERTIES.FN(fnID).AsInteger; Edit_PName.Text := DataSet_PROPERTIES.FN(fnName).AsString; Edit_PSysName.Text := DataSet_PROPERTIES.FN(fnSysName).AsString;; Edit_PIzm.Text := DataSet_PROPERTIES.FN(fnIzm).AsString; CheckBox_PNotNull.Checked := IntToBool(DataSet_PROPERTIES.FN(fnValueReq).AsInteger); SelectItemByIDinCombo(ComboBox_PDataType, DataSet_PROPERTIES.FN(fnIDDataType).AsInteger); {case DataSet_PROPERTIES.FN(fnIDDataType).AsInteger of // DataType dtDate: begin DateEdit_PMin.Date := DataSet_PROPERTIES.FN(fnMinValue).AsFloat; DateEdit_PMax.Date := DataSet_PROPERTIES.FN(fnMaxValue).AsFloat; end; else begin SpinEdit_PMin.Value := RoundCP(DataSet_PROPERTIES.FN(fnMinValue).AsFloat); SpinEdit_PMax.Value := RoundCP(DataSet_PROPERTIES.FN(fnMaxValue).AsFloat); end; end;} SetMinMaxValues(DataSet_PROPERTIES.FN(fnMinValue).AsFloat, DataSet_PROPERTIES.FN(fnMaxValue).AsFloat, DataSet_PROPERTIES.FN(fnIDDataType).AsInteger, DataSet_PROPERTIES.FN(fnSysName).AsString); GValue := DataSet_PROPERTIES.FN(fnDefValue).AsString; Edit_PDescription.Text := DataSet_PROPERTIES.FN(fnDescription).AsString; CheckBox_IsProject.Checked := IntToBool(DataSet_PROPERTIES.FN(fnIsProject).AsInteger); CheckBox_IsFolder.Checked := IntToBool(DataSet_PROPERTIES.FN(fnIsFolder).AsInteger); CheckBox_IsList.Checked := IntToBool(DataSet_PROPERTIES.FN(fnIsList).AsInteger); CheckBox_IsRoom.Checked := IntToBool(DataSet_PROPERTIES.FN(fnIsRoom).AsInteger); CheckBox_IsSCSLine.Checked := IntToBool(DataSet_PROPERTIES.FN(fnIsSCSline).AsInteger); CheckBox_IsSCSConnector.Checked := IntToBool(DataSet_PROPERTIES.FN(fnIsSCSConnector).AsInteger); CheckBox_IsComponLine.Checked := IntToBool(DataSet_PROPERTIES.FN(fnIsComponLine).AsInteger); CheckBox_IsComponConn.Checked := IntToBool(DataSet_PROPERTIES.FN(fnIsComponConn).AsInteger); cbIsForWholeComponent.Checked := IntToBool(DataSet_PROPERTIES.FN(fnIsForWholeComponent).AsInteger); cbIsValueRelToObj.Checked := IntToBool(DataSet_PROPERTIES.FN(fnIsValueRelToObj).AsInteger); {if TF_Main(GForm).GDBMode = bkProjectManager then begin //DM.SelectProperty; ComboBox_ItemType.ItemIndex := FN('ID_Item_Type').AsInteger; end;} end; FSysNameBeforeEdit := Edit_PSysName.Text; FID := PropertyID; end; end; //ComboBox_ItemType.ItemIndex := GItemType; SelectItemByIDinCombo(ComboBox_ItemType, GItemType); ChoiceEdit; SendPropValRelFromBaseToMemTables; EnableDisableControls; if GFormMode <> fmNone then if ShowModal = mrOk then begin Result := true; DataType := GetIDFromComboBox(ComboBox_PDataType); _Value := GetPropValue(true); ZeroMemory(@PropertyData, SizeOf(TPropertyData)); case DataType of dtDate: begin PropertyData.MinValue := DateEdit_PMin.Date; PropertyData.MaxValue := DateEdit_PMax.Date; end; else begin ValueFloat := SpinEdit_PMin.Value; PropValueInUOM(ValueFloat, Edit_PSysName.Text, FUOM, umMetr); PropertyData.MinValue := RoundCP(ValueFloat); ValueFloat := SpinEdit_PMax.Value; PropValueInUOM(ValueFloat, Edit_PSysName.Text, FUOM, umMetr); PropertyData.MaxValue := RoundCP(ValueFloat); end; end; if AMemTable <> nil then begin case GFormMode of fmMake: AMemTable.Append; fmEdit: AMemTable.Edit; end; AMemTable.FieldByName(fnName).AsString := Edit_PName.Text; AMemTable.FieldByName(fnSysName).AsString := Edit_PSysName.Text; AMemTable.FieldByName(fnIzm).AsString := Edit_PIzm.Text; AMemTable.FieldByName(fnValueReq).AsInteger := BoolToInt(CheckBox_PNotNull.Checked); AMemTable.FieldByName(fnIDDataType).AsInteger := DataType; AMemTable.FieldByName(fnMinValue).AsFloat := PropertyData.MinValue; AMemTable.FieldByName(fnMaxValue).AsFloat := PropertyData.MaxValue; AMemTable.FieldByName(fnDefValue).AsString := _Value; AMemTable.FieldByName(fnDescription).AsString := Edit_PDescription.Text; AMemTable.FieldByName(fnIDItemType).AsInteger := GetIDFromComboBox(ComboBox_ItemType); AMemTable.FieldByName(fnIsProject).AsInteger := BoolToInt(CheckBox_IsProject.Checked); AMemTable.FieldByName(fnIsFolder).AsInteger := BoolToInt(CheckBox_IsFolder.Checked); AMemTable.FieldByName(fnIsList).AsInteger := BoolToInt(CheckBox_IsList.Checked); AMemTable.FieldByName(fnIsRoom).AsInteger := BoolToInt(CheckBox_IsRoom.Checked); AMemTable.FieldByName(fnIsSCSline).AsInteger := BoolToInt(CheckBox_IsSCSLine.Checked); AMemTable.FieldByName(fnIsSCSConnector).AsInteger := BoolToInt(CheckBox_IsSCSConnector.Checked); AMemTable.FieldByName(fnIsComponLine).AsInteger := BoolToInt(CheckBox_IsComponLine.Checked); AMemTable.FieldByName(fnIsComponConn).AsInteger := BoolToInt(CheckBox_IsComponConn.Checked); AMemTable.FieldByName(fnIsForWholeComponent).AsInteger := BoolToInt(cbIsForWholeComponent.Checked); AMemTable.FieldByName(fnIsValueRelToObj).AsInteger := BoolToInt(cbIsValueRelToObj.Checked); AMemTable.FieldByName(fnIsModified).AsBoolean := true; AMemTable.Post; GID := AMemTable.FieldByName(fnID).AsInteger; FID := AMemTable.FieldByName(fnID).AsInteger; end else with TF_Main(GForm).DM do begin PropertyData.ID := PropertyID; PropertyData.Name := Edit_PName.Text; PropertyData.SysName := Edit_PSysName.Text; PropertyData.Izm := Edit_PIzm.Text; PropertyData.ValueReq := BoolToInt(CheckBox_PNotNull.Checked); PropertyData.IDDataType := DataType; PropertyData.DefValue := _Value; PropertyData.Description := Edit_PDescription.Text; //if TF_Main(GForm).GDBMode = bkProjectManager then PropertyData.IDItemType := GetIDFromComboBox(ComboBox_ItemType); PropertyData.IsProject := BoolToInt(CheckBox_IsProject.Checked); PropertyData.IsFolder := BoolToInt(CheckBox_IsFolder.Checked); PropertyData.IsList := BoolToInt(CheckBox_IsList.Checked); PropertyData.IsRoom := BoolToInt(CheckBox_IsRoom.Checked); PropertyData.IsSCSline := BoolToInt(CheckBox_IsSCSLine.Checked); PropertyData.IsSCSConnector := BoolToInt(CheckBox_IsSCSConnector.Checked); PropertyData.IsComponLine := BoolToInt(CheckBox_IsComponLine.Checked); PropertyData.IsComponConn := BoolToInt(CheckBox_IsComponConn.Checked); PropertyData.IsForWholeComponent := BoolToInt(cbIsForWholeComponent.Checked); PropertyData.IsValueRelToObj := BoolToInt(cbIsValueRelToObj.Checked); SaveProperty(AEditMode, @PropertyData); if AEditMode = meMake then GID := PropertyData.ID else if AEditMode = meEdit then DataSet_PROPERTIES.ReopenLocate(fnID); //DataSet_PROPERTIES.FullRefresh; FID := PropertyData.ID; { case GFormMode of fmMake: DataSet_PROPERTIES.Append; fmEdit: DataSet_PROPERTIES.Edit; end; DataSet_PROPERTIES.FN(fnName).AsString := Edit_PName.Text; DataSet_PROPERTIES.FN(fnSysName).AsString := Edit_PSysName.Text; DataSet_PROPERTIES.FN(fnIzm).AsString := Edit_PIzm.Text; DataSet_PROPERTIES.FN(fnValueReq).AsInteger := BoolToInt(CheckBox_PNotNull.Checked); DataSet_PROPERTIES.FN(fnIDDataType).AsInteger := GetIDFromComboBox(ComboBox_PDataType); case DataType of dtDate: begin DataSet_PROPERTIES.FN(fnMinValue).AsFloat := DateEdit_PMin.Date; DataSet_PROPERTIES.FN(fnMaxValue).AsFloat := DateEdit_PMax.Date; end; else begin DataSet_PROPERTIES.FN(fnMinValue).AsFloat := RoundCP(SpinEdit_PMin.Value); DataSet_PROPERTIES.FN(fnMaxValue).AsFloat := RoundCP(SpinEdit_PMax.Value); end; end; DataSet_PROPERTIES.FN(fnDefValue).AsString := _Value; DataSet_PROPERTIES.FN(fnDescription).AsString := Edit_PDescription.Text; //if TF_Main(GForm).GDBMode = bkProjectManager then DataSet_PROPERTIES.FN(fnIDItemType).AsInteger := GetIDFromComboBox(ComboBox_ItemType); DataSet_PROPERTIES.FN(fnIsProject).AsInteger := BoolToInt(CheckBox_IsProject.Checked); DataSet_PROPERTIES.FN(fnIsFolder).AsInteger := BoolToInt(CheckBox_IsFolder.Checked); DataSet_PROPERTIES.FN(fnIsList).AsInteger := BoolToInt(CheckBox_IsList.Checked); DataSet_PROPERTIES.FN(fnIsRoom).AsInteger := BoolToInt(CheckBox_IsRoom.Checked); DataSet_PROPERTIES.FN(fnIsSCSline).AsInteger := BoolToInt(CheckBox_IsSCSLine.Checked); DataSet_PROPERTIES.FN(fnIsSCSConnector).AsInteger := BoolToInt(CheckBox_IsSCSConnector.Checked); DataSet_PROPERTIES.FN(fnIsComponLine).AsInteger := BoolToInt(CheckBox_IsComponLine.Checked); DataSet_PROPERTIES.FN(fnIsComponConn).AsInteger := BoolToInt(CheckBox_IsComponConn.Checked); DataSet_PROPERTIES.FN(fnIsForWholeComponent).AsInteger := BoolToInt(cbIsForWholeComponent.Checked); DataSet_PROPERTIES.Post; GID := DataSet_PROPERTIES.FN(fnID).AsInteger; } end; SendPropValRelFromMemTablesToBase; end; end; // ############################################################################# // ############################################################################# // // ##### создать форму ##### procedure TF_MakeProperty.FormCreate(Sender: TObject); var i: Integer; //var ptrID: PID; { procedure AddIDToCombo(AID: Integer; AString: String); begin New(ptrID); ptrID^ := TID.Create; ptrID.ID := AID; ComboBox_ItemType.Properties.Items.AddObject(AString, ptrID^); end; } begin {if GDBActiveKind = bkNormBase then begin Label_ItemType.Visible := false; ComboBox_ItemType.Visible := false; end; } {AddIDToCombo(itDir, 'Папка', ComboBox_ItemType); AddIDToCombo(itProject, 'Проект', ComboBox_ItemType); AddIDToCombo(itList, 'Лист', ComboBox_ItemType); AddIDToCombo(itSCSLine, 'Линейный объект', ComboBox_ItemType); AddIDToCombo(itSCSConnector, 'Точечный объект', ComboBox_ItemType); AddIDToCombo(itComponent, 'Компонента', ComboBox_ItemType); AddIDToCombo(itCommon, 'Все', ComboBox_ItemType); } ComboBox_PDataType.Properties.BeginUpdate; try AddIDToCombo(dtFloat, cMinMaxControl_Msg2_1, ComboBox_PDataType); AddIDToCombo(dtInteger, cMinMaxControl_Msg2_2, ComboBox_PDataType); AddIDToCombo(dtBoolean, cMinMaxControl_Msg2_3, ComboBox_PDataType); AddIDToCombo(dtString, cMinMaxControl_Msg2_4, ComboBox_PDataType); AddIDToCombo(dtDate, cMinMaxControl_Msg2_5, ComboBox_PDataType); AddIDToCombo(dtCompStateType, cMinMaxControl_Msg2_6, ComboBox_PDataType); AddIDToCombo(dtColor, cMinMaxControl_Msg2_7, ComboBox_PDataType); AddIDToCombo(dtCableCanalElementType, cMinMaxControl_Msg2_8, ComboBox_PDataType); AddIDToCombo(dtDimensions, cDimensionsB, ComboBox_PDataType); AddIDToCombo(dtConnectionKind, cNameConnectionKind, ComboBox_PDataType); AddIDToCombo(dtStringList, cNameStringListB, ComboBox_PDataType); //AddIDToCombo(dtBasementType, cNameBasementTypeB, ComboBox_PDataType); AddIDToCombo(dtPlaneMaterialType, cNamePlaneMaterialTypeB, ComboBox_PDataType); AddIDToCombo(dtRoofHipType, cNameRoofHipTypeB, ComboBox_PDataType); AddIDToCombo(dtRoofHipApexType, cNameRoofHipApexTypeB, ComboBox_PDataType); AddIDToCombo(dtRoofHipValleyType, cNameRoofHipValleyTypeB, ComboBox_PDataType); finally ComboBox_PDataType.Properties.EndUpdate; end; ComboBox_PCompStateType.Properties.BeginUpdate; try AddIDToCombo(oitProjectible, cMinMaxControl_Msg3_1, ComboBox_PCompStateType); AddIDToCombo(oitActive, cMinMaxControl_Msg3_2, ComboBox_PCompStateType); finally ComboBox_PCompStateType.Properties.EndUpdate; end; cbCableCanalElemntTypes.Properties.BeginUpdate; try AddIDToCombo(contNone, '', cbCableCanalElemntTypes); AddIDToCombo(contCork, ctnCork, cbCableCanalElemntTypes); AddIDToCombo(contAnglePlane, ctnAnglePlane, cbCableCanalElemntTypes); AddIDToCombo(contTjoin, ctnTjoin, cbCableCanalElemntTypes); AddIDToCombo(contCross, ctnCross, cbCableCanalElemntTypes); AddIDToCombo(contAngleIn, ctnAngleIn, cbCableCanalElemntTypes); AddIDToCombo(contAngleOut, ctnAngleOut, cbCableCanalElemntTypes); AddIDToCombo(contADapter, ctnADapter, cbCableCanalElemntTypes); AddIDToCombo(contConnector, ctnConnector, cbCableCanalElemntTypes); AddIDToCombo(contWallCork, ctnWallCork, cbCableCanalElemntTypes); finally cbCableCanalElemntTypes.Properties.EndUpdate; end; CheckBox_IsComponLineClick(CheckBox_IsComponLine); btSendSectionSideToBase.Hint := cSendValueToDimensionsSprav; //SetCableChannelSectionMaskEditProps(meSectionSideDefault.Properties); //meCableChannelSectionDefault.Properties.MaskKind := emkRegExpr; //meCableChannelSectionDefault.Properties.EditMask := GetDimensionsMask; TcxCurrencyEditProperties(GT_PropValNormResKolvo.Properties).DisplayFormat := GetDisplayFormatForFloat; TcxCurrencyEditProperties(GT_PropValNormResKolvo.Properties).DecimalPlaces := FloatPrecision; TcxCurrencyEditProperties(GT_PropValNormResExpenseForLength.Properties).DisplayFormat := GetDisplayFormatForFloat; TcxCurrencyEditProperties(GT_PropValNormResExpenseForLength.Properties).DecimalPlaces := FloatPrecision; TcxCurrencyEditProperties(GT_PropValNormResCountForPoint.Properties).DisplayFormat := GetDisplayFormatForFloat; TcxCurrencyEditProperties(GT_PropValNormResCountForPoint.Properties).DecimalPlaces := FloatPrecision; TcxCurrencyEditProperties(GT_PropValNormResStepOfPoint.Properties).DisplayFormat := GetDisplayFormatForFloat; TcxCurrencyEditProperties(GT_PropValNormResStepOfPoint.Properties).DecimalPlaces := FloatPrecision; mtPropValRel.FieldDefs.Add(fnID, ftInteger); mtPropValRel.FieldDefs.Add(fnGUID, ftString, cnstGUIDLength); mtPropValRel.FieldDefs.Add(fnPValue, ftString, 255); mtPropValRel.FieldDefs.Add(fnMinValue, ftString, 255); mtPropValRel.FieldDefs.Add(fnMaxValue, ftString, 255); mtPropValRel.FieldDefs.Add(fnIsNew, ftBoolean); mtPropValRel.FieldDefs.Add(fnIsModified, ftBoolean); mtPropValRel.Active := true; mtPropValNormRes.FieldDefs.Add(fnID, ftInteger); mtPropValNormRes.FieldDefs.Add(fnGUID, ftString, cnstGUIDLength); mtPropValNormRes.FieldDefs.Add(fnIDPropValRel, ftInteger); mtPropValNormRes.FieldDefs.Add(fnGuidPropValRel, ftString, cnstGUIDLength); mtPropValNormRes.FieldDefs.Add(fnIDNBComponent, ftInteger); mtPropValNormRes.FieldDefs.Add(fnGuidNBComponent, ftString, cnstGUIDLength); mtPropValNormRes.FieldDefs.Add(fnIDNBRes, ftInteger); mtPropValNormRes.FieldDefs.Add(fnGuidNBRes, ftString, cnstGUIDLength); mtPropValNormRes.FieldDefs.Add(fnIDNBNorm, ftInteger); mtPropValNormRes.FieldDefs.Add(fnGuidNBNorm, ftString, cnstGUIDLength); mtPropValNormRes.FieldDefs.Add(fnName, ftString, 255); mtPropValNormRes.FieldDefs.Add(fnKolvo, ftFloat); mtPropValNormRes.FieldDefs.Add(fnExpenseForLength, ftFloat); mtPropValNormRes.FieldDefs.Add(fnCountForPoint, ftFloat); mtPropValNormRes.FieldDefs.Add(fnStepOfPoint, ftFloat); mtPropValNormRes.FieldDefs.Add(fnIsNew, ftBoolean); mtPropValNormRes.FieldDefs.Add(fnIsModified, ftBoolean); mtPropValNormRes.MasterSource := dsrcPropValRel; mtPropValNormRes.MasterFields := fnGUID; mtPropValNormRes.DetailFields := fnGuidPropValRel; FDeletedPropValGUIDs := TStringList.Create; FDeletedPropValNormResGUIDs := TStringList.Create; meStringListDef.MaxLength := cnstPropValMaxLen; FLastTypeItem := TIntList.Create; for i := 0 to dtLast do FLastTypeItem.Add(-1); end; procedure TF_MakeProperty.FormShow(Sender: TObject); begin (* {if TF_Main(GForm).GDBMode = bkNormBase then begin Label_ItemType.Visible := false; ComboBox_ItemType.Visible := false; end;} //*** Обнулить значения Edit_PDefault.Text := ''; DateEdit_PDefault.Text := ''; SpinEdit_PDefault.Value := 0; SpinEdit_PMax.Value := 0; SpinEdit_PMin.Value := 0; DateEdit_PMax.Text := ''; DateEdit_PMin.Text := ''; //FillComboBox(ComboBox_PCompStateType, F_NormBase.DM.DataSet_MT_COMP_STATE_TYPE, false, 'ID', 'Name'); case GFormMode of fmMake: begin Caption := cMinMaxControl_Msg4_1; Edit_PName.Text := ''; Edit_PSysName.Text := ''; Edit_PIzm.Text := ''; CheckBox_PNotNull.Checked := true; SelectItemByIDinCombo(ComboBox_PDataType, dtFloat); //ComboBox_PDataType.ItemIndex := 0; SpinEdit_PMin.Value := null; SpinEdit_PMax.Value := null; GValue := ''; Edit_PDescription.Text := ''; cbIsForWholeComponent.Checked := true; SetIsStateForValue(false); //if TF_Main(GForm).GDBMode = bkProjectManager then //ComboBox_ItemType.ItemIndex := GItemType; //PObjectData(TF_Main(GForm).Tree_Catalog.Selected.Data).ItemType; end; fmEdit: begin Caption := cMinMaxControl_Msg4_2; with TF_Main(GForm).DM do begin Edit_PName.Text := DataSet_PROPERTIES.FN(fnName).AsString; Edit_PSysName.Text := DataSet_PROPERTIES.FN(fnSysName).AsString;; Edit_PIzm.Text := DataSet_PROPERTIES.FN(fnIzm).AsString; if DataSet_PROPERTIES.FN(fnValueReq).AsInteger = 0 then CheckBox_PNotNull.Checked := false else CheckBox_PNotNull.Checked := true; SelectItemByIDinCombo(ComboBox_PDataType, DataSet_PROPERTIES.FN(fnIDDataType).AsInteger); case DataSet_PROPERTIES.FN(fnIDDataType).AsInteger of // DataType dtDate: begin DateEdit_PMin.Date := DataSet_PROPERTIES.FN(fnMinValue).AsFloat; DateEdit_PMax.Date := DataSet_PROPERTIES.FN(fnMaxValue).AsFloat; end; else begin SpinEdit_PMin.Value := RoundCP(DataSet_PROPERTIES.FN(fnMinValue).AsFloat); SpinEdit_PMax.Value := RoundCP(DataSet_PROPERTIES.FN(fnMaxValue).AsFloat); end; end; GValue := DataSet_PROPERTIES.FN(fnDefValue).AsString; Edit_PDescription.Text := DataSet_PROPERTIES.FN(fnDescription).AsString; CheckBox_IsProject.Checked := IntToBool(DataSet_PROPERTIES.FN(fnIsProject).AsInteger); CheckBox_IsFolder.Checked := IntToBool(DataSet_PROPERTIES.FN(fnIsFolder).AsInteger); CheckBox_IsList.Checked := IntToBool(DataSet_PROPERTIES.FN(fnIsList).AsInteger); CheckBox_IsRoom.Checked := IntToBool(DataSet_PROPERTIES.FN(fnIsRoom).AsInteger); CheckBox_IsSCSLine.Checked := IntToBool(DataSet_PROPERTIES.FN(fnIsSCSline).AsInteger); CheckBox_IsSCSConnector.Checked := IntToBool(DataSet_PROPERTIES.FN(fnIsSCSConnector).AsInteger); CheckBox_IsComponLine.Checked := IntToBool(DataSet_PROPERTIES.FN(fnIsComponLine).AsInteger); CheckBox_IsComponConn.Checked := IntToBool(DataSet_PROPERTIES.FN(fnIsComponConn).AsInteger); cbIsForWholeComponent.Checked := IntToBool(DataSet_PROPERTIES.FN(fnIsForWholeComponent).AsInteger); {if TF_Main(GForm).GDBMode = bkProjectManager then begin //DM.SelectProperty; ComboBox_ItemType.ItemIndex := FN('ID_Item_Type').AsInteger; end;} end; end; end; //ComboBox_ItemType.ItemIndex := GItemType; SelectItemByIDinCombo(ComboBox_ItemType, GItemType); ChoiceEdit; *) Edit_PName.SetFocus; end; // ##### Выбор типа ##### procedure TF_MakeProperty.ComboBox_PDataTypePropertiesChange(Sender: TObject); begin GValue := ''; ChoiceEdit; end; procedure TF_MakeProperty.Button_OkClick(Sender: TObject); var _Value: String; DataType: Integer; SysNameCount: Integer; //BookMarkStr: string; BookMarkStr: TBookMark; begin ModalResult := mrOK; try if Edit_PSysName.Text = '' then begin ShowMessageByType(Self.Handle, smtDisplay, Label_SysName.Caption+' '+cMinMaxControl_Msg5, Application.Title, MB_OK or MB_ICONINFORMATION); ModalResult := mrNone; end; //*** Провкрить на существование такого уже имени if ModalResult = mrOK then begin SysNameCount := 0; if FMemTable <> nil then begin //BookMarkStr := FMemTable.Bookmark; BookMarkStr := FMemTable.getBookmark; FMemTable.DisableControls; try FMemTable.First; while Not FMemTable.Eof do begin if FMemTable.FieldByName(fnSysName).AsString = Edit_PSysName.Text then Inc(SysNameCount); FMemTable.Next; end; //FMemTable.Bookmark := BookMarkStr; if BookMarkStr <> nil then begin FMemTable.GotoBookmark(BookMarkStr); FMemTable.FreeBookmark(BookMarkStr); end; finally FMemTable.EnableControls; end; end else if TF_Main(GForm).GDBMode = bkNormBase then begin with TF_Main(GForm).DM do begin // смотрим стандартные свойства с таким именем SetSQLToFIBQuery(Query_Select, 'select count(id) from '+tnProperties+' where ('+fnSysName+' = '''+Edit_PSysName.Text+''') and (ISSTANDART = '''+IntToStr(biTrue)+''')'); SysNameCount := Query_Select.FN(fnCount).AsInteger; if FSysNameBeforeEdit <> '' then if FSysNameBeforeEdit <> Edit_PSysName.Text then SysNameCount := SysNameCount + 1; end; if ((GFormMode = fmMake) and (SysNameCount > 0)) or ((GFormMode = fmEdit) and (SysNameCount > 1)) then begin ShowMessageByType(Self.Handle, smtDisplay, Label_SysName.Caption+' '+Edit_PSysName.Text+' '+cMinMaxControl_Msg6_2, Application.Title, MB_OK or MB_ICONINFORMATION); ModalResult := mrNone; end; end; end; if ModalResult = mrOK then begin if Edit_PName.Text = '' then begin MessageModal(cMinMaxControl_Msg7, '', MB_ICONINFORMATION or MB_OK); ModalResult := mrNone; Edit_PName.SetFocus; Exit; end else ModalResult := mrOK; {DataType := GetIDFromComboBox(ComboBox_PDataType); case DataType of dtFloat : _Value := FloatToStr(SpinEdit_PDefault.Value); dtInteger: _Value := IntToStr(SpinEdit_PDefault.Value); dtBoolean: if CheckBox_PDefault.Checked then _Value := '1' else _Value := '0'; dtString : _Value := Edit_PDefault.Text; dtDate : _Value := DateToStr(DateEdit_PDefault.Date); dtCompStateType: _Value := IntToStr(GetIDFromComboBox(ComboBox_PCompStateType)); dtColor: _Value := IntToStr(ColorEdit_PDefault.SelectedColor); dtCableCanalElementType: _Value := IntToStr(GetIDFromComboBox(cbCableCanalElemntTypes)); end; } _Value := GetPropValue(false); if Not MinMaxControl(_Value) then begin ModalResult := mrNone; Exit; end else ModalResult := mrOK; {with TF_Main(GForm).DM do begin case GFormMode of fmMake: DataSet_PROPERTIES.Append; fmEdit: DataSet_PROPERTIES.Edit; end; DataSet_PROPERTIES.FN(fnName).AsString := Edit_PName.Text; DataSet_PROPERTIES.FN(fnSysName).AsString := Edit_PSysName.Text; DataSet_PROPERTIES.FN(fnIzm).AsString := Edit_PIzm.Text; DataSet_PROPERTIES.FN(fnValueReq).AsInteger := BoolToInt(CheckBox_PNotNull.Checked); DataSet_PROPERTIES.FN(fnIDDataType).AsInteger := GetIDFromComboBox(ComboBox_PDataType); case DataType of dtDate: begin DataSet_PROPERTIES.FN(fnMinValue).AsFloat := DateEdit_PMin.Date; DataSet_PROPERTIES.FN(fnMaxValue).AsFloat := DateEdit_PMax.Date; end; else begin DataSet_PROPERTIES.FN(fnMinValue).AsFloat := RoundCP(SpinEdit_PMin.Value); DataSet_PROPERTIES.FN(fnMaxValue).AsFloat := RoundCP(SpinEdit_PMax.Value); end; end; DataSet_PROPERTIES.FN(fnDefValue).AsString := _Value; DataSet_PROPERTIES.FN(fnDescription).AsString := Edit_PDescription.Text; //if TF_Main(GForm).GDBMode = bkProjectManager then DataSet_PROPERTIES.FN(fnIDItemType).AsInteger := GetIDFromComboBox(ComboBox_ItemType); DataSet_PROPERTIES.FN(fnIsProject).AsInteger := BoolToInt(CheckBox_IsProject.Checked); DataSet_PROPERTIES.FN(fnIsFolder).AsInteger := BoolToInt(CheckBox_IsFolder.Checked); DataSet_PROPERTIES.FN(fnIsList).AsInteger := BoolToInt(CheckBox_IsList.Checked); DataSet_PROPERTIES.FN(fnIsRoom).AsInteger := BoolToInt(CheckBox_IsRoom.Checked); DataSet_PROPERTIES.FN(fnIsSCSline).AsInteger := BoolToInt(CheckBox_IsSCSLine.Checked); DataSet_PROPERTIES.FN(fnIsSCSConnector).AsInteger := BoolToInt(CheckBox_IsSCSConnector.Checked); DataSet_PROPERTIES.FN(fnIsComponLine).AsInteger := BoolToInt(CheckBox_IsComponLine.Checked); DataSet_PROPERTIES.FN(fnIsComponConn).AsInteger := BoolToInt(CheckBox_IsComponConn.Checked); DataSet_PROPERTIES.FN(fnIsForWholeComponent).AsInteger := BoolToInt(cbIsForWholeComponent.Checked); DataSet_PROPERTIES.Post; GID := DataSet_PROPERTIES.FN(fnID).AsInteger; end;} end; except else //if DateEdit_PDefault.Date = null then MessageModal(cMinMaxControl_Msg8, cMinMaxControl_Msg9, MB_ICONERROR or MB_OK); ModalResult := mrNone; end; end; procedure TF_MakeProperty.ComboBox_PDataTypeKeyPress(Sender: TObject; var Key: Char); begin Key := #0; Beep; end; procedure TF_MakeProperty.FormHide(Sender: TObject); begin // ##### При Следующем вsзове, Отображать эту форму в средине Главной ##### //F_MakeProperty.Position :=poMainFormCenter; end; procedure TF_MakeProperty.ComboBox_ItemTypeKeyPress(Sender: TObject; var Key: Char); begin Key := #0; Beep; end; constructor TF_MakeProperty.Create(AOwner: TComponent; AForm: TForm); begin GForm := AForm; inherited Create(AOwner); end; destructor TF_MakeProperty.Destroy; begin inherited; end; procedure TF_MakeProperty.FormDestroy(Sender: TObject); begin FreeAndNil(FDeletedPropValGUIDs); FreeAndNil(FDeletedPropValNormResGUIDs); ClearComboBox(ComboBox_ItemType); ClearComboBox(ComboBox_PCompStateType); FreeAndNil(FLastTypeItem); end; procedure TF_MakeProperty.Button_IsStateForAllClick(Sender: TObject); begin SetIsStateForValue(true); end; procedure TF_MakeProperty.Button_IsStateForNoneClick(Sender: TObject); begin SetIsStateForValue(false); end; procedure TF_MakeProperty.CheckBox_IsComponLineClick(Sender: TObject); begin cbIsForWholeComponent.Visible := CheckBox_IsComponLine.Checked; end; procedure TF_MakeProperty.cxButton1Click(Sender: TObject); begin //meSectionSideDefault.Properties.EditMask := cxTextEdit1.Text; end; procedure TF_MakeProperty.btSendSectionSideToBaseClick(Sender: TObject); begin TF_Main(GForm).FNormBase.DM.SendTextToInputStringsWithAddToTStrings(cbSectionSideDefault.Text, stDimensions, true, cbSectionSideDefault.Properties.Items); end; procedure TF_MakeProperty.RzGroupBox2Resize(Sender: TObject); begin SetMiddleControlChilds(TControl(Sender), TControl(Self)); end; procedure TF_MakeProperty.cbItemListPropertiesChange(Sender: TObject); var DataType: Integer; begin DataType := GetIDFromComboBox(ComboBox_PDataType); if DataType = dtConnectionKind then FLastTubeConnectcKind := GetIDFromComboBox(cbItemList) else if DataType = dtBasementType then FLastBasementType := GetIDFromComboBox(cbItemList); FLastTypeItem[DataType] := GetIDFromComboBox(cbItemList); end; procedure TF_MakeProperty.erSpinItemMinMaxPropertiesValidate( Sender: TObject; var DisplayValue: Variant; var ErrorText: TCaption; var Error: Boolean); var CurrFieldName: String; NearFieldName: String; NearFieldValue: String; NearFieldValueFloat: Double; DisplayValueFloat: Double; begin { NearFieldName := ''; CurrFieldName := TcxGridDBColumn(TcxGridTableView(TcxGridSite(TcxSpinEdit(Sender).parent).GridView).Controller.FocusedColumn).DataBinding.FieldName; if CurrFieldName = fnMinValue then NearFieldName := fnMaxValue else if CurrFieldName = fnMaxValue then NearFieldName := fnMinValue; if NearFieldName <> '' then begin NearFieldValue := mtPropValRel.FieldByName(NearFieldName).AsString; NearFieldValueFloat := 0; DisplayValueFloat := 0; try NearFieldValueFloat := StrToFloat_My(NearFieldValue); except end; try DisplayValueFloat := StrToFloat_My(DisplayValue); except end; if (mtPropValRel.FieldByName(NearFieldName).AsString = '') or ((NearFieldValueFloat < DisplayValueFloat) and (CurrFieldName = fnMinValue)) or ((NearFieldValueFloat > DisplayValueFloat) and (CurrFieldName = fnMaxValue)) then begin mtPropValRel.Edit; mtPropValRel.FieldByName(CurrFieldName).AsString := DisplayValue; mtPropValRel.FieldByName(NearFieldName).AsString := DisplayValue; mtPropValRel.Post; end; if mtPropValRel.FieldByName(fnPValue).AsString <> '0' then begin mtPropValRel.Edit; mtPropValRel.FieldByName(fnPValue).AsString := '0'; mtPropValRel.Post; end; end else if CurrFieldName = fnPValue then begin mtPropValRel.Edit; mtPropValRel.FieldByName(CurrFieldName).AsString := DisplayValue; mtPropValRel.FieldByName(fnMaxValue).AsString := ''; mtPropValRel.FieldByName(fnMinValue).AsString := ''; mtPropValRel.Post; end; } end; procedure TF_MakeProperty.GT_PropValRelEditValueChanged( Sender: TcxCustomGridTableView; AItem: TcxCustomGridTableItem); begin FEditedTableView := Sender; FEditedItem := AItem; GT_PropValRel.OnEditValueChanged := nil; Timer_EditValueChanged.Enabled := true; end; procedure TF_MakeProperty.Timer_EditValueChangedTimer(Sender: TObject); var DataType: integer; CurrFieldName: String; CurrFieldValue: String; CurrFieldValueFloat: Double; NearFieldName: String; NearFieldValue: String; NearFieldValueFloat: Double; Value: Variant; EmptyValue: String; begin TTimer(Sender).Enabled := false; //if mtPropValRel.State <> dsBrowse then // Exit; ///// EXIT ///// try DataType := GetIDFromComboBox(ComboBox_PDataType); EmptyValue := '0'; if DataType = dtDate then EmptyValue := ''; if FEditedTableView = GT_PropValRel then begin if FEditedTableView.DataController.IsEditing and (mtPropValRel.State <> dsBrowse) then begin FEditedTableView.DataController.Post; Application.ProcessMessages; end; NearFieldName := ''; //CurrFieldName := TcxGridDBColumn(TcxGridTableView(TcxGridSite(TcxSpinEdit(Sender).parent).GridView).Controller.FocusedColumn).DataBinding.FieldName; CurrFieldName := TcxGridDBColumn(FEditedItem).DataBinding.FieldName; if CurrFieldName = fnMinValue then NearFieldName := fnMaxValue else if CurrFieldName = fnMaxValue then NearFieldName := fnMinValue; if NearFieldName <> '' then begin CurrFieldValue := mtPropValRel.FieldByName(CurrFieldName).AsString; CurrFieldValueFloat := 0; NearFieldValue := mtPropValRel.FieldByName(NearFieldName).AsString; NearFieldValueFloat := 0; try if NearFieldValue <> '' then begin if DataType = dtDate then NearFieldValueFloat := StrToDateTime(NearFieldValue) else NearFieldValueFloat := StrToFloat_My(NearFieldValue); end; except end; try if CurrFieldValue <> '' then begin if DataType = dtDate then CurrFieldValueFloat := StrToDateTime(CurrFieldValue) else CurrFieldValueFloat := StrToFloat_My(CurrFieldValue); end; except end; if (mtPropValRel.FieldByName(NearFieldName).AsString = '') or ((NearFieldValueFloat < CurrFieldValueFloat) and (CurrFieldName = fnMinValue)) or ((NearFieldValueFloat > CurrFieldValueFloat) and (CurrFieldName = fnMaxValue)) then begin mtPropValRel.Edit; //mtPropValRel.FieldByName(CurrFieldName).AsString := CurrFieldValue; mtPropValRel.FieldByName(NearFieldName).AsString := CurrFieldValue; mtPropValRel.Post; end; if mtPropValRel.FieldByName(fnPValue).AsString <> '0' then begin mtPropValRel.Edit; mtPropValRel.FieldByName(fnPValue).Value := null; //.AsString := '';//'0'; mtPropValRel.Post; end; end else if CurrFieldName = fnPValue then begin mtPropValRel.Edit; //mtPropValRel.FieldByName(CurrFieldName).AsString := CurrFieldValue; mtPropValRel.FieldByName(fnMaxValue).Value := null; //.AsString := '';//'0'; mtPropValRel.FieldByName(fnMinValue).Value := null; //.AsString := '';//'0'; mtPropValRel.Post; end; end; finally GT_PropValRel.OnEditValueChanged := GT_PropValRelEditValueChanged; end; end; procedure TF_MakeProperty.mtPropValRelBeforePost(DataSet: TDataSet); var DataType: integer; CurrFieldName: String; CurrFieldValue: String; CurrFieldValueFloat: Double; NearFieldName: String; NearFieldValue: String; NearFieldValueFloat: Double; Value: Variant; begin //if mtPropValRel.State <> dsBrowse then // Exit; ///// EXIT ///// Exit; ///// EXIT ///// try DataType := GetIDFromComboBox(ComboBox_PDataType); if FEditedTableView = GT_PropValRel then begin NearFieldName := ''; //CurrFieldName := TcxGridDBColumn(TcxGridTableView(TcxGridSite(TcxSpinEdit(Sender).parent).GridView).Controller.FocusedColumn).DataBinding.FieldName; CurrFieldName := TcxGridDBColumn(FEditedItem).DataBinding.FieldName; if CurrFieldName = fnMinValue then NearFieldName := fnMaxValue else if CurrFieldName = fnMaxValue then NearFieldName := fnMinValue; if NearFieldName <> '' then begin CurrFieldValue := mtPropValRel.FieldByName(CurrFieldName).AsString; CurrFieldValueFloat := 0; NearFieldValue := mtPropValRel.FieldByName(NearFieldName).AsString; NearFieldValueFloat := 0; try if NearFieldValue <> '' then begin if DataType = dtDate then NearFieldValueFloat := StrToDateTime(NearFieldValue) else NearFieldValueFloat := StrToFloat_My(NearFieldValue); end; except end; try if CurrFieldValue <> '' then begin if DataType = dtDate then CurrFieldValueFloat := StrToDateTime(CurrFieldValue) else CurrFieldValueFloat := StrToFloat_My(CurrFieldValue); end; except end; if (mtPropValRel.FieldByName(NearFieldName).AsString = '') or ((NearFieldValueFloat < CurrFieldValueFloat) and (CurrFieldName = fnMinValue)) or ((NearFieldValueFloat > CurrFieldValueFloat) and (CurrFieldName = fnMaxValue)) then begin //mtPropValRel.Edit; //mtPropValRel.FieldByName(CurrFieldName).AsString := CurrFieldValue; mtPropValRel.FieldByName(NearFieldName).AsString := CurrFieldValue; //mtPropValRel.Post; end; if mtPropValRel.FieldByName(fnPValue).AsString <> '0' then begin //mtPropValRel.Edit; mtPropValRel.FieldByName(fnPValue).AsString := '0'; //mtPropValRel.Post; end; end else if CurrFieldName = fnPValue then begin //mtPropValRel.Edit; //mtPropValRel.FieldByName(CurrFieldName).AsString := CurrFieldValue; mtPropValRel.FieldByName(fnMaxValue).AsString := '0'; mtPropValRel.FieldByName(fnMinValue).AsString := '0'; //mtPropValRel.Post; end; end; finally GT_PropValRel.OnEditValueChanged := GT_PropValRelEditValueChanged; end; end; procedure TF_MakeProperty.Act_AddValueExecute(Sender: TObject); begin SetFocusToControl(gridPropValRel); mtPropValRel.Append; mtPropValRel.FieldByName(fnGuid).AsString := CreateGUID; mtPropValRel.FieldByName(fnIsNew).AsBoolean := true; mtPropValRel.Post; EnableDisableControls; end; procedure TF_MakeProperty.Act_DeleteValueExecute(Sender: TObject); begin SetFocusToControl(gridPropValRel); if MessageModal(cMakeProperty1, ApplicationName, MB_ICONQUESTION or MB_YESNO) = IDYES then begin if Not mtPropValRel.FieldByName(fnIsNew).AsBoolean then FDeletedPropValGUIDs.Add(mtPropValRel.FieldByName(fnGUID).AsString); mtPropValRel.Delete; EnableDisableControls; end; end; procedure TF_MakeProperty.Act_AddPropValAccessoryExecute(Sender: TObject); begin SetFocusToControl(gridPropValNormRes); AddEditResource(meMake, true, false, false); end; procedure TF_MakeProperty.Act_EditPropValNormResExecute(Sender: TObject); begin SetFocusToControl(gridPropValNormRes); AddEditResource(meEdit, false, false, false); end; procedure TF_MakeProperty.Act_DelPropValNormResExecute(Sender: TObject); var StrMessg: String; begin SetFocusToControl(gridPropValNormRes); StrMessg := ''; if mtPropValNormRes.FieldByName(fnGuidNBComponent).AsString <> '' then StrMessg := cQuastDelAccessoryCompon else if mtPropValNormRes.FieldByName(fnGuidNBRes).AsString <> '' then StrMessg := cQuastDelResource else if mtPropValNormRes.FieldByName(fnGuidNBNorm).AsString <> '' then StrMessg := cQuastDelNorm; StrMessg := StrMessg + ' "'+mtPropValNormRes.FieldByName(fnName).AsString+'"?'; if MessageModal(StrMessg, ApplicationName, MB_ICONQUESTION or MB_YESNO) = IDYES then begin if Not mtPropValNormRes.FieldByName(fnIsNew).AsBoolean then FDeletedPropValNormResGUIDs.Add(mtPropValNormRes.FieldByName(fnGuid).AsString); mtPropValNormRes.Delete; EnableDisableControls; end; end; procedure TF_MakeProperty.GT_PropValNormResKolvoPropertiesValidate( Sender: TObject; var DisplayValue: Variant; var ErrorText: TCaption; var Error: Boolean); var SavedEvent: TcxEditValidateEvent; begin Error := false; if DisplayValue = '' then begin DisplayValue := mtPropValNormRes.FieldByName(fnKolvo).AsFloat; Exit; ///// EXIT ///// end; SavedEvent := TcxCurrencyEdit(Sender).Properties.OnValidate; TcxCurrencyEdit(Sender).Properties.OnValidate := nil; try mtPropValNormRes.Edit; mtPropValNormRes.FieldByName(fnKolvo).AsFloat := DisplayValue; mtPropValNormRes.FieldByName(fnExpenseForLength).AsFloat := 0; mtPropValNormRes.FieldByName(fnCountForPoint).AsFloat := 0; mtPropValNormRes.FieldByName(fnStepOfPoint).AsFloat := 0; mtPropValNormRes.Post; finally TcxCurrencyEdit(Sender).Properties.OnValidate := SavedEvent; end; end; procedure TF_MakeProperty.GT_PropValNormResExpenseForLengthPropertiesValidate( Sender: TObject; var DisplayValue: Variant; var ErrorText: TCaption; var Error: Boolean); var SavedEvent: TcxEditValidateEvent; ValueFloat: Double; begin try // Преобразуем расход из FUOM на метр if DisplayValue = '' then begin DisplayValue := FloatToStr(mtPropValNormRes.FieldByName(fnExpenseForLength).AsFloat); Exit; ///// EXIT ///// end; ValueFloat := StrToFloat_My(DisplayValue); ValueFloat := FloatInUOM(ValueFloat, umMetr, FUOM); SavedEvent := TcxCurrencyEdit(Sender).Properties.OnValidate; TcxCurrencyEdit(Sender).Properties.OnValidate := nil; try mtPropValNormRes.Edit; mtPropValNormRes.FieldByName(fnExpenseForLength).AsFloat := RoundCP(ValueFloat); mtPropValNormRes.FieldByName(fnKolvo).AsFloat := 0; mtPropValNormRes.FieldByName(fnCountForPoint).AsFloat := 0; mtPropValNormRes.FieldByName(fnStepOfPoint).AsFloat := 0; mtPropValNormRes.Post; finally TcxCurrencyEdit(Sender).Properties.OnValidate := SavedEvent; end; except end; end; procedure TF_MakeProperty.GT_PropValNormResCountForPointPropertiesValidate( Sender: TObject; var DisplayValue: Variant; var ErrorText: TCaption; var Error: Boolean); var SavedEvent: TcxEditValidateEvent; ValueFloat: Double; begin try if DisplayValue = '' then begin DisplayValue := FloatToStr(mtPropValNormRes.FieldByName(fnCountForPoint).AsFloat); Exit; ///// EXIT ///// end; ValueFloat := StrToFloat_My(DisplayValue); SavedEvent := TcxCurrencyEdit(Sender).Properties.OnValidate; TcxCurrencyEdit(Sender).Properties.OnValidate := nil; try InputFloatToRelatedZeroFieldInMT(mtPropValNormRes, ValueFloat, fnCountForPoint, fnStepOfPoint, fnKolvo+';'+fnExpenseForLength, cAddComponent_Msg20_1, true, FUOM); finally TcxCurrencyEdit(Sender).Properties.OnValidate := SavedEvent; end; except end; end; procedure TF_MakeProperty.GT_PropValNormResStepOfPointPropertiesValidate( Sender: TObject; var DisplayValue: Variant; var ErrorText: TCaption; var Error: Boolean); var SavedEvent: TcxEditValidateEvent; ValueFloat: Double; begin try // Преобразуем расход из TF_Main(GForm).FUOM на метр if DisplayValue = '' then begin DisplayValue := FloatToStr(mtPropValNormRes.FieldByName(fnStepOfPoint).AsFloat); Exit; ///// EXIT ///// end; ValueFloat := StrToFloat_My(DisplayValue); ValueFloat := FloatInUOM(ValueFloat, FUOM, umMetr); SavedEvent := TcxCurrencyEdit(Sender).Properties.OnValidate; TcxCurrencyEdit(Sender).Properties.OnValidate := nil; try InputFloatToRelatedZeroFieldInMT(mtPropValNormRes, ValueFloat, fnStepOfPoint, fnCountForPoint, fnKolvo+';'+fnExpenseForLength, cAddComponent_Msg20_2, false, FUOM); finally TcxCurrencyEdit(Sender).Properties.OnValidate := SavedEvent; end; except end; end; procedure TF_MakeProperty.GT_PropValNormResExpenseForLengthGetDisplayText( Sender: TcxCustomGridTableItem; ARecord: TcxCustomGridRecord; var AText: String); begin AText := GetDisplayTextToNORMExpenseForLength(AText, FUOM); end; procedure TF_MakeProperty.GT_PropValNormResStepOfPointGetDisplayText( Sender: TcxCustomGridTableItem; ARecord: TcxCustomGridRecord; var AText: String); begin AText := GetDisplayTextInFLoatUOM(AText, FUOM); end; procedure TF_MakeProperty.GT_PropValNormResInitEdit( Sender: TcxCustomGridTableView; AItem: TcxCustomGridTableItem; AEdit: TcxCustomEdit); begin if AItem = GT_PropValNormResExpenseForLength then AEdit.EditValue := GetDisplayTextToNORMExpenseForLength(AEdit.EditValue, FUOM) else if AItem = GT_PropValNormResStepOfPoint then AEdit.EditValue := GetDisplayTextInFLoatUOM(AEdit.EditValue, FUOM); end; procedure TF_MakeProperty.GT_PropValRelEditing( Sender: TcxCustomGridTableView; AItem: TcxCustomGridTableItem; var AAllow: Boolean); begin mtPropValRel.Edit; mtPropValRel.FieldByName(fnIsModified).AsBoolean := true; mtPropValRel.Post; end; procedure TF_MakeProperty.GT_PropValNormResEditing( Sender: TcxCustomGridTableView; AItem: TcxCustomGridTableItem; var AAllow: Boolean); begin mtPropValNormRes.Edit; mtPropValNormRes.FieldByName(fnIsModified).AsBoolean := true; mtPropValNormRes.Post; end; procedure TF_MakeProperty.GT_PropValRelFocusedRecordChanged( Sender: TcxCustomGridTableView; APrevFocusedRecord, AFocusedRecord: TcxCustomGridRecord; ANewItemRecordFocusingChanged: Boolean); begin EnableDisableControls; end; procedure TF_MakeProperty.cbIsValueRelToObjClick(Sender: TObject); begin pnValueObjects.Visible := cbIsValueRelToObj.Checked; pnMain.AutoSize := true; pnMain.AutoSize := false; Self.AutoSize := true; Self.AutoSize := false; end; end.