OSDN Git Service

TEditor、TTaskTrayの配布先変更に追従
[winbottle/winbottle.git] / bottleclient / SpecialCharEditor.pas
1 unit SpecialCharEditor;
2
3 interface
4
5 uses
6   Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
7   Dialogs, Spin, StdCtrls;
8
9 type
10   TfrmSpecialCharEditor = class(TForm)
11     btnOk: TButton;
12     btnCancel: TButton;
13     lblChar: TLabel;
14     edtChar: TEdit;
15     lblCost: TLabel;
16     spnCost: TSpinEdit;
17     procedure btnOkClick(Sender: TObject);
18     procedure btnCancelClick(Sender: TObject);
19   private
20     FCost: integer;
21     FSpecialChar: String;
22     procedure SetCost(const Value: integer);
23     procedure SetSpecialChar(const Value: String);
24     { Private \90é\8c¾ }
25   public
26     property SpecialChar: String read FSpecialChar write SetSpecialChar;
27     property Cost: integer read FCost write SetCost;
28     function Execute: boolean;
29   end;
30
31 var
32   frmSpecialCharEditor: TfrmSpecialCharEditor;
33
34 implementation
35
36 {$R *.dfm}
37
38 { TForm1 }
39
40 function TfrmSpecialCharEditor.Execute: boolean;
41 begin
42   spnCost.Value := Cost;
43   edtChar.Text := SpecialChar;
44   Result := ShowModal = mrOk;
45 end;
46
47 procedure TfrmSpecialCharEditor.SetCost(const Value: integer);
48 begin
49   FCost := Value;
50 end;
51
52 procedure TfrmSpecialCharEditor.SetSpecialChar(const Value: String);
53 begin
54   FSpecialChar := Value;
55 end;
56
57 procedure TfrmSpecialCharEditor.btnOkClick(Sender: TObject);
58 var
59   OK: boolean;
60 begin
61   OK := false;
62   if (Length(edtChar.Text) = 1) and not (edtChar.Text[1] in LeadBytes) then
63     OK := true;
64   if (Length(edtChar.Text) = 2) and (edtChar.Text[1] in LeadBytes) then
65     OK := true;
66   SpecialChar := edtChar.Text;
67   Cost := spnCost.Value;
68   if OK then
69     ModalResult := mrOk;
70 end;
71
72 procedure TfrmSpecialCharEditor.btnCancelClick(Sender: TObject);
73 begin
74   ModalResult := mrCancel;
75 end;
76
77 end.