Skip to content

Commit

Permalink
fix: Correct way to clean value panel
Browse files Browse the repository at this point in the history
  • Loading branch information
gcarreno committed Mar 18, 2021
1 parent 2e0ef68 commit c434702
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 16 deletions.
4 changes: 2 additions & 2 deletions src/application/ljv.application.version.pas
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,11 @@
interface

const
cVersion = '0.1.9.36';
cVersion = '0.1.9.37';
cVersionMajor = 0;
cVersionMinor = 1;
cVersionRevision = 9;
cVersionBuild = 36;
cVersionBuild = 37;

implementation

Expand Down
7 changes: 4 additions & 3 deletions src/forms/ljv.forms.main.lfm
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ object frmMain: TfrmMain
OnDestroy = FormDestroy
OnDropFiles = FormDropFiles
SessionProperties = 'Top;Left;Height;Width;WindowState'
LCLVersion = '2.1.0.0'
object lbFiles: TListBox
Left = 0
Height = 528
Expand Down Expand Up @@ -61,7 +62,7 @@ object frmMain: TfrmMain
TabPosition = tpBottom
object tsTree: TTabSheet
Caption = '&Tree'
ClientHeight = 497
ClientHeight = 494
ClientWidth = 787
object psMain: TPairSplitter
Cursor = crDefault
Expand Down Expand Up @@ -90,7 +91,7 @@ object frmMain: TfrmMain
Header.Columns = <
item
Position = 0
Width = 398
Width = 400
end>
Header.Options = [hoAutoResize, hoColumnResize, hoDrag, hoShowSortGlyphs]
TabOrder = 0
Expand Down Expand Up @@ -163,7 +164,7 @@ object frmMain: TfrmMain
end
object tsJSON: TTabSheet
Caption = '&JSON'
ClientHeight = 497
ClientHeight = 494
ClientWidth = 787
inline SynEdit: TSynEdit
Left = 0
Expand Down
26 changes: 16 additions & 10 deletions src/forms/ljv.forms.main.pas
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,14 @@ interface
, PairSplitter
, JSONPropStorage
, ActnList
, StdActns, ComCtrls, SynEdit, SynHighlighterJScript
, StdActns
, ComCtrls
, SynEdit
, SynHighlighterJScript
, fpjson
, VirtualTrees
//, DefaultTranslator
, LCLTranslator
;

type
Expand Down Expand Up @@ -97,6 +102,7 @@ TfrmMain = class(TForm)
procedure ClosePropStorage;

procedure ClearLabels;
procedure ClearValuePanel;
procedure CorrectPairSplitterCursor;
procedure ProcessParams;
procedure UpdateFileList;
Expand Down Expand Up @@ -236,8 +242,6 @@ procedure TfrmMain.FormDropFiles(Sender: TObject;
end;

procedure TfrmMain.lbFilesSelectionChange(Sender: TObject; User: boolean);
var
index: Integer;
begin
if User then
begin
Expand All @@ -247,13 +251,7 @@ procedure TfrmMain.lbFilesSelectionChange(Sender: TObject; User: boolean);
begin
Caption:= Format(rsFormCaptionFile, [FFileList[lbFiles.ItemIndex], cVersion]);
ClearLabels;
for index:=0 to pred(panValue.ComponentCount) do
begin
if Assigned(panValue.Components[index]) then
begin
panValue.Components[index].Free;
end;
end;
ClearValuePanel;
LoadFile(FFileList[lbFiles.ItemIndex]);
UpdateTree;
end;
Expand Down Expand Up @@ -534,6 +532,14 @@ procedure TfrmMain.SetupShortcuts;
{$ENDIF}
end;

procedure TfrmMain.ClearValuePanel;
begin
while panValue.ComponentCount > 0 do
begin
panValue.Components[0].Free;
end;
end;

function TfrmMain.FormatBytes(ABytes: Int64): String;
var
dSize: Double;
Expand Down
2 changes: 1 addition & 1 deletion src/lazJSONViewer.lpi
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
<UseVersionInfo Value="True"/>
<MinorVersionNr Value="1"/>
<RevisionNr Value="9"/>
<BuildNr Value="36"/>
<BuildNr Value="37"/>
<Language Value="0809"/>
</VersionInfo>
<BuildModes Count="3">
Expand Down

0 comments on commit c434702

Please sign in to comment.