unit U_InputRadio; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls, U_LNG, siComp, siLngLnk, RzButton, Mask, RzEdit, ExtCtrls, RzPanel, RzRadGrp, EnJpgGr, RxGIF, GIFImg, RzLabel, U_Cad; type TF_InputRadio = class(TForm) lng_Forms: TsiLangLinked; RzPanel1: TRzPanel; pnOkCancel: TRzPanel; btOk: TRzBitBtn; btCancel: TRzBitBtn; rgValues: TRzRadioGroup; Image1: TImage; Image2: TImage; Image3: TImage; RzLabel1: TRzLabel; RzRadioGroup1: TRzRadioGroup; chbExcludeRack: TCheckBox; RzRadioGroup2: TRzRadioGroup; RzLabel2: TRzLabel; RzLabel3: TRzLabel; RzLabel4: TRzLabel; RzLabel5: TRzLabel; Label1: TLabel; Edit1: TEdit; Label2: TLabel; procedure rgValuesChanging(Sender: TObject; NewIndex: Integer; var AllowChange: Boolean); procedure RzLabel1Click(Sender: TObject); procedure FormCloseQuery(Sender: TObject; var CanClose: Boolean); procedure FormClose(Sender: TObject; var Action: TCloseAction); procedure btOkClick(Sender: TObject); procedure FormShow(Sender: TObject); procedure RzRadioGroup1Changing(Sender: TObject; NewIndex: Integer; var AllowChange: Boolean); procedure RzLabel3Click(Sender: TObject); private GForm: TForm; FDefItems: string; FDisableItem1: boolean; public Constructor Create(AOwner: TComponent; AForm: TForm); Destructor Destroy; override; function Execute(const ACaption, APrompt: String): Integer; end; function InputRadio(const ACaption, APrompt: String; aValues: TStrings; ASelIdx: Integer=1; aDisableItem1: boolean = False): Integer; var F_InputRadio: TF_InputRadio; implementation uses U_Common, USCS_Main, U_BaseConstants, U_BaseCommon; {$R *.dfm} procedure TF_InputRadio.btOkClick(Sender: TObject); var i: integer; begin if RzRadioGroup1.ItemIndex = -1 then begin for i := 0 to 5 do begin RzRadioGroup1.BorderColor := clred; Application.ProcessMessages; sleep(100); RzRadioGroup1.BorderColor := clBtnFace; Application.ProcessMessages; sleep(100); end; end else ModalResult := mrOK; end; constructor TF_InputRadio.Create(AOwner: TComponent; AForm: TForm); begin GForm := AForm; inherited Create(AOwner); RzRadioGroup2.Buttons[0].Caption := cInputMsg1; RzRadioGroup2.Buttons[1].Caption := cInputMsg2; end; destructor TF_InputRadio.Destroy; begin inherited; end; function TF_InputRadio.Execute(const ACaption, APrompt: String): Integer; begin Result := -1; Caption := ACaption; rgValues.Caption := APrompt; if ShowModal = mrOk then Result := rgValues.ItemIndex; end; procedure TF_InputRadio.FormClose(Sender: TObject; var Action: TCloseAction); var i: integer; begin end; procedure TF_InputRadio.FormCloseQuery(Sender: TObject; var CanClose: Boolean); var i: integer; begin end; procedure TF_InputRadio.FormShow(Sender: TObject); begin //Tolik 26/01/2022 -- F_InputRadio.rgValues.Buttons[1].Top := 112; F_InputRadio.rgValues.Buttons[2].Top := 160; // btOk.SetFocus; F_InputRadio.RzRadioGroup1.ItemIndex := -1; // Tolik 04/08/2021 -- chbExcludeRack.Checked := True; RzRadioGroup2.Enabled := (rgValues.ItemIndex = 0); Label2.Caption := GetNormalSTRUom; if Assigned(GCadForm) then Edit1.Text := FloatTostr(MetreToUom(GCadForm.FLineHeight)); {$IF DEFINED(SCS_PE)} Edit1.Left := 123; Label2.Left := 177; {$ELSE} Edit1.Left := 153; Label2.Left := 207; {$IFEND} end; function InputRadio(const ACaption, APrompt: String; aValues: TStrings; ASelIdx: Integer=1; aDisableItem1: boolean = False): Integer; begin if F_InputRadio = nil then begin F_InputRadio := TF_InputRadio.Create(Application, nil); F_InputRadio.FDefItems := F_InputRadio.rgValues.Items.Text; end; F_InputRadio.RzLabel2.Visible := aDisableItem1; F_InputRadio.RzLabel1.Visible := aDisableItem1; //Tolik 04/08/2021 -- F_InputRadio.RzLabel3.Visible := aDisableItem1; F_InputRadio.RzLabel4.Visible := aDisableItem1; F_InputRadio.RzLabel5.Visible := aDisableItem1; {$IF Defined(SCS_PE)} F_InputRadio.RzLabel3.Left := 47; F_InputRadio.RzLabel4.Left := 103; {$ELSE} F_InputRadio.RzLabel3.Left := 81; F_InputRadio.RzLabel4.Left := 149; {$IFEND} F_InputRadio.RzRadioGroup2.Visible := not F_InputRadio.RzLabel1.Visible; F_InputRadio.RzRadioGroup1.ItemIndex := -1; // Tolik 04/08/2021 -- F_InputRadio.rgValues.OnChanging := nil; F_InputRadio.FDisableItem1 := aDisableItem1; if aValues <> nil then begin F_InputRadio.rgValues.Items.Clear; F_InputRadio.rgValues.Items.AddStrings(aValues); end else begin F_InputRadio.rgValues.Items.Clear; F_InputRadio.rgValues.Items.Text := F_InputRadio.FDefItems; end; F_InputRadio.rgValues.ItemIndex := ASelIdx; if F_InputRadio.FDisableItem1 then begin if ASelIdx = 0 then F_InputRadio.rgValues.ItemIndex := 1; end; F_InputRadio.rgValues.OnChanging := F_InputRadio.rgValuesChanging; //Tolik 26/01/2022 -- F_InputRadio.rgValues.Buttons[1].Top := 112; F_InputRadio.rgValues.Buttons[2].Top := 160; // Result := F_InputRadio.Execute(ACaption, APrompt); end; procedure TF_InputRadio.rgValuesChanging(Sender: TObject; NewIndex: Integer; var AllowChange: Boolean); begin AllowChange := True; if FDisableItem1 then if NewIndex = 0 then AllowChange := False; RzRadioGroup2.Enabled := (NewIndex = 0); end; procedure TF_InputRadio.RzLabel1Click(Sender: TObject); var i: integer; begin //GCadForm.cbManualCableTracingMode.Down := False; { GNoTraceCable := True; F_InputRadio.ModalResult := mrCancel; FSCS_Main.tbToolOrtholineExpert.Click; } //FSCS_Main.aToolOrthoLineExecute(Sender); end; procedure TF_InputRadio.RzLabel3Click(Sender: TObject); begin GNoTraceCable := True; F_InputRadio.ModalResult := mrCancel; FSCS_Main.tbToolOrtholineExpert.Click; //ShowHintRzR(CRouteMode_Mess, 7000); end; procedure TF_InputRadio.RzRadioGroup1Changing(Sender: TObject; NewIndex: Integer; var AllowChange: Boolean); begin AllowChange := True; if NewIndex = 1 then chbExcludeRack.Enabled := True else chbExcludeRack.Enabled := False; end; end.