Стартовый пул
This commit is contained in:
170
ANB ST CP/Demo/JSON/JSONWriter/data/MainForm.lfm
Normal file
170
ANB ST CP/Demo/JSON/JSONWriter/data/MainForm.lfm
Normal file
@@ -0,0 +1,170 @@
|
||||
object MainFrm: TMainFrm
|
||||
Left = 603
|
||||
Height = 297
|
||||
Top = 302
|
||||
Width = 559
|
||||
BorderIcons = [biSystemMenu]
|
||||
BorderStyle = bsSingle
|
||||
Caption = 'JSON Writer'
|
||||
ClientHeight = 297
|
||||
ClientWidth = 559
|
||||
Font.CharSet = RUSSIAN_CHARSET
|
||||
Font.Color = clBlack
|
||||
Font.Height = -15
|
||||
Font.Name = 'Times New Roman'
|
||||
Font.Pitch = fpVariable
|
||||
Font.Quality = fqDraft
|
||||
OnCreate = FormCreate
|
||||
Position = poScreenCenter
|
||||
LCLVersion = '1.6.0.1'
|
||||
object JSONFileNameEd: TFileNameEdit
|
||||
Left = 16
|
||||
Height = 25
|
||||
Top = 32
|
||||
Width = 528
|
||||
Filter = 'JSON File (*.json)|*.json'
|
||||
FilterIndex = 0
|
||||
HideDirectories = False
|
||||
ButtonWidth = 23
|
||||
NumGlyphs = 1
|
||||
Flat = True
|
||||
FocusOnButtonClick = True
|
||||
MaxLength = 0
|
||||
TabOrder = 0
|
||||
end
|
||||
object JSONFileNameEdLbl: TLabel
|
||||
Left = 16
|
||||
Height = 17
|
||||
Top = 8
|
||||
Width = 72
|
||||
Caption = '&Имя файла:'
|
||||
ParentColor = False
|
||||
end
|
||||
object KeyEdt: TLabeledEdit
|
||||
Left = 16
|
||||
Height = 25
|
||||
Top = 88
|
||||
Width = 528
|
||||
EditLabel.AnchorSideLeft.Control = KeyEdt
|
||||
EditLabel.AnchorSideRight.Control = KeyEdt
|
||||
EditLabel.AnchorSideRight.Side = asrBottom
|
||||
EditLabel.AnchorSideBottom.Control = KeyEdt
|
||||
EditLabel.Left = 16
|
||||
EditLabel.Height = 17
|
||||
EditLabel.Top = 68
|
||||
EditLabel.Width = 528
|
||||
EditLabel.Caption = '&Ключ:'
|
||||
EditLabel.ParentColor = False
|
||||
TabOrder = 1
|
||||
end
|
||||
object RecTypeEd: TRadioGroup
|
||||
Left = 16
|
||||
Height = 48
|
||||
Top = 128
|
||||
Width = 528
|
||||
AutoFill = True
|
||||
Caption = '&Тип:'
|
||||
ChildSizing.LeftRightSpacing = 6
|
||||
ChildSizing.EnlargeHorizontal = crsHomogenousChildResize
|
||||
ChildSizing.EnlargeVertical = crsHomogenousChildResize
|
||||
ChildSizing.ShrinkHorizontal = crsScaleChilds
|
||||
ChildSizing.ShrinkVertical = crsScaleChilds
|
||||
ChildSizing.Layout = cclLeftToRightThenTopToBottom
|
||||
ChildSizing.ControlsPerLine = 3
|
||||
ClientHeight = 26
|
||||
ClientWidth = 524
|
||||
Columns = 3
|
||||
ItemIndex = 0
|
||||
Items.Strings = (
|
||||
'Строка'
|
||||
'Число'
|
||||
'Правда/Ложь'
|
||||
)
|
||||
OnSelectionChanged = RecTypeEdSelectionChanged
|
||||
TabOrder = 2
|
||||
end
|
||||
object ValuePages: TPageControl
|
||||
Left = 16
|
||||
Height = 48
|
||||
Top = 200
|
||||
Width = 528
|
||||
ActivePage = StringSht
|
||||
ShowTabs = False
|
||||
TabIndex = 0
|
||||
TabOrder = 3
|
||||
object StringSht: TTabSheet
|
||||
Caption = 'StringSht'
|
||||
ClientHeight = 40
|
||||
ClientWidth = 520
|
||||
object sValueEd: TEdit
|
||||
Left = 8
|
||||
Height = 25
|
||||
Top = 8
|
||||
Width = 504
|
||||
TabOrder = 0
|
||||
end
|
||||
end
|
||||
object IntegerSht: TTabSheet
|
||||
Caption = 'IntegerSht'
|
||||
ClientHeight = 40
|
||||
ClientWidth = 520
|
||||
object iValueEd: TSpinEdit
|
||||
Left = 8
|
||||
Height = 25
|
||||
Top = 8
|
||||
Width = 498
|
||||
Alignment = taRightJustify
|
||||
MaxValue = 2147483647
|
||||
MinValue = -2147483648
|
||||
TabOrder = 0
|
||||
end
|
||||
end
|
||||
object BooleanSht: TTabSheet
|
||||
Caption = 'BooleanSht'
|
||||
ClientHeight = 40
|
||||
ClientWidth = 520
|
||||
object bValueEd: TComboBox
|
||||
Left = 8
|
||||
Height = 25
|
||||
Top = 8
|
||||
Width = 496
|
||||
ItemHeight = 17
|
||||
ItemIndex = 0
|
||||
Items.Strings = (
|
||||
'Правда'
|
||||
'Ложь'
|
||||
)
|
||||
Style = csDropDownList
|
||||
TabOrder = 0
|
||||
Text = 'Правда'
|
||||
end
|
||||
end
|
||||
end
|
||||
object ValueEdLbl: TLabel
|
||||
Left = 16
|
||||
Height = 17
|
||||
Top = 183
|
||||
Width = 115
|
||||
Caption = '&Введите значение:'
|
||||
ParentColor = False
|
||||
end
|
||||
object ExitBtn: TButton
|
||||
Left = 432
|
||||
Height = 25
|
||||
Top = 256
|
||||
Width = 112
|
||||
Caption = 'В&ыход'
|
||||
Default = True
|
||||
OnClick = ExitBtnClick
|
||||
TabOrder = 4
|
||||
end
|
||||
object WriteBtn: TButton
|
||||
Left = 296
|
||||
Height = 25
|
||||
Top = 256
|
||||
Width = 131
|
||||
Caption = '&Записать'
|
||||
OnClick = WriteBtnClick
|
||||
TabOrder = 5
|
||||
end
|
||||
end
|
72
ANB ST CP/Demo/JSON/JSONWriter/data/MainForm.pas
Normal file
72
ANB ST CP/Demo/JSON/JSONWriter/data/MainForm.pas
Normal file
@@ -0,0 +1,72 @@
|
||||
unit MainForm;
|
||||
{$mode delphi}
|
||||
{$codepage UTF8}
|
||||
interface
|
||||
uses Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, StdCtrls, ExtCtrls, EditBtn, ComCtrls, Spin,
|
||||
windows, SimplyJSON;
|
||||
type
|
||||
{ TMainFrm }
|
||||
TMainFrm = class(TForm)
|
||||
WriteBtn: TButton;
|
||||
ExitBtn: TButton;
|
||||
bValueEd: TComboBox;
|
||||
iValueEd: TSpinEdit;
|
||||
sValueEd: TEdit;
|
||||
JSONFileNameEd: TFileNameEdit;
|
||||
JSONFileNameEdLbl: TLabel;
|
||||
KeyEdt: TLabeledEdit;
|
||||
BooleanSht: TTabSheet;
|
||||
ValueEdLbl: TLabel;
|
||||
StringSht: TTabSheet;
|
||||
IntegerSht: TTabSheet;
|
||||
ValuePages: TPageControl;
|
||||
RecTypeEd: TRadioGroup;
|
||||
procedure ExitBtnClick(Sender: TObject);
|
||||
procedure FormCreate(Sender: TObject);
|
||||
procedure RecTypeEdSelectionChanged(Sender: TObject);
|
||||
procedure WriteBtnClick(Sender: TObject);
|
||||
private
|
||||
public
|
||||
end;
|
||||
var
|
||||
MainFrm: TMainFrm;
|
||||
implementation
|
||||
{$R *.lfm}
|
||||
{ TMainFrm }
|
||||
procedure TMainFrm.ExitBtnClick(Sender: TObject);
|
||||
begin
|
||||
Application.Terminate;
|
||||
end;
|
||||
procedure TMainFrm.FormCreate(Sender: TObject);
|
||||
begin
|
||||
RecTypeEd.ItemIndex:= 0;
|
||||
ValuePages.ActivePage:= StringSht;
|
||||
end;
|
||||
procedure TMainFrm.RecTypeEdSelectionChanged(Sender: TObject);
|
||||
begin
|
||||
case RecTypeEd.ItemIndex of
|
||||
0: ValuePages.ActivePage:= StringSht;
|
||||
1: ValuePages.ActivePage:= IntegerSht;
|
||||
2: ValuePages.ActivePage:= BooleanSht;
|
||||
end;
|
||||
end;
|
||||
procedure TMainFrm.WriteBtnClick(Sender: TObject);
|
||||
begin
|
||||
if Trim(JSONFileNameEd.Text) = '' then
|
||||
begin
|
||||
Application.MessageBox(PChar('Поле "Имя файла" не заполнено!'), PChar('Ошибка!'), MB_ICONERROR);
|
||||
Abort;
|
||||
end;
|
||||
if Trim(KeyEdt.Text) = '' then
|
||||
begin
|
||||
Application.MessageBox(PChar('Поле "Ключ" не заполнено!'), PChar('Ошибка!'), MB_ICONERROR);
|
||||
Abort;
|
||||
end;
|
||||
case RecTypeEd.ItemIndex of
|
||||
0: JSWriteString(KeyEdt.Text, sValueEd.Text, JSONFileNameEd.Text);
|
||||
1: JSWriteInteger(KeyEdt.Text, iValueEd.Value, JSONFileNameEd.Text);
|
||||
2: JSWriteBoolean(KeyEdt.Text, (bValueEd.ItemIndex = 0), JSONFileNameEd.Text);
|
||||
end;
|
||||
Application.MessageBox(PChar('Выполнено!'), PChar('Информация'), MB_ICONASTERISK);
|
||||
end;
|
||||
end.
|
Reference in New Issue
Block a user