Стартовый пул
This commit is contained in:
104
ANB ST CP/Demo/JSON/JSONReader/data/MainForm.lfm
Normal file
104
ANB ST CP/Demo/JSON/JSONReader/data/MainForm.lfm
Normal file
@@ -0,0 +1,104 @@
|
||||
object MainFrm: TMainFrm
|
||||
Left = 603
|
||||
Height = 221
|
||||
Top = 302
|
||||
Width = 559
|
||||
BorderIcons = [biSystemMenu]
|
||||
BorderStyle = bsSingle
|
||||
Caption = 'JSON Reader'
|
||||
ClientHeight = 221
|
||||
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 = (
|
||||
'Строка'
|
||||
'Число'
|
||||
'Правда/Ложь'
|
||||
)
|
||||
TabOrder = 2
|
||||
end
|
||||
object ExitBtn: TButton
|
||||
Left = 432
|
||||
Height = 25
|
||||
Top = 184
|
||||
Width = 112
|
||||
Caption = 'В&ыход'
|
||||
Default = True
|
||||
OnClick = ExitBtnClick
|
||||
TabOrder = 3
|
||||
end
|
||||
object ReadBtn: TButton
|
||||
Left = 296
|
||||
Height = 25
|
||||
Top = 184
|
||||
Width = 131
|
||||
Caption = '&Прочитать'
|
||||
OnClick = ReadBtnClick
|
||||
TabOrder = 4
|
||||
end
|
||||
end
|
64
ANB ST CP/Demo/JSON/JSONReader/data/MainForm.pas
Normal file
64
ANB ST CP/Demo/JSON/JSONReader/data/MainForm.pas
Normal file
@@ -0,0 +1,64 @@
|
||||
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)
|
||||
ReadBtn: TButton;
|
||||
ExitBtn: TButton;
|
||||
JSONFileNameEd: TFileNameEdit;
|
||||
JSONFileNameEdLbl: TLabel;
|
||||
KeyEdt: TLabeledEdit;
|
||||
RecTypeEd: TRadioGroup;
|
||||
procedure ExitBtnClick(Sender: TObject);
|
||||
procedure FormCreate(Sender: TObject);
|
||||
procedure ReadBtnClick(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;
|
||||
end;
|
||||
procedure TMainFrm.ReadBtnClick(Sender: TObject);
|
||||
var STitle, SMsg: String;
|
||||
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: begin
|
||||
STitle:= 'Строка';
|
||||
SMsg:= JSReadString(KeyEdt.Text, '???', JSONFileNameEd.Text);
|
||||
end;
|
||||
1: begin
|
||||
STitle:= 'Число';
|
||||
SMsg:= IntToStr(JSReadInteger(KeyEdt.Text, 0, JSONFileNameEd.Text));
|
||||
end;
|
||||
2: begin
|
||||
STitle:= 'Правда/Ложь';
|
||||
SMsg:= BoolToStr(JSReadBoolean(KeyEdt.Text, False, JSONFileNameEd.Text), 'Правда', 'Ложь');
|
||||
end;
|
||||
end;
|
||||
Application.MessageBox(PChar(SMsg), PChar(STitle), MB_ICONASTERISK);
|
||||
end;
|
||||
end.
|
Reference in New Issue
Block a user