Skip to content

Commit 7dfc510

Browse files
committed
jsonV tweaks
1 parent efecba6 commit 7dfc510

File tree

5 files changed

+33
-5
lines changed

5 files changed

+33
-5
lines changed

LICENSE

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
The MIT License (MIT)
22

3-
Copyright (c) 2015-2019 Stijn Sanders
3+
Copyright (c) 2015-2024 Stijn Sanders
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

jsonV.dof

+3-3
Original file line numberDiff line numberDiff line change
@@ -110,8 +110,8 @@ IncludeVerInfo=1
110110
AutoIncBuild=0
111111
MajorVer=1
112112
MinorVer=2
113-
Release=2
114-
Build=654
113+
Release=4
114+
Build=688
115115
Debug=0
116116
PreRelease=0
117117
Special=0
@@ -122,7 +122,7 @@ CodePage=1252
122122
[Version Info Keys]
123123
CompanyName=
124124
FileDescription=jsonV
125-
FileVersion=1.2.2.654
125+
FileVersion=1.2.4.688
126126
InternalName=
127127
LegalCopyright=
128128
LegalTrademarks=

jsonV.res

0 Bytes
Binary file not shown.

jsonV1.dfm

+7
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,13 @@ object frmJsonViewer: TfrmJsonViewer
4646
Height = 16
4747
Caption = '&Find:'
4848
end
49+
object lblSearchResult: TLabel
50+
Left = 352
51+
Top = 8
52+
Width = 12
53+
Height = 16
54+
Caption = '...'
55+
end
4956
object txtFind: TEdit
5057
Left = 40
5158
Top = 4

jsonV1.pas

+22-1
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ TfrmJsonViewer = class(TForm)
2121
actSearchPrev: TAction;
2222
actSearchNext: TAction;
2323
actSortChildren: TAction;
24+
lblSearchResult: TLabel;
2425
procedure TreeView1CreateNodeClass(Sender: TCustomTreeView;
2526
var NodeClass: TTreeNodeClass);
2627
procedure TreeView1Expanding(Sender: TObject; Node: TTreeNode;
@@ -46,6 +47,7 @@ TfrmJsonViewer = class(TForm)
4647
procedure SearchNode(Sender: TObject; Down: boolean);
4748
protected
4849
procedure DoShow; override;
50+
procedure CreateParams(var Params: TCreateParams); override;
4951
end;
5052

5153
TJSONNode=class(TTreeNode)
@@ -94,6 +96,7 @@ procedure TfrmJsonViewer.DoShow;
9496
FFileMulti:=false;
9597

9698
Application.OnActivate:=AppActivate;
99+
ShowWindow(Application.Handle,SW_HIDE);
97100

98101
TreeView1.Items.BeginUpdate;
99102
try
@@ -409,6 +412,12 @@ procedure TfrmJsonViewer.AppActivate(Sender: TObject);
409412
end;
410413
end;
411414

415+
procedure TfrmJsonViewer.CreateParams(var Params: TCreateParams);
416+
begin
417+
inherited;
418+
Params.WndParent:=GetDesktopWindow;
419+
end;
420+
412421
{ TJSONNode }
413422

414423
procedure TJSONNode.AfterConstruction;
@@ -644,6 +653,7 @@ procedure TfrmJsonViewer.SearchNode(Sender:TObject;Down:boolean);
644653
n,n1:TTreeNode;
645654
f:string;
646655
b:boolean;
656+
c:integer;
647657

648658
procedure MoveOne;
649659
begin
@@ -676,12 +686,14 @@ procedure TfrmJsonViewer.SearchNode(Sender:TObject;Down:boolean);
676686
end;
677687
end;
678688
end;
689+
inc(c);
679690
end;
680691

681692
begin
682693
Screen.Cursor:=crHourGlass;
683694
TreeView1.Items.BeginUpdate;
684695
try
696+
c:=0;
685697
n1:=TreeView1.Selected;
686698
n:=n1;
687699
MoveOne;
@@ -695,7 +707,16 @@ procedure TfrmJsonViewer.SearchNode(Sender:TObject;Down:boolean);
695707
Screen.Cursor:=crDefault;
696708
TreeView1.Items.EndUpdate;
697709
end;
698-
TreeView1.Selected:=n;
710+
if n=nil then
711+
lblSearchResult.Caption:='none found'
712+
else
713+
begin
714+
if Down then
715+
lblSearchResult.Caption:=IntToStr(c)+' nodes forward'
716+
else
717+
lblSearchResult.Caption:=IntToStr(c)+' nodes backward';
718+
TreeView1.Selected:=n;
719+
end;
699720
TreeView1.SetFocus;
700721
end;
701722

0 commit comments

Comments
 (0)