1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980 |
- unit BillsPasteSelectFrm;
- interface
- uses
- Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
- Dialogs, ExtCtrls, StdCtrls;
- type
- TBillsPasteSelectForm = class(TForm)
- btnOk: TButton;
- btnCancel: TButton;
- pnlPos: TPanel;
- rbNext: TRadioButton;
- rbPre: TRadioButton;
- rbChild: TRadioButton;
- Label1: TLabel;
- procedure btnOkClick(Sender: TObject);
- private
- FCanBeChild: Boolean;
- function GetPos: Integer;
- procedure SetCanBeChild(const Value: Boolean);
- public
- property Pos: Integer read GetPos;
- property CanBeChild: Boolean read FCanBeChild write SetCanBeChild;
- end;
- function SelectBillsPasteType(var APos: Integer; ACanBeChild: Boolean): Boolean;
- implementation
- uses
- UtilMethods;
- {$R *.dfm}
- function SelectBillsPasteType(var APos: Integer; ACanBeChild: Boolean): Boolean;
- var
- SelectForm: TBillsPasteSelectForm;
- begin
- SelectForm := TBillsPasteSelectForm.Create(nil);
- try
- SelectForm.CanBeChild := ACanBeChild;
- Result := SelectForm.ShowModal = mrOk;
- if Result then
- APos := SelectForm.Pos;
- finally
- SelectForm.Free;
- end;
- end;
- { TBillsPasteSelectForm }
- function TBillsPasteSelectForm.GetPos: Integer;
- begin
- if rbChild.Checked then
- Result := 0
- else if rbNext.Checked then
- Result := 1
- else if rbPre.Checked then
- Result := 2
- else
- Result := -1;
- end;
- procedure TBillsPasteSelectForm.btnOkClick(Sender: TObject);
- begin
- if (Pos = -1) then
- WarningMessage('粘贴层次结构模式下,须选择插入节点的类型!')
- else
- ModalResult := mrOk;
- end;
- procedure TBillsPasteSelectForm.SetCanBeChild(const Value: Boolean);
- begin
- FCanBeChild := Value;
- rbChild.Enabled := FCanBeChild;
- end;
- end.
|