From 7e5b30671f517cbd99aa816dccb3e6ad7f81365d Mon Sep 17 00:00:00 2001 From: ivanluv Date: Mon, 26 Apr 2021 12:47:14 +0300 Subject: [PATCH 01/27] Removing quotes from the NA and adding toolstrip to the default value textbox --- instat/dlgInsertColumn.Designer.vb | 4 ++++ instat/dlgInsertColumn.resx | 9 +++++++++ instat/dlgInsertColumn.vb | 7 ++++++- 3 files changed, 19 insertions(+), 1 deletion(-) diff --git a/instat/dlgInsertColumn.Designer.vb b/instat/dlgInsertColumn.Designer.vb index 9ec4ddb33d5..26272208dd4 100644 --- a/instat/dlgInsertColumn.Designer.vb +++ b/instat/dlgInsertColumn.Designer.vb @@ -38,6 +38,7 @@ Partial Class dlgInsertColumn 'Do not modify it using the code editor. Private Sub InitializeComponent() + Me.components = New System.ComponentModel.Container() Dim resources As System.ComponentModel.ComponentResourceManager = New System.ComponentModel.ComponentResourceManager(GetType(dlgInsertColumn)) Me.lblStartPos = New System.Windows.Forms.Label() Me.lblNumberOfRowsToInsert = New System.Windows.Forms.Label() @@ -66,6 +67,7 @@ Partial Class dlgInsertColumn Me.ucrBase = New instat.ucrButtons() Me.ucrNudNumberOfRows = New instat.ucrNud() Me.ucrNudStartRow = New instat.ucrNud() + Me.ttColumnDefaultValue = New System.Windows.Forms.ToolTip(Me.components) Me.grpInsert.SuspendLayout() Me.grpOptions.SuspendLayout() Me.SuspendLayout() @@ -101,6 +103,7 @@ Partial Class dlgInsertColumn 'ucrInputBeforeAfter ' Me.ucrInputBeforeAfter.AddQuotesIfUnrecognised = True + Me.ucrInputBeforeAfter.GetSetSelectedIndex = -1 Me.ucrInputBeforeAfter.IsReadOnly = False resources.ApplyResources(Me.ucrInputBeforeAfter, "ucrInputBeforeAfter") Me.ucrInputBeforeAfter.Name = "ucrInputBeforeAfter" @@ -326,4 +329,5 @@ Partial Class dlgInsertColumn Friend WithEvents ucrInputPrefixForNewColumn As ucrInputTextBox Friend WithEvents lblColumn As Label Friend WithEvents ucrSelectorInsertColumns As ucrSelectorByDataFrameAddRemove + Friend WithEvents ttColumnDefaultValue As ToolTip End Class diff --git a/instat/dlgInsertColumn.resx b/instat/dlgInsertColumn.resx index 472c60945e6..dd9242eaea6 100644 --- a/instat/dlgInsertColumn.resx +++ b/instat/dlgInsertColumn.resx @@ -639,6 +639,12 @@ Insert Columns/Rows + + ttColumnDefaultValue + + + System.Windows.Forms.ToolTip, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + dlgInsertColumn @@ -795,4 +801,7 @@ 15 + + 17, 17 + \ No newline at end of file diff --git a/instat/dlgInsertColumn.vb b/instat/dlgInsertColumn.vb index 709a2a7c3d3..04c501a8bde 100644 --- a/instat/dlgInsertColumn.vb +++ b/instat/dlgInsertColumn.vb @@ -75,7 +75,8 @@ Public Class dlgInsertColumn ucrNudNumberOfColumns.SetMinMax(1, Integer.MaxValue) ucrInputDefaultValue.SetParameter(New RParameter("col_data", 5)) - ucrInputDefaultValue.SetRDefault("NA") + ucrInputDefaultValue.AddQuotesIfUnrecognised = False + ucrPnlInsertColumns.SetParameter(New RParameter("before", 3)) ucrPnlInsertColumns.AddRadioButton(rdoAtStart, "TRUE") @@ -111,6 +112,8 @@ Public Class dlgInsertColumn ucrNudNumberOfRows.SetLinkedDisplayControl(lblNumberOfRowsToInsert) ucrNudStartRow.SetLinkedDisplayControl(lblStartPos) ucrReceiverColumnsToInsert.SetLinkedDisplayControl(lblColumn) + + ttColumnDefaultValue.SetToolTip(ucrInputDefaultValue.txtInput, "Include the quotes if the default value is a string, e.g. ""small""") End Sub Private Sub SetDefaults() @@ -127,6 +130,8 @@ Public Class dlgInsertColumn clsInsertColumnFunction.SetRCommand(frmMain.clsRLink.strInstatDataObject & "$add_columns_to_data") clsInsertColumnFunction.AddParameter("use_col_name_as_prefix", "TRUE") clsInsertColumnFunction.AddParameter("before", "FALSE") + clsInsertColumnFunction.AddParameter("col_data", "NA") + clsInsertRowFunction.SetRCommand(frmMain.clsRLink.strInstatDataObject & "$insert_row_in_data") clsInsertRowFunction.AddParameter("before", "FALSE") From 5d6f4dd2b2c55b779f79e3812b2e732c7a1ccd40 Mon Sep 17 00:00:00 2001 From: ivanluv Date: Mon, 26 Apr 2021 15:06:47 +0300 Subject: [PATCH 02/27] Adding parameter positions --- instat/dlgInsertColumn.vb | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/instat/dlgInsertColumn.vb b/instat/dlgInsertColumn.vb index 04c501a8bde..34ffe03216b 100644 --- a/instat/dlgInsertColumn.vb +++ b/instat/dlgInsertColumn.vb @@ -124,18 +124,16 @@ Public Class dlgInsertColumn ucrInputBeforeAfter.Reset() ucrInputDefaultValue.Reset() ucrInputPrefixForNewColumn.Reset() - clsInsertColumnFunction.AddParameter("col_data", "NA") - clsInsertColumnFunction.AddParameter("col_name", "X") clsInsertColumnFunction.SetRCommand(frmMain.clsRLink.strInstatDataObject & "$add_columns_to_data") clsInsertColumnFunction.AddParameter("use_col_name_as_prefix", "TRUE") - clsInsertColumnFunction.AddParameter("before", "FALSE") - clsInsertColumnFunction.AddParameter("col_data", "NA") - + clsInsertColumnFunction.AddParameter("before", "FALSE", iPosition:=3) + clsInsertColumnFunction.AddParameter("col_data", "NA", iPosition:=5) + clsInsertColumnFunction.AddParameter("col_name", "X", iPosition:=6) clsInsertRowFunction.SetRCommand(frmMain.clsRLink.strInstatDataObject & "$insert_row_in_data") - clsInsertRowFunction.AddParameter("before", "FALSE") - clsInsertRowFunction.AddParameter("start_row", ucrSelectorInsertColumns.ucrAvailableDataFrames.iDataFrameLength) + clsInsertRowFunction.AddParameter("before", "FALSE", iPosition:=1) + clsInsertRowFunction.AddParameter("start_row", ucrSelectorInsertColumns.ucrAvailableDataFrames.iDataFrameLength, iPosition:=3) ucrNudStartRow.SetMinMax(1, ucrSelectorInsertColumns.ucrAvailableDataFrames.iDataFrameLength) ucrBase.clsRsyntax.SetBaseRFunction(clsInsertColumnFunction) End Sub From 402b656e2bd0d44a171d68d40cc0350212e4a30a Mon Sep 17 00:00:00 2001 From: ivanluv Date: Mon, 26 Apr 2021 15:45:34 +0300 Subject: [PATCH 03/27] minor change --- instat/dlgInsertColumn.vb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/instat/dlgInsertColumn.vb b/instat/dlgInsertColumn.vb index 34ffe03216b..db932939b9d 100644 --- a/instat/dlgInsertColumn.vb +++ b/instat/dlgInsertColumn.vb @@ -126,7 +126,7 @@ Public Class dlgInsertColumn ucrInputPrefixForNewColumn.Reset() clsInsertColumnFunction.SetRCommand(frmMain.clsRLink.strInstatDataObject & "$add_columns_to_data") - clsInsertColumnFunction.AddParameter("use_col_name_as_prefix", "TRUE") + clsInsertColumnFunction.AddParameter("use_col_name_as_prefix", "TRUE", iPosition:=7) clsInsertColumnFunction.AddParameter("before", "FALSE", iPosition:=3) clsInsertColumnFunction.AddParameter("col_data", "NA", iPosition:=5) clsInsertColumnFunction.AddParameter("col_name", "X", iPosition:=6) From f7e88f0f6051680d952a26a7376ccab86c51dbe4 Mon Sep 17 00:00:00 2001 From: patowhiz Date: Thu, 29 Apr 2021 10:48:13 +0300 Subject: [PATCH 04/27] dlgRecodeNumeric --- instat/dlgRecodeNumeric.Designer.vb | 55 ++--- instat/dlgRecodeNumeric.resx | 107 +++++----- instat/dlgRecodeNumeric.vb | 300 ++++++++++++++-------------- 3 files changed, 224 insertions(+), 238 deletions(-) diff --git a/instat/dlgRecodeNumeric.Designer.vb b/instat/dlgRecodeNumeric.Designer.vb index 3128dfab731..4153c407f81 100644 --- a/instat/dlgRecodeNumeric.Designer.vb +++ b/instat/dlgRecodeNumeric.Designer.vb @@ -45,13 +45,12 @@ Partial Class dlgRecodeNumeric Me.grpClosedOn = New System.Windows.Forms.GroupBox() Me.rdoLeft = New System.Windows.Forms.RadioButton() Me.rdoRight = New System.Windows.Forms.RadioButton() - Me.lblNewColumnName = New System.Windows.Forms.Label() - Me.ucrInputRecode = New instat.ucrInputComboBox() + Me.ucrSaveRecode = New instat.ucrSave() + Me.ucrMultipleNumericRecode = New instat.ucrInputTextBox() + Me.ucrMultipleLabels = New instat.ucrInputTextBox() Me.ucrReceiverRecode = New instat.ucrReceiverSingle() Me.ucrSelectorForRecode = New instat.ucrSelectorByDataFrameAddRemove() Me.ucrBase = New instat.ucrButtons() - Me.ucrMultipleLabels = New instat.ucrInputTextBox() - Me.ucrMultipleNumericRecode = New instat.ucrInputTextBox() Me.grpClosedOn.SuspendLayout() Me.SuspendLayout() ' @@ -97,18 +96,26 @@ Partial Class dlgRecodeNumeric Me.rdoRight.Tag = "Right" Me.rdoRight.UseVisualStyleBackColor = True ' - 'lblNewColumnName + 'ucrSaveRecode ' - resources.ApplyResources(Me.lblNewColumnName, "lblNewColumnName") - Me.lblNewColumnName.Name = "lblNewColumnName" - Me.lblNewColumnName.Tag = "New_Column_Name:" + resources.ApplyResources(Me.ucrSaveRecode, "ucrSaveRecode") + Me.ucrSaveRecode.Name = "ucrSaveRecode" ' - 'ucrInputRecode + 'ucrMultipleNumericRecode ' - Me.ucrInputRecode.AddQuotesIfUnrecognised = True - Me.ucrInputRecode.IsReadOnly = False - resources.ApplyResources(Me.ucrInputRecode, "ucrInputRecode") - Me.ucrInputRecode.Name = "ucrInputRecode" + Me.ucrMultipleNumericRecode.AddQuotesIfUnrecognised = True + Me.ucrMultipleNumericRecode.IsMultiline = False + Me.ucrMultipleNumericRecode.IsReadOnly = False + resources.ApplyResources(Me.ucrMultipleNumericRecode, "ucrMultipleNumericRecode") + Me.ucrMultipleNumericRecode.Name = "ucrMultipleNumericRecode" + ' + 'ucrMultipleLabels + ' + Me.ucrMultipleLabels.AddQuotesIfUnrecognised = True + Me.ucrMultipleLabels.IsMultiline = False + Me.ucrMultipleLabels.IsReadOnly = False + resources.ApplyResources(Me.ucrMultipleLabels, "ucrMultipleLabels") + Me.ucrMultipleLabels.Name = "ucrMultipleLabels" ' 'ucrReceiverRecode ' @@ -132,30 +139,13 @@ Partial Class dlgRecodeNumeric resources.ApplyResources(Me.ucrBase, "ucrBase") Me.ucrBase.Name = "ucrBase" ' - 'ucrMultipleLabels - ' - Me.ucrMultipleLabels.AddQuotesIfUnrecognised = True - Me.ucrMultipleLabels.IsMultiline = False - Me.ucrMultipleLabels.IsReadOnly = False - resources.ApplyResources(Me.ucrMultipleLabels, "ucrMultipleLabels") - Me.ucrMultipleLabels.Name = "ucrMultipleLabels" - ' - 'ucrMultipleNumericRecode - ' - Me.ucrMultipleNumericRecode.AddQuotesIfUnrecognised = True - Me.ucrMultipleNumericRecode.IsMultiline = False - Me.ucrMultipleNumericRecode.IsReadOnly = False - resources.ApplyResources(Me.ucrMultipleNumericRecode, "ucrMultipleNumericRecode") - Me.ucrMultipleNumericRecode.Name = "ucrMultipleNumericRecode" - ' 'dlgRecodeNumeric ' resources.ApplyResources(Me, "$this") Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font + Me.Controls.Add(Me.ucrSaveRecode) Me.Controls.Add(Me.ucrMultipleNumericRecode) Me.Controls.Add(Me.ucrMultipleLabels) - Me.Controls.Add(Me.ucrInputRecode) - Me.Controls.Add(Me.lblNewColumnName) Me.Controls.Add(Me.grpClosedOn) Me.Controls.Add(Me.lblBreakPoints) Me.Controls.Add(Me.ucrReceiverRecode) @@ -183,8 +173,7 @@ Partial Class dlgRecodeNumeric Friend WithEvents grpClosedOn As GroupBox Friend WithEvents rdoLeft As RadioButton Friend WithEvents rdoRight As RadioButton - Friend WithEvents lblNewColumnName As Label - Friend WithEvents ucrInputRecode As ucrInputComboBox Friend WithEvents ucrMultipleLabels As ucrInputTextBox Friend WithEvents ucrMultipleNumericRecode As ucrInputTextBox + Friend WithEvents ucrSaveRecode As ucrSave End Class diff --git a/instat/dlgRecodeNumeric.resx b/instat/dlgRecodeNumeric.resx index cffe1413df1..ad96c38924c 100644 --- a/instat/dlgRecodeNumeric.resx +++ b/instat/dlgRecodeNumeric.resx @@ -121,6 +121,10 @@ True + + + NoControl + 10, 206 @@ -144,11 +148,14 @@ $this - 9 + 8 True + + NoControl + 249, 46 @@ -171,11 +178,14 @@ $this - 8 + 7 True + + NoControl + 249, 92 @@ -198,11 +208,14 @@ $this - 5 + 4 True + + NoControl + 7, 20 @@ -230,6 +243,9 @@ True + + NoControl + 7, 43 @@ -276,64 +292,31 @@ $this - 4 - - - True - - - 7, 237 - - - 101, 13 - - - 8 - - - New Column Name: - - - lblNewColumnName - - - System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - $this - - 3 - - 163, 233 + + 9, 232 - - 145, 21 - - - 9 + + 4, 5, 4, 5 - - ucrInputRecode + + 328, 23 - - instat.ucrInputComboBox, instat, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null + + 20 - - $this + + ucrSaveRecode - - 2 + + instat.ucrSave, instat, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null - - True - - - 6, 13 + + $this - - 419, 316 + + 0 247, 107 @@ -354,7 +337,7 @@ $this - 0 + 1 163, 206 @@ -375,12 +358,20 @@ $this - 1 + 2 + + + True + + + 6, 13 + + + 418, 316 10, 10 - 0, 0, 0, 0 @@ -400,7 +391,7 @@ $this - 7 + 6 10, 261 @@ -421,7 +412,7 @@ $this - 10 + 9 CenterScreen @@ -457,6 +448,6 @@ $this - 6 + 5 \ No newline at end of file diff --git a/instat/dlgRecodeNumeric.vb b/instat/dlgRecodeNumeric.vb index a007987870c..1d3fdcca815 100644 --- a/instat/dlgRecodeNumeric.vb +++ b/instat/dlgRecodeNumeric.vb @@ -14,57 +14,64 @@ ' You should have received a copy of the GNU General Public License ' along with this program. If not, see . -Imports instat.Translations -Public Class dlgRecodeNumeric - Public bFirstLoad As Boolean = True - Public strDefaultDataFrame As String = "" - Public strDefaultColumn As String = "" - Private Sub dlgRecode_Load(sender As Object, e As EventArgs) Handles MyBase.Load - autoTranslate(Me) - If bFirstLoad Then - InitialiseDialog() - SetDefaults() - bFirstLoad = False - Else - ReopenDialog() - End If - SetDefaultColumn() - TestOKEnabled() - ucrBase.iHelpTopicID = 43 - End Sub - - Private Sub InitialiseDialog() - ucrReceiverRecode.Selector = ucrSelectorForRecode - ucrReceiverRecode.SetMeAsReceiver() - ucrReceiverRecode.SetIncludedDataTypes({"numeric"}) +Imports instat.Translations +Public Class dlgRecodeNumeric + Public bFirstLoad As Boolean = True + Public strDefaultDataFrame As String = "" + Public strDefaultColumn As String = "" + Private Sub dlgRecode_Load(sender As Object, e As EventArgs) Handles MyBase.Load + autoTranslate(Me) + If bFirstLoad Then + InitialiseDialog() + SetDefaults() + bFirstLoad = False + Else + ReopenDialog() + End If + SetDefaultColumn() + TestOKEnabled() + ucrBase.iHelpTopicID = 43 + End Sub + + Private Sub InitialiseDialog() + ucrReceiverRecode.Selector = ucrSelectorForRecode + ucrReceiverRecode.SetMeAsReceiver() + ucrReceiverRecode.SetIncludedDataTypes({"numeric"}) ucrBase.clsRsyntax.SetFunction("cut") ucrReceiverRecode.strSelectorHeading = "Numerics" - ucrBase.clsRsyntax.AddParameter("include.lowest", "TRUE") - ucrBase.clsRsyntax.AddParameter("dig.lab", "10") - ucrInputRecode.SetItemsTypeAsColumns() - ucrInputRecode.SetDefaultTypeAsColumn() - ucrInputRecode.SetDataFrameSelector(ucrSelectorForRecode.ucrAvailableDataFrames) - ucrInputRecode.SetValidationTypeAsRVariable() - ucrMultipleLabels.SetValidationTypeAsList() - ucrMultipleNumericRecode.SetValidationTypeAsNumericList(bNewAllowInf:=True) - End Sub - - Private Sub SetDefaults() - chkAddLabels.Checked = False - ucrMultipleLabels.Visible = False + ucrBase.clsRsyntax.AddParameter("include.lowest", "TRUE") + ucrBase.clsRsyntax.AddParameter("dig.lab", "10") + + 'ucrSave + ucrSaveRecode.SetPrefix("Recode") + ucrSaveRecode.SetSaveTypeAsColumn() + ucrSaveRecode.SetDataFrameSelector(ucrSelectorForRecode.ucrAvailableDataFrames) + ucrSaveRecode.SetIsComboBox() + ucrSaveRecode.SetLabelText("New column name:") + ucrSaveRecode.setLinkedReceiver(ucrReceiverRecode) + ucrSaveRecode.SetRCode(ucrBase.clsRsyntax.clsBaseFunction, True) + + ucrMultipleLabels.SetValidationTypeAsList() + ucrMultipleNumericRecode.SetValidationTypeAsNumericList(bNewAllowInf:=True) + End Sub + + Private Sub SetDefaults() + chkAddLabels.Checked = False + ucrMultipleLabels.Visible = False rdoRight.Checked = True - ucrInputRecode.SetPrefix("Recode") - ucrSelectorForRecode.Reset() - ucrSelectorForRecode.Focus() - ucrMultipleNumericRecode.Reset() - ucrMultipleNumericRecode.SetName("") - ucrMultipleLabels.Reset() - ucrMultipleLabels.SetName("") - TestOKEnabled() - End Sub - - Private Sub ReopenDialog() - + 'ucrInputRecode.SetPrefix("Recode") + ucrSelectorForRecode.Reset() + ucrSelectorForRecode.Focus() + ucrSaveRecode.Reset() + ucrMultipleNumericRecode.Reset() + ucrMultipleNumericRecode.SetName("") + ucrMultipleLabels.Reset() + ucrMultipleLabels.SetName("") + TestOKEnabled() + End Sub + + Private Sub ReopenDialog() + End Sub Private Sub SetDefaultColumn() @@ -73,40 +80,40 @@ Public Class dlgRecodeNumeric End If If strDefaultColumn <> "" Then ucrReceiverRecode.Add(strDefaultColumn, strDefaultDataFrame) - ucrInputRecode.Focus() + ucrSaveRecode.Focus() End If strDefaultDataFrame = "" strDefaultColumn = "" - End Sub - - Private Sub TestOKEnabled() - Dim iTemp As Integer - - If Not ucrReceiverRecode.IsEmpty() AndAlso Not ucrMultipleNumericRecode.IsEmpty AndAlso Not ucrInputRecode.IsEmpty Then - If chkAddLabels.Checked AndAlso Not ucrMultipleLabels.IsEmpty Then - If (ucrMultipleNumericRecode.clsRList.clsParameters.Count > 1 AndAlso (Not ucrMultipleLabels.clsRList.clsParameters.Count <> ucrMultipleNumericRecode.clsRList.clsParameters.Count - 1)) OrElse (ucrMultipleNumericRecode.clsRList.clsParameters.Count = 1 AndAlso Integer.TryParse(ucrMultipleNumericRecode.clsRList.clsParameters(0).strArgumentValue, iTemp) AndAlso iTemp = ucrMultipleLabels.clsRList.clsParameters.Count) Then - ucrBase.OKEnabled(True) - Else - ucrBase.OKEnabled(False) - End If - Else - ucrBase.OKEnabled(True) - End If - Else - ucrBase.OKEnabled(False) - End If - End Sub - - Private Sub ucrReceiverRecode_SelectionChanged() Handles ucrReceiverRecode.SelectionChanged - If Not ucrReceiverRecode.IsEmpty Then - ucrBase.clsRsyntax.AddParameter("x", clsRFunctionParameter:=ucrReceiverRecode.GetVariables()) - - Else - ucrBase.clsRsyntax.RemoveParameter("x") - End If - TestOKEnabled() - End Sub - + End Sub + + Private Sub TestOKEnabled() + Dim iTemp As Integer + + If Not ucrReceiverRecode.IsEmpty() AndAlso Not ucrMultipleNumericRecode.IsEmpty AndAlso ucrSaveRecode.IsComplete Then + If chkAddLabels.Checked AndAlso Not ucrMultipleLabels.IsEmpty Then + If (ucrMultipleNumericRecode.clsRList.clsParameters.Count > 1 AndAlso (Not ucrMultipleLabels.clsRList.clsParameters.Count <> ucrMultipleNumericRecode.clsRList.clsParameters.Count - 1)) OrElse (ucrMultipleNumericRecode.clsRList.clsParameters.Count = 1 AndAlso Integer.TryParse(ucrMultipleNumericRecode.clsRList.clsParameters(0).strArgumentValue, iTemp) AndAlso iTemp = ucrMultipleLabels.clsRList.clsParameters.Count) Then + ucrBase.OKEnabled(True) + Else + ucrBase.OKEnabled(False) + End If + Else + ucrBase.OKEnabled(True) + End If + Else + ucrBase.OKEnabled(False) + End If + End Sub + + Private Sub ucrReceiverRecode_SelectionChanged() Handles ucrReceiverRecode.SelectionChanged + If Not ucrReceiverRecode.IsEmpty Then + ucrBase.clsRsyntax.AddParameter("x", clsRFunctionParameter:=ucrReceiverRecode.GetVariables()) + + Else + ucrBase.clsRsyntax.RemoveParameter("x") + End If + TestOKEnabled() + End Sub + Private Sub ucrMultipleNumericRecode_NameChanged() Handles ucrMultipleNumericRecode.NameChanged 'Warning: Apparently the event is raised twice, such that the message is sent twice... 'This sub is sending validation errors to the user for him/her to fill in the settingsof the dialogue in an appropriate way. @@ -115,78 +122,77 @@ Public Class dlgRecodeNumeric If ucrMultipleNumericRecode.GetText <> "" AndAlso ucrMultipleNumericRecode.clsRList.clsParameters.Count = 1 Then MsgBox("If the input of break points is a single number, it is understood as the number of intervals. It has to be > 1, otherwise an error will occur.", vbOKOnly, "Validation Error") Else - ValidateBreakPointLabelCount() - End If - ucrBase.clsRsyntax.AddParameter("breaks", clsRFunctionParameter:=ucrMultipleNumericRecode.clsRList) - TestOKEnabled() - End Sub - - Private Sub ucrMultipleLabels_NameChanged() Handles ucrMultipleLabels.NameChanged - AddLabelsParameter() - TestOKEnabled() - End Sub - - Private Sub ucrMultipleNumericRecode_Validated(sender As Object, e As EventArgs) Handles ucrMultipleNumericRecode.Validated, ucrMultipleLabels.Validated - ValidateBreakPointLabelCount() - End Sub - - Private Sub AddLabelsParameter() - If Not ucrMultipleLabels.IsEmpty() Then - ucrBase.clsRsyntax.AddParameter("labels", clsRFunctionParameter:=ucrMultipleLabels.clsRList) - Else - ucrBase.clsRsyntax.RemoveParameter("labels") - End If - End Sub - + ValidateBreakPointLabelCount() + End If + ucrBase.clsRsyntax.AddParameter("breaks", clsRFunctionParameter:=ucrMultipleNumericRecode.clsRList) + TestOKEnabled() + End Sub + + Private Sub ucrMultipleLabels_NameChanged() Handles ucrMultipleLabels.NameChanged + AddLabelsParameter() + TestOKEnabled() + End Sub + + Private Sub ucrMultipleNumericRecode_Validated(sender As Object, e As EventArgs) Handles ucrMultipleNumericRecode.Validated, ucrMultipleLabels.Validated + ValidateBreakPointLabelCount() + End Sub + + Private Sub AddLabelsParameter() + If Not ucrMultipleLabels.IsEmpty() Then + ucrBase.clsRsyntax.AddParameter("labels", clsRFunctionParameter:=ucrMultipleLabels.clsRList) + Else + ucrBase.clsRsyntax.RemoveParameter("labels") + End If + End Sub + Private Sub ValidateBreakPointLabelCount() - Dim iTemp As Integer - + Dim iTemp As Integer + If Not ucrMultipleNumericRecode.IsEmpty() AndAlso (Not ucrMultipleLabels.IsEmpty()) Then If ucrMultipleNumericRecode.clsRList.clsParameters.Count > 1 AndAlso ucrMultipleLabels.clsRList.clsParameters.Count <> ucrMultipleNumericRecode.clsRList.clsParameters.Count - 1 Then MsgBox("There must be one less label than the number of break points. Ok will not be enabled until this is resolved.", vbOKOnly, "Validation Error") ElseIf ucrMultipleNumericRecode.clsRList.clsParameters.Count = 1 AndAlso Integer.TryParse(ucrMultipleNumericRecode.clsRList.clsParameters(0).strArgumentValue, iTemp) AndAlso iTemp <> ucrMultipleLabels.clsRList.clsParameters.Count Then MsgBox("There must be the same number of labels to the number of intervals. Ok will not be enabled until this is resolved.", vbOKOnly, "Validation Error") - End If - End If - End Sub - - Private Sub chkAddLabels_CheckedChanged(sender As Object, e As EventArgs) Handles chkAddLabels.CheckedChanged - If chkAddLabels.Checked Then - ucrMultipleLabels.Visible = True - AddLabelsParameter() - Else - ucrMultipleLabels.Visible = False - ucrBase.clsRsyntax.RemoveParameter("labels") - End If - TestOKEnabled() - End Sub - - Private Sub grpClosedOn_CheckedChanged(sender As Object, e As EventArgs) Handles rdoLeft.CheckedChanged, rdoRight.CheckedChanged - SetClosedOn() - End Sub - - Private Sub SetClosedOn() - If rdoRight.Checked Then - If frmMain.clsInstatOptions.bIncludeRDefaultParameters Then - ucrBase.clsRsyntax.AddParameter("right", "TRUE") - Else - ucrBase.clsRsyntax.RemoveParameter("right") - End If - Else - ucrBase.clsRsyntax.AddParameter("right", "FALSE") - End If - End Sub - - Private Sub ucrBase_ClickReset(sender As Object, e As EventArgs) Handles ucrBase.ClickReset - SetDefaults() - End Sub - - Private Sub ucrInputRecode_Namechanged() Handles ucrInputRecode.NameChanged - ucrBase.clsRsyntax.SetAssignTo(strAssignToName:=ucrInputRecode.GetText, strTempDataframe:=ucrSelectorForRecode.ucrAvailableDataFrames.cboAvailableDataFrames.Text, strTempColumn:=ucrInputRecode.GetText) - TestOKEnabled() - End Sub - - Private Sub ucrReceiverRecode_SelectionChanged(sender As Object, e As EventArgs) Handles ucrReceiverRecode.SelectionChanged - ucrBase.clsRsyntax.AddParameter("x", clsRFunctionParameter:=ucrReceiverRecode.GetVariables()) - End Sub + End If + End If + End Sub + + Private Sub chkAddLabels_CheckedChanged(sender As Object, e As EventArgs) Handles chkAddLabels.CheckedChanged + If chkAddLabels.Checked Then + ucrMultipleLabels.Visible = True + AddLabelsParameter() + Else + ucrMultipleLabels.Visible = False + ucrBase.clsRsyntax.RemoveParameter("labels") + End If + TestOKEnabled() + End Sub + + Private Sub grpClosedOn_CheckedChanged(sender As Object, e As EventArgs) Handles rdoLeft.CheckedChanged, rdoRight.CheckedChanged + SetClosedOn() + End Sub + + Private Sub SetClosedOn() + If rdoRight.Checked Then + If frmMain.clsInstatOptions.bIncludeRDefaultParameters Then + ucrBase.clsRsyntax.AddParameter("right", "TRUE") + Else + ucrBase.clsRsyntax.RemoveParameter("right") + End If + Else + ucrBase.clsRsyntax.AddParameter("right", "FALSE") + End If + End Sub + + Private Sub ucrBase_ClickReset(sender As Object, e As EventArgs) Handles ucrBase.ClickReset + SetDefaults() + End Sub + + Private Sub ucrReceiverRecode_SelectionChanged(sender As Object, e As EventArgs) Handles ucrReceiverRecode.SelectionChanged + ucrBase.clsRsyntax.AddParameter("x", clsRFunctionParameter:=ucrReceiverRecode.GetVariables()) + End Sub + + Private Sub ucrControls_ControlContentsChanged(ucrChangedControl As ucrCore) Handles ucrMultipleNumericRecode.ControlContentsChanged, ucrMultipleLabels.ControlContentsChanged + TestOKEnabled() + End Sub End Class \ No newline at end of file From c4aa8043a9bafa2d26060644110d0e308eaf801e Mon Sep 17 00:00:00 2001 From: patowhiz Date: Thu, 29 Apr 2021 11:25:20 +0300 Subject: [PATCH 05/27] made changes to Prepare > Column: Factor dialogs --- instat/dlgCombine.Designer.vb | 1 + instat/dlgCombine.resx | 2 +- instat/dlgCombine.vb | 1 + instat/dlgCountinFactor.Designer.vb | 1 + instat/dlgCountinFactor.resx | 7 +++++-- instat/dlgCountinFactor.vb | 2 +- instat/dlgRecodeFactor.resx | 2 +- instat/dlgRecodeFactor.vb | 1 + instat/dlgRecodeNumeric.resx | 2 +- 9 files changed, 13 insertions(+), 6 deletions(-) diff --git a/instat/dlgCombine.Designer.vb b/instat/dlgCombine.Designer.vb index b170ac60cbc..9603f22d636 100644 --- a/instat/dlgCombine.Designer.vb +++ b/instat/dlgCombine.Designer.vb @@ -70,6 +70,7 @@ Partial Class dlgCombine 'ucrInputSeparator ' Me.ucrInputSeparator.AddQuotesIfUnrecognised = True + Me.ucrInputSeparator.GetSetSelectedIndex = -1 Me.ucrInputSeparator.IsReadOnly = False resources.ApplyResources(Me.ucrInputSeparator, "ucrInputSeparator") Me.ucrInputSeparator.Name = "ucrInputSeparator" diff --git a/instat/dlgCombine.resx b/instat/dlgCombine.resx index 59e4d954a60..5ff38cfc8e5 100644 --- a/instat/dlgCombine.resx +++ b/instat/dlgCombine.resx @@ -226,7 +226,7 @@ 4, 5, 4, 5 - 294, 24 + 294, 22 7 diff --git a/instat/dlgCombine.vb b/instat/dlgCombine.vb index 8423d6c75aa..8a04774fd95 100644 --- a/instat/dlgCombine.vb +++ b/instat/dlgCombine.vb @@ -68,6 +68,7 @@ Public Class dlgCombine ucrNewColName.SetSaveTypeAsColumn() ucrNewColName.SetDataFrameSelector(ucrSelectorCombineFactors.ucrAvailableDataFrames) ucrNewColName.SetLabelText("New Column Name:") + ucrNewColName.setLinkedReceiver(ucrFactorsReceiver) 'chkbox ucrChkDropUnusedLevels.SetParameter(New RParameter("drop", 1)) diff --git a/instat/dlgCountinFactor.Designer.vb b/instat/dlgCountinFactor.Designer.vb index 1a2b74985d9..aa8b07dc132 100644 --- a/instat/dlgCountinFactor.Designer.vb +++ b/instat/dlgCountinFactor.Designer.vb @@ -72,6 +72,7 @@ Partial Class dlgCountinFactor ' 'ucrCountSelector ' + Me.ucrCountSelector.bDropUnusedFilterLevels = False Me.ucrCountSelector.bShowHiddenColumns = False Me.ucrCountSelector.bUseCurrentFilter = True resources.ApplyResources(Me.ucrCountSelector, "ucrCountSelector") diff --git a/instat/dlgCountinFactor.resx b/instat/dlgCountinFactor.resx index 88def5ae835..c9ae6d5fd3d 100644 --- a/instat/dlgCountinFactor.resx +++ b/instat/dlgCountinFactor.resx @@ -149,8 +149,12 @@ 9, 210 + + + 4, 5, 4, 5 + - 255, 24 + 255, 22 3 @@ -179,7 +183,6 @@ 9, 9 - 0, 0, 0, 0 diff --git a/instat/dlgCountinFactor.vb b/instat/dlgCountinFactor.vb index 4cca2a1d52e..b7469940329 100644 --- a/instat/dlgCountinFactor.vb +++ b/instat/dlgCountinFactor.vb @@ -48,7 +48,7 @@ Public Class dlgCountinFactor ' ucrNewColName ucrNewColName.SetIsComboBox() - ucrNewColName.SetPrefix("Count") + ucrNewColName.SetPrefix("count") ucrNewColName.SetSaveTypeAsColumn() ucrNewColName.SetDataFrameSelector(ucrCountSelector.ucrAvailableDataFrames) ucrNewColName.SetLabelText("New Column Name:") diff --git a/instat/dlgRecodeFactor.resx b/instat/dlgRecodeFactor.resx index a34149984de..e0d0784152c 100644 --- a/instat/dlgRecodeFactor.resx +++ b/instat/dlgRecodeFactor.resx @@ -157,7 +157,7 @@ 4, 5, 4, 5 - 334, 24 + 334, 22 4 diff --git a/instat/dlgRecodeFactor.vb b/instat/dlgRecodeFactor.vb index 3223862dcaa..2fa556094b6 100644 --- a/instat/dlgRecodeFactor.vb +++ b/instat/dlgRecodeFactor.vb @@ -55,6 +55,7 @@ Public Class dlgRecodeFactor ucrSaveNewColumn.SetDataFrameSelector(ucrSelectorForRecode.ucrAvailableDataFrames) ucrSaveNewColumn.SetIsComboBox() ucrSaveNewColumn.SetLabelText("New Column Name:") + ucrSaveNewColumn.setLinkedReceiver(ucrReceiverFactor) End Sub Private Sub SetDefaults() diff --git a/instat/dlgRecodeNumeric.resx b/instat/dlgRecodeNumeric.resx index ad96c38924c..aeddca581dd 100644 --- a/instat/dlgRecodeNumeric.resx +++ b/instat/dlgRecodeNumeric.resx @@ -301,7 +301,7 @@ 4, 5, 4, 5 - 328, 23 + 328, 22 20 From 2659775d199d59fdfa09a395a19487a904ec9833 Mon Sep 17 00:00:00 2001 From: patowhiz Date: Thu, 29 Apr 2021 12:35:07 +0300 Subject: [PATCH 06/27] Prepare > Column: Calculate dialogs --- instat/dlgDuplicateColumns.Designer.vb | 24 +++---- instat/dlgDuplicateColumns.resx | 5 +- instat/dlgPermuteColumn.resx | 2 +- instat/dlgPolynomials.Designer.vb | 1 + instat/dlgPolynomials.resx | 98 +++++++++++++++++++------- instat/dlgPolynomials.vb | 1 + instat/dlgRandomSample.resx | 2 +- instat/dlgRank.resx | 11 +-- instat/dlgRank.vb | 1 + instat/dlgRowSummary.Designer.vb | 13 ++-- instat/dlgRowSummary.resx | 8 +-- instat/dlgRowSummary.vb | 1 + 12 files changed, 110 insertions(+), 57 deletions(-) diff --git a/instat/dlgDuplicateColumns.Designer.vb b/instat/dlgDuplicateColumns.Designer.vb index 30cba560d3c..f6758b1ce9b 100644 --- a/instat/dlgDuplicateColumns.Designer.vb +++ b/instat/dlgDuplicateColumns.Designer.vb @@ -47,16 +47,16 @@ Partial Class dlgDuplicateColumns Me.rdoConvertToNumeric = New System.Windows.Forms.RadioButton() Me.rdoConvertToOrderedFactor = New System.Windows.Forms.RadioButton() Me.rdoConvertToFactor = New System.Windows.Forms.RadioButton() + Me.ucrPnlConvertTo = New instat.UcrPanel() Me.grpFactorToNumericOptions = New System.Windows.Forms.GroupBox() Me.rdoConvertDefault = New System.Windows.Forms.RadioButton() Me.rdoConvertOrdinals = New System.Windows.Forms.RadioButton() Me.rdoConvertLevels = New System.Windows.Forms.RadioButton() + Me.ucrPnlConvertFactorToNumericOptions = New instat.UcrPanel() Me.ucrChkChangeType = New instat.ucrCheck() Me.ucrChkConvertCreateLabels = New instat.ucrCheck() Me.ucrChkConvertKeepAttributes = New instat.ucrCheck() Me.ucrNudConvertDisplayDecimals = New instat.ucrNud() - Me.ucrPnlConvertFactorToNumericOptions = New instat.UcrPanel() - Me.ucrPnlConvertTo = New instat.UcrPanel() Me.ucrChkConvertSpecifyDecimalsToDisplay = New instat.ucrCheck() Me.ucrReceiverDuplicateColumns = New instat.ucrReceiverSingle() Me.ucrSelectorForDuplicateColumn = New instat.ucrSelectorByDataFrameAddRemove() @@ -126,6 +126,11 @@ Partial Class dlgDuplicateColumns Me.rdoConvertToFactor.TabStop = True Me.rdoConvertToFactor.UseVisualStyleBackColor = True ' + 'ucrPnlConvertTo + ' + resources.ApplyResources(Me.ucrPnlConvertTo, "ucrPnlConvertTo") + Me.ucrPnlConvertTo.Name = "ucrPnlConvertTo" + ' 'grpFactorToNumericOptions ' Me.grpFactorToNumericOptions.Controls.Add(Me.rdoConvertDefault) @@ -157,6 +162,11 @@ Partial Class dlgDuplicateColumns Me.rdoConvertLevels.TabStop = True Me.rdoConvertLevels.UseVisualStyleBackColor = True ' + 'ucrPnlConvertFactorToNumericOptions + ' + resources.ApplyResources(Me.ucrPnlConvertFactorToNumericOptions, "ucrPnlConvertFactorToNumericOptions") + Me.ucrPnlConvertFactorToNumericOptions.Name = "ucrPnlConvertFactorToNumericOptions" + ' 'ucrChkChangeType ' Me.ucrChkChangeType.Checked = False @@ -185,16 +195,6 @@ Partial Class dlgDuplicateColumns Me.ucrNudConvertDisplayDecimals.Name = "ucrNudConvertDisplayDecimals" Me.ucrNudConvertDisplayDecimals.Value = New Decimal(New Integer() {0, 0, 0, 0}) ' - 'ucrPnlConvertFactorToNumericOptions - ' - resources.ApplyResources(Me.ucrPnlConvertFactorToNumericOptions, "ucrPnlConvertFactorToNumericOptions") - Me.ucrPnlConvertFactorToNumericOptions.Name = "ucrPnlConvertFactorToNumericOptions" - ' - 'ucrPnlConvertTo - ' - resources.ApplyResources(Me.ucrPnlConvertTo, "ucrPnlConvertTo") - Me.ucrPnlConvertTo.Name = "ucrPnlConvertTo" - ' 'ucrChkConvertSpecifyDecimalsToDisplay ' Me.ucrChkConvertSpecifyDecimalsToDisplay.Checked = False diff --git a/instat/dlgDuplicateColumns.resx b/instat/dlgDuplicateColumns.resx index 8729289a4fc..8683690d489 100644 --- a/instat/dlgDuplicateColumns.resx +++ b/instat/dlgDuplicateColumns.resx @@ -652,7 +652,7 @@ 4, 5, 4, 5 - 293, 24 + 293, 22 30 @@ -717,9 +717,6 @@ 11 - - NoControl - CenterScreen diff --git a/instat/dlgPermuteColumn.resx b/instat/dlgPermuteColumn.resx index 0290af232a2..da6c0f74a6e 100644 --- a/instat/dlgPermuteColumn.resx +++ b/instat/dlgPermuteColumn.resx @@ -244,7 +244,7 @@ 4, 5, 4, 5 - 336, 24 + 280, 22 7 diff --git a/instat/dlgPolynomials.Designer.vb b/instat/dlgPolynomials.Designer.vb index dba8bf21cb5..08b44e015e5 100644 --- a/instat/dlgPolynomials.Designer.vb +++ b/instat/dlgPolynomials.Designer.vb @@ -113,6 +113,7 @@ Partial Class dlgPolynomials ' 'ucrSelectorForPolynomial ' + Me.ucrSelectorForPolynomial.bDropUnusedFilterLevels = False Me.ucrSelectorForPolynomial.bShowHiddenColumns = False Me.ucrSelectorForPolynomial.bUseCurrentFilter = True resources.ApplyResources(Me.ucrSelectorForPolynomial, "ucrSelectorForPolynomial") diff --git a/instat/dlgPolynomials.resx b/instat/dlgPolynomials.resx index 3e6f40bbefe..79b93ef018f 100644 --- a/instat/dlgPolynomials.resx +++ b/instat/dlgPolynomials.resx @@ -146,6 +146,78 @@ 7 + + rdoCentred + + + System.Windows.Forms.RadioButton, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + grpType + + + 0 + + + rdoOrthogonal + + + System.Windows.Forms.RadioButton, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + grpType + + + 1 + + + rdoSimple + + + System.Windows.Forms.RadioButton, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + grpType + + + 2 + + + ucrPnlType + + + instat.UcrPanel, instat, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null + + + grpType + + + 3 + + + 248, 119 + + + 120, 98 + + + 5 + + + Type + + + grpType + + + System.Windows.Forms.GroupBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + $this + + + 1 + Top, Left, Right @@ -258,30 +330,6 @@ 3 - - 248, 119 - - - 120, 98 - - - 5 - - - Type - - - grpType - - - System.Windows.Forms.GroupBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - $this - - - 1 - 318, 90 @@ -310,7 +358,7 @@ 4, 5, 4, 5 - 358, 24 + 280, 22 6 diff --git a/instat/dlgPolynomials.vb b/instat/dlgPolynomials.vb index 34a2cf400e9..4f3a2268564 100644 --- a/instat/dlgPolynomials.vb +++ b/instat/dlgPolynomials.vb @@ -64,6 +64,7 @@ Public Class dlgPolynomials ucrSavePoly.SetSaveTypeAsColumn() ucrSavePoly.SetDataFrameSelector(ucrSelectorForPolynomial.ucrAvailableDataFrames) ucrSavePoly.SetIsComboBox() + ucrSavePoly.setLinkedReceiver(ucrReceiverPolynomial) End Sub Private Sub SetDefaults() diff --git a/instat/dlgRandomSample.resx b/instat/dlgRandomSample.resx index d57fb2b888d..d7c21361043 100644 --- a/instat/dlgRandomSample.resx +++ b/instat/dlgRandomSample.resx @@ -325,7 +325,7 @@ 4, 5, 4, 5 - 334, 24 + 334, 22 8 diff --git a/instat/dlgRank.resx b/instat/dlgRank.resx index d76ef49b9ba..663cbeb963b 100644 --- a/instat/dlgRank.resx +++ b/instat/dlgRank.resx @@ -126,13 +126,13 @@ 244, 45 - 91, 13 + 86, 13 1 - Columns to Rank: + Column to Rank: lblColumnsToRank @@ -446,8 +446,12 @@ 10, 284 + + + 4, 5, 4, 5 + - 271, 24 + 271, 22 5 @@ -467,7 +471,6 @@ 10, 10 - 0, 0, 0, 0 diff --git a/instat/dlgRank.vb b/instat/dlgRank.vb index a8393046cd7..80b68c44b16 100644 --- a/instat/dlgRank.vb +++ b/instat/dlgRank.vb @@ -64,6 +64,7 @@ Public Class dlgRank ucrSaveRank.SetDataFrameSelector(ucrSelectorForRank.ucrAvailableDataFrames) ucrSaveRank.SetLabelText("New Column Name:") ucrSaveRank.SetIsComboBox() + ucrSaveRank.setLinkedReceiver(ucrReceiverRank) End Sub ' Sub that runs only the first time the dialog loads it sets default RFunction as the base function diff --git a/instat/dlgRowSummary.Designer.vb b/instat/dlgRowSummary.Designer.vb index 5bdc9864458..711e9226a3b 100644 --- a/instat/dlgRowSummary.Designer.vb +++ b/instat/dlgRowSummary.Designer.vb @@ -50,9 +50,9 @@ Partial Class dlgRowSummary Me.rdoNumberofMissing = New System.Windows.Forms.RadioButton() Me.rdoMedian = New System.Windows.Forms.RadioButton() Me.rdoSum = New System.Windows.Forms.RadioButton() + Me.ucrPanelStatistics = New instat.UcrPanel() Me.ucrChkIgnoreMissingValues = New instat.ucrCheck() Me.ucrSaveResults = New instat.ucrSave() - Me.ucrPanelStatistics = New instat.UcrPanel() Me.ucrSelectorForRowSummaries = New instat.ucrSelectorByDataFrameAddRemove() Me.ucrReceiverForRowSummaries = New instat.ucrReceiverMultiple() Me.ucrBase = New instat.ucrButtons() @@ -152,6 +152,11 @@ Partial Class dlgRowSummary Me.rdoSum.Tag = "Sum" Me.rdoSum.UseVisualStyleBackColor = True ' + 'ucrPanelStatistics + ' + resources.ApplyResources(Me.ucrPanelStatistics, "ucrPanelStatistics") + Me.ucrPanelStatistics.Name = "ucrPanelStatistics" + ' 'ucrChkIgnoreMissingValues ' Me.ucrChkIgnoreMissingValues.Checked = False @@ -163,13 +168,9 @@ Partial Class dlgRowSummary resources.ApplyResources(Me.ucrSaveResults, "ucrSaveResults") Me.ucrSaveResults.Name = "ucrSaveResults" ' - 'ucrPanelStatistics - ' - resources.ApplyResources(Me.ucrPanelStatistics, "ucrPanelStatistics") - Me.ucrPanelStatistics.Name = "ucrPanelStatistics" - ' 'ucrSelectorForRowSummaries ' + Me.ucrSelectorForRowSummaries.bDropUnusedFilterLevels = False Me.ucrSelectorForRowSummaries.bShowHiddenColumns = False Me.ucrSelectorForRowSummaries.bUseCurrentFilter = True resources.ApplyResources(Me.ucrSelectorForRowSummaries, "ucrSelectorForRowSummaries") diff --git a/instat/dlgRowSummary.resx b/instat/dlgRowSummary.resx index 265e71601fa..badcce124b0 100644 --- a/instat/dlgRowSummary.resx +++ b/instat/dlgRowSummary.resx @@ -486,8 +486,11 @@ 10, 271 + + 4, 5, 4, 5 + - 269, 24 + 269, 22 5 @@ -558,9 +561,6 @@ 7 - - NoControl - CenterScreen diff --git a/instat/dlgRowSummary.vb b/instat/dlgRowSummary.vb index c76fab4aae4..7f3c55dec7e 100644 --- a/instat/dlgRowSummary.vb +++ b/instat/dlgRowSummary.vb @@ -69,6 +69,7 @@ Public Class dlgRowSummary ucrSaveResults.SetDataFrameSelector(ucrSelectorForRowSummaries.ucrAvailableDataFrames) ucrSaveResults.SetLabelText("New Column Name:") ucrSaveResults.SetIsComboBox() + ucrSaveResults.setLinkedReceiver(ucrReceiverForRowSummaries) End Sub Private Sub SetDefaults() From 6554c03a0cda4d9735ec57823c4d0e2da963c2a7 Mon Sep 17 00:00:00 2001 From: patowhiz Date: Thu, 29 Apr 2021 12:55:29 +0300 Subject: [PATCH 07/27] Prepare > Check Data dialogs --- instat/dlgAnonymiseIDColumn.Designer.vb | 2 +- instat/dlgAnonymiseIDColumn.vb | 3 +- instat/dlgCompareColumns.resx | 110 ++++++++++++++++++------ instat/dlgCompareColumns.vb | 3 +- instat/dlgDuplicates.resx | 2 +- 5 files changed, 91 insertions(+), 29 deletions(-) diff --git a/instat/dlgAnonymiseIDColumn.Designer.vb b/instat/dlgAnonymiseIDColumn.Designer.vb index a386bd67cac..925ecd6aa1e 100644 --- a/instat/dlgAnonymiseIDColumn.Designer.vb +++ b/instat/dlgAnonymiseIDColumn.Designer.vb @@ -97,7 +97,7 @@ Partial Class dlgAnonymiseIDColumn Me.ucrSaveAnonymisedColumn.Location = New System.Drawing.Point(10, 205) Me.ucrSaveAnonymisedColumn.Margin = New System.Windows.Forms.Padding(4, 5, 4, 5) Me.ucrSaveAnonymisedColumn.Name = "ucrSaveAnonymisedColumn" - Me.ucrSaveAnonymisedColumn.Size = New System.Drawing.Size(250, 24) + Me.ucrSaveAnonymisedColumn.Size = New System.Drawing.Size(250, 22) Me.ucrSaveAnonymisedColumn.TabIndex = 7 ' 'ucrReceiverIDColumn diff --git a/instat/dlgAnonymiseIDColumn.vb b/instat/dlgAnonymiseIDColumn.vb index a2dd9a3cf7f..c387518d3ab 100644 --- a/instat/dlgAnonymiseIDColumn.vb +++ b/instat/dlgAnonymiseIDColumn.vb @@ -57,11 +57,12 @@ Public Class dlgAnonymiseIDColumn ucrInputAlgorithm.SetItems(dctAlgorithm) ucrInputAlgorithm.SetDropDownStyleAsNonEditable() - ucrSaveAnonymisedColumn.SetPrefix("Hash") + ucrSaveAnonymisedColumn.SetPrefix("hash") ucrSaveAnonymisedColumn.SetSaveTypeAsColumn() ucrSaveAnonymisedColumn.SetDataFrameSelector(ucrSelectorAnonymiseIDColumn.ucrAvailableDataFrames) ucrSaveAnonymisedColumn.SetIsTextBox() ucrSaveAnonymisedColumn.SetLabelText("Column Name:") + ucrSaveAnonymisedColumn.setLinkedReceiver(ucrReceiverIDColumn) End Sub Private Sub SetDefaults() diff --git a/instat/dlgCompareColumns.resx b/instat/dlgCompareColumns.resx index 52be4a37db7..ceb6fb5bcb6 100644 --- a/instat/dlgCompareColumns.resx +++ b/instat/dlgCompareColumns.resx @@ -180,6 +180,90 @@ 9 + + ucrChkAllValues + + + instat.ucrCheck, instat, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null + + + grpComparisions + + + 0 + + + ucrChkUnion + + + instat.ucrCheck, instat, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null + + + grpComparisions + + + 1 + + + ucrChkIntersection + + + instat.ucrCheck, instat, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null + + + grpComparisions + + + 2 + + + ucrChkSecondNotFirst + + + instat.ucrCheck, instat, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null + + + grpComparisions + + + 3 + + + ucrChkFirstNotSecond + + + instat.ucrCheck, instat, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null + + + grpComparisions + + + 4 + + + 10, 270 + + + 271, 154 + + + 7 + + + Comparisons to Display: + + + grpComparisions + + + System.Windows.Forms.GroupBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + $this + + + 7 + 11, 122 @@ -285,30 +369,6 @@ 4 - - 10, 270 - - - 271, 154 - - - 7 - - - Comparisons to Display: - - - grpComparisions - - - System.Windows.Forms.GroupBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - $this - - - 7 - True @@ -463,7 +523,7 @@ 4, 5, 4, 5 - 396, 24 + 280, 22 8 diff --git a/instat/dlgCompareColumns.vb b/instat/dlgCompareColumns.vb index 22b38f2f9bf..b2828d8a917 100644 --- a/instat/dlgCompareColumns.vb +++ b/instat/dlgCompareColumns.vb @@ -108,7 +108,8 @@ Public Class dlgCompareColumns ucrSaveLogical.SetSaveTypeAsColumn() ucrSaveLogical.SetDataFrameSelector(ucrSelectorCompareColumns.ucrAvailableDataFrames) ucrSaveLogical.SetIsComboBox() - ucrSaveLogical.SetLabelText("New Column Name") + ucrSaveLogical.SetLabelText("Save result for second column:") + ucrSaveLogical.setLinkedReceiver(ucrReceiverSecond) ucrBase.clsRsyntax.iCallType = 2 End Sub diff --git a/instat/dlgDuplicates.resx b/instat/dlgDuplicates.resx index 8bb0645ee9b..860217045af 100644 --- a/instat/dlgDuplicates.resx +++ b/instat/dlgDuplicates.resx @@ -646,7 +646,7 @@ 4, 5, 4, 5 - 281, 24 + 281, 22 15 From efd3c9f78a6879da381cb916332694993756f8a1 Mon Sep 17 00:00:00 2001 From: patowhiz Date: Thu, 29 Apr 2021 17:11:31 +0300 Subject: [PATCH 08/27] duplicates and save control enhancements --- instat/dlgDuplicates.vb | 5 +++++ instat/ucrSave.vb | 19 +++++++++++++++++-- 2 files changed, 22 insertions(+), 2 deletions(-) diff --git a/instat/dlgDuplicates.vb b/instat/dlgDuplicates.vb index 77a8d4b6f16..1044d23c358 100644 --- a/instat/dlgDuplicates.vb +++ b/instat/dlgDuplicates.vb @@ -235,6 +235,11 @@ Public Class dlgDuplicates Private Sub ucrPnlOptions_ControlContentsChanged(ucrChangedControl As ucrCore) Handles ucrPnlOptions.ControlValueChanged SetDataFrameOrColumns() + If rdoSelectedVariables.Checked Then + ucrNewColumnName.setLinkedReceiver(ucrReceiverForSelectedVariables) + ElseIf rdoSuccessiveValues.Checked Then + ucrNewColumnName.setLinkedReceiver(ucrReceiverForSuccessiveValues) + End If End Sub Private Sub ucrChkIncludeSummary_ControlValueChanged(ucrChangedControl As ucrCore) Handles ucrChkIncludeSummary.ControlValueChanged diff --git a/instat/ucrSave.vb b/instat/ucrSave.vb index 3e6b726c90d..df9087dafe5 100644 --- a/instat/ucrSave.vb +++ b/instat/ucrSave.vb @@ -883,8 +883,15 @@ Public Class ucrSave ''' calculation. '''-------------------------------------------------------------------------------------------- Public Sub setLinkedReceiver(ucrLinkedReceiver As ucrReceiver) + 'if there was a previous linked receiver, then remove the event handler from it + 'prevents multiple unnecessary calls that could be caused by previously linked receivers + If Me.ucrLinkedReceiver IsNot Nothing Then + RemoveHandler Me.ucrLinkedReceiver.ControlValueChanged, AddressOf LinkedReceiverControlValueChanged + End If Me.ucrLinkedReceiver = ucrLinkedReceiver - AddHandler ucrLinkedReceiver.ControlValueChanged, AddressOf LinkedReceiverControlValueChanged + AddHandler Me.ucrLinkedReceiver.ControlValueChanged, AddressOf LinkedReceiverControlValueChanged + 'call event handler to immediately get the values from the new receiver + LinkedReceiverControlValueChanged() End Sub '''-------------------------------------------------------------------------------------------- @@ -903,7 +910,15 @@ Public Class ucrSave Private Sub LinkedReceiverControlValueChanged() If Not sdgSaveColumnPosition.bUserSelected Then bInsertColumnBefore = False - strAdjacentColumn = If(Not ucrLinkedReceiver.IsEmpty, ucrLinkedReceiver.GetVariableNames(), "") + If ucrLinkedReceiver.IsEmpty Then + strAdjacentColumn = "" + Else + If TypeOf ucrLinkedReceiver Is ucrReceiverMultiple Then + strAdjacentColumn = ucrLinkedReceiver.GetVariableNamesList()(ucrLinkedReceiver.GetVariableNamesList().Length - 1) + Else + strAdjacentColumn = ucrLinkedReceiver.GetVariableNames() + End If + End If End If UpdateAssignTo() End Sub From b6c85a86bb7dd96153d263d2f2698e63cca17719 Mon Sep 17 00:00:00 2001 From: patowhiz Date: Thu, 29 Apr 2021 18:14:54 +0300 Subject: [PATCH 09/27] Prepare Menu dialogs --- instat/dlgCombineText.Designer.vb | 2 + instat/dlgCombineText.resx | 7 +- instat/dlgCombineText.vb | 3 +- instat/dlgEnter.resx | 362 ++++++++++++++++++---- instat/dlgStringDistance.resx | 2 +- instat/dlgStringDistance.vb | 2 +- instat/dlgStringHandling.resx | 2 +- instat/dlgStringHandling.vb | 2 +- instat/dlgTransformText.Designer.vb | 3 + instat/dlgTransformText.resx | 461 +++++++++++----------------- instat/dlgTransformText.vb | 3 +- 11 files changed, 497 insertions(+), 352 deletions(-) diff --git a/instat/dlgCombineText.Designer.vb b/instat/dlgCombineText.Designer.vb index ce9c0c99396..f6b0e82d996 100644 --- a/instat/dlgCombineText.Designer.vb +++ b/instat/dlgCombineText.Designer.vb @@ -67,6 +67,7 @@ Partial Class dlgCombineText 'ucrInputSeparator ' Me.ucrInputSeparator.AddQuotesIfUnrecognised = True + Me.ucrInputSeparator.GetSetSelectedIndex = -1 Me.ucrInputSeparator.IsReadOnly = False resources.ApplyResources(Me.ucrInputSeparator, "ucrInputSeparator") Me.ucrInputSeparator.Name = "ucrInputSeparator" @@ -82,6 +83,7 @@ Partial Class dlgCombineText ' 'ucrSelectorForCombineText ' + Me.ucrSelectorForCombineText.bDropUnusedFilterLevels = False Me.ucrSelectorForCombineText.bShowHiddenColumns = False Me.ucrSelectorForCombineText.bUseCurrentFilter = True resources.ApplyResources(Me.ucrSelectorForCombineText, "ucrSelectorForCombineText") diff --git a/instat/dlgCombineText.resx b/instat/dlgCombineText.resx index 8c6becbb5cf..6823247a740 100644 --- a/instat/dlgCombineText.resx +++ b/instat/dlgCombineText.resx @@ -176,8 +176,12 @@ 10, 209 + + + 4, 5, 4, 5 + - 305, 24 + 280, 22 5 @@ -227,7 +231,6 @@ 10, 10 - 0, 0, 0, 0 diff --git a/instat/dlgCombineText.vb b/instat/dlgCombineText.vb index d7896a0ce7c..4cd20dafc16 100644 --- a/instat/dlgCombineText.vb +++ b/instat/dlgCombineText.vb @@ -60,7 +60,8 @@ Public Class dlgCombineText ucrSaveColumn.SetPrefix("Combine") ucrSaveColumn.SetSaveTypeAsColumn() ucrSaveColumn.SetDataFrameSelector(ucrSelectorForCombineText.ucrAvailableDataFrames) - ucrSaveColumn.SetLabelText("Prefix for New Column:") + ucrSaveColumn.SetLabelText("New Column:") + ucrSaveColumn.setLinkedReceiver(ucrReceiverCombineText) iColumnsUsed = 0 End Sub diff --git a/instat/dlgEnter.resx b/instat/dlgEnter.resx index 7f86255ba66..5a5ba98e99d 100644 --- a/instat/dlgEnter.resx +++ b/instat/dlgEnter.resx @@ -495,6 +495,57 @@ 2 + + cmdText + + + System.Windows.Forms.Button, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + grpEnterKeyboard2 + + + 0 + + + cmdFactor + + + System.Windows.Forms.Button, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + grpEnterKeyboard2 + + + 1 + + + 378, 50 + + + 2, 3, 2, 3 + + + 2, 3, 2, 3 + + + 156, 134 + + + 159 + + + grpEnterKeyboard2 + + + System.Windows.Forms.GroupBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + $this + + + 4 + Microsoft Sans Serif, 8.25pt @@ -561,33 +612,6 @@ 1 - - 378, 50 - - - 2, 3, 2, 3 - - - 2, 3, 2, 3 - - - 156, 134 - - - 159 - - - grpEnterKeyboard2 - - - System.Windows.Forms.GroupBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - $this - - - 4 - NoControl @@ -618,6 +642,261 @@ 2 + + cmdClear + + + System.Windows.Forms.Button, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + grpBasic + + + 0 + + + Button1 + + + System.Windows.Forms.Button, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + grpBasic + + + 1 + + + cmdBrackets + + + System.Windows.Forms.Button, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + grpBasic + + + 2 + + + cmdPower + + + System.Windows.Forms.Button, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + grpBasic + + + 3 + + + cmdDivide + + + System.Windows.Forms.Button, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + grpBasic + + + 4 + + + cmdPlus + + + System.Windows.Forms.Button, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + grpBasic + + + 5 + + + cmdMinus + + + System.Windows.Forms.Button, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + grpBasic + + + 6 + + + cmdMultiply + + + System.Windows.Forms.Button, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + grpBasic + + + 7 + + + Button2 + + + System.Windows.Forms.Button, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + grpBasic + + + 8 + + + cmd9 + + + System.Windows.Forms.Button, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + grpBasic + + + 9 + + + cmd8 + + + System.Windows.Forms.Button, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + grpBasic + + + 10 + + + cmd7 + + + System.Windows.Forms.Button, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + grpBasic + + + 11 + + + cmd6 + + + System.Windows.Forms.Button, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + grpBasic + + + 12 + + + cmd5 + + + System.Windows.Forms.Button, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + grpBasic + + + 13 + + + cmd4 + + + System.Windows.Forms.Button, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + grpBasic + + + 14 + + + cmd3 + + + System.Windows.Forms.Button, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + grpBasic + + + 15 + + + cmd2 + + + System.Windows.Forms.Button, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + grpBasic + + + 16 + + + cmd0 + + + System.Windows.Forms.Button, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + grpBasic + + + 17 + + + cmd1 + + + System.Windows.Forms.Button, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + grpBasic + + + 18 + + + 170, 51 + + + 2, 3, 2, 3 + + + 2, 3, 2, 3 + + + 205, 134 + + + 180 + + + grpBasic + + + System.Windows.Forms.GroupBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + $this + + + 1 + NoControl @@ -1209,33 +1488,6 @@ 18 - - 170, 51 - - - 2, 3, 2, 3 - - - 2, 3, 2, 3 - - - 205, 134 - - - 180 - - - grpBasic - - - System.Windows.Forms.GroupBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - $this - - - 1 - 17, 5 @@ -1246,7 +1498,7 @@ 4, 5, 4, 5 - 308, 23 + 280, 22 181 diff --git a/instat/dlgStringDistance.resx b/instat/dlgStringDistance.resx index dc574127c9b..734fbc0728f 100644 --- a/instat/dlgStringDistance.resx +++ b/instat/dlgStringDistance.resx @@ -355,7 +355,7 @@ 4, 5, 4, 5 - 295, 24 + 285, 22 10 diff --git a/instat/dlgStringDistance.vb b/instat/dlgStringDistance.vb index 6762bc7a207..c63ae260a1a 100644 --- a/instat/dlgStringDistance.vb +++ b/instat/dlgStringDistance.vb @@ -82,7 +82,7 @@ Public Class dlgStringDistance ucrSaveStringDistance.SetSaveTypeAsColumn() ucrSaveStringDistance.SetDataFrameSelector(ucrSelectorStringDistance.ucrAvailableDataFrames) ucrSaveStringDistance.SetIsComboBox() - ucrSaveStringDistance.SetLabelText("Save Result:") + ucrSaveStringDistance.SetLabelText("New Column:") ucrSaveStringDistance.setLinkedReceiver(ucrReceiverStringDistance) End Sub diff --git a/instat/dlgStringHandling.resx b/instat/dlgStringHandling.resx index a58439881d4..644747619d4 100644 --- a/instat/dlgStringHandling.resx +++ b/instat/dlgStringHandling.resx @@ -1240,7 +1240,7 @@ 4, 5, 4, 5 - 328, 24 + 285, 22 19 diff --git a/instat/dlgStringHandling.vb b/instat/dlgStringHandling.vb index 3e1f25c3332..32d53218810 100644 --- a/instat/dlgStringHandling.vb +++ b/instat/dlgStringHandling.vb @@ -79,7 +79,7 @@ Public Class dlgStringHandling ucrSaveStringHandling.SetSaveTypeAsColumn() ucrSaveStringHandling.SetDataFrameSelector(ucrSelectorStringHandling.ucrAvailableDataFrames) ucrSaveStringHandling.SetIsComboBox() - ucrSaveStringHandling.SetLabelText("Prefix for New Column:") + ucrSaveStringHandling.SetLabelText("New Column:") ucrSaveStringHandling.setLinkedReceiver(ucrReceiverStringHandling) 'added 'ucrChkIncludeRegularExpressions diff --git a/instat/dlgTransformText.Designer.vb b/instat/dlgTransformText.Designer.vb index 870fcdf6731..2534f03a9b2 100644 --- a/instat/dlgTransformText.Designer.vb +++ b/instat/dlgTransformText.Designer.vb @@ -146,6 +146,7 @@ Partial Class dlgTransformText 'ucrInputSeparator ' Me.ucrInputSeparator.AddQuotesIfUnrecognised = True + Me.ucrInputSeparator.GetSetSelectedIndex = -1 Me.ucrInputSeparator.IsReadOnly = False resources.ApplyResources(Me.ucrInputSeparator, "ucrInputSeparator") Me.ucrInputSeparator.Name = "ucrInputSeparator" @@ -184,6 +185,7 @@ Partial Class dlgTransformText 'ucrInputPad ' Me.ucrInputPad.AddQuotesIfUnrecognised = True + Me.ucrInputPad.GetSetSelectedIndex = -1 Me.ucrInputPad.IsReadOnly = False resources.ApplyResources(Me.ucrInputPad, "ucrInputPad") Me.ucrInputPad.Name = "ucrInputPad" @@ -271,6 +273,7 @@ Partial Class dlgTransformText 'ucrInputTo ' Me.ucrInputTo.AddQuotesIfUnrecognised = True + Me.ucrInputTo.GetSetSelectedIndex = -1 Me.ucrInputTo.IsReadOnly = False resources.ApplyResources(Me.ucrInputTo, "ucrInputTo") Me.ucrInputTo.Name = "ucrInputTo" diff --git a/instat/dlgTransformText.resx b/instat/dlgTransformText.resx index 318b55c9ea3..ef6e6f76758 100644 --- a/instat/dlgTransformText.resx +++ b/instat/dlgTransformText.resx @@ -374,6 +374,28 @@ 507, 498 + + + Button + + + Flat + + + 252, 12 + + + 83, 27 + + + 4 + + + Trim + + + MiddleCenter + rdoTrim @@ -386,6 +408,27 @@ 1 + + Button + + + Flat + + + 333, 12 + + + 83, 27 + + + 5 + + + Words + + + MiddleCenter + rdoWords @@ -398,6 +441,27 @@ 2 + + Button + + + Flat + + + 414, 12 + + + 83, 27 + + + 6 + + + Substring + + + MiddleCenter + rdoSubstring @@ -410,6 +474,27 @@ 3 + + Button + + + Flat + + + 171, 12 + + + 83, 27 + + + 3 + + + Pad + + + MiddleCenter + rdoPad @@ -422,6 +507,27 @@ 4 + + Button + + + Flat + + + 90, 12 + + + 83, 27 + + + 2 + + + Length + + + MiddleCenter + rdoLength @@ -434,6 +540,27 @@ 5 + + Button + + + Flat + + + 9, 12 + + + 83, 27 + + + 1 + + + Convert Case + + + MiddleCenter + rdoConvertCase @@ -446,6 +573,18 @@ 6 + + 10, 417 + + + 4, 5, 4, 5 + + + 280, 22 + + + 11 + ucrNewColName @@ -458,6 +597,18 @@ 7 + + 253, 100 + + + 0, 0, 0, 0 + + + 135, 26 + + + 9 + ucrReceiverTransformText @@ -470,6 +621,18 @@ 10 + + 10, 50 + + + 0, 0, 0, 0 + + + 242, 185 + + + 7 + ucrSelectorForTransformText @@ -482,6 +645,15 @@ 11 + + 10, 442 + + + 410, 53 + + + 12 + ucrBase @@ -494,7 +666,6 @@ 12 - CenterScreen @@ -909,292 +1080,4 @@ 8 - - 253, 100 - - - 0, 0, 0, 0 - - - 135, 26 - - - 9 - - - ucrReceiverTransformText - - - instat.ucrReceiverSingle, instat, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null - - - $this - - - 10 - - - 10, 442 - - - 410, 53 - - - 12 - - - ucrBase - - - instat.ucrButtons, instat, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null - - - $this - - - 12 - - - 10, 417 - - - 272, 24 - - - 11 - - - ucrNewColName - - - instat.ucrSave, instat, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null - - - $this - - - 7 - - - 10, 50 - - - 0, 0, 0, 0 - - - 242, 185 - - - 7 - - - ucrSelectorForTransformText - - - instat.ucrSelectorByDataFrameAddRemove, instat, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null - - - $this - - - 11 - - - Button - - - Flat - - - 9, 12 - - - 83, 27 - - - 1 - - - Convert Case - - - MiddleCenter - - - rdoConvertCase - - - System.Windows.Forms.RadioButton, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - $this - - - 6 - - - Button - - - Flat - - - 90, 12 - - - 83, 27 - - - 2 - - - Length - - - MiddleCenter - - - rdoLength - - - System.Windows.Forms.RadioButton, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - $this - - - 5 - - - Button - - - Flat - - - 171, 12 - - - 83, 27 - - - 3 - - - Pad - - - MiddleCenter - - - rdoPad - - - System.Windows.Forms.RadioButton, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - $this - - - 4 - - - Button - - - Flat - - - 414, 12 - - - 83, 27 - - - 6 - - - Substring - - - MiddleCenter - - - rdoSubstring - - - System.Windows.Forms.RadioButton, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - $this - - - 3 - - - Button - - - Flat - - - 333, 12 - - - 83, 27 - - - 5 - - - Words - - - MiddleCenter - - - rdoWords - - - System.Windows.Forms.RadioButton, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - $this - - - 2 - - - Button - - - Flat - - - 252, 12 - - - 83, 27 - - - 4 - - - Trim - - - MiddleCenter - - - rdoTrim - - - System.Windows.Forms.RadioButton, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - $this - - - 1 - \ No newline at end of file diff --git a/instat/dlgTransformText.vb b/instat/dlgTransformText.vb index 170629b4c72..791b7a4f722 100644 --- a/instat/dlgTransformText.vb +++ b/instat/dlgTransformText.vb @@ -177,7 +177,8 @@ Public Class dlgTransformText ucrNewColName.SetIsComboBox() ucrNewColName.SetSaveTypeAsColumn() ucrNewColName.SetDataFrameSelector(ucrSelectorForTransformText.ucrAvailableDataFrames) - ucrNewColName.SetLabelText("Column Name:") + ucrNewColName.SetLabelText("New Column:") + ucrNewColName.setLinkedReceiver(ucrReceiverTransformText) End Sub Private Sub SetDefaults() From a0eca2d62b981e93f872bf668619636c28c468c8 Mon Sep 17 00:00:00 2001 From: patowhiz Date: Thu, 29 Apr 2021 18:25:15 +0300 Subject: [PATCH 10/27] made changes to dlgEnter --- instat/dlgEnter.vb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/instat/dlgEnter.vb b/instat/dlgEnter.vb index 930294eac70..bbe4599700a 100644 --- a/instat/dlgEnter.vb +++ b/instat/dlgEnter.vb @@ -51,10 +51,10 @@ Public Class dlgEnter clsDetach.AddParameter("name", clsRFunctionParameter:=ucrDataFrameEnter.clsCurrDataFrame) clsDetach.AddParameter("unload", "TRUE") ucrBase.clsRsyntax.SetCommandString("") - ucrSaveEnterResultInto.SetSaveTypeAsColumn() ucrSaveEnterResultInto.SetPrefix("enter") - ucrSaveEnterResultInto.SetIsComboBox() ucrSaveEnterResultInto.SetDataFrameSelector(ucrDataFrameEnter) + ucrSaveEnterResultInto.SetIsComboBox() + ucrSaveEnterResultInto.SetSaveTypeAsColumn() ucrSaveEnterResultInto.SetLabelText("Enter Result Into:") 'Adding tooltips for the buttons From b210058ef3523364f3d2b6e4a0638878766a7011 Mon Sep 17 00:00:00 2001 From: ivanluv Date: Mon, 3 May 2021 09:36:35 +0300 Subject: [PATCH 11/27] Adding NA_real_ --- instat/dlgInsertColumn.vb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/instat/dlgInsertColumn.vb b/instat/dlgInsertColumn.vb index db932939b9d..6464672b86d 100644 --- a/instat/dlgInsertColumn.vb +++ b/instat/dlgInsertColumn.vb @@ -128,7 +128,7 @@ Public Class dlgInsertColumn clsInsertColumnFunction.SetRCommand(frmMain.clsRLink.strInstatDataObject & "$add_columns_to_data") clsInsertColumnFunction.AddParameter("use_col_name_as_prefix", "TRUE", iPosition:=7) clsInsertColumnFunction.AddParameter("before", "FALSE", iPosition:=3) - clsInsertColumnFunction.AddParameter("col_data", "NA", iPosition:=5) + clsInsertColumnFunction.AddParameter("col_data", "NA_real_", iPosition:=5) clsInsertColumnFunction.AddParameter("col_name", "X", iPosition:=6) clsInsertRowFunction.SetRCommand(frmMain.clsRLink.strInstatDataObject & "$insert_row_in_data") From f4451747bbbba4e6769aae41fc5e335a3cd2ca73 Mon Sep 17 00:00:00 2001 From: ivanluv Date: Mon, 3 May 2021 12:16:50 +0300 Subject: [PATCH 12/27] minor change --- instat/dlgInsertColumn.vb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/instat/dlgInsertColumn.vb b/instat/dlgInsertColumn.vb index 6464672b86d..db932939b9d 100644 --- a/instat/dlgInsertColumn.vb +++ b/instat/dlgInsertColumn.vb @@ -128,7 +128,7 @@ Public Class dlgInsertColumn clsInsertColumnFunction.SetRCommand(frmMain.clsRLink.strInstatDataObject & "$add_columns_to_data") clsInsertColumnFunction.AddParameter("use_col_name_as_prefix", "TRUE", iPosition:=7) clsInsertColumnFunction.AddParameter("before", "FALSE", iPosition:=3) - clsInsertColumnFunction.AddParameter("col_data", "NA_real_", iPosition:=5) + clsInsertColumnFunction.AddParameter("col_data", "NA", iPosition:=5) clsInsertColumnFunction.AddParameter("col_name", "X", iPosition:=6) clsInsertRowFunction.SetRCommand(frmMain.clsRLink.strInstatDataObject & "$insert_row_in_data") From 8b4e051493260094407d0a21a78c871c987a6a16 Mon Sep 17 00:00:00 2001 From: ivanluv Date: Mon, 3 May 2021 14:19:11 +0300 Subject: [PATCH 13/27] adding the as numeric rfunction as parameter for the col_data --- instat/dlgInsertColumn.vb | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/instat/dlgInsertColumn.vb b/instat/dlgInsertColumn.vb index db932939b9d..82c4ea77c66 100644 --- a/instat/dlgInsertColumn.vb +++ b/instat/dlgInsertColumn.vb @@ -18,7 +18,7 @@ Imports instat.Translations Public Class dlgInsertColumn Private bFirstload As Boolean = True Private bReset As Boolean = True - Private clsInsertRowFunction, clsInsertColumnFunction As New RFunction + Private clsInsertRowFunction, clsInsertColumnFunction, clsAsNumericFunction As New RFunction Private Sub dlgInsertColumn_Load(sender As Object, e As EventArgs) Handles MyBase.Load If bFirstload Then @@ -74,7 +74,7 @@ Public Class dlgInsertColumn ucrNudNumberOfColumns.SetRDefault(1) ucrNudNumberOfColumns.SetMinMax(1, Integer.MaxValue) - ucrInputDefaultValue.SetParameter(New RParameter("col_data", 5)) + ucrInputDefaultValue.SetParameter(New RParameter("col_data", 0, bNewIncludeArgumentName:=False)) ucrInputDefaultValue.AddQuotesIfUnrecognised = False @@ -119,16 +119,20 @@ Public Class dlgInsertColumn Private Sub SetDefaults() clsInsertColumnFunction = New RFunction clsInsertRowFunction = New RFunction + clsAsNumericFunction = New RFunction ucrSelectorInsertColumns.Reset() ucrInputBeforeAfter.Reset() ucrInputDefaultValue.Reset() ucrInputPrefixForNewColumn.Reset() + clsAsNumericFunction.SetRCommand("as.numeric") + clsAsNumericFunction.AddParameter("col_data", "NA", bIncludeArgumentName:=False, iPosition:=0) + clsInsertColumnFunction.SetRCommand(frmMain.clsRLink.strInstatDataObject & "$add_columns_to_data") clsInsertColumnFunction.AddParameter("use_col_name_as_prefix", "TRUE", iPosition:=7) clsInsertColumnFunction.AddParameter("before", "FALSE", iPosition:=3) - clsInsertColumnFunction.AddParameter("col_data", "NA", iPosition:=5) + clsInsertColumnFunction.AddParameter("col_data", clsRFunctionParameter:=clsAsNumericFunction, iPosition:=5) clsInsertColumnFunction.AddParameter("col_name", "X", iPosition:=6) clsInsertRowFunction.SetRCommand(frmMain.clsRLink.strInstatDataObject & "$insert_row_in_data") @@ -144,8 +148,9 @@ Public Class dlgInsertColumn ucrNudStartRow.SetRCode(clsInsertRowFunction, bReset) ucrPnlBeforeAfter.SetRCode(clsInsertRowFunction, bReset) + ucrInputDefaultValue.SetRCode(clsAsNumericFunction, bReset) + ucrNudNumberOfColumns.SetRCode(clsInsertColumnFunction, bReset) - ucrInputDefaultValue.SetRCode(clsInsertColumnFunction, bReset) ucrInputPrefixForNewColumn.SetRCode(clsInsertColumnFunction, bReset) ucrReceiverColumnsToInsert.SetRCode(clsInsertColumnFunction, bReset) ucrSelectorInsertColumns.SetRCode(clsInsertColumnFunction, bReset) From c4917b00edecc309b61f1becfb4a9b031e2273aa Mon Sep 17 00:00:00 2001 From: ivanluv Date: Mon, 3 May 2021 14:33:36 +0300 Subject: [PATCH 14/27] Minor change --- instat/dlgInsertColumn.vb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/instat/dlgInsertColumn.vb b/instat/dlgInsertColumn.vb index 82c4ea77c66..7a771d0ae54 100644 --- a/instat/dlgInsertColumn.vb +++ b/instat/dlgInsertColumn.vb @@ -74,7 +74,7 @@ Public Class dlgInsertColumn ucrNudNumberOfColumns.SetRDefault(1) ucrNudNumberOfColumns.SetMinMax(1, Integer.MaxValue) - ucrInputDefaultValue.SetParameter(New RParameter("col_data", 0, bNewIncludeArgumentName:=False)) + ucrInputDefaultValue.SetParameter(New RParameter("x", 0)) ucrInputDefaultValue.AddQuotesIfUnrecognised = False @@ -127,7 +127,7 @@ Public Class dlgInsertColumn ucrInputPrefixForNewColumn.Reset() clsAsNumericFunction.SetRCommand("as.numeric") - clsAsNumericFunction.AddParameter("col_data", "NA", bIncludeArgumentName:=False, iPosition:=0) + clsAsNumericFunction.AddParameter("x", "NA", iPosition:=0) clsInsertColumnFunction.SetRCommand(frmMain.clsRLink.strInstatDataObject & "$add_columns_to_data") clsInsertColumnFunction.AddParameter("use_col_name_as_prefix", "TRUE", iPosition:=7) From 4920782fd74d52b60c05a9bd1d51e3ac2cbf7545 Mon Sep 17 00:00:00 2001 From: ivanluv Date: Mon, 3 May 2021 16:07:57 +0300 Subject: [PATCH 15/27] minor change --- instat/dlgInsertColumn.Designer.vb | 22 ++++++------ instat/dlgInsertColumn.resx | 54 +++++++++++++++--------------- instat/dlgInsertColumn.vb | 20 +++++------ 3 files changed, 46 insertions(+), 50 deletions(-) diff --git a/instat/dlgInsertColumn.Designer.vb b/instat/dlgInsertColumn.Designer.vb index 26272208dd4..6e2b27250ca 100644 --- a/instat/dlgInsertColumn.Designer.vb +++ b/instat/dlgInsertColumn.Designer.vb @@ -63,11 +63,11 @@ Partial Class dlgInsertColumn Me.ucrInputPrefixForNewColumn = New instat.ucrInputTextBox() Me.ucrNudNumberOfColumns = New instat.ucrNud() Me.ucrPnlColumnsOrRows = New instat.UcrPanel() - Me.ucrInputDefaultValue = New instat.ucrInputTextBox() Me.ucrBase = New instat.ucrButtons() Me.ucrNudNumberOfRows = New instat.ucrNud() Me.ucrNudStartRow = New instat.ucrNud() Me.ttColumnDefaultValue = New System.Windows.Forms.ToolTip(Me.components) + Me.ucrInputDefaultValue = New instat.ucrInputComboBox() Me.grpInsert.SuspendLayout() Me.grpOptions.SuspendLayout() Me.SuspendLayout() @@ -237,14 +237,6 @@ Partial Class dlgInsertColumn resources.ApplyResources(Me.ucrPnlColumnsOrRows, "ucrPnlColumnsOrRows") Me.ucrPnlColumnsOrRows.Name = "ucrPnlColumnsOrRows" ' - 'ucrInputDefaultValue - ' - Me.ucrInputDefaultValue.AddQuotesIfUnrecognised = True - Me.ucrInputDefaultValue.IsMultiline = False - Me.ucrInputDefaultValue.IsReadOnly = False - resources.ApplyResources(Me.ucrInputDefaultValue, "ucrInputDefaultValue") - Me.ucrInputDefaultValue.Name = "ucrInputDefaultValue" - ' 'ucrBase ' resources.ApplyResources(Me.ucrBase, "ucrBase") @@ -270,10 +262,19 @@ Partial Class dlgInsertColumn Me.ucrNudStartRow.Name = "ucrNudStartRow" Me.ucrNudStartRow.Value = New Decimal(New Integer() {0, 0, 0, 0}) ' + 'ucrInputDefaultValue + ' + Me.ucrInputDefaultValue.AddQuotesIfUnrecognised = True + Me.ucrInputDefaultValue.GetSetSelectedIndex = -1 + Me.ucrInputDefaultValue.IsReadOnly = False + resources.ApplyResources(Me.ucrInputDefaultValue, "ucrInputDefaultValue") + Me.ucrInputDefaultValue.Name = "ucrInputDefaultValue" + ' 'dlgInsertColumn ' resources.ApplyResources(Me, "$this") Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font + Me.Controls.Add(Me.ucrInputDefaultValue) Me.Controls.Add(Me.lblInputColumnPrefix) Me.Controls.Add(Me.ucrInputPrefixForNewColumn) Me.Controls.Add(Me.ucrNudNumberOfColumns) @@ -281,7 +282,6 @@ Partial Class dlgInsertColumn Me.Controls.Add(Me.rdoInsertColumns) Me.Controls.Add(Me.ucrPnlColumnsOrRows) Me.Controls.Add(Me.grpOptions) - Me.Controls.Add(Me.ucrInputDefaultValue) Me.Controls.Add(Me.lblDefaultValue) Me.Controls.Add(Me.lblNumberOfColumnsToInsert) Me.Controls.Add(Me.lblStartPos) @@ -312,7 +312,6 @@ Partial Class dlgInsertColumn Friend WithEvents ucrReceiverColumnsToInsert As ucrReceiverSingle Friend WithEvents lblNumberOfColumnsToInsert As Label Friend WithEvents lblDefaultValue As Label - Friend WithEvents ucrInputDefaultValue As ucrInputTextBox Friend WithEvents grpOptions As GroupBox Friend WithEvents rdoAfter As RadioButton Friend WithEvents rdoBefore As RadioButton @@ -330,4 +329,5 @@ Partial Class dlgInsertColumn Friend WithEvents lblColumn As Label Friend WithEvents ucrSelectorInsertColumns As ucrSelectorByDataFrameAddRemove Friend WithEvents ttColumnDefaultValue As ToolTip + Friend WithEvents ucrInputDefaultValue As ucrInputComboBox End Class diff --git a/instat/dlgInsertColumn.resx b/instat/dlgInsertColumn.resx index dd9242eaea6..de9078191b5 100644 --- a/instat/dlgInsertColumn.resx +++ b/instat/dlgInsertColumn.resx @@ -224,6 +224,27 @@ 526, 369 + + 219, 258 + + + 105, 21 + + + 17 + + + ucrInputDefaultValue + + + instat.ucrInputComboBox, instat, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null + + + $this + + + 0 + 11, 289 @@ -246,7 +267,7 @@ $this - 0 + 1 220, 286 @@ -267,7 +288,7 @@ $this - 1 + 2 220, 233 @@ -288,7 +309,7 @@ $this - 2 + 3 @@ -322,7 +343,7 @@ $this - 3 + 4 Button @@ -355,7 +376,7 @@ $this - 4 + 5 161, 12 @@ -376,7 +397,7 @@ $this - 5 + 6 True @@ -475,27 +496,6 @@ $this - 6 - - - 220, 259 - - - 49, 21 - - - 15 - - - ucrInputDefaultValue - - - instat.ucrInputTextBox, instat, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null - - - $this - - 7 diff --git a/instat/dlgInsertColumn.vb b/instat/dlgInsertColumn.vb index 7a771d0ae54..15e2ee09cc0 100644 --- a/instat/dlgInsertColumn.vb +++ b/instat/dlgInsertColumn.vb @@ -18,7 +18,7 @@ Imports instat.Translations Public Class dlgInsertColumn Private bFirstload As Boolean = True Private bReset As Boolean = True - Private clsInsertRowFunction, clsInsertColumnFunction, clsAsNumericFunction As New RFunction + Private clsInsertRowFunction, clsInsertColumnFunction As New RFunction Private Sub dlgInsertColumn_Load(sender As Object, e As EventArgs) Handles MyBase.Load If bFirstload Then @@ -74,9 +74,10 @@ Public Class dlgInsertColumn ucrNudNumberOfColumns.SetRDefault(1) ucrNudNumberOfColumns.SetMinMax(1, Integer.MaxValue) - ucrInputDefaultValue.SetParameter(New RParameter("x", 0)) + ucrInputDefaultValue.SetParameter(New RParameter("col_data", 5)) + ucrInputDefaultValue.SetItems({"NA", "NA_real_"}, bAddConditions:=True, bAddQuotes:=False) ucrInputDefaultValue.AddQuotesIfUnrecognised = False - + ucrInputDefaultValue.bAllowNonConditionValues = True ucrPnlInsertColumns.SetParameter(New RParameter("before", 3)) ucrPnlInsertColumns.AddRadioButton(rdoAtStart, "TRUE") @@ -113,26 +114,22 @@ Public Class dlgInsertColumn ucrNudStartRow.SetLinkedDisplayControl(lblStartPos) ucrReceiverColumnsToInsert.SetLinkedDisplayControl(lblColumn) - ttColumnDefaultValue.SetToolTip(ucrInputDefaultValue.txtInput, "Include the quotes if the default value is a string, e.g. ""small""") + ttColumnDefaultValue.SetToolTip(ucrInputDefaultValue.cboInput, "Include the quotes if the default value is a string, e.g. ""small"".Do not include qoutes if its logical, e.g. TRUE") End Sub Private Sub SetDefaults() clsInsertColumnFunction = New RFunction clsInsertRowFunction = New RFunction - clsAsNumericFunction = New RFunction ucrSelectorInsertColumns.Reset() ucrInputBeforeAfter.Reset() ucrInputDefaultValue.Reset() ucrInputPrefixForNewColumn.Reset() - clsAsNumericFunction.SetRCommand("as.numeric") - clsAsNumericFunction.AddParameter("x", "NA", iPosition:=0) - clsInsertColumnFunction.SetRCommand(frmMain.clsRLink.strInstatDataObject & "$add_columns_to_data") clsInsertColumnFunction.AddParameter("use_col_name_as_prefix", "TRUE", iPosition:=7) clsInsertColumnFunction.AddParameter("before", "FALSE", iPosition:=3) - clsInsertColumnFunction.AddParameter("col_data", clsRFunctionParameter:=clsAsNumericFunction, iPosition:=5) + clsInsertColumnFunction.AddParameter("col_data", "NA", iPosition:=5) clsInsertColumnFunction.AddParameter("col_name", "X", iPosition:=6) clsInsertRowFunction.SetRCommand(frmMain.clsRLink.strInstatDataObject & "$insert_row_in_data") @@ -148,8 +145,7 @@ Public Class dlgInsertColumn ucrNudStartRow.SetRCode(clsInsertRowFunction, bReset) ucrPnlBeforeAfter.SetRCode(clsInsertRowFunction, bReset) - ucrInputDefaultValue.SetRCode(clsAsNumericFunction, bReset) - + ucrInputDefaultValue.SetRCode(clsInsertColumnFunction, bReset) ucrNudNumberOfColumns.SetRCode(clsInsertColumnFunction, bReset) ucrInputPrefixForNewColumn.SetRCode(clsInsertColumnFunction, bReset) ucrReceiverColumnsToInsert.SetRCode(clsInsertColumnFunction, bReset) @@ -192,7 +188,7 @@ Public Class dlgInsertColumn ReopenDialog() End Sub - Private Sub ucrReceiverColumnsToInsert_ControlContentsChanged(ucrChangedControl As ucrCore) Handles ucrReceiverColumnsToInsert.ControlContentsChanged, ucrPnlColumnsOrRows.ControlContentsChanged, ucrPnlBeforeAfter.ControlContentsChanged, ucrPnlInsertColumns.ControlContentsChanged, ucrInputPrefixForNewColumn.ControlContentsChanged, ucrInputDefaultValue.ControlContentsChanged, ucrInputBeforeAfter.ControlContentsChanged, ucrNudNumberOfRows.ControlContentsChanged, ucrNudStartRow.ControlContentsChanged, ucrNudNumberOfColumns.ControlContentsChanged, ucrSelectorInsertColumns.ControlContentsChanged + Private Sub ucrReceiverColumnsToInsert_ControlContentsChanged(ucrChangedControl As ucrCore) Handles ucrReceiverColumnsToInsert.ControlContentsChanged, ucrPnlColumnsOrRows.ControlContentsChanged, ucrPnlBeforeAfter.ControlContentsChanged, ucrPnlInsertColumns.ControlContentsChanged, ucrInputPrefixForNewColumn.ControlContentsChanged, ucrInputBeforeAfter.ControlContentsChanged, ucrNudNumberOfRows.ControlContentsChanged, ucrNudStartRow.ControlContentsChanged, ucrNudNumberOfColumns.ControlContentsChanged, ucrSelectorInsertColumns.ControlContentsChanged, ucrInputDefaultValue.ControlValueChanged TestOKEnabled() End Sub From 584b60fdfb936f5c60d5a80c8522bf4fcc78604f Mon Sep 17 00:00:00 2001 From: ivanluv Date: Tue, 4 May 2021 10:53:29 +0300 Subject: [PATCH 16/27] Removing reduntant code and adding more Na options --- instat/dlgInsertColumn.vb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/instat/dlgInsertColumn.vb b/instat/dlgInsertColumn.vb index 15e2ee09cc0..3538ec56313 100644 --- a/instat/dlgInsertColumn.vb +++ b/instat/dlgInsertColumn.vb @@ -75,7 +75,7 @@ Public Class dlgInsertColumn ucrNudNumberOfColumns.SetMinMax(1, Integer.MaxValue) ucrInputDefaultValue.SetParameter(New RParameter("col_data", 5)) - ucrInputDefaultValue.SetItems({"NA", "NA_real_"}, bAddConditions:=True, bAddQuotes:=False) + ucrInputDefaultValue.SetItems({"NA", "NA_real_", " NA_integer_", " NA_complex_", "NA_character_"}) ucrInputDefaultValue.AddQuotesIfUnrecognised = False ucrInputDefaultValue.bAllowNonConditionValues = True From 69dae3dc71b67e3ebf815bcb5b7d1ffe5ae911ac Mon Sep 17 00:00:00 2001 From: patowhiz Date: Wed, 5 May 2021 10:49:23 +0300 Subject: [PATCH 17/27] dlgRecodeNumeric translation change --- instat/dlgRecodeNumeric.vb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/instat/dlgRecodeNumeric.vb b/instat/dlgRecodeNumeric.vb index 1d3fdcca815..3fb6fe06b0b 100644 --- a/instat/dlgRecodeNumeric.vb +++ b/instat/dlgRecodeNumeric.vb @@ -20,7 +20,6 @@ Public Class dlgRecodeNumeric Public strDefaultDataFrame As String = "" Public strDefaultColumn As String = "" Private Sub dlgRecode_Load(sender As Object, e As EventArgs) Handles MyBase.Load - autoTranslate(Me) If bFirstLoad Then InitialiseDialog() SetDefaults() @@ -31,6 +30,7 @@ Public Class dlgRecodeNumeric SetDefaultColumn() TestOKEnabled() ucrBase.iHelpTopicID = 43 + autoTranslate(Me) End Sub Private Sub InitialiseDialog() From ec21b8bbf24ca681a7d3b7aaed9898a1192df2d7 Mon Sep 17 00:00:00 2001 From: Antoine Ntalumeso Date: Thu, 6 May 2021 11:53:55 +0200 Subject: [PATCH 18/27] Small design fixes --- instat/dlgClimaticDataEntry.vb | 5 +++++ instat/dlgEnter.resx | 9 ++++++--- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/instat/dlgClimaticDataEntry.vb b/instat/dlgClimaticDataEntry.vb index 66ff5785554..e4fb6727e11 100644 --- a/instat/dlgClimaticDataEntry.vb +++ b/instat/dlgClimaticDataEntry.vb @@ -32,6 +32,7 @@ Public Class dlgClimaticDataEntry Private ReadOnly strRange As String = "Range" Private bChange As Boolean = False Private bSubdialogFirstLoad As Boolean = True + Private bRemoveValueChanged As Boolean = True Private bState As Boolean = False Private bResetSubdialogs As Boolean @@ -43,6 +44,10 @@ Public Class dlgClimaticDataEntry If bReset Then SetDefaults() End If + If bRemoveValueChanged Then + AddHandler ucrReceiverStation.ControlValueChanged, AddressOf StationControls_ControlValueChanged + bRemoveValueChanged = False + End If SetRCodeForControls(bReset) bReset = False autoTranslate(Me) diff --git a/instat/dlgEnter.resx b/instat/dlgEnter.resx index 7f86255ba66..d67d5b1bd29 100644 --- a/instat/dlgEnter.resx +++ b/instat/dlgEnter.resx @@ -592,7 +592,7 @@ NoControl - 419, 16 + 436, 16 2, 2, 2, 2 @@ -1341,6 +1341,9 @@ 9 + + NoControl + CenterScreen @@ -1360,13 +1363,13 @@ System.Windows.Forms.Form, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - 44, 16 + 69, 16 2, 3, 2, 3 - 254, 28 + 229, 28 153 From c097a18d06201ed68c0d48dc3e460e5d8b3bd699 Mon Sep 17 00:00:00 2001 From: patowhiz Date: Thu, 6 May 2021 18:26:56 +0300 Subject: [PATCH 19/27] dlgCompare changes --- instat/dlgCompare.Designer.vb | 86 ++----------- instat/dlgCompare.resx | 230 +++++++--------------------------- instat/dlgCompare.vb | 153 ++++++++++++---------- 3 files changed, 145 insertions(+), 324 deletions(-) diff --git a/instat/dlgCompare.Designer.vb b/instat/dlgCompare.Designer.vb index b92fc688b38..bf6f2aa03f1 100644 --- a/instat/dlgCompare.Designer.vb +++ b/instat/dlgCompare.Designer.vb @@ -29,23 +29,17 @@ Partial Class dlgCompare Me.lblWithinYear = New System.Windows.Forms.Label() Me.rdoAnomalies = New System.Windows.Forms.RadioButton() Me.rdoDifferences = New System.Windows.Forms.RadioButton() - Me.lblSateliteAnomalies = New System.Windows.Forms.Label() - Me.lblStationAnomalies = New System.Windows.Forms.Label() + Me.ucrSaveSecondCol = New instat.ucrSave() + Me.ucrSaveFirstCol = New instat.ucrSave() Me.ucrReceiverWithinYear = New instat.ucrReceiverSingle() Me.ucrReceiverStationElement = New instat.ucrReceiverSingle() Me.ucrReceiverStation = New instat.ucrReceiverSingle() Me.ucrReceiverSateliteElement = New instat.ucrReceiverSingle() - Me.ucrInputStationAnomalies = New instat.ucrInputTextBox() - Me.ucrInputSateliteAnomalies = New instat.ucrInputTextBox() - Me.ucrChkBias = New instat.ucrCheck() - Me.ucrInputAbsDev = New instat.ucrInputTextBox() - Me.ucrInputBias = New instat.ucrInputTextBox() Me.ucrNudMovingAverage = New instat.ucrNud() Me.ucrPnlCompare = New instat.UcrPanel() Me.ucrChkMovingAverage = New instat.ucrCheck() Me.ucrBase = New instat.ucrButtons() Me.ucrSelectorCompare = New instat.ucrSelectorByDataFrameAddRemove() - Me.ucrChkAbsDev = New instat.ucrCheck() Me.SuspendLayout() ' 'lblStation @@ -88,15 +82,15 @@ Partial Class dlgCompare Me.rdoDifferences.TabStop = True Me.rdoDifferences.UseVisualStyleBackColor = True ' - 'lblSateliteAnomalies + 'ucrSaveSecondCol ' - resources.ApplyResources(Me.lblSateliteAnomalies, "lblSateliteAnomalies") - Me.lblSateliteAnomalies.Name = "lblSateliteAnomalies" + resources.ApplyResources(Me.ucrSaveSecondCol, "ucrSaveSecondCol") + Me.ucrSaveSecondCol.Name = "ucrSaveSecondCol" ' - 'lblStationAnomalies + 'ucrSaveFirstCol ' - resources.ApplyResources(Me.lblStationAnomalies, "lblStationAnomalies") - Me.lblStationAnomalies.Name = "lblStationAnomalies" + resources.ApplyResources(Me.ucrSaveFirstCol, "ucrSaveFirstCol") + Me.ucrSaveFirstCol.Name = "ucrSaveFirstCol" ' 'ucrReceiverWithinYear ' @@ -134,44 +128,6 @@ Partial Class dlgCompare Me.ucrReceiverSateliteElement.strNcFilePath = "" Me.ucrReceiverSateliteElement.ucrSelector = Nothing ' - 'ucrInputStationAnomalies - ' - Me.ucrInputStationAnomalies.AddQuotesIfUnrecognised = True - Me.ucrInputStationAnomalies.IsMultiline = False - Me.ucrInputStationAnomalies.IsReadOnly = False - resources.ApplyResources(Me.ucrInputStationAnomalies, "ucrInputStationAnomalies") - Me.ucrInputStationAnomalies.Name = "ucrInputStationAnomalies" - ' - 'ucrInputSateliteAnomalies - ' - Me.ucrInputSateliteAnomalies.AddQuotesIfUnrecognised = True - Me.ucrInputSateliteAnomalies.IsMultiline = False - Me.ucrInputSateliteAnomalies.IsReadOnly = False - resources.ApplyResources(Me.ucrInputSateliteAnomalies, "ucrInputSateliteAnomalies") - Me.ucrInputSateliteAnomalies.Name = "ucrInputSateliteAnomalies" - ' - 'ucrChkBias - ' - Me.ucrChkBias.Checked = False - resources.ApplyResources(Me.ucrChkBias, "ucrChkBias") - Me.ucrChkBias.Name = "ucrChkBias" - ' - 'ucrInputAbsDev - ' - Me.ucrInputAbsDev.AddQuotesIfUnrecognised = True - Me.ucrInputAbsDev.IsMultiline = False - Me.ucrInputAbsDev.IsReadOnly = False - resources.ApplyResources(Me.ucrInputAbsDev, "ucrInputAbsDev") - Me.ucrInputAbsDev.Name = "ucrInputAbsDev" - ' - 'ucrInputBias - ' - Me.ucrInputBias.AddQuotesIfUnrecognised = True - Me.ucrInputBias.IsMultiline = False - Me.ucrInputBias.IsReadOnly = False - resources.ApplyResources(Me.ucrInputBias, "ucrInputBias") - Me.ucrInputBias.Name = "ucrInputBias" - ' 'ucrNudMovingAverage ' Me.ucrNudMovingAverage.DecimalPlaces = New Decimal(New Integer() {0, 0, 0, 0}) @@ -206,30 +162,18 @@ Partial Class dlgCompare resources.ApplyResources(Me.ucrSelectorCompare, "ucrSelectorCompare") Me.ucrSelectorCompare.Name = "ucrSelectorCompare" ' - 'ucrChkAbsDev - ' - Me.ucrChkAbsDev.Checked = False - resources.ApplyResources(Me.ucrChkAbsDev, "ucrChkAbsDev") - Me.ucrChkAbsDev.Name = "ucrChkAbsDev" - ' 'dlgCompare ' resources.ApplyResources(Me, "$this") Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font + Me.Controls.Add(Me.ucrSaveSecondCol) + Me.Controls.Add(Me.ucrSaveFirstCol) Me.Controls.Add(Me.ucrReceiverWithinYear) Me.Controls.Add(Me.ucrReceiverStationElement) Me.Controls.Add(Me.ucrReceiverStation) Me.Controls.Add(Me.ucrReceiverSateliteElement) - Me.Controls.Add(Me.lblStationAnomalies) - Me.Controls.Add(Me.lblSateliteAnomalies) - Me.Controls.Add(Me.ucrInputStationAnomalies) - Me.Controls.Add(Me.ucrInputSateliteAnomalies) Me.Controls.Add(Me.lblStationElement) Me.Controls.Add(Me.lblSateliteElement) - Me.Controls.Add(Me.ucrChkAbsDev) - Me.Controls.Add(Me.ucrChkBias) - Me.Controls.Add(Me.ucrInputAbsDev) - Me.Controls.Add(Me.ucrInputBias) Me.Controls.Add(Me.ucrNudMovingAverage) Me.Controls.Add(Me.rdoAnomalies) Me.Controls.Add(Me.rdoDifferences) @@ -259,16 +203,10 @@ Partial Class dlgCompare Friend WithEvents rdoDifferences As RadioButton Friend WithEvents ucrPnlCompare As UcrPanel Friend WithEvents ucrNudMovingAverage As ucrNud - Friend WithEvents ucrChkBias As ucrCheck - Friend WithEvents ucrInputAbsDev As ucrInputTextBox - Friend WithEvents ucrInputBias As ucrInputTextBox - Friend WithEvents ucrInputStationAnomalies As ucrInputTextBox - Friend WithEvents ucrInputSateliteAnomalies As ucrInputTextBox - Friend WithEvents lblSateliteAnomalies As Label - Friend WithEvents lblStationAnomalies As Label Friend WithEvents ucrReceiverSateliteElement As ucrReceiverSingle Friend WithEvents ucrReceiverWithinYear As ucrReceiverSingle Friend WithEvents ucrReceiverStationElement As ucrReceiverSingle Friend WithEvents ucrReceiverStation As ucrReceiverSingle - Friend WithEvents ucrChkAbsDev As ucrCheck + Friend WithEvents ucrSaveFirstCol As ucrSave + Friend WithEvents ucrSaveSecondCol As ucrSave End Class diff --git a/instat/dlgCompare.resx b/instat/dlgCompare.resx index 6decec02248..c8ebb771604 100644 --- a/instat/dlgCompare.resx +++ b/instat/dlgCompare.resx @@ -148,7 +148,7 @@ $this - 20 + 14 True @@ -178,7 +178,7 @@ $this - 9 + 7 True @@ -208,7 +208,7 @@ $this - 8 + 6 True @@ -239,7 +239,7 @@ $this - 19 + 13 Button @@ -275,7 +275,7 @@ $this - 15 + 9 Button @@ -311,67 +311,55 @@ $this - 16 - - - True - - - NoControl + 10 - - 12, 315 + + 10, 343 - - 93, 13 + + 4, 5, 4, 5 - - 15 + + 350, 22 - - Satelite Anomalies + + 24 - - lblSateliteAnomalies + + ucrSaveSecondCol - - System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + instat.ucrSave, instat, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null - + $this - - 5 - - - True - - - NoControl + + 0 - - 12, 347 + + 10, 312 - - 91, 13 + + 4, 5, 4, 5 - - 19 + + 350, 22 - - Station Anomalies + + 23 - - lblStationAnomalies + + ucrSaveFirstCol - - System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + instat.ucrSave, instat, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null - + $this - - 4 + + 1 True @@ -380,7 +368,7 @@ 6, 13 - 424, 431 + 425, 431 261, 153 @@ -404,7 +392,7 @@ $this - 1 + 3 261, 206 @@ -428,7 +416,7 @@ $this - 2 + 4 261, 100 @@ -452,133 +440,7 @@ $this - 3 - - - 109, 343 - - - 137, 21 - - - 20 - - - ucrInputStationAnomalies - - - instat.ucrInputTextBox, instat, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null - - - $this - - - 6 - - - 109, 311 - - - 137, 21 - - - 16 - - - ucrInputSateliteAnomalies - - - instat.ucrInputTextBox, instat, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null - - - $this - - - 7 - - - 10, 343 - - - 135, 20 - - - 18 - - - ucrChkAbsDev - - - instat.ucrCheck, instat, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null - - - $this - - - 10 - - - 10, 312 - - - 100, 20 - - - 14 - - - ucrChkBias - - - instat.ucrCheck, instat, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null - - - $this - - - 11 - - - 145, 343 - - - 137, 21 - - - 21 - - - ucrInputAbsDev - - - instat.ucrInputTextBox, instat, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null - - - $this - - - 12 - - - 145, 311 - - - 137, 21 - - - 17 - - - ucrInputBias - - - instat.ucrInputTextBox, instat, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null - - - $this - - - 13 + 5 175, 280 @@ -599,7 +461,7 @@ $this - 14 + 8 100, 8 @@ -620,7 +482,7 @@ $this - 17 + 11 10, 280 @@ -641,7 +503,7 @@ $this - 18 + 12 10, 373 @@ -662,7 +524,7 @@ $this - 21 + 15 10, 71 @@ -686,7 +548,7 @@ $this - 22 + 16 CenterScreen @@ -722,6 +584,6 @@ $this - 0 + 2 \ No newline at end of file diff --git a/instat/dlgCompare.vb b/instat/dlgCompare.vb index db0f44647d9..9c6cb427611 100644 --- a/instat/dlgCompare.vb +++ b/instat/dlgCompare.vb @@ -85,22 +85,24 @@ Public Class dlgCompare ucrChkMovingAverage.Enabled = False ucrNudMovingAverage.Enabled = False - ucrChkBias.SetParameter(New RParameter("sub1", clsBiasCalculation, 0, bNewIncludeArgumentName:=False), False) - ucrChkBias.SetText("Bias") - ucrChkAbsDev.SetParameter(New RParameter("sub2", clsAbsDevCalculation, 1, bNewIncludeArgumentName:=False), False) - ucrChkAbsDev.SetText("Absolute deviation") + + 'ucrSaveFirstCol.SetPrefix("bias") + ucrSaveFirstCol.SetSaveTypeAsColumn() + ucrSaveFirstCol.SetDataFrameSelector(ucrSelectorCompare.ucrAvailableDataFrames) + ucrSaveFirstCol.SetIsComboBox() + ucrSaveFirstCol.SetPositionParametersDirectly(False, "result_name") + ucrSaveFirstCol.setLinkedReceiver(ucrReceiverStationElement) + + 'ucrSaveSecondCol.SetPrefix("absdev") + ucrSaveSecondCol.SetSaveTypeAsColumn() + ucrSaveSecondCol.SetDataFrameSelector(ucrSelectorCompare.ucrAvailableDataFrames) + ucrSaveSecondCol.SetIsComboBox() + ucrSaveSecondCol.SetPositionParametersDirectly(False, "result_name") + ucrSaveSecondCol.setLinkedReceiver(ucrReceiverStationElement) ucrPnlCompare.AddToLinkedControls(ucrReceiverStation, {rdoAnomalies}, bNewLinkedHideIfParameterMissing:=True, bNewLinkedAddRemoveParameter:=True) ucrPnlCompare.AddToLinkedControls(ucrReceiverWithinYear, {rdoAnomalies}, bNewLinkedHideIfParameterMissing:=True, bNewLinkedAddRemoveParameter:=True) - ucrPnlCompare.AddToLinkedControls(ucrInputSateliteAnomalies, {rdoAnomalies}, bNewLinkedHideIfParameterMissing:=True) - ucrPnlCompare.AddToLinkedControls(ucrInputStationAnomalies, {rdoAnomalies}, bNewLinkedHideIfParameterMissing:=True) - - ucrChkBias.AddToLinkedControls(ucrInputBias, {True}, bNewLinkedHideIfParameterMissing:=True, bNewLinkedAddRemoveParameter:=True) - ucrChkBias.AddToLinkedControls(ucrInputBias, {True}, bNewLinkedHideIfParameterMissing:=True, bNewLinkedAddRemoveParameter:=True) - ucrChkAbsDev.AddToLinkedControls(ucrInputAbsDev, {True}, bNewLinkedHideIfParameterMissing:=True) - ucrPnlCompare.AddToLinkedControls(ucrChkBias, {rdoDifferences}, bNewLinkedHideIfParameterMissing:=True, bNewLinkedAddRemoveParameter:=True) - ucrPnlCompare.AddToLinkedControls(ucrChkAbsDev, {rdoDifferences}, bNewLinkedHideIfParameterMissing:=True, bNewLinkedAddRemoveParameter:=True) ucrPnlCompare.AddToLinkedControls(ucrChkMovingAverage, {rdoAnomalies}, bNewLinkedHideIfParameterMissing:=True, bNewLinkedAddRemoveParameter:=True) ucrChkMovingAverage.AddToLinkedControls(ucrNudMovingAverage, {True}, bNewLinkedAddRemoveParameter:=True, bNewLinkedHideIfParameterMissing:=True, bNewLinkedChangeToDefaultState:=True, objNewDefaultState:=0) @@ -108,28 +110,7 @@ Public Class dlgCompare ucrReceiverWithinYear.SetLinkedDisplayControl(lblWithinYear) ucrReceiverSateliteElement.SetLinkedDisplayControl(lblSateliteElement) ucrReceiverStationElement.SetLinkedDisplayControl(lblStationElement) - ucrInputSateliteAnomalies.SetLinkedDisplayControl(lblSateliteAnomalies) - ucrInputStationAnomalies.SetLinkedDisplayControl(lblStationAnomalies) - - ucrInputBias.SetParameter(New RParameter("result_name", 2)) - ucrInputBias.SetDataFrameSelector(ucrSelectorCompare.ucrAvailableDataFrames) - ucrInputBias.SetDefaultTypeAsColumn() - ucrInputBias.SetPrefix("bias") - - ucrInputAbsDev.SetParameter(New RParameter("result_name", 2)) - ucrInputAbsDev.SetDataFrameSelector(ucrSelectorCompare.ucrAvailableDataFrames) - ucrInputAbsDev.SetDefaultTypeAsColumn() - ucrInputAbsDev.SetPrefix("absdev") - - ucrInputSateliteAnomalies.SetParameter(New RParameter("result_name", 2)) - ucrInputSateliteAnomalies.SetDataFrameSelector(ucrSelectorCompare.ucrAvailableDataFrames) - ucrInputSateliteAnomalies.SetDefaultTypeAsColumn() - ucrInputSateliteAnomalies.SetPrefix("satellite_anom") - - ucrInputStationAnomalies.SetParameter(New RParameter("result_name", 2)) - ucrInputStationAnomalies.SetDataFrameSelector(ucrSelectorCompare.ucrAvailableDataFrames) - ucrInputStationAnomalies.SetDefaultTypeAsColumn() - ucrInputStationAnomalies.SetPrefix("station_anom") + End Sub Private Sub SetDefaults() @@ -152,6 +133,10 @@ Public Class dlgCompare ucrSelectorCompare.Reset() ucrReceiverSateliteElement.SetMeAsReceiver() + ucrSaveFirstCol.ucrChkSave.Checked = True + ucrSaveSecondCol.ucrChkSave.Checked = True + ucrSaveFirstCol.Reset() + ucrSaveSecondCol.Reset() 'group_by_station_day_of_year clsGroupByStationWithinYear.SetRCommand("instat_calculation$new") @@ -240,30 +225,29 @@ Public Class dlgCompare ucrReceiverSateliteElement.SetRCode(clsDiffOperator, bReset) ucrReceiverStationElement.SetRCode(clsDiffOperator, bReset) - ucrChkBias.SetRCode(clsListFunction, bReset) - ucrChkAbsDev.SetRCode(clsListFunction, bReset) - ucrInputBias.SetRCode(clsBiasCalculation, bReset) - ucrInputAbsDev.SetRCode(clsAbsDevCalculation, bReset) + ucrPnlCompare.SetRCode(clsCombinedCalculation, bReset) - ucrInputSateliteAnomalies.SetRCode(clsSateliteAnomalies, bReset) - ucrInputStationAnomalies.SetRCode(clsStationAnomalies, bReset) + + ucrSaveFirstCol.AddAdditionalRCode(clsSateliteAnomalies, bReset) + ucrSaveSecondCol.AddAdditionalRCode(clsStationAnomalies, bReset) + ucrSaveFirstCol.SetRCode(clsBiasCalculation, bReset) + ucrSaveSecondCol.SetRCode(clsAbsDevCalculation, bReset) + End Sub Private Sub TestOkEnabled() Dim bOkEnabled As Boolean = True If rdoDifferences.Checked Then - If Not ucrReceiverSateliteElement.IsEmpty AndAlso Not ucrReceiverStationElement.IsEmpty AndAlso (ucrChkBias.Checked OrElse ucrChkAbsDev.Checked) Then - If (ucrChkBias.Checked AndAlso ucrInputBias.IsEmpty) OrElse (ucrChkAbsDev.Checked AndAlso ucrInputAbsDev.IsEmpty) Then - bOkEnabled = False - End If + If Not ucrReceiverSateliteElement.IsEmpty AndAlso Not ucrReceiverStationElement.IsEmpty AndAlso (ucrSaveFirstCol.ucrChkSave.Checked OrElse ucrSaveSecondCol.ucrChkSave.Checked) Then + bOkEnabled = ucrSaveFirstCol.IsComplete OrElse ucrSaveSecondCol.IsComplete Else bOkEnabled = False End If ElseIf rdoAnomalies.Checked Then If ucrReceiverWithinYear.IsEmpty OrElse (ucrReceiverSateliteElement.IsEmpty AndAlso ucrReceiverStationElement.IsEmpty()) Then bOkEnabled = False - ElseIf (Not ucrReceiverSateliteElement.IsEmpty AndAlso ucrInputSateliteAnomalies.IsEmpty) OrElse (Not ucrReceiverStationElement.IsEmpty AndAlso ucrInputStationAnomalies.IsEmpty) Then + ElseIf (Not ucrReceiverSateliteElement.IsEmpty AndAlso Not ucrSaveFirstCol.IsComplete) OrElse (Not ucrReceiverStationElement.IsEmpty AndAlso Not ucrSaveSecondCol.IsComplete) Then bOkEnabled = False End If End If @@ -276,20 +260,6 @@ Public Class dlgCompare TestOkEnabled() End Sub - Private Sub ElementsLabelReceiverLocation() - If rdoDifferences.Checked Then - lblSateliteElement.Location = New Point(lblSateliteElement.Location.X, iReceiverLabelSateliteY / 2.0) - lblStationElement.Location = New Point(lblStationElement.Location.X, iReceiverLabelStationY / 1.7) - ucrReceiverSateliteElement.Location = New Point(ucrReceiverSateliteElement.Location.X, iReceiverSateliteY / 1.85) - ucrReceiverStationElement.Location = New Point(ucrReceiverStationElement.Location.X, iReceiverStationY / 1.6) - Else - lblSateliteElement.Location = New Point(lblSateliteElement.Location.X, iReceiverLabelSateliteY) - ucrReceiverSateliteElement.Location = New Point(ucrReceiverSateliteElement.Location.X, iReceiverSateliteY) - lblStationElement.Location = New Point(lblStationElement.Location.X, iReceiverLabelStationY) - ucrReceiverStationElement.Location = New Point(ucrReceiverStationElement.Location.X, iReceiverStationY) - End If - End Sub - Private Sub SetCurrentReceiver() Dim ucrCurrentReceiver As ucrReceiver = Nothing @@ -305,15 +275,23 @@ Public Class dlgCompare Private Sub ucrPnlCompare_ControlValueChanged(ucrChangedControl As ucrCore) Handles ucrPnlCompare.ControlValueChanged SetCurrentReceiver() + If rdoAnomalies.Checked Then - clsCombinedCalculation.AddParameter("manipulations", clsRFunctionParameter:=clsListManipulation, iPosition:=1) - clsListFunction.AddParameter("sub3", clsRFunctionParameter:=clsSateliteAnomalies, bIncludeArgumentName:=False, iPosition:=2) - clsListFunction.AddParameter("sub4", clsRFunctionParameter:=clsStationAnomalies, bIncludeArgumentName:=False, iPosition:=3) + ucrSaveFirstCol.SetCheckBoxText("Satelite Anomalies:") + ucrSaveFirstCol.SetPrefix("satellite_anom") + + ucrSaveSecondCol.SetCheckBoxText("Station Anomalies:") + ucrSaveSecondCol.SetPrefix("station_anom") Else - clsCombinedCalculation.RemoveParameterByName("manipulations") - clsListFunction.RemoveParameterByName("sub3") - clsListFunction.RemoveParameterByName("sub4") + ucrSaveFirstCol.SetLabelText("Bias:") + ucrSaveFirstCol.SetPrefix("bias") + + ucrSaveSecondCol.SetLabelText("Absolute deviation:") + ucrSaveSecondCol.SetPrefix("absdev") End If + + SetSaveColumnControlsParameters() + End Sub Private Sub ucrReceiverSateliteElement_ControlValueChanged(ucrChangedControl As ucrCore) Handles ucrReceiverSateliteElement.ControlValueChanged, ucrReceiverStationElement.ControlValueChanged @@ -346,7 +324,50 @@ Public Class dlgCompare End If End Sub - Private Sub ucrReceiverSateliteElement_ControlContentsChanged(ucrChangedControl As ucrCore) Handles ucrReceiverSateliteElement.ControlContentsChanged, ucrReceiverStationElement.ControlContentsChanged, ucrChkBias.ControlContentsChanged, ucrChkAbsDev.ControlContentsChanged, ucrInputBias.ControlContentsChanged, ucrInputAbsDev.ControlContentsChanged, ucrPnlCompare.ControlContentsChanged, ucrInputSateliteAnomalies.ControlContentsChanged, ucrInputStationAnomalies.ControlContentsChanged, ucrReceiverStation.ControlContentsChanged, ucrReceiverWithinYear.ControlContentsChanged + Private Sub ucrReceiverSateliteElement_ControlContentsChanged(ucrChangedControl As ucrCore) Handles ucrReceiverSateliteElement.ControlContentsChanged, ucrReceiverStationElement.ControlContentsChanged, ucrPnlCompare.ControlContentsChanged, ucrReceiverStation.ControlContentsChanged, ucrReceiverWithinYear.ControlContentsChanged, ucrSaveFirstCol.ControlContentsChanged, ucrSaveSecondCol.ControlContentsChanged TestOkEnabled() End Sub + + Private Sub ucrSaveControls_ControlValueChanged(ucrChangedControl As ucrCore) Handles ucrSaveFirstCol.ControlValueChanged, ucrSaveSecondCol.ControlValueChanged + SetSaveColumnControlsParameters() + End Sub + + Private Sub SetSaveColumnControlsParameters() + If rdoDifferences.Checked AndAlso ucrSaveFirstCol.ucrChkSave.Checked Then + clsListFunction.AddParameter("sub1", clsRFunctionParameter:=clsBiasCalculation, bIncludeArgumentName:=False, iPosition:=0) + clsBiasCalculation.AddParameter(strParameterName:="result_name", strParameterValue:=Chr(34) & ucrSaveFirstCol.GetText & Chr(34), iPosition:=2) + clsBiasCalculation.SetAssignTo("bias_calculation") + Else + clsListFunction.RemoveParameterByName("sub1") + End If + + If rdoDifferences.Checked AndAlso ucrSaveSecondCol.ucrChkSave.Checked Then + clsListFunction.AddParameter("sub2", clsRFunctionParameter:=clsAbsDevCalculation, bIncludeArgumentName:=False, iPosition:=1) + clsAbsDevCalculation.AddParameter(strParameterName:="result_name", strParameterValue:=Chr(34) & ucrSaveSecondCol.GetText & Chr(34), iPosition:=2) + clsAbsDevCalculation.SetAssignTo("absdev_calculation") + Else + clsListFunction.RemoveParameterByName("sub2") + End If + + + If rdoAnomalies.Checked Then + clsCombinedCalculation.AddParameter("manipulations", clsRFunctionParameter:=clsListManipulation, iPosition:=1) + + clsListFunction.AddParameter("sub3", clsRFunctionParameter:=clsSateliteAnomalies, bIncludeArgumentName:=False, iPosition:=0) + clsSateliteAnomalies.AddParameter(strParameterName:="result_name", strParameterValue:=Chr(34) & ucrSaveFirstCol.GetText & Chr(34), iPosition:=2) + clsSateliteAnomalies.SetAssignTo("satellite_anomalies") + + clsListFunction.AddParameter("sub4", clsRFunctionParameter:=clsStationAnomalies, bIncludeArgumentName:=False, iPosition:=1) + clsStationAnomalies.AddParameter(strParameterName:="result_name", strParameterValue:=Chr(34) & ucrSaveSecondCol.GetText & Chr(34), iPosition:=2) + clsStationAnomalies.SetAssignTo("station_anomalies") + + Else + clsCombinedCalculation.RemoveParameterByName("manipulations") + clsListFunction.RemoveParameterByName("sub3") + clsListFunction.RemoveParameterByName("sub4") + End If + End Sub + + + End Class From 635566e752411f94b91b044127a5e9b75d85437a Mon Sep 17 00:00:00 2001 From: patowhiz Date: Thu, 6 May 2021 20:42:12 +0300 Subject: [PATCH 20/27] Pasting columns initial code --- instat/static/InstatObject/R/data_object_R6.R | 56 +++++++++++ .../static/InstatObject/R/instat_object_R6.R | 5 + instat/ucrDataView.Designer.vb | 54 +++++----- instat/ucrDataView.resx | 2 +- instat/ucrDataView.vb | 99 ++++++++++++++++++- 5 files changed, 187 insertions(+), 29 deletions(-) diff --git a/instat/static/InstatObject/R/data_object_R6.R b/instat/static/InstatObject/R/data_object_R6.R index 3209f825deb..198e35d1df3 100644 --- a/instat/static/InstatObject/R/data_object_R6.R +++ b/instat/static/InstatObject/R/data_object_R6.R @@ -850,6 +850,62 @@ DataSheet$set("public", "replace_value_in_data", function(col_names, rows, old_v } ) +DataSheet$set("public", "paste_from_clipboard", function(col_names, start_row_pos = 1, first_clip_row_is_header = FALSE, clip_board_text) { + #reads data from clipboard and saves it to selected columns + #get the clipboard text contents as a data frame + clip_tbl <- clipr::read_clip_tbl(x = clip_board_text, header = first_clip_row_is_header) + current_tbl <- self$get_data_frame(use_current_filter = FALSE) + + #check if number of copied columns and selected columns are equal + if(ncol(clip_tbl) != length(col_names)){ + stop(paste("number of columns are not the same.", + "Selected columns:", length(col_names), ". Copied columns:", ncol(clip_tbl)) ) + } + + #check if copied data rows are more than current data rows + if( nrow(clip_tbl) > nrow(current_tbl) ){ + stop(paste("rows copied cannot be more than number of rows in the data frame.", + "Current data frame rows:", nrow(current_tbl), ". Copied rows:", nrow(clip_tbl)) ) + } + + #check copied data integrity + for(index in seq_along(col_names)){ + col_data <- current_tbl[, col_names[index]] + #get column type of column from the current table using column name + col_type <- class(col_data) + #check copied data integrity based on the data type expected + if (is.factor(col_data)) { + #get all the factor levels of the selected column in the current data frame + expected_factor_levels <- levels(col_data) + #check if all copied data values are contained in the factor levels + #if any invalid is found. exit function + for(val in clip_tbl[,index]){ + if(!is.na(val) && !is.element(val,expected_factor_levels)){ + stop("Invalid column values. Level not found in factor") + } + }#end inner for loop + } else if( !(is.numeric(col_data) || is.logical(col_data) || is.character(col_data)) ) { + #clipr support above column types only. So pasting to a column not recognised by clipr may result to unpredictible results + #if not in any of above column types then exit function + stop( paste("Cannot paste into columns of type:", col_type) ) + }#end if + }#end outer for loop + + #replace values in the selected columns + for(index in seq_along(col_names)){ + #set the row positions and the values + rows_to_replace <- c(start_row_pos : (start_row_pos + nrow(clip_tbl) - 1 )) + new_values <- clip_tbl[,index] + #replace the old values with new values + self$replace_value_in_data(col_names = col_names[index], rows = rows_to_replace, new_value = new_values) + #rename header if first row of clip data is header. + if(first_clip_row_is_header){ + self$rename_column_in_data(curr_col_name = col_names[index], new_col_name = colnames(clip_tbl)[index]) + } + }#end for loop +} +)#end function + DataSheet$set("public", "append_to_metadata", function(property, new_value = "") { if(missing(property)) stop("property must be specified.") diff --git a/instat/static/InstatObject/R/instat_object_R6.R b/instat/static/InstatObject/R/instat_object_R6.R index a20bb881cca..b576150b18e 100644 --- a/instat/static/InstatObject/R/instat_object_R6.R +++ b/instat/static/InstatObject/R/instat_object_R6.R @@ -829,6 +829,11 @@ DataBook$set("public", "replace_value_in_data", function(data_name, col_names, r } ) +DataBook$set("public", "paste_from_clipboard", function(data_name, col_names, start_row_pos = 1, first_clip_row_is_header = TRUE, clip_board_text) { + self$get_data_objects(data_name)$paste_from_clipboard(col_names, start_row_pos, first_clip_row_is_header, clip_board_text) +} +) + DataBook$set("public", "rename_column_in_data", function(data_name, column_name, new_val, label = "") { self$get_data_objects(data_name)$rename_column_in_data(column_name, new_val, label) self$update_links_rename_column(data_name = data_name, old_column_name = column_name, new_column_name = new_val) diff --git a/instat/ucrDataView.Designer.vb b/instat/ucrDataView.Designer.vb index 9c40b66ad71..d9064019653 100644 --- a/instat/ucrDataView.Designer.vb +++ b/instat/ucrDataView.Designer.vb @@ -57,6 +57,7 @@ Partial Class ucrDataView Me.mnuLevelsLabels = New System.Windows.Forms.ToolStripMenuItem() Me.toolStripMenuItem21 = New System.Windows.Forms.ToolStripSeparator() Me.mnuSort = New System.Windows.Forms.ToolStripMenuItem() + Me.mnuColumnAddComment = New System.Windows.Forms.ToolStripMenuItem() Me.mnuColumnFilter = New System.Windows.Forms.ToolStripMenuItem() Me.mnuClearColumnFilter = New System.Windows.Forms.ToolStripMenuItem() Me.cellContextMenuStrip = New System.Windows.Forms.ContextMenuStrip(Me.components) @@ -89,6 +90,7 @@ Partial Class ucrDataView Me.statusColumnMenu = New System.Windows.Forms.ContextMenuStrip(Me.components) Me.deleteDataFrame = New System.Windows.Forms.ToolStripMenuItem() Me.renameSheet = New System.Windows.Forms.ToolStripMenuItem() + Me.mnuBottomAddComment = New System.Windows.Forms.ToolStripMenuItem() Me.HideSheet = New System.Windows.Forms.ToolStripMenuItem() Me.unhideSheet = New System.Windows.Forms.ToolStripMenuItem() Me.CopySheet = New System.Windows.Forms.ToolStripMenuItem() @@ -113,8 +115,7 @@ Partial Class ucrDataView Me.linkStartNewDataFrame = New System.Windows.Forms.LinkLabel() Me.linkStartOpenFile = New System.Windows.Forms.LinkLabel() Me.linkStartOpenLibrary = New System.Windows.Forms.LinkLabel() - Me.mnuColumnAddComment = New System.Windows.Forms.ToolStripMenuItem() - Me.mnuBottomAddComment = New System.Windows.Forms.ToolStripMenuItem() + Me.mnuPaste = New System.Windows.Forms.ToolStripMenuItem() Me.columnContextMenuStrip.SuspendLayout() Me.cellContextMenuStrip.SuspendLayout() Me.rowContextMenuStrip.SuspendLayout() @@ -149,9 +150,9 @@ Partial Class ucrDataView 'columnContextMenuStrip ' Me.columnContextMenuStrip.ImageScalingSize = New System.Drawing.Size(20, 20) - Me.columnContextMenuStrip.Items.AddRange(New System.Windows.Forms.ToolStripItem() {Me.mnuColumnRename, Me.mnuDuplicateColumn, Me.mnuReorderColumns, Me.mnuInsertColsBefore, Me.mnuInsertColsAfter, Me.mnuDeleteCol, Me.toolStripMenuItem2, Me.mnuConvertToFactor, Me.mnuCovertToOrderedFactors, Me.mnuConvertText, Me.mnuConvertToLogical, Me.mnuConvertVariate, Me.ToolStripSeparator1, Me.mnuLevelsLabels, Me.toolStripMenuItem21, Me.mnuSort, Me.mnuColumnAddComment, Me.mnuColumnFilter, Me.mnuClearColumnFilter}) + Me.columnContextMenuStrip.Items.AddRange(New System.Windows.Forms.ToolStripItem() {Me.mnuColumnRename, Me.mnuDuplicateColumn, Me.mnuReorderColumns, Me.mnuInsertColsBefore, Me.mnuInsertColsAfter, Me.mnuDeleteCol, Me.mnuPaste, Me.toolStripMenuItem2, Me.mnuConvertToFactor, Me.mnuCovertToOrderedFactors, Me.mnuConvertText, Me.mnuConvertToLogical, Me.mnuConvertVariate, Me.ToolStripSeparator1, Me.mnuLevelsLabels, Me.toolStripMenuItem21, Me.mnuSort, Me.mnuColumnAddComment, Me.mnuColumnFilter, Me.mnuClearColumnFilter}) Me.columnContextMenuStrip.Name = "columnContextMenuStrip" - Me.columnContextMenuStrip.Size = New System.Drawing.Size(213, 374) + Me.columnContextMenuStrip.Size = New System.Drawing.Size(213, 396) ' 'mnuColumnRename ' @@ -246,6 +247,12 @@ Partial Class ucrDataView Me.mnuSort.Size = New System.Drawing.Size(212, 22) Me.mnuSort.Text = "Sort..." ' + 'mnuColumnAddComment + ' + Me.mnuColumnAddComment.Name = "mnuColumnAddComment" + Me.mnuColumnAddComment.Size = New System.Drawing.Size(212, 22) + Me.mnuColumnAddComment.Text = "Add Comment..." + ' 'mnuColumnFilter ' Me.mnuColumnFilter.Name = "mnuColumnFilter" @@ -263,7 +270,7 @@ Partial Class ucrDataView Me.cellContextMenuStrip.ImageScalingSize = New System.Drawing.Size(20, 20) Me.cellContextMenuStrip.Items.AddRange(New System.Windows.Forms.ToolStripItem() {Me.ToolStripSeparator3, Me.mnuRenameColumn, Me.mnuDuplColumn, Me.mnuReorderColumn, Me.ToolStripSeparator5, Me.mnuConvertToFact, Me.mnuConvertToOrderedFactor, Me.mnuConvertToCharacter, Me.mnuConvertToLogic, Me.mnuConvertToNumeric, Me.ToolStripSeparator6, Me.mnuLebelsLevel, Me.ToolStripSeparator7, Me.mnuSorts, Me.mnuComment, Me.mnuFilters, Me.mnuRemoveCurrentFilters}) Me.cellContextMenuStrip.Name = "cellContextMenuStrip" - Me.cellContextMenuStrip.Size = New System.Drawing.Size(213, 314) + Me.cellContextMenuStrip.Size = New System.Drawing.Size(213, 336) ' 'ToolStripSeparator3 ' @@ -423,49 +430,55 @@ Partial Class ucrDataView Me.statusColumnMenu.ImageScalingSize = New System.Drawing.Size(20, 20) Me.statusColumnMenu.Items.AddRange(New System.Windows.Forms.ToolStripItem() {Me.deleteDataFrame, Me.renameSheet, Me.mnuBottomAddComment, Me.HideSheet, Me.unhideSheet, Me.CopySheet, Me.reorderSheet, Me.ViewSheet}) Me.statusColumnMenu.Name = "statusColumnMenu" - Me.statusColumnMenu.Size = New System.Drawing.Size(181, 202) + Me.statusColumnMenu.Size = New System.Drawing.Size(163, 180) ' 'deleteDataFrame ' Me.deleteDataFrame.Name = "deleteDataFrame" - Me.deleteDataFrame.Size = New System.Drawing.Size(180, 22) + Me.deleteDataFrame.Size = New System.Drawing.Size(162, 22) Me.deleteDataFrame.Text = "Delete..." ' 'renameSheet ' Me.renameSheet.Name = "renameSheet" - Me.renameSheet.Size = New System.Drawing.Size(180, 22) + Me.renameSheet.Size = New System.Drawing.Size(162, 22) Me.renameSheet.Text = "Rename..." ' + 'mnuBottomAddComment + ' + Me.mnuBottomAddComment.Name = "mnuBottomAddComment" + Me.mnuBottomAddComment.Size = New System.Drawing.Size(162, 22) + Me.mnuBottomAddComment.Text = "Add Comment..." + ' 'HideSheet ' Me.HideSheet.Name = "HideSheet" - Me.HideSheet.Size = New System.Drawing.Size(180, 22) + Me.HideSheet.Size = New System.Drawing.Size(162, 22) Me.HideSheet.Text = "Hide" ' 'unhideSheet ' Me.unhideSheet.Name = "unhideSheet" - Me.unhideSheet.Size = New System.Drawing.Size(180, 22) + Me.unhideSheet.Size = New System.Drawing.Size(162, 22) Me.unhideSheet.Text = "Unhide..." ' 'CopySheet ' Me.CopySheet.Name = "CopySheet" - Me.CopySheet.Size = New System.Drawing.Size(180, 22) + Me.CopySheet.Size = New System.Drawing.Size(162, 22) Me.CopySheet.Text = "Copy..." ' 'reorderSheet ' Me.reorderSheet.Enabled = False Me.reorderSheet.Name = "reorderSheet" - Me.reorderSheet.Size = New System.Drawing.Size(180, 22) + Me.reorderSheet.Size = New System.Drawing.Size(162, 22) Me.reorderSheet.Text = "Reorder..." ' 'ViewSheet ' Me.ViewSheet.Name = "ViewSheet" - Me.ViewSheet.Size = New System.Drawing.Size(180, 22) + Me.ViewSheet.Size = New System.Drawing.Size(162, 22) Me.ViewSheet.Text = "View Data Frame" ' 'lblRowDisplay @@ -700,17 +713,11 @@ Partial Class ucrDataView Me.linkStartOpenLibrary.TabStop = True Me.linkStartOpenLibrary.Text = "Open from library..." ' - 'mnuColumnAddComment - ' - Me.mnuColumnAddComment.Name = "mnuColumnAddComment" - Me.mnuColumnAddComment.Size = New System.Drawing.Size(212, 22) - Me.mnuColumnAddComment.Text = "Add Comment..." - ' - 'mnuBottomAddComment + 'mnuPaste ' - Me.mnuBottomAddComment.Name = "mnuBottomAddComment" - Me.mnuBottomAddComment.Size = New System.Drawing.Size(180, 22) - Me.mnuBottomAddComment.Text = "Add Comment..." + Me.mnuPaste.Name = "mnuPaste" + Me.mnuPaste.Size = New System.Drawing.Size(212, 22) + Me.mnuPaste.Text = "Delete Column(s)" ' 'ucrDataView ' @@ -813,4 +820,5 @@ Partial Class ucrDataView Friend WithEvents mnuComment As ToolStripMenuItem Friend WithEvents mnuColumnAddComment As ToolStripMenuItem Friend WithEvents mnuBottomAddComment As ToolStripMenuItem + Private WithEvents mnuPaste As ToolStripMenuItem End Class diff --git a/instat/ucrDataView.resx b/instat/ucrDataView.resx index 2ee0f1a21ce..27a9fabaf7d 100644 --- a/instat/ucrDataView.resx +++ b/instat/ucrDataView.resx @@ -121,7 +121,7 @@ 17, 17 - 208, 17 + 205, 18 377, 17 diff --git a/instat/ucrDataView.vb b/instat/ucrDataView.vb index e051f1f046a..6e06ad08747 100644 --- a/instat/ucrDataView.vb +++ b/instat/ucrDataView.vb @@ -664,12 +664,26 @@ Public Class ucrDataView End Sub Private Sub grdCurrSheet_BeforePaste(sender As Object, e As BeforeRangeOperationEventArgs) Handles grdCurrSheet.BeforePaste - e.IsCancelled = True - If Not e.Range.IsSingleCell Then - MsgBox("Pasting multiple cells is currently disabled. This feature will be included in future versions." & Environment.NewLine & "Try pasting one cell at a time.", MsgBoxStyle.Information, "Cannot paste multiple cells") - Else - ReplaceValueInData(Clipboard.GetText(), e.Range.Row, e.Range.Col) + e.IsCancelled = True 'prevents pasted data from being added directly into the data view + Dim arrAllCurrentColumns As String() + Dim lstSelectedColumnNames As New List(Of String) + Dim iStartRowPos As Integer + 'get all columns of current selected data frame + arrAllCurrentColumns = GetCurrentWorkSheetColumnNames() + 'validate columns + If e.Range.EndCol >= arrAllCurrentColumns.Length Then + 'this happens when Ctrl + V is pressed and the data to be pasted has more columns + 'than columns between start and end column + MsgBox("Columns copied are more than the current data frame columns.", MsgBoxStyle.Critical, "Excess Columns") + Exit Sub End If + 'get selected columns + For colIndex As Integer = e.Range.Col To e.Range.EndCol + lstSelectedColumnNames.Add(arrAllCurrentColumns(colIndex)) + Next + 'get starting row position then paste clipboard values + iStartRowPos = Integer.Parse(grdData.CurrentWorksheet.RowHeaders.Item(e.Range.Row).Text) + PasteValuesToDataFrame(lstSelectedColumnNames, iStartRowPos, False) End Sub ' Not currently working. Bug with reogrid reported here: @@ -984,4 +998,79 @@ Public Class ucrDataView dlgAddComment.SetPosition(strDataFrame:=grdCurrSheet.Name) dlgAddComment.ShowDialog() End Sub + + Private Sub mnuPaste_Click(sender As Object, e As EventArgs) Handles mnuPaste.Click + PasteValuesToDataFrame(SelectedColumnsAsArray(), 1, False) + End Sub + + '''' + '''' event raised on menu toolstrip click + '''' paste data starting from selected cells + '''' + '''' + '''' + 'Private Sub mnuCellPasteRange_Click(sender As Object, e As EventArgs) Handles mnuCellPasteRange.Click + ' Dim arrAllCurrentColumns As String() + ' Dim lstSelectedColumnNames As New List(Of String) + ' Dim iStartRowPos As Integer + ' 'get all columns of current selected data frame + ' arrAllCurrentColumns = GetCurrentWorkSheetColumnNames() + ' 'get columns selected + ' For colIndex As Integer = grdData.CurrentWorksheet.SelectionRange.Col To grdData.CurrentWorksheet.SelectionRange.EndCol + ' lstSelectedColumnNames.Add(arrAllCurrentColumns(colIndex)) + ' Next + ' 'get starting row position then paste clipboard values + ' iStartRowPos = Integer.Parse(grdData.CurrentWorksheet.RowHeaders.Item(grdData.CurrentWorksheet.SelectionRange.Row).Text) + ' PasteValuesToDataFrame(lstSelectedColumnNames, iStartRowPos, False) + 'End Sub + + ''' + ''' pastes data from clipboard to data view + ''' + ''' column names to paste data into + ''' starting row position. This starts at postion 1 + ''' flag indicating whether first row of clipboard data is a header + Private Sub PasteValuesToDataFrame(lstColumnNames As IEnumerable(Of String), startRowPos As String, firstClipRowHeader As Boolean) + Dim clsPasteValues As New RFunction + Dim strColNamesVec As String = "" + Dim strClipBoardText As String = My.Computer.Clipboard.GetText + + If String.IsNullOrEmpty(strClipBoardText) Then + MsgBox("No data available for pasting.", MsgBoxStyle.Information, "No Data") + Exit Sub + End If + 'warn user action cannot be undone + If DialogResult.No = MsgBox("Are you sure you want to paste to these column(s)?" & Environment.NewLine & + "This action cannot be undone.", MessageBoxButtons.YesNo, "Paste Data") Then + Exit Sub + End If + + 'construct R vector command for new row values + For i As Integer = 0 To lstColumnNames.Count - 1 + strColNamesVec = strColNamesVec & Chr(34) & lstColumnNames(i) & Chr(34) + If i = lstColumnNames.Count - 1 Then + Exit For + End If + strColNamesVec = strColNamesVec & ", " + Next + strColNamesVec = "c(" & strColNamesVec & ")" + + 'add R parameters and run the command + clsPasteValues.SetRCommand(frmMain.clsRLink.strInstatDataObject & "$paste_from_clipboard") + clsPasteValues.AddParameter("data_name", Chr(34) & grdCurrSheet.Name & Chr(34)) + clsPasteValues.AddParameter("col_names", strColNamesVec) + clsPasteValues.AddParameter("start_row_pos", startRowPos) + clsPasteValues.AddParameter("first_clip_row_is_header", If(firstClipRowHeader, "TRUE", "FALSE")) + clsPasteValues.AddParameter("clip_board_text", Chr(34) & strClipBoardText & Chr(34)) + RunScriptFromDataView(clsPasteValues.ToScript(), strComment:="Paste values in Data") + End Sub + + ''' + ''' gets column names of current worksheet + ''' + ''' array of column names + Private Function GetCurrentWorkSheetColumnNames() As String() + 'get all columns of current selected data frame + Return lstColumnNames.Find(Function(x) x.Key = grdData.CurrentWorksheet.Name).Value + End Function End Class From a37271c8275b1a7231f046d5f7ddb44b175fde85 Mon Sep 17 00:00:00 2001 From: patowhiz Date: Fri, 7 May 2021 11:11:41 +0300 Subject: [PATCH 21/27] Made paste work --- instat/ucrDataView.Designer.vb | 22 +++++++++++++++------- instat/ucrDataView.vb | 28 ++++++++++++++-------------- 2 files changed, 29 insertions(+), 21 deletions(-) diff --git a/instat/ucrDataView.Designer.vb b/instat/ucrDataView.Designer.vb index d9064019653..353c598277e 100644 --- a/instat/ucrDataView.Designer.vb +++ b/instat/ucrDataView.Designer.vb @@ -47,6 +47,7 @@ Partial Class ucrDataView Me.mnuInsertColsBefore = New System.Windows.Forms.ToolStripMenuItem() Me.mnuInsertColsAfter = New System.Windows.Forms.ToolStripMenuItem() Me.mnuDeleteCol = New System.Windows.Forms.ToolStripMenuItem() + Me.mnuPaste = New System.Windows.Forms.ToolStripMenuItem() Me.toolStripMenuItem2 = New System.Windows.Forms.ToolStripSeparator() Me.mnuConvertToFactor = New System.Windows.Forms.ToolStripMenuItem() Me.mnuCovertToOrderedFactors = New System.Windows.Forms.ToolStripMenuItem() @@ -115,7 +116,7 @@ Partial Class ucrDataView Me.linkStartNewDataFrame = New System.Windows.Forms.LinkLabel() Me.linkStartOpenFile = New System.Windows.Forms.LinkLabel() Me.linkStartOpenLibrary = New System.Windows.Forms.LinkLabel() - Me.mnuPaste = New System.Windows.Forms.ToolStripMenuItem() + Me.mnuCellPasteRange = New System.Windows.Forms.ToolStripMenuItem() Me.columnContextMenuStrip.SuspendLayout() Me.cellContextMenuStrip.SuspendLayout() Me.rowContextMenuStrip.SuspendLayout() @@ -190,6 +191,12 @@ Partial Class ucrDataView Me.mnuDeleteCol.Size = New System.Drawing.Size(212, 22) Me.mnuDeleteCol.Text = "Delete Column(s)" ' + 'mnuPaste + ' + Me.mnuPaste.Name = "mnuPaste" + Me.mnuPaste.Size = New System.Drawing.Size(212, 22) + Me.mnuPaste.Text = "Paste" + ' 'toolStripMenuItem2 ' Me.toolStripMenuItem2.Name = "toolStripMenuItem2" @@ -268,9 +275,9 @@ Partial Class ucrDataView 'cellContextMenuStrip ' Me.cellContextMenuStrip.ImageScalingSize = New System.Drawing.Size(20, 20) - Me.cellContextMenuStrip.Items.AddRange(New System.Windows.Forms.ToolStripItem() {Me.ToolStripSeparator3, Me.mnuRenameColumn, Me.mnuDuplColumn, Me.mnuReorderColumn, Me.ToolStripSeparator5, Me.mnuConvertToFact, Me.mnuConvertToOrderedFactor, Me.mnuConvertToCharacter, Me.mnuConvertToLogic, Me.mnuConvertToNumeric, Me.ToolStripSeparator6, Me.mnuLebelsLevel, Me.ToolStripSeparator7, Me.mnuSorts, Me.mnuComment, Me.mnuFilters, Me.mnuRemoveCurrentFilters}) + Me.cellContextMenuStrip.Items.AddRange(New System.Windows.Forms.ToolStripItem() {Me.ToolStripSeparator3, Me.mnuRenameColumn, Me.mnuDuplColumn, Me.mnuReorderColumn, Me.mnuCellPasteRange, Me.ToolStripSeparator5, Me.mnuConvertToFact, Me.mnuConvertToOrderedFactor, Me.mnuConvertToCharacter, Me.mnuConvertToLogic, Me.mnuConvertToNumeric, Me.ToolStripSeparator6, Me.mnuLebelsLevel, Me.ToolStripSeparator7, Me.mnuSorts, Me.mnuComment, Me.mnuFilters, Me.mnuRemoveCurrentFilters}) Me.cellContextMenuStrip.Name = "cellContextMenuStrip" - Me.cellContextMenuStrip.Size = New System.Drawing.Size(213, 336) + Me.cellContextMenuStrip.Size = New System.Drawing.Size(213, 358) ' 'ToolStripSeparator3 ' @@ -713,11 +720,11 @@ Partial Class ucrDataView Me.linkStartOpenLibrary.TabStop = True Me.linkStartOpenLibrary.Text = "Open from library..." ' - 'mnuPaste + 'mnuCellPasteRange ' - Me.mnuPaste.Name = "mnuPaste" - Me.mnuPaste.Size = New System.Drawing.Size(212, 22) - Me.mnuPaste.Text = "Delete Column(s)" + Me.mnuCellPasteRange.Name = "mnuCellPasteRange" + Me.mnuCellPasteRange.Size = New System.Drawing.Size(212, 22) + Me.mnuCellPasteRange.Text = "Paste" ' 'ucrDataView ' @@ -821,4 +828,5 @@ Partial Class ucrDataView Friend WithEvents mnuColumnAddComment As ToolStripMenuItem Friend WithEvents mnuBottomAddComment As ToolStripMenuItem Private WithEvents mnuPaste As ToolStripMenuItem + Friend WithEvents mnuCellPasteRange As ToolStripMenuItem End Class diff --git a/instat/ucrDataView.vb b/instat/ucrDataView.vb index 6e06ad08747..1d87782e513 100644 --- a/instat/ucrDataView.vb +++ b/instat/ucrDataView.vb @@ -1009,20 +1009,20 @@ Public Class ucrDataView '''' '''' '''' - 'Private Sub mnuCellPasteRange_Click(sender As Object, e As EventArgs) Handles mnuCellPasteRange.Click - ' Dim arrAllCurrentColumns As String() - ' Dim lstSelectedColumnNames As New List(Of String) - ' Dim iStartRowPos As Integer - ' 'get all columns of current selected data frame - ' arrAllCurrentColumns = GetCurrentWorkSheetColumnNames() - ' 'get columns selected - ' For colIndex As Integer = grdData.CurrentWorksheet.SelectionRange.Col To grdData.CurrentWorksheet.SelectionRange.EndCol - ' lstSelectedColumnNames.Add(arrAllCurrentColumns(colIndex)) - ' Next - ' 'get starting row position then paste clipboard values - ' iStartRowPos = Integer.Parse(grdData.CurrentWorksheet.RowHeaders.Item(grdData.CurrentWorksheet.SelectionRange.Row).Text) - ' PasteValuesToDataFrame(lstSelectedColumnNames, iStartRowPos, False) - 'End Sub + Private Sub mnuCellPasteRange_Click(sender As Object, e As EventArgs) Handles mnuCellPasteRange.Click + Dim arrAllCurrentColumns As String() + Dim lstSelectedColumnNames As New List(Of String) + Dim iStartRowPos As Integer + 'get all columns of current selected data frame + arrAllCurrentColumns = GetCurrentWorkSheetColumnNames() + 'get columns selected + For colIndex As Integer = grdData.CurrentWorksheet.SelectionRange.Col To grdData.CurrentWorksheet.SelectionRange.EndCol + lstSelectedColumnNames.Add(arrAllCurrentColumns(colIndex)) + Next + 'get starting row position then paste clipboard values + iStartRowPos = Integer.Parse(grdData.CurrentWorksheet.RowHeaders.Item(grdData.CurrentWorksheet.SelectionRange.Row).Text) + PasteValuesToDataFrame(lstSelectedColumnNames, iStartRowPos, False) + End Sub ''' ''' pastes data from clipboard to data view From c355b72ba47dc65e16d5b77306ec96fba8a1c047 Mon Sep 17 00:00:00 2001 From: Antoine Ntalumeso Date: Fri, 7 May 2021 12:40:05 +0200 Subject: [PATCH 22/27] Removed not needed code --- instat/dlgClimaticDataEntry.vb | 5 ----- 1 file changed, 5 deletions(-) diff --git a/instat/dlgClimaticDataEntry.vb b/instat/dlgClimaticDataEntry.vb index e4fb6727e11..66ff5785554 100644 --- a/instat/dlgClimaticDataEntry.vb +++ b/instat/dlgClimaticDataEntry.vb @@ -32,7 +32,6 @@ Public Class dlgClimaticDataEntry Private ReadOnly strRange As String = "Range" Private bChange As Boolean = False Private bSubdialogFirstLoad As Boolean = True - Private bRemoveValueChanged As Boolean = True Private bState As Boolean = False Private bResetSubdialogs As Boolean @@ -44,10 +43,6 @@ Public Class dlgClimaticDataEntry If bReset Then SetDefaults() End If - If bRemoveValueChanged Then - AddHandler ucrReceiverStation.ControlValueChanged, AddressOf StationControls_ControlValueChanged - bRemoveValueChanged = False - End If SetRCodeForControls(bReset) bReset = False autoTranslate(Me) From 8b95da3605175466bcfb1cded85b0336facb7f59 Mon Sep 17 00:00:00 2001 From: patowhiz Date: Fri, 7 May 2021 15:50:58 +0300 Subject: [PATCH 23/27] Fixed "remembering" of last selected level by the control --- instat/ucrInputFactorLevels.vb | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/instat/ucrInputFactorLevels.vb b/instat/ucrInputFactorLevels.vb index a1ec93bc2de..9d778247f16 100644 --- a/instat/ucrInputFactorLevels.vb +++ b/instat/ucrInputFactorLevels.vb @@ -23,6 +23,11 @@ Public Class ucrInputFactorLevels ''' Should the first level be selected by default? Public bFirstLevelDefault As Boolean = False + ''' + ''' holds last selected level displayed by the control + ''' + Private strLastSelectedLevel As String = "" + Public Sub New() ' This call is required by the designer. @@ -65,11 +70,22 @@ Public Class ucrInputFactorLevels For i As Integer = 0 To strLevels.Count - 1 lstLevels.Add(strQuotes & strLevels(i) & strQuotes) Next + SetItems(lstLevels.ToArray()) - If bFirstLevelDefault AndAlso lstLevels.Count > 0 Then + + 'restore last selected level if its still contained in the new list of retrieved levels + If strLastSelectedLevel <> "" AndAlso lstLevels.Contains(strLastSelectedLevel) Then + SetName(strLastSelectedLevel) + ElseIf bFirstLevelDefault AndAlso lstLevels.Count > 0 Then GetSetSelectedIndex = 0 End If End If End If End Sub + + Private Sub ucrInputFactorLevels_ControlValueChanged(ucrChangedControl As ucrCore) Handles Me.ControlValueChanged + If Not String.IsNullOrEmpty(GetText) Then + strLastSelectedLevel = GetText() + End If + End Sub End Class From 2d67ead91836b2df663d5294be69ca5d316ebb67 Mon Sep 17 00:00:00 2001 From: Antoine Ntalumeso Date: Fri, 7 May 2021 15:21:23 +0200 Subject: [PATCH 24/27] Fixing the bug when selected another station --- instat/dlgClimaticDataEntry.vb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/instat/dlgClimaticDataEntry.vb b/instat/dlgClimaticDataEntry.vb index 66ff5785554..3ff80c8b022 100644 --- a/instat/dlgClimaticDataEntry.vb +++ b/instat/dlgClimaticDataEntry.vb @@ -269,7 +269,7 @@ Public Class dlgClimaticDataEntry Return dfTemp End Function - Private Sub ucrChangedControls_ControlValueChanged(ucrChangedControl As ucrCore) Handles ucrReceiverStation.ControlValueChanged, ucrReceiverDate.ControlValueChanged, ucrReceiverElements.ControlValueChanged, ucrReceiverViewVariables.ControlValueChanged, ucrInputType.ControlValueChanged, ucrStartDate.ControlValueChanged, ucrEndDate.ControlValueChanged, ucrPnlOptions.ControlValueChanged + Private Sub ucrChangedControls_ControlValueChanged(ucrChangedControl As ucrCore) Handles ucrReceiverStation.ControlValueChanged, ucrReceiverDate.ControlValueChanged, ucrReceiverElements.ControlValueChanged, ucrReceiverViewVariables.ControlValueChanged, ucrInputType.ControlValueChanged, ucrStartDate.ControlValueChanged, ucrEndDate.ControlValueChanged, ucrInputSelectStation.ControlValueChanged, ucrPnlOptions.ControlValueChanged bChange = True End Sub From 4692eeef4e4d0aea272ebdc417e912a44e33dfc6 Mon Sep 17 00:00:00 2001 From: patowhiz Date: Mon, 10 May 2021 16:07:36 +0300 Subject: [PATCH 25/27] Added reste subroutine --- instat/ucrInputFactorLevels.vb | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/instat/ucrInputFactorLevels.vb b/instat/ucrInputFactorLevels.vb index 9d778247f16..7ebe6ef014a 100644 --- a/instat/ucrInputFactorLevels.vb +++ b/instat/ucrInputFactorLevels.vb @@ -44,12 +44,28 @@ Public Class ucrInputFactorLevels End Sub Private Sub ucrReceiverFactor_ControlValueChanged(ucrChangedControl As ucrCore) Handles ucrReceiverFactor.ControlValueChanged + SelectFactorLevel() + End Sub + + Private Sub ucrInputFactorLevels_ControlValueChanged(ucrChangedControl As ucrCore) Handles Me.ControlValueChanged + If Not String.IsNullOrEmpty(GetText) Then + strLastSelectedLevel = GetText() + End If + End Sub + + Public Overrides Sub Reset() + MyBase.Reset() + strLastSelectedLevel = "" + SelectFactorLevel() + End Sub + + Private Sub SelectFactorLevel() Dim expTemp As SymbolicExpression Dim strLevels() As String Dim lstLevels As New List(Of String) Dim clsFactor As RFunction - If ucrReceiverFactor.IsEmpty Then + If ucrReceiverFactor Is Nothing OrElse ucrReceiverFactor.IsEmpty Then SetItems() Enabled = False Else @@ -83,9 +99,4 @@ Public Class ucrInputFactorLevels End If End Sub - Private Sub ucrInputFactorLevels_ControlValueChanged(ucrChangedControl As ucrCore) Handles Me.ControlValueChanged - If Not String.IsNullOrEmpty(GetText) Then - strLastSelectedLevel = GetText() - End If - End Sub End Class From c9a98399d88cb399b67d750b288e3deed9806f31 Mon Sep 17 00:00:00 2001 From: Ivanluv <45068931+Ivanluv@users.noreply.github.com> Date: Thu, 13 May 2021 10:47:21 +0300 Subject: [PATCH 26/27] Update instat/dlgInsertColumn.vb Co-authored-by: Shadrack Kibet --- instat/dlgInsertColumn.vb | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/instat/dlgInsertColumn.vb b/instat/dlgInsertColumn.vb index 3538ec56313..43e3682b318 100644 --- a/instat/dlgInsertColumn.vb +++ b/instat/dlgInsertColumn.vb @@ -114,7 +114,8 @@ Public Class dlgInsertColumn ucrNudStartRow.SetLinkedDisplayControl(lblStartPos) ucrReceiverColumnsToInsert.SetLinkedDisplayControl(lblColumn) - ttColumnDefaultValue.SetToolTip(ucrInputDefaultValue.cboInput, "Include the quotes if the default value is a string, e.g. ""small"".Do not include qoutes if its logical, e.g. TRUE") + ttColumnDefaultValue.SetToolTip(ucrInputDefaultValue.cboInput, "Include the quotes if the default value is a string e.g. "small". Do not include quotes if the default value is logical e.g. TRUE) + End Sub Private Sub SetDefaults() @@ -211,4 +212,4 @@ Public Class dlgInsertColumn ucrSelectorInsertColumns.SetVariablesVisible(False) End If End Sub -End Class \ No newline at end of file +End Class From 7e9c33adff9d9416cca915d85b7b2bccf5283110 Mon Sep 17 00:00:00 2001 From: ivanluv Date: Thu, 13 May 2021 10:51:42 +0300 Subject: [PATCH 27/27] Minor change --- instat/dlgInsertColumn.vb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/instat/dlgInsertColumn.vb b/instat/dlgInsertColumn.vb index 43e3682b318..4f5cb77b400 100644 --- a/instat/dlgInsertColumn.vb +++ b/instat/dlgInsertColumn.vb @@ -114,7 +114,7 @@ Public Class dlgInsertColumn ucrNudStartRow.SetLinkedDisplayControl(lblStartPos) ucrReceiverColumnsToInsert.SetLinkedDisplayControl(lblColumn) - ttColumnDefaultValue.SetToolTip(ucrInputDefaultValue.cboInput, "Include the quotes if the default value is a string e.g. "small". Do not include quotes if the default value is logical e.g. TRUE) + ttColumnDefaultValue.SetToolTip(ucrInputDefaultValue.cboInput, "Include the quotes if the default value is a string e.g. ""small"". Do not include quotes if the default value is logical e.g. TRUE") End Sub