unit U_UpdateNormBaseDialog; interface uses Windows, U_LNG, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, U_BaseCommon, U_BaseConstants, RzButton, RzPanel, StdCtrls, RzRadGrp, ExtCtrls, RzRadChk, Mask, RzEdit, siComp, siLngLnk; type TF_UpdateNormBaseDialog = class(TForm) RzPanel1: TRzPanel; RzPanel2: TRzPanel; lbText: TLabel; gbOkCancel: TRzGroupBox; btOk: TRzBitBtn; btCancel: TRzBitBtn; pnNewName: TRzPanel; Label1: TLabel; edNewName: TRzEdit; rgActions: TRzRadioGroup; lng_Forms: TsiLangLinked; procedure rgActionsClick(Sender: TObject); procedure edNewNameChange(Sender: TObject); private GForm: TForm; procedure SetControls; public NewName: String; constructor Create(AOwner: TComponent; AForm: TForm); destructor Destroy; override; function Execute(ADBType: Integer; AElementName: String): TUpdateNodeResult; end; //var // F_UpdateNormBaseDialog: TF_UpdateNormBaseDialog; implementation Uses U_Main; {$R *.dfm} { TF_UpdateNormBaseDialog } constructor TF_UpdateNormBaseDialog.Create(AOwner: TComponent; AForm: TForm); begin GForm := AForm; inherited Create(AOwner); end; destructor TF_UpdateNormBaseDialog.Destroy; begin inherited; end; function TF_UpdateNormBaseDialog.Execute(ADBType: Integer; AElementName: String): TUpdateNodeResult; var ObjectName: String; begin Result := unrCancel; Caption := ''; ObjectName := ''; case ADBType of dbtCatalog: begin Caption := cUpdateNormBaseDialog_Msg1; ObjectName := cUpdateNormBaseDialog_Msg2; end; dbtComponent: begin Caption := cUpdateNormBaseDialog_Msg3; ObjectName := cUpdateNormBaseDialog_Msg4; end; end; lbText.Caption := ObjectName+' "'+AElementName+'" '+cUpdateNormBaseDialog_Msg5_1+#13+#10+cUpdateNormBaseDialog_Msg5_6+' :'; rgActions.ItemIndex := -1; SetControls; NewName := ''; if ShowModal = mrOk then begin case rgActions.ItemIndex of 0: Result := unrUpdate; 1: Result := unrGoToExistsObject; end; {case rgActions.ItemIndex of 0: begin Result := unrNew; NewName := edNewName.Text; end; 1: Result := unrUpdate; 2: Result := unrGoToExistsObject; end;} end; end; procedure TF_UpdateNormBaseDialog.SetControls; begin btOk.Enabled := (rgActions.ItemIndex >= 0); //pnNewName.Visible := (rgActions.ItemIndex = 0); //btOk.Enabled := (rgActions.ItemIndex > 0) or ((rgActions.ItemIndex = 0) and (edNewName.Text <> '')); end; procedure TF_UpdateNormBaseDialog.rgActionsClick(Sender: TObject); begin SetControls; //if rgActions.ItemIndex = 0 then //edNewName.SetFocus; end; procedure TF_UpdateNormBaseDialog.edNewNameChange(Sender: TObject); begin SetControls; end; end.