OSDN Git Service

レイアウト面での修正
authoryamat0jp <yamat0jp@yahoo.co.jp>
Thu, 23 Sep 2021 09:48:23 +0000 (18:48 +0900)
committeryamat0jp <yamat0jp@yahoo.co.jp>
Thu, 23 Sep 2021 09:48:23 +0000 (18:48 +0900)
Unit1.pas
json_checker.dproj

index 2092920..416f2e9 100644 (file)
--- a/Unit1.pas
+++ b/Unit1.pas
@@ -9,6 +9,8 @@ uses
   Vcl.ImgList, JSON, Vcl.Menus, Vcl.StdActns, System.Actions, Vcl.ActnList;
 
 type
+  TIndxChar = (chMul, chPlus, chMin, chEqu);
+
   TForm1 = class(TForm)
     Memo1: TMemo;
     ToolBar1: TToolBar;
@@ -65,8 +67,10 @@ type
     procedure Memo1Change(Sender: TObject);
   private
     { Private \90é\8c¾ }
+    id: TIndxChar;
     procedure loop(item: TTreeNode; JSON: TJSONObject);
     procedure arrloop(item: TTreeNode; arr: TJSONArray);
+    function returnChar(c: TIndxChar): Char;
   public
     { Public \90é\8c¾ }
   end;
@@ -86,7 +90,6 @@ var
   val: TJSONValue;
   i: integer;
 begin
-  item := TreeView1.Items.AddChild(item, '_array');
   for i := 0 to arr.count - 1 do
   begin
     val := arr.Items[i];
@@ -96,7 +99,7 @@ begin
       arrloop(item, val as TJSONArray)
     else
     begin
-      s := arr.Items[i].ToString;
+      s := '_' + arr.Items[i].ToString;
       TreeView1.Items.AddChild(item, s);
     end;
   end;
@@ -113,7 +116,13 @@ var
   pair: TJSONPair;
   s: string;
   val: TJSONValue;
+  c: Char;
 begin
+  c := returnChar(id);
+  if id = High(id) then
+    id := Low(id)
+  else
+    id := Succ(id);
   for i := 0 to JSON.count - 1 do
   begin
     pair := JSON.Pairs[i];
@@ -121,7 +130,7 @@ begin
     begin
       TreeView1.Items.AddChild(item, 'error');
       Showmessage('\93à\95\94\83G\83\89\81[\82É\82æ\82è\92\86\92f\82µ\82Ü\82µ\82½');
-      TabControl1.TabIndex:=2;
+      TabControl1.TabIndex := 2;
       TabControl1Change(nil);
       TabControl1.Show;
       Exit;
@@ -130,18 +139,18 @@ begin
       val := pair.JsonValue;
     if val is TJSONObject then
     begin
-      s := pair.JsonString.ToString + ':';
+      s := c + pair.JsonString.ToString + ':';
       JSON := pair.JsonValue as TJSONObject;
       loop(TreeView1.Items.AddChild(item, s), JSON);
     end
     else if val is TJSONArray then
     begin
-      s := pair.JsonString.ToString + ':';
+      s := c + pair.JsonString.ToString + ':';
       arrloop(TreeView1.Items.AddChild(item, s), pair.JsonValue as TJSONArray);
     end
     else
     begin
-      s := pair.JsonString.ToString + ':' + pair.JsonValue.ToString;
+      s := c + pair.JsonString.ToString + ':' + pair.JsonValue.ToString;
       TreeView1.Items.AddChild(item, s);
     end;
   end;
@@ -156,15 +165,30 @@ begin
   end;
 end;
 
+function TForm1.returnChar(c: TIndxChar): Char;
+begin
+  result := ' ';
+  case c of
+    chMul:
+      result := '*';
+    chPlus:
+      result := '+';
+    chMin:
+      result := '-';
+    chEqu:
+      result := '=';
+  end;
+end;
+
 procedure TForm1.TabControl1Change(Sender: TObject);
 begin
   case TabControl1.TabIndex of
-  0:
-    Memo2.Text := Memo3.Text;
-  1:
-    Memo2.Text := Memo4.Text;
-  2:
-    Memo2.Text:=Memo5.Text;
+    0:
+      Memo2.Text := Memo3.Text;
+    1:
+      Memo2.Text := Memo4.Text;
+    2:
+      Memo2.Text := Memo5.Text;
   end;
 end;
 
@@ -173,6 +197,7 @@ var
   i: integer;
   j: TJSONObject;
 begin
+  id := Low(id);
   TreeView1.Items.Clear;
   if Memo1.Text = '' then
     Memo1.Text := Clipboard.AsText;
index 5b02ad6..0cbb561 100644 (file)
@@ -5,7 +5,7 @@
         <FrameworkType>VCL</FrameworkType>
         <MainSource>json_checker.dpr</MainSource>
         <Base>True</Base>
-        <Config Condition="'$(Config)'==''">Debug</Config>
+        <Config Condition="'$(Config)'==''">Release</Config>
         <Platform Condition="'$(Platform)'==''">Win64</Platform>
         <TargetedPlatforms>3</TargetedPlatforms>
         <AppType>Application</AppType>