From eeb14b2e91cc1712d7877f7d33eb449eee5e0b4f Mon Sep 17 00:00:00 2001 From: n-thony Date: Tue, 26 Sep 2023 12:05:37 +0300 Subject: [PATCH 1/7] fixed bug on R-Instat not crashing when clicked the Toggle Data View Open and Closed Icon --- instat/ucrDataView.vb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/instat/ucrDataView.vb b/instat/ucrDataView.vb index b0e2760b91b..bd983c2c2be 100644 --- a/instat/ucrDataView.vb +++ b/instat/ucrDataView.vb @@ -150,9 +150,10 @@ Public Class ucrDataView 'refresh of that cell will be done manually If Not bOnlyUpdateOneCell Then AddAndUpdateWorksheets() - _grid.RemoveOldWorksheets() If _clsDataBook.DataFrames.Count = 0 Then RefreshDisplayInformation() + Else + _grid.RemoveOldWorksheets() End If End If End Sub From 29a71fd8f1cfc1e29f8694ec8530a6e87eeccff4 Mon Sep 17 00:00:00 2001 From: n-thony Date: Tue, 26 Sep 2023 12:10:42 +0300 Subject: [PATCH 2/7] minor code change --- instat/ucrDataView.vb | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/instat/ucrDataView.vb b/instat/ucrDataView.vb index bd983c2c2be..8493a89a33f 100644 --- a/instat/ucrDataView.vb +++ b/instat/ucrDataView.vb @@ -150,9 +150,7 @@ Public Class ucrDataView 'refresh of that cell will be done manually If Not bOnlyUpdateOneCell Then AddAndUpdateWorksheets() - If _clsDataBook.DataFrames.Count = 0 Then - RefreshDisplayInformation() - Else + If _clsDataBook.DataFrames.Count > 0 Then _grid.RemoveOldWorksheets() End If End If From 5bf89f6f8543a8904ea721c9a6b9bb33435c193e Mon Sep 17 00:00:00 2001 From: n-thony Date: Mon, 2 Oct 2023 18:17:47 +0300 Subject: [PATCH 3/7] revert the code --- instat/ucrDataView.vb | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/instat/ucrDataView.vb b/instat/ucrDataView.vb index 8493a89a33f..b0e2760b91b 100644 --- a/instat/ucrDataView.vb +++ b/instat/ucrDataView.vb @@ -150,8 +150,9 @@ Public Class ucrDataView 'refresh of that cell will be done manually If Not bOnlyUpdateOneCell Then AddAndUpdateWorksheets() - If _clsDataBook.DataFrames.Count > 0 Then - _grid.RemoveOldWorksheets() + _grid.RemoveOldWorksheets() + If _clsDataBook.DataFrames.Count = 0 Then + RefreshDisplayInformation() End If End If End Sub From d788c4944ae19e3c9b06cd4a97889e7254c1d8f4 Mon Sep 17 00:00:00 2001 From: n-thony Date: Mon, 2 Oct 2023 18:35:37 +0300 Subject: [PATCH 4/7] minor code change --- instat/frmMain.vb | 81 +++++++++++++++++++++++++---------------------- 1 file changed, 43 insertions(+), 38 deletions(-) diff --git a/instat/frmMain.vb b/instat/frmMain.vb index c65e42af663..2987cd8d64d 100644 --- a/instat/frmMain.vb +++ b/instat/frmMain.vb @@ -276,53 +276,58 @@ Public Class frmMain Public Sub UpdateLayout() - If Not mnuViewDataView.Checked _ - AndAlso Not mnuViewOutput.Checked _ - AndAlso Not mnuViewColumnMetadata.Checked _ - AndAlso Not mnuViewDataFrameMetadata.Checked _ - AndAlso Not mnuViewLogScript.Checked _ - AndAlso Not mnuViewSwapDataAndMetadata.Checked Then - splOverall.Hide() - Else - splOverall.Show() - - 'determine splOverall contents visibility + Try + If Not mnuViewDataView.Checked _ + AndAlso Not mnuViewOutput.Checked _ + AndAlso Not mnuViewColumnMetadata.Checked _ + AndAlso Not mnuViewDataFrameMetadata.Checked _ + AndAlso Not mnuViewLogScript.Checked _ + AndAlso Not mnuViewSwapDataAndMetadata.Checked Then + splOverall.Hide() + Else + splOverall.Show() + + 'determine splOverall contents visibility + + '------------------------------- + 'determine splOverall.Panel1 and it's contents visibility + + If mnuViewColumnMetadata.Checked OrElse mnuViewDataFrameMetadata.Checked OrElse mnuViewLogScript.Checked Then + 'expand panel 1 + splOverall.Panel1Collapsed = False + 'change splOverall.Panel1Collapsed contents visibilty + If mnuViewColumnMetadata.Checked OrElse mnuViewDataFrameMetadata.Checked Then + splMetadata.Panel1Collapsed = Not mnuViewColumnMetadata.Checked + splMetadata.Panel2Collapsed = Not mnuViewDataFrameMetadata.Checked + splExtraWindows.Panel1Collapsed = False + Else + splExtraWindows.Panel1Collapsed = True + End If + 'expand panel 2 based on log script menu item checked status + splExtraWindows.Panel2Collapsed = Not mnuViewLogScript.Checked + Else + splOverall.Panel1Collapsed = True + End If + '------------------------------- - '------------------------------- - 'determine splOverall.Panel1 and it's contents visibility + '------------------------------- + 'determine splOverall.Panel2 and it's contents visibility - If mnuViewColumnMetadata.Checked OrElse mnuViewDataFrameMetadata.Checked OrElse mnuViewLogScript.Checked Then - 'expand panel 1 - splOverall.Panel1Collapsed = False - 'change splOverall.Panel1Collapsed contents visibilty - If mnuViewColumnMetadata.Checked OrElse mnuViewDataFrameMetadata.Checked Then - splMetadata.Panel1Collapsed = Not mnuViewColumnMetadata.Checked - splMetadata.Panel2Collapsed = Not mnuViewDataFrameMetadata.Checked - splExtraWindows.Panel1Collapsed = False + If mnuViewDataView.Checked OrElse mnuViewOutput.Checked Then + splDataOutput.Panel1Collapsed = Not mnuViewDataView.Checked + splDataOutput.Panel2Collapsed = Not mnuViewOutput.Checked + splOverall.Panel2Collapsed = False Else - splExtraWindows.Panel1Collapsed = True + splOverall.Panel2Collapsed = True End If - 'expand panel 2 based on log script menu item checked status - splExtraWindows.Panel2Collapsed = Not mnuViewLogScript.Checked - Else - splOverall.Panel1Collapsed = True - End If - '------------------------------- + '------------------------------- - '------------------------------- - 'determine splOverall.Panel2 and it's contents visibility - If mnuViewDataView.Checked OrElse mnuViewOutput.Checked Then - splDataOutput.Panel1Collapsed = Not mnuViewDataView.Checked - splDataOutput.Panel2Collapsed = Not mnuViewOutput.Checked - splOverall.Panel2Collapsed = False - Else - splOverall.Panel2Collapsed = True End If - '------------------------------- + Catch ex As Exception + End Try - End If mnuTbDataView.Checked = mnuViewDataView.Checked mnuOutputWindow.Checked = mnuViewOutput.Checked mnuLogScript.Checked = mnuViewLogScript.Checked From 1cccfc2fc8732b7880f1c338a0a40466eacbb1f4 Mon Sep 17 00:00:00 2001 From: n-thony Date: Mon, 2 Oct 2023 19:05:06 +0300 Subject: [PATCH 5/7] minor code change --- instat/frmMain.vb | 2 +- instat/ucrDataView.vb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/instat/frmMain.vb b/instat/frmMain.vb index 2987cd8d64d..ad3981a595c 100644 --- a/instat/frmMain.vb +++ b/instat/frmMain.vb @@ -325,7 +325,7 @@ Public Class frmMain End If Catch ex As Exception - + MsgBox(ex.Message) End Try mnuTbDataView.Checked = mnuViewDataView.Checked diff --git a/instat/ucrDataView.vb b/instat/ucrDataView.vb index b0e2760b91b..4386d2e6cc0 100644 --- a/instat/ucrDataView.vb +++ b/instat/ucrDataView.vb @@ -132,6 +132,7 @@ Public Class ucrDataView End If End If RefreshWorksheet(worksheet, clsDataFrame) + _grid.RemoveOldWorksheets() Next If strCurrWorksheet IsNot Nothing Then _grid.ReOrderWorksheets(strCurrWorksheet) @@ -150,7 +151,6 @@ Public Class ucrDataView 'refresh of that cell will be done manually If Not bOnlyUpdateOneCell Then AddAndUpdateWorksheets() - _grid.RemoveOldWorksheets() If _clsDataBook.DataFrames.Count = 0 Then RefreshDisplayInformation() End If From 6a118ff160181c0695d9a4082ed2f6570880671a Mon Sep 17 00:00:00 2001 From: n-thony Date: Wed, 18 Oct 2023 16:43:19 +0300 Subject: [PATCH 6/7] revert the code --- instat/ucrDataView.vb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/instat/ucrDataView.vb b/instat/ucrDataView.vb index 4386d2e6cc0..984a5f7fd4e 100644 --- a/instat/ucrDataView.vb +++ b/instat/ucrDataView.vb @@ -132,7 +132,7 @@ Public Class ucrDataView End If End If RefreshWorksheet(worksheet, clsDataFrame) - _grid.RemoveOldWorksheets() + Next If strCurrWorksheet IsNot Nothing Then _grid.ReOrderWorksheets(strCurrWorksheet) @@ -149,6 +149,7 @@ Public Class ucrDataView _clsDataBook.RefreshData() 'If we are updating one cell we do not need to refresh the grid and the 'refresh of that cell will be done manually + _grid.RemoveOldWorksheets() If Not bOnlyUpdateOneCell Then AddAndUpdateWorksheets() If _clsDataBook.DataFrames.Count = 0 Then From ae53fb2c741063c6edf5197e5e40ff5ba20752a0 Mon Sep 17 00:00:00 2001 From: n-thony Date: Wed, 18 Oct 2023 16:48:42 +0300 Subject: [PATCH 7/7] added a condition to check if deleting last sheet --- instat/UserControls/DataGrid/ReoGrid/ucrReoGrid.vb | 7 +++++-- instat/ucrDataView.vb | 2 +- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/instat/UserControls/DataGrid/ReoGrid/ucrReoGrid.vb b/instat/UserControls/DataGrid/ReoGrid/ucrReoGrid.vb index 34ffa33d754..c8c84549d30 100644 --- a/instat/UserControls/DataGrid/ReoGrid/ucrReoGrid.vb +++ b/instat/UserControls/DataGrid/ReoGrid/ucrReoGrid.vb @@ -139,8 +139,11 @@ Public MustInherit Class ucrReoGrid For i = grdData.Worksheets.Count - 1 To 0 Step -1 Dim iGridWorkheetsPosition As Integer = i 'Needed to prevent warning If _clsDataBook.DataFrames.Where(Function(x) x.strName = grdData.Worksheets(iGridWorkheetsPosition).Name).Count = 0 Then - grdData.RemoveWorksheet(i) - bDeleted = True + ' Check if we are deleting the last worksheet + If grdData.Worksheets.Count > 1 Then + grdData.RemoveWorksheet(i) + bDeleted = True + End If End If Next ' Force the grid to refresh if a sheet has been deleted as there is sometimes a UI problem otherwise. diff --git a/instat/ucrDataView.vb b/instat/ucrDataView.vb index 984a5f7fd4e..417be28f5bf 100644 --- a/instat/ucrDataView.vb +++ b/instat/ucrDataView.vb @@ -149,9 +149,9 @@ Public Class ucrDataView _clsDataBook.RefreshData() 'If we are updating one cell we do not need to refresh the grid and the 'refresh of that cell will be done manually - _grid.RemoveOldWorksheets() If Not bOnlyUpdateOneCell Then AddAndUpdateWorksheets() + _grid.RemoveOldWorksheets() If _clsDataBook.DataFrames.Count = 0 Then RefreshDisplayInformation() End If