diff --git a/instat/dlgAddComment.Designer.vb b/instat/dlgAddComment.Designer.vb index 0d84d6cbf6b..cfeb5560685 100644 --- a/instat/dlgAddComment.Designer.vb +++ b/instat/dlgAddComment.Designer.vb @@ -44,12 +44,14 @@ Partial Class dlgAddComment Me.lblComment = New System.Windows.Forms.Label() Me.rdoCell = New System.Windows.Forms.RadioButton() Me.rdoRow = New System.Windows.Forms.RadioButton() - Me.ucrPnlCellOrRow = New instat.UcrPanel() + Me.ucrPnlCellRowColumnDataFrame = New instat.UcrPanel() Me.ucrInputComment = New instat.ucrInputTextBox() Me.ucrReceiverColumn = New instat.ucrReceiverSingle() Me.ucrBase = New instat.ucrButtons() Me.ucrSelectorAddComment = New instat.ucrSelectorByDataFrameAddRemove() Me.ucrInputRow = New instat.ucrInputTextBox() + Me.rdoDataFrame = New System.Windows.Forms.RadioButton() + Me.rdoColumn = New System.Windows.Forms.RadioButton() Me.SuspendLayout() ' 'lblRow @@ -87,10 +89,10 @@ Partial Class dlgAddComment Me.rdoRow.Name = "rdoRow" Me.rdoRow.UseVisualStyleBackColor = True ' - 'ucrPnlCellOrRow + 'ucrPnlCellRowColumnDataFrame ' - resources.ApplyResources(Me.ucrPnlCellOrRow, "ucrPnlCellOrRow") - Me.ucrPnlCellOrRow.Name = "ucrPnlCellOrRow" + resources.ApplyResources(Me.ucrPnlCellRowColumnDataFrame, "ucrPnlCellRowColumnDataFrame") + Me.ucrPnlCellRowColumnDataFrame.Name = "ucrPnlCellRowColumnDataFrame" ' 'ucrInputComment ' @@ -130,15 +132,37 @@ Partial Class dlgAddComment resources.ApplyResources(Me.ucrInputRow, "ucrInputRow") Me.ucrInputRow.Name = "ucrInputRow" ' + 'rdoDataFrame + ' + resources.ApplyResources(Me.rdoDataFrame, "rdoDataFrame") + Me.rdoDataFrame.FlatAppearance.BorderColor = System.Drawing.SystemColors.ActiveCaption + Me.rdoDataFrame.FlatAppearance.BorderSize = 2 + Me.rdoDataFrame.FlatAppearance.CheckedBackColor = System.Drawing.SystemColors.ActiveCaption + Me.rdoDataFrame.ForeColor = System.Drawing.SystemColors.ActiveCaptionText + Me.rdoDataFrame.Name = "rdoDataFrame" + Me.rdoDataFrame.UseVisualStyleBackColor = True + ' + 'rdoColumn + ' + resources.ApplyResources(Me.rdoColumn, "rdoColumn") + Me.rdoColumn.FlatAppearance.BorderColor = System.Drawing.SystemColors.ActiveCaption + Me.rdoColumn.FlatAppearance.BorderSize = 2 + Me.rdoColumn.FlatAppearance.CheckedBackColor = System.Drawing.SystemColors.ActiveCaption + Me.rdoColumn.ForeColor = System.Drawing.SystemColors.ActiveCaptionText + Me.rdoColumn.Name = "rdoColumn" + Me.rdoColumn.UseVisualStyleBackColor = True + ' 'dlgAddComment ' resources.ApplyResources(Me, "$this") Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font + Me.Controls.Add(Me.rdoColumn) + Me.Controls.Add(Me.rdoDataFrame) Me.Controls.Add(Me.ucrInputRow) Me.Controls.Add(Me.ucrSelectorAddComment) Me.Controls.Add(Me.rdoCell) Me.Controls.Add(Me.rdoRow) - Me.Controls.Add(Me.ucrPnlCellOrRow) + Me.Controls.Add(Me.ucrPnlCellRowColumnDataFrame) Me.Controls.Add(Me.ucrInputComment) Me.Controls.Add(Me.lblComment) Me.Controls.Add(Me.lblColumn) @@ -162,7 +186,9 @@ Partial Class dlgAddComment Friend WithEvents ucrInputComment As ucrInputTextBox Friend WithEvents rdoCell As RadioButton Friend WithEvents rdoRow As RadioButton - Friend WithEvents ucrPnlCellOrRow As UcrPanel + Friend WithEvents ucrPnlCellRowColumnDataFrame As UcrPanel Friend WithEvents ucrInputRow As ucrInputTextBox Friend WithEvents ucrSelectorAddComment As ucrSelectorByDataFrameAddRemove + Friend WithEvents rdoColumn As RadioButton + Friend WithEvents rdoDataFrame As RadioButton End Class diff --git a/instat/dlgAddComment.resx b/instat/dlgAddComment.resx index 6d19be9e9a1..fb19bcac70f 100644 --- a/instat/dlgAddComment.resx +++ b/instat/dlgAddComment.resx @@ -123,13 +123,13 @@ - 266, 70 + 266, 72 32, 13 - 4 + 6 Row: @@ -144,7 +144,7 @@ $this - 9 + 11 True @@ -156,7 +156,7 @@ 45, 13 - 6 + 8 Column: @@ -171,19 +171,19 @@ $this - 7 + 9 True - 12, 242 + 14, 242 54, 13 - 8 + 10 Comment: @@ -198,7 +198,7 @@ $this - 6 + 8 @@ -208,7 +208,7 @@ Flat - 115, 12 + 10, 12 100, 28 @@ -232,7 +232,7 @@ $this - 2 + 4 Button @@ -247,7 +247,7 @@ Flat - 213, 12 + 108, 12 100, 28 @@ -271,37 +271,37 @@ $this - 3 + 5 - - 108, 12 + + -4, 12 - - 219, 29 + + 422, 29 - + 0 - - ucrPnlCellOrRow + + ucrPnlCellRowColumnDataFrame - + instat.UcrPanel, instat, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null - + $this - - 4 + + 6 - 92, 239 + 72, 239 - 316, 47 + 336, 47 - 9 + 11 ucrInputComment @@ -313,7 +313,7 @@ $this - 5 + 7 True @@ -324,14 +324,98 @@ 418, 346 + + Button + + + None + + + MiddleCenter + + + Flat + + + NoControl + + + 206, 12 + + + 100, 28 + + + 3 + + + Column + + + MiddleCenter + + + rdoColumn + + + System.Windows.Forms.RadioButton, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + $this + + + 0 + + + Button + + + None + + + MiddleCenter + + + Flat + + + NoControl + + + 304, 12 + + + 100, 28 + + + 4 + + + Data Frame + + + MiddleCenter + + + rdoDataFrame + + + System.Windows.Forms.RadioButton, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + $this + + + 1 + - 305, 68 + 302, 68 80, 21 - 12 + 7 ucrInputRow @@ -343,7 +427,7 @@ $this - 0 + 2 10, 48 @@ -355,7 +439,7 @@ 210, 180 - 11 + 5 ucrSelectorAddComment @@ -367,7 +451,7 @@ $this - 1 + 3 10, 293 @@ -376,7 +460,7 @@ 408, 52 - 10 + 12 ucrBase @@ -388,7 +472,7 @@ $this - 10 + 12 CenterScreen @@ -412,7 +496,7 @@ 137, 20 - 7 + 9 ucrReceiverColumn @@ -424,6 +508,6 @@ $this - 8 + 10 \ No newline at end of file diff --git a/instat/dlgAddComment.vb b/instat/dlgAddComment.vb index cb9d04747dc..95eabea211d 100644 --- a/instat/dlgAddComment.vb +++ b/instat/dlgAddComment.vb @@ -44,11 +44,24 @@ Public Class dlgAddComment Private Sub InitialiseDialog() ucrBase.iHelpTopicID = 508 - ucrPnlCellOrRow.AddRadioButton(rdoCell) - ucrPnlCellOrRow.AddRadioButton(rdoRow) - ucrPnlCellOrRow.AddParameterPresentCondition(rdoCell, "column", True) - ucrPnlCellOrRow.AddParameterPresentCondition(rdoRow, "column", False) - ucrPnlCellOrRow.AddToLinkedControls(ucrReceiverColumn, {rdoCell}, bNewLinkedHideIfParameterMissing:=True, bNewLinkedAddRemoveParameter:=True) + ucrPnlCellRowColumnDataFrame.AddRadioButton(rdoCell) + ucrPnlCellRowColumnDataFrame.AddRadioButton(rdoRow) + ucrPnlCellRowColumnDataFrame.AddRadioButton(rdoColumn) + ucrPnlCellRowColumnDataFrame.AddRadioButton(rdoDataFrame) + ucrPnlCellRowColumnDataFrame.AddParameterPresentCondition(rdoCell, "column") + ucrPnlCellRowColumnDataFrame.AddParameterPresentCondition(rdoCell, "row") + ucrPnlCellRowColumnDataFrame.AddParameterPresentCondition(rdoRow, "row") + ucrPnlCellRowColumnDataFrame.AddParameterPresentCondition(rdoColumn, "column") + ucrPnlCellRowColumnDataFrame.AddParameterPresentCondition(rdoColumn, "row", False) + ucrPnlCellRowColumnDataFrame.AddParameterPresentCondition(rdoRow, "column", False) + ucrPnlCellRowColumnDataFrame.AddParameterPresentCondition(rdoDataFrame, "column", False) + ucrPnlCellRowColumnDataFrame.AddParameterPresentCondition(rdoDataFrame, "row", False) + + + ucrPnlCellRowColumnDataFrame.AddToLinkedControls(ucrReceiverColumn, {rdoCell, rdoColumn}, bNewLinkedHideIfParameterMissing:=True, bNewLinkedAddRemoveParameter:=True) + ucrPnlCellRowColumnDataFrame.AddToLinkedControls(ucrInputRow, {rdoCell, rdoRow}, bNewLinkedHideIfParameterMissing:=True, bNewLinkedAddRemoveParameter:=True) + ucrInputRow.SetLinkedDisplayControl(lblRow) + ucrReceiverColumn.SetLinkedDisplayControl(lblColumn) ucrSelectorAddComment.SetParameter(New RParameter("data_name", 0)) ucrSelectorAddComment.SetParameterIsString() @@ -59,7 +72,6 @@ Public Class dlgAddComment ucrReceiverColumn.Selector = ucrSelectorAddComment ucrReceiverColumn.SetParameter(New RParameter("column", iNewPosition:=2)) ucrReceiverColumn.SetParameterIsString() - ucrReceiverColumn.SetLinkedDisplayControl(lblColumn) ucrInputComment.SetParameter(New RParameter("comment", iNewPosition:=3)) End Sub @@ -81,7 +93,10 @@ Public Class dlgAddComment End Sub Private Sub TestOKEnabled() - If Not ucrInputRow.IsEmpty() AndAlso Not ucrInputComment.IsEmpty AndAlso (Not ucrReceiverColumn.IsEmpty OrElse rdoRow.Checked) Then + If (((rdoCell.Checked AndAlso Not ucrInputRow.IsEmpty AndAlso Not ucrReceiverColumn.IsEmpty) OrElse + (rdoRow.Checked AndAlso Not ucrInputRow.IsEmpty) OrElse + (rdoColumn.Checked AndAlso Not ucrReceiverColumn.IsEmpty) OrElse + (rdoDataFrame.Checked)) AndAlso Not ucrInputComment.IsEmpty) Then ucrBase.OKEnabled(True) Else ucrBase.OKEnabled(False) @@ -97,11 +112,16 @@ Public Class dlgAddComment Private Sub SetDefaultPosition() ucrSelectorAddComment.SetDataframe(strSelectedDataFrame) ucrInputRow.SetName(strSelectedRow) - If strSelectedColumn <> "" Then + If strSelectedColumn <> "" AndAlso strSelectedRow <> "" Then ucrReceiverColumn.Add(strSelectedColumn, strSelectedDataFrame) rdoCell.Checked = True - Else + ElseIf strSelectedColumn <> "" AndAlso strSelectedRow = "" Then + ucrReceiverColumn.Add(strSelectedColumn, strSelectedDataFrame) + rdoColumn.Checked = True + ElseIf strSelectedColumn = "" AndAlso strSelectedRow <> "" Then rdoRow.Checked = True + Else + rdoDataFrame.Checked = True End If strSelectedDataFrame = "" strSelectedRow = "" @@ -109,18 +129,18 @@ Public Class dlgAddComment bUseSelectedPosition = False End Sub - Public Sub SetPosition(strDataFrame As String, strRow As String, Optional strColumn As String = "") + Public Sub SetPosition(strDataFrame As String, Optional strRow As String = "", Optional strColumn As String = "") strSelectedDataFrame = strDataFrame strSelectedRow = strRow strSelectedColumn = strColumn bUseSelectedPosition = True End Sub - Private Sub Control_ControlContentsChanged(ucrChangedControl As ucrCore) Handles ucrReceiverColumn.ControlContentsChanged, ucrInputRow.ControlContentsChanged, ucrInputComment.ControlContentsChanged, ucrPnlCellOrRow.ControlContentsChanged - TestOKEnabled() + Private Sub ucrPnlCellRowColumnDataFrame_ControlValueChanged(ucrChangedControl As ucrCore) Handles ucrPnlCellRowColumnDataFrame.ControlValueChanged + ucrSelectorAddComment.ShowColumnSelector(rdoCell.Checked OrElse rdoColumn.Checked) End Sub - Private Sub ucrPnlCellOrRow_ControlValueChanged(ucrChangedControl As ucrCore) Handles ucrPnlCellOrRow.ControlValueChanged - ucrSelectorAddComment.ShowColumnSelector(rdoCell.Checked) + Private Sub Control_ControlContentsChanged(ucrChangedControl As ucrCore) Handles ucrReceiverColumn.ControlContentsChanged, ucrInputRow.ControlContentsChanged, ucrInputComment.ControlContentsChanged, ucrPnlCellRowColumnDataFrame.ControlContentsChanged + TestOKEnabled() End Sub End Class \ No newline at end of file diff --git a/instat/dlgClimaticDataEntry.Designer.vb b/instat/dlgClimaticDataEntry.Designer.vb index 0e6e6eeafc6..0ace6405b69 100644 --- a/instat/dlgClimaticDataEntry.Designer.vb +++ b/instat/dlgClimaticDataEntry.Designer.vb @@ -36,26 +36,22 @@ Partial Class dlgClimaticDataEntry Me.lblEndingDate = New System.Windows.Forms.Label() Me.cmdCheckData = New System.Windows.Forms.Button() Me.ttCmdCheckData = New System.Windows.Forms.ToolTip(Me.components) - Me.grpRestrictEntry = New System.Windows.Forms.GroupBox() - Me.ucrChkAllowTrace = New instat.ucrCheck() - Me.ucrChkNoDecimal = New instat.ucrCheck() Me.ttucrChkDefaultValue = New System.Windows.Forms.ToolTip(Me.components) - Me.ucrInputDefaultValue = New instat.ucrInputTextBox() - Me.ucrInputTransform = New instat.ucrInputComboBox() - Me.ucrChkDefaultValue = New instat.ucrCheck() - Me.ucrChkTransform = New instat.ucrCheck() Me.ucrEndDate = New instat.ucrDateTimePicker() Me.ucrStartDate = New instat.ucrDateTimePicker() Me.ucrInputType = New instat.ucrInputComboBox() Me.ucrReceiverViewVariables = New instat.ucrReceiverMultiple() Me.ucrSelectorClimaticDataEntry = New instat.ucrSelectorByDataFrameAddRemove() - Me.ucrInputSelectStation = New instat.ucrInputFactorLevels() Me.ucrReceiverStation = New instat.ucrReceiverSingle() Me.ucrReceiverDate = New instat.ucrReceiverSingle() Me.ucrReceiverElements = New instat.ucrReceiverMultiple() Me.ucrBase = New instat.ucrButtons() Me.ucrPnlOptions = New instat.UcrPanel() - Me.grpRestrictEntry.SuspendLayout() + Me.lblNbRowsChanged = New System.Windows.Forms.Label() + Me.cmdOptions = New System.Windows.Forms.Button() + Me.lblNbRowsChanged1 = New System.Windows.Forms.Label() + Me.ucrInputSelectStation = New instat.ucrInputFactorLevels() + Me.lblNbCommentEntered = New System.Windows.Forms.Label() Me.SuspendLayout() ' 'rdoAdd @@ -85,7 +81,7 @@ Partial Class dlgClimaticDataEntry Me.rdoEdit.FlatAppearance.CheckedBackColor = System.Drawing.SystemColors.ActiveCaption Me.rdoEdit.FlatStyle = System.Windows.Forms.FlatStyle.Flat Me.rdoEdit.ImeMode = System.Windows.Forms.ImeMode.NoControl - Me.rdoEdit.Location = New System.Drawing.Point(204, 12) + Me.rdoEdit.Location = New System.Drawing.Point(206, 12) Me.rdoEdit.Name = "rdoEdit" Me.rdoEdit.Size = New System.Drawing.Size(110, 27) Me.rdoEdit.TabIndex = 2 @@ -97,7 +93,7 @@ Partial Class dlgClimaticDataEntry ' Me.Label1.AutoSize = True Me.Label1.ImeMode = System.Windows.Forms.ImeMode.NoControl - Me.Label1.Location = New System.Drawing.Point(274, 95) + Me.Label1.Location = New System.Drawing.Point(274, 111) Me.Label1.Name = "Label1" Me.Label1.Size = New System.Drawing.Size(76, 13) Me.Label1.TabIndex = 8 @@ -107,7 +103,7 @@ Partial Class dlgClimaticDataEntry ' Me.lblElement.AutoSize = True Me.lblElement.ImeMode = System.Windows.Forms.ImeMode.NoControl - Me.lblElement.Location = New System.Drawing.Point(274, 181) + Me.lblElement.Location = New System.Drawing.Point(274, 195) Me.lblElement.Name = "lblElement" Me.lblElement.Size = New System.Drawing.Size(86, 13) Me.lblElement.TabIndex = 12 @@ -117,7 +113,7 @@ Partial Class dlgClimaticDataEntry ' Me.lblDate.AutoSize = True Me.lblDate.ImeMode = System.Windows.Forms.ImeMode.NoControl - Me.lblDate.Location = New System.Drawing.Point(274, 139) + Me.lblDate.Location = New System.Drawing.Point(274, 153) Me.lblDate.Name = "lblDate" Me.lblDate.Size = New System.Drawing.Size(33, 13) Me.lblDate.TabIndex = 10 @@ -127,7 +123,7 @@ Partial Class dlgClimaticDataEntry ' Me.lblStation.AutoSize = True Me.lblStation.ImeMode = System.Windows.Forms.ImeMode.NoControl - Me.lblStation.Location = New System.Drawing.Point(274, 54) + Me.lblStation.Location = New System.Drawing.Point(274, 68) Me.lblStation.Name = "lblStation" Me.lblStation.Size = New System.Drawing.Size(43, 13) Me.lblStation.TabIndex = 6 @@ -148,7 +144,7 @@ Partial Class dlgClimaticDataEntry 'cmdEnterData ' Me.cmdEnterData.ImeMode = System.Windows.Forms.ImeMode.NoControl - Me.cmdEnterData.Location = New System.Drawing.Point(7, 436) + Me.cmdEnterData.Location = New System.Drawing.Point(7, 370) Me.cmdEnterData.Name = "cmdEnterData" Me.cmdEnterData.Size = New System.Drawing.Size(106, 24) Me.cmdEnterData.TabIndex = 20 @@ -159,7 +155,7 @@ Partial Class dlgClimaticDataEntry ' Me.Label2.AutoSize = True Me.Label2.ImeMode = System.Windows.Forms.ImeMode.NoControl - Me.Label2.Location = New System.Drawing.Point(274, 306) + Me.Label2.Location = New System.Drawing.Point(274, 320) Me.Label2.Name = "Label2" Me.Label2.Size = New System.Drawing.Size(91, 13) Me.Label2.TabIndex = 14 @@ -169,7 +165,7 @@ Partial Class dlgClimaticDataEntry ' Me.lblPeriod.AutoSize = True Me.lblPeriod.ImeMode = System.Windows.Forms.ImeMode.NoControl - Me.lblPeriod.Location = New System.Drawing.Point(22, 247) + Me.lblPeriod.Location = New System.Drawing.Point(7, 247) Me.lblPeriod.Name = "lblPeriod" Me.lblPeriod.Size = New System.Drawing.Size(40, 13) Me.lblPeriod.TabIndex = 4 @@ -190,7 +186,7 @@ Partial Class dlgClimaticDataEntry 'cmdCheckData ' Me.cmdCheckData.ImeMode = System.Windows.Forms.ImeMode.NoControl - Me.cmdCheckData.Location = New System.Drawing.Point(137, 436) + Me.cmdCheckData.Location = New System.Drawing.Point(137, 370) Me.cmdCheckData.Name = "cmdCheckData" Me.cmdCheckData.Size = New System.Drawing.Size(72, 24) Me.cmdCheckData.TabIndex = 21 @@ -203,76 +199,12 @@ Partial Class dlgClimaticDataEntry Me.ttCmdCheckData.InitialDelay = 500 Me.ttCmdCheckData.ReshowDelay = 100 ' - 'grpRestrictEntry - ' - Me.grpRestrictEntry.Controls.Add(Me.ucrChkAllowTrace) - Me.grpRestrictEntry.Controls.Add(Me.ucrChkNoDecimal) - Me.grpRestrictEntry.Location = New System.Drawing.Point(7, 388) - Me.grpRestrictEntry.Name = "grpRestrictEntry" - Me.grpRestrictEntry.Size = New System.Drawing.Size(243, 40) - Me.grpRestrictEntry.TabIndex = 64 - Me.grpRestrictEntry.TabStop = False - Me.grpRestrictEntry.Text = "Restrict Entry:" - ' - 'ucrChkAllowTrace - ' - Me.ucrChkAllowTrace.Checked = False - Me.ucrChkAllowTrace.Location = New System.Drawing.Point(109, 14) - Me.ucrChkAllowTrace.Name = "ucrChkAllowTrace" - Me.ucrChkAllowTrace.Size = New System.Drawing.Size(127, 20) - Me.ucrChkAllowTrace.TabIndex = 66 - ' - 'ucrChkNoDecimal - ' - Me.ucrChkNoDecimal.Checked = False - Me.ucrChkNoDecimal.Location = New System.Drawing.Point(7, 14) - Me.ucrChkNoDecimal.Name = "ucrChkNoDecimal" - Me.ucrChkNoDecimal.Size = New System.Drawing.Size(113, 20) - Me.ucrChkNoDecimal.TabIndex = 65 - ' 'ttucrChkDefaultValue ' Me.ttucrChkDefaultValue.AutoPopDelay = 10000 Me.ttucrChkDefaultValue.InitialDelay = 500 Me.ttucrChkDefaultValue.ReshowDelay = 100 ' - 'ucrInputDefaultValue - ' - Me.ucrInputDefaultValue.AddQuotesIfUnrecognised = True - Me.ucrInputDefaultValue.IsMultiline = False - Me.ucrInputDefaultValue.IsReadOnly = False - Me.ucrInputDefaultValue.Location = New System.Drawing.Point(97, 361) - Me.ucrInputDefaultValue.Name = "ucrInputDefaultValue" - Me.ucrInputDefaultValue.Size = New System.Drawing.Size(61, 21) - Me.ucrInputDefaultValue.TabIndex = 87 - ' - 'ucrInputTransform - ' - Me.ucrInputTransform.AddQuotesIfUnrecognised = True - Me.ucrInputTransform.GetSetSelectedIndex = -1 - Me.ucrInputTransform.IsReadOnly = False - Me.ucrInputTransform.Location = New System.Drawing.Point(97, 331) - Me.ucrInputTransform.Margin = New System.Windows.Forms.Padding(5) - Me.ucrInputTransform.Name = "ucrInputTransform" - Me.ucrInputTransform.Size = New System.Drawing.Size(94, 21) - Me.ucrInputTransform.TabIndex = 86 - ' - 'ucrChkDefaultValue - ' - Me.ucrChkDefaultValue.Checked = False - Me.ucrChkDefaultValue.Location = New System.Drawing.Point(7, 362) - Me.ucrChkDefaultValue.Name = "ucrChkDefaultValue" - Me.ucrChkDefaultValue.Size = New System.Drawing.Size(93, 20) - Me.ucrChkDefaultValue.TabIndex = 63 - ' - 'ucrChkTransform - ' - Me.ucrChkTransform.Checked = False - Me.ucrChkTransform.Location = New System.Drawing.Point(7, 333) - Me.ucrChkTransform.Name = "ucrChkTransform" - Me.ucrChkTransform.Size = New System.Drawing.Size(83, 20) - Me.ucrChkTransform.TabIndex = 62 - ' 'ucrEndDate ' Me.ucrEndDate.DateValue = New Date(2021, 3, 27, 16, 14, 1, 560) @@ -281,7 +213,7 @@ Partial Class dlgClimaticDataEntry Me.ucrEndDate.MaxDate = New Date(9998, 12, 31, 0, 0, 0, 0) Me.ucrEndDate.MinDate = New Date(1753, 1, 1, 0, 0, 0, 0) Me.ucrEndDate.Name = "ucrEndDate" - Me.ucrEndDate.Size = New System.Drawing.Size(135, 20) + Me.ucrEndDate.Size = New System.Drawing.Size(132, 21) Me.ucrEndDate.TabIndex = 28 ' 'ucrStartDate @@ -292,7 +224,7 @@ Partial Class dlgClimaticDataEntry Me.ucrStartDate.MaxDate = New Date(9998, 12, 31, 0, 0, 0, 0) Me.ucrStartDate.MinDate = New Date(1753, 1, 1, 0, 0, 0, 0) Me.ucrStartDate.Name = "ucrStartDate" - Me.ucrStartDate.Size = New System.Drawing.Size(135, 20) + Me.ucrStartDate.Size = New System.Drawing.Size(132, 21) Me.ucrStartDate.TabIndex = 27 ' 'ucrInputType @@ -308,7 +240,7 @@ Partial Class dlgClimaticDataEntry 'ucrReceiverViewVariables ' Me.ucrReceiverViewVariables.frmParent = Me - Me.ucrReceiverViewVariables.Location = New System.Drawing.Point(273, 323) + Me.ucrReceiverViewVariables.Location = New System.Drawing.Point(273, 337) Me.ucrReceiverViewVariables.Margin = New System.Windows.Forms.Padding(0) Me.ucrReceiverViewVariables.Name = "ucrReceiverViewVariables" Me.ucrReceiverViewVariables.Selector = Nothing @@ -328,20 +260,10 @@ Partial Class dlgClimaticDataEntry Me.ucrSelectorClimaticDataEntry.Size = New System.Drawing.Size(210, 180) Me.ucrSelectorClimaticDataEntry.TabIndex = 3 ' - 'ucrInputSelectStation - ' - Me.ucrInputSelectStation.AddQuotesIfUnrecognised = True - Me.ucrInputSelectStation.GetSetSelectedIndex = -1 - Me.ucrInputSelectStation.IsReadOnly = False - Me.ucrInputSelectStation.Location = New System.Drawing.Point(273, 111) - Me.ucrInputSelectStation.Name = "ucrInputSelectStation" - Me.ucrInputSelectStation.Size = New System.Drawing.Size(120, 21) - Me.ucrInputSelectStation.TabIndex = 9 - ' 'ucrReceiverStation ' Me.ucrReceiverStation.frmParent = Me - Me.ucrReceiverStation.Location = New System.Drawing.Point(273, 70) + Me.ucrReceiverStation.Location = New System.Drawing.Point(273, 84) Me.ucrReceiverStation.Margin = New System.Windows.Forms.Padding(0) Me.ucrReceiverStation.Name = "ucrReceiverStation" Me.ucrReceiverStation.Selector = Nothing @@ -353,7 +275,7 @@ Partial Class dlgClimaticDataEntry 'ucrReceiverDate ' Me.ucrReceiverDate.frmParent = Me - Me.ucrReceiverDate.Location = New System.Drawing.Point(273, 155) + Me.ucrReceiverDate.Location = New System.Drawing.Point(273, 169) Me.ucrReceiverDate.Margin = New System.Windows.Forms.Padding(0) Me.ucrReceiverDate.Name = "ucrReceiverDate" Me.ucrReceiverDate.Selector = Nothing @@ -365,7 +287,7 @@ Partial Class dlgClimaticDataEntry 'ucrReceiverElements ' Me.ucrReceiverElements.frmParent = Me - Me.ucrReceiverElements.Location = New System.Drawing.Point(273, 198) + Me.ucrReceiverElements.Location = New System.Drawing.Point(273, 212) Me.ucrReceiverElements.Margin = New System.Windows.Forms.Padding(0) Me.ucrReceiverElements.Name = "ucrReceiverElements" Me.ucrReceiverElements.Selector = Nothing @@ -388,16 +310,63 @@ Partial Class dlgClimaticDataEntry Me.ucrPnlOptions.Size = New System.Drawing.Size(278, 35) Me.ucrPnlOptions.TabIndex = 26 ' + 'lblNbRowsChanged + ' + Me.lblNbRowsChanged.AutoSize = True + Me.lblNbRowsChanged.Location = New System.Drawing.Point(253, -57) + Me.lblNbRowsChanged.Name = "lblNbRowsChanged" + Me.lblNbRowsChanged.Size = New System.Drawing.Size(39, 13) + Me.lblNbRowsChanged.TabIndex = 88 + Me.lblNbRowsChanged.Text = "Label3" + ' + 'cmdOptions + ' + Me.cmdOptions.ImeMode = System.Windows.Forms.ImeMode.NoControl + Me.cmdOptions.Location = New System.Drawing.Point(7, 337) + Me.cmdOptions.Name = "cmdOptions" + Me.cmdOptions.Size = New System.Drawing.Size(106, 24) + Me.cmdOptions.TabIndex = 89 + Me.cmdOptions.Text = "Options" + Me.cmdOptions.UseVisualStyleBackColor = True + ' + 'lblNbRowsChanged1 + ' + Me.lblNbRowsChanged1.AutoSize = True + Me.lblNbRowsChanged1.Location = New System.Drawing.Point(7, 405) + Me.lblNbRowsChanged1.Name = "lblNbRowsChanged1" + Me.lblNbRowsChanged1.Size = New System.Drawing.Size(39, 13) + Me.lblNbRowsChanged1.TabIndex = 90 + Me.lblNbRowsChanged1.Text = "Label3" + ' + 'ucrInputSelectStation + ' + Me.ucrInputSelectStation.AddQuotesIfUnrecognised = True + Me.ucrInputSelectStation.GetSetSelectedIndex = -1 + Me.ucrInputSelectStation.IsReadOnly = False + Me.ucrInputSelectStation.Location = New System.Drawing.Point(273, 127) + Me.ucrInputSelectStation.Name = "ucrInputSelectStation" + Me.ucrInputSelectStation.Size = New System.Drawing.Size(126, 21) + Me.ucrInputSelectStation.TabIndex = 91 + ' + 'lblNbCommentEntered + ' + Me.lblNbCommentEntered.AutoSize = True + Me.lblNbCommentEntered.Location = New System.Drawing.Point(7, 429) + Me.lblNbCommentEntered.Name = "lblNbCommentEntered" + Me.lblNbCommentEntered.Size = New System.Drawing.Size(39, 13) + Me.lblNbCommentEntered.TabIndex = 92 + Me.lblNbCommentEntered.Text = "Label4" + ' 'dlgClimaticDataEntry ' Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!) Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font Me.ClientSize = New System.Drawing.Size(411, 520) - Me.Controls.Add(Me.ucrInputDefaultValue) - Me.Controls.Add(Me.ucrInputTransform) - Me.Controls.Add(Me.grpRestrictEntry) - Me.Controls.Add(Me.ucrChkDefaultValue) - Me.Controls.Add(Me.ucrChkTransform) + Me.Controls.Add(Me.lblNbCommentEntered) + Me.Controls.Add(Me.ucrInputSelectStation) + Me.Controls.Add(Me.lblNbRowsChanged1) + Me.Controls.Add(Me.cmdOptions) + Me.Controls.Add(Me.lblNbRowsChanged) Me.Controls.Add(Me.ucrEndDate) Me.Controls.Add(Me.ucrStartDate) Me.Controls.Add(Me.cmdCheckData) @@ -408,7 +377,6 @@ Partial Class dlgClimaticDataEntry Me.Controls.Add(Me.ucrReceiverViewVariables) Me.Controls.Add(Me.ucrSelectorClimaticDataEntry) Me.Controls.Add(Me.cmdEnterData) - Me.Controls.Add(Me.ucrInputSelectStation) Me.Controls.Add(Me.lblStartingDate) Me.Controls.Add(Me.lblStation) Me.Controls.Add(Me.ucrReceiverStation) @@ -425,7 +393,6 @@ Partial Class dlgClimaticDataEntry Me.Name = "dlgClimaticDataEntry" Me.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent Me.Text = "Daily Data Entry" - Me.grpRestrictEntry.ResumeLayout(False) Me.ResumeLayout(False) Me.PerformLayout() @@ -442,7 +409,6 @@ Partial Class dlgClimaticDataEntry Friend WithEvents lblStation As Label Friend WithEvents ucrReceiverStation As ucrReceiverSingle Friend WithEvents lblStartingDate As Label - Friend WithEvents ucrInputSelectStation As ucrInputFactorLevels Friend WithEvents cmdEnterData As Button Friend WithEvents ucrSelectorClimaticDataEntry As ucrSelectorByDataFrameAddRemove Friend WithEvents Label2 As Label @@ -454,12 +420,10 @@ Partial Class dlgClimaticDataEntry Friend WithEvents ttCmdCheckData As ToolTip Friend WithEvents ucrEndDate As ucrDateTimePicker Friend WithEvents ucrStartDate As ucrDateTimePicker - Friend WithEvents ucrChkDefaultValue As ucrCheck - Friend WithEvents ucrChkTransform As ucrCheck - Friend WithEvents grpRestrictEntry As GroupBox - Friend WithEvents ucrChkAllowTrace As ucrCheck - Friend WithEvents ucrChkNoDecimal As ucrCheck Friend WithEvents ttucrChkDefaultValue As ToolTip - Friend WithEvents ucrInputTransform As ucrInputComboBox - Friend WithEvents ucrInputDefaultValue As ucrInputTextBox + Friend WithEvents lblNbRowsChanged As Label + Friend WithEvents cmdOptions As Button + Friend WithEvents lblNbRowsChanged1 As Label + Friend WithEvents ucrInputSelectStation As ucrInputFactorLevels + Friend WithEvents lblNbCommentEntered As Label End Class diff --git a/instat/dlgClimaticDataEntry.vb b/instat/dlgClimaticDataEntry.vb index b5b5df1d528..9b2a25f59dc 100644 --- a/instat/dlgClimaticDataEntry.vb +++ b/instat/dlgClimaticDataEntry.vb @@ -43,6 +43,7 @@ Public Class dlgClimaticDataEntry bReset = False autoTranslate(Me) ucrBase.OKEnabled(False) + SetNumberCommentEnteredText(sdgCommentForDataEntry.NbCommentEntered) End Sub Private Sub InitialiseDialog() @@ -74,10 +75,9 @@ Public Class dlgClimaticDataEntry ucrReceiverStation.SetIncludedDataTypes({"factor"}) ucrReceiverStation.strSelectorHeading = "Factors" - ucrInputSelectStation.SetParameter(New RParameter("station_name", 6)) ucrInputSelectStation.SetFactorReceiver(ucrReceiverStation) - ucrInputSelectStation.AddQuotesIfUnrecognised = False - ucrInputSelectStation.bFirstLevelDefault = True + ucrInputSelectStation.strQuotes = "" + ucrReceiverDate.Selector = ucrSelectorClimaticDataEntry ucrReceiverDate.SetClimaticType("date") @@ -104,25 +104,8 @@ Public Class dlgClimaticDataEntry ucrEndDate.SetParameter(New RParameter("end_date", iNewPosition:=9)) ucrEndDate.SetParameterIsRDate() - 'Not yet implemented - ucrChkTransform.SetText("Transform:") - - 'ucrInputTransform.SetItems({"10", "Inch to mm"}) - ucrInputTransform.SetItems({"10"}) 'todo. temporary - ucrInputTransform.SetValidationTypeAsNumeric(dcmMin:=1) 'temporary` - ucrInputTransform.Visible = False - - ucrChkDefaultValue.SetText("Default Value") - ucrInputDefaultValue.SetText("0") - ucrInputDefaultValue.Visible = False - - ucrChkNoDecimal.SetText("No Decimal") - - ucrChkAllowTrace.SetText("Allow t for Trace") - ttCmdCheckData.SetToolTip(cmdCheckData, "Data checking facilities not yet implemented") cmdCheckData.Enabled = False - ttucrChkDefaultValue.SetToolTip(ucrChkDefaultValue, "The data must be defined as climatic to recognise which variable is precipitation.") End Sub Private Sub SetDefaults() @@ -132,10 +115,9 @@ Public Class dlgClimaticDataEntry ucrSelectorClimaticDataEntry.Reset() ucrReceiverElements.SetMeAsReceiver() - ucrChkDefaultValue.Checked = False - ucrChkAllowTrace.Checked = False - ucrChkTransform.Checked = False - ucrInputTransform.SetName(10) + ucrInputSelectStation.bFirstLevelDefault = True + lblNbCommentEntered.Visible = False + lblNbRowsChanged1.Visible = False clsGetDataEntry.SetRCommand(frmMain.clsRLink.strInstatDataObject & "$get_data_entry_data") clsGetDataEntry.AddParameter("type", Chr(34) & "month" & Chr(34), iPosition:=6) @@ -161,6 +143,7 @@ Public Class dlgClimaticDataEntry ucrReceiverElements.SetRCode(clsGetDataEntry, bReset) ucrReceiverViewVariables.SetRCode(clsGetDataEntry, bReset) ucrInputSelectStation.SetRCode(clsGetDataEntry, bReset) + ucrStartDate.SetRCode(clsGetDataEntry, bReset) ucrEndDate.SetRCode(clsGetDataEntry, bReset) If bReset Then @@ -186,6 +169,7 @@ Public Class dlgClimaticDataEntry Private Sub ucrBase_ClickReset(sender As Object, e As EventArgs) Handles ucrBase.ClickReset SetDefaults() sdgClimaticDataEntry.Reset() + sdgCommentForDataEntry.ClearInputComment() SetRCodeForControls(True) TestOkEnabled() End Sub @@ -202,15 +186,8 @@ Public Class dlgClimaticDataEntry Dim strStationSelected As String Dim dfEditData As DataFrame Dim strDataFrameName As String - Dim strDefaultValue As String 'todo. why is this a string? Dim bSetup As Boolean Dim bShow As Boolean - Dim bNoDecimals As Boolean - Dim bDefaultValue As Boolean - Dim bAllowTrace As Boolean - Dim bTransform As Boolean - Dim dTranformValue As Double - strDataFrameName = ucrSelectorClimaticDataEntry.strCurrentDataFrame strStationColumnName = ucrReceiverStation.GetVariableNames(bWithQuotes:=False) @@ -220,8 +197,6 @@ Public Class dlgClimaticDataEntry lstVariablesColumnNames = ucrReceiverViewVariables.GetVariableNamesList(bWithQuotes:=False).ToList dfEditData = GetSelectedDataFrame() - strDefaultValue = ucrInputDefaultValue.GetValue() - If dfEditData Is Nothing Then MsgBox("No available data for this selection. Modify dates and try again.") Exit Sub @@ -239,23 +214,23 @@ Public Class dlgClimaticDataEntry bShow = True bSetup = False End If - 'todo. do we really need the bState?? - If bState Then - bNoDecimals = ucrChkNoDecimal.Checked - bDefaultValue = ucrChkDefaultValue.Checked - bAllowTrace = ucrChkAllowTrace.Checked - bTransform = ucrChkTransform.Checked - dTranformValue = ucrInputTransform.GetValue - End If + If bShow Then If bSetup Then sdgClimaticDataEntry.Setup(dfEditData, strDataFrameName, clsSaveDataEntry, clsEditDataFrame, strDateColumnName, lstElementsColumnNames, lstVariablesColumnNames, strStationColumnName, - bDefaultValue:=bDefaultValue, strDefaultValue:=strDefaultValue, - bNoDecimal:=bNoDecimals, bAllowTrace:=bAllowTrace, - bTransform:=bTransform, dTranformValue:=dTranformValue) + bDefaultValue:=sdgClimaticDataEntryOptions.UseDefault, + strDefaultValue:=sdgClimaticDataEntryOptions.DefaultValue, + bNoDecimal:=sdgClimaticDataEntryOptions.NoDecimals, + bAllowTrace:=sdgClimaticDataEntryOptions.AllowTrace, + bTransform:=sdgClimaticDataEntryOptions.Transform, + dTranformValue:=sdgClimaticDataEntryOptions.TransformValue, + MissingValueAsNA:=sdgClimaticDataEntryOptions.MissingValueAsNA, + strEntryType:=ucrInputType.GetText) End If sdgClimaticDataEntry.ShowDialog() + SetNumberRowsChangedText(sdgClimaticDataEntry.NRowsChanged) + SetNumberCommentEnteredText(sdgCommentForDataEntry.NbCommentEntered) bSubdialogFirstLoad = False bChange = False TestOkEnabled() @@ -273,7 +248,7 @@ Public Class dlgClimaticDataEntry Return dfTemp End Function - Private Sub ucrSelectorClimaticDataEntry_ControlValueChanged(ucrChangedControl As ucrCore) Handles ucrSelectorClimaticDataEntry.ControlValueChanged, ucrReceiverStation.ControlValueChanged, ucrReceiverDate.ControlValueChanged, ucrReceiverElements.ControlValueChanged, ucrReceiverViewVariables.ControlValueChanged, ucrInputSelectStation.ControlValueChanged, ucrInputType.ControlValueChanged, ucrStartDate.ControlValueChanged, ucrEndDate.ControlValueChanged, ucrPnlOptions.ControlValueChanged + Private Sub ucrSelectorClimaticDataEntry_ControlValueChanged(ucrChangedControl As ucrCore) Handles ucrSelectorClimaticDataEntry.ControlValueChanged, ucrReceiverStation.ControlValueChanged, ucrReceiverDate.ControlValueChanged, ucrReceiverElements.ControlValueChanged, ucrReceiverViewVariables.ControlValueChanged, ucrInputType.ControlValueChanged, ucrStartDate.ControlValueChanged, ucrEndDate.ControlValueChanged, ucrPnlOptions.ControlValueChanged bChange = True End Sub @@ -300,33 +275,42 @@ Public Class dlgClimaticDataEntry Private Sub StationControls_ControlValueChanged(ucrChangedControl As ucrCore) Handles ucrReceiverStation.ControlValueChanged, ucrInputSelectStation.ControlValueChanged clsEditDataFrame.RemoveParameterByName(strStationColumn) + clsGetDataEntry.AddParameter("station_name", Chr(34) & ucrInputSelectStation.GetValue() & Chr(34), iPosition:=6) strStationColumn = ucrReceiverStation.GetVariableNames(bWithQuotes:=False) If Not strStationColumn = "" AndAlso Not ucrInputSelectStation.GetValue() = "" Then - clsEditDataFrame.AddParameter(strStationColumn, ucrInputSelectStation.GetValue(), iPosition:=0) + clsEditDataFrame.AddParameter(strStationColumn, Chr(34) & ucrInputSelectStation.GetValue() & Chr(34), iPosition:=0) End If End Sub Private Sub ucrBase_ClickOk(sender As Object, e As EventArgs) Handles ucrBase.ClickOk bChange = True bSubdialogFirstLoad = True + sdgCommentForDataEntry.ClearComments() + SetNumberRowsChangedText(0) End Sub - Private Sub ucrChkNoDecimal_ControlValueChanged(ucrChangedControl As ucrCore) Handles ucrChkNoDecimal.ControlValueChanged, ucrChkDefaultValue.ControlValueChanged, ucrChkAllowTrace.ControlValueChanged, ucrChkTransform.ControlValueChanged - bChange = True - If ucrChkDefaultValue.Checked OrElse ucrChkNoDecimal.Checked OrElse ucrChkAllowTrace.Checked OrElse ucrChkTransform.Checked Then - bState = True + Private Sub SetNumberRowsChangedText(nval As Integer) + If nval > 0 Then + lblNbRowsChanged1.Visible = True + lblNbRowsChanged1.ForeColor = Color.Red + lblNbRowsChanged1.Text = nval & " row(s) entered" Else - bState = False + lblNbRowsChanged1.Visible = False End If End Sub - Private Sub ucrChkDefaultValue_ControlValueChanged(ucrChangedControl As ucrCore) Handles ucrChkDefaultValue.ControlValueChanged - 'todo. can this "toggling" be done in another way? - ucrInputDefaultValue.Visible = ucrChkDefaultValue.Checked + Private Sub SetNumberCommentEnteredText(nval As Integer) + If nval > 0 Then + lblNbCommentEntered.Visible = True + lblNbCommentEntered.ForeColor = Color.Red + lblNbCommentEntered.Text = nval & " comment(s) entered" + Else + lblNbCommentEntered.Visible = False + End If End Sub - Private Sub ucrChkTransform_ControlValueChanged(ucrChangedControl As ucrCore) Handles ucrChkTransform.ControlValueChanged - 'todo. can this "toggling" be done in another way? - ucrInputTransform.Visible = ucrChkTransform.Checked + Private Sub cmdOptions_Click(sender As Object, e As EventArgs) Handles cmdOptions.Click + sdgClimaticDataEntryOptions.ShowDialog() + bChange = True 'todo. is it always true End Sub End Class \ No newline at end of file diff --git a/instat/dlgCompareColumns.Designer.vb b/instat/dlgCompareColumns.Designer.vb index 6ac453ea612..7423005b525 100644 --- a/instat/dlgCompareColumns.Designer.vb +++ b/instat/dlgCompareColumns.Designer.vb @@ -26,18 +26,23 @@ Partial Class dlgCompareColumns Me.lblFirstColumn = New System.Windows.Forms.Label() Me.lblSecondColumn = New System.Windows.Forms.Label() Me.grpComparisions = New System.Windows.Forms.GroupBox() - Me.ucrSaveLogical = New instat.ucrSave() - Me.ucrChkSort = New instat.ucrCheck() - Me.ucrChkUnique = New instat.ucrCheck() Me.ucrChkAllValues = New instat.ucrCheck() Me.ucrChkUnion = New instat.ucrCheck() Me.ucrChkIntersection = New instat.ucrCheck() Me.ucrChkSecondNotFirst = New instat.ucrCheck() Me.ucrChkFirstNotSecond = New instat.ucrCheck() + Me.lblTolerance = New System.Windows.Forms.Label() + Me.rdoByValue = New System.Windows.Forms.RadioButton() + Me.rdoByRow = New System.Windows.Forms.RadioButton() + Me.ucrInputTolerance = New instat.ucrInputComboBox() + Me.ucrPnlOptions = New instat.UcrPanel() + Me.ucrSaveLogical = New instat.ucrSave() + Me.ucrChkSort = New instat.ucrCheck() Me.ucrBase = New instat.ucrButtons() Me.ucrReceiverSecond = New instat.ucrReceiverSingle() Me.ucrReceiverFirst = New instat.ucrReceiverSingle() Me.ucrSelectorCompareColumns = New instat.ucrSelectorByDataFrameAddRemove() + Me.ucrChkUnique = New instat.ucrCheck() Me.grpComparisions.SuspendLayout() Me.SuspendLayout() ' @@ -62,23 +67,6 @@ Partial Class dlgCompareColumns Me.grpComparisions.Name = "grpComparisions" Me.grpComparisions.TabStop = False ' - 'ucrSaveLogical - ' - resources.ApplyResources(Me.ucrSaveLogical, "ucrSaveLogical") - Me.ucrSaveLogical.Name = "ucrSaveLogical" - ' - 'ucrChkSort - ' - Me.ucrChkSort.Checked = False - resources.ApplyResources(Me.ucrChkSort, "ucrChkSort") - Me.ucrChkSort.Name = "ucrChkSort" - ' - 'ucrChkUnique - ' - Me.ucrChkUnique.Checked = False - resources.ApplyResources(Me.ucrChkUnique, "ucrChkUnique") - Me.ucrChkUnique.Name = "ucrChkUnique" - ' 'ucrChkAllValues ' Me.ucrChkAllValues.Checked = False @@ -109,6 +97,57 @@ Partial Class dlgCompareColumns resources.ApplyResources(Me.ucrChkFirstNotSecond, "ucrChkFirstNotSecond") Me.ucrChkFirstNotSecond.Name = "ucrChkFirstNotSecond" ' + 'lblTolerance + ' + resources.ApplyResources(Me.lblTolerance, "lblTolerance") + Me.lblTolerance.Name = "lblTolerance" + ' + 'rdoByValue + ' + resources.ApplyResources(Me.rdoByValue, "rdoByValue") + Me.rdoByValue.FlatAppearance.BorderColor = System.Drawing.SystemColors.ActiveCaption + Me.rdoByValue.FlatAppearance.BorderSize = 2 + Me.rdoByValue.FlatAppearance.CheckedBackColor = System.Drawing.SystemColors.ActiveCaption + Me.rdoByValue.Name = "rdoByValue" + Me.rdoByValue.TabStop = True + Me.rdoByValue.Tag = "" + Me.rdoByValue.UseVisualStyleBackColor = True + ' + 'rdoByRow + ' + resources.ApplyResources(Me.rdoByRow, "rdoByRow") + Me.rdoByRow.FlatAppearance.BorderColor = System.Drawing.SystemColors.ActiveCaption + Me.rdoByRow.FlatAppearance.BorderSize = 2 + Me.rdoByRow.FlatAppearance.CheckedBackColor = System.Drawing.SystemColors.ActiveCaption + Me.rdoByRow.Name = "rdoByRow" + Me.rdoByRow.TabStop = True + Me.rdoByRow.Tag = "" + Me.rdoByRow.UseVisualStyleBackColor = True + ' + 'ucrInputTolerance + ' + Me.ucrInputTolerance.AddQuotesIfUnrecognised = True + Me.ucrInputTolerance.GetSetSelectedIndex = -1 + Me.ucrInputTolerance.IsReadOnly = False + resources.ApplyResources(Me.ucrInputTolerance, "ucrInputTolerance") + Me.ucrInputTolerance.Name = "ucrInputTolerance" + ' + 'ucrPnlOptions + ' + resources.ApplyResources(Me.ucrPnlOptions, "ucrPnlOptions") + Me.ucrPnlOptions.Name = "ucrPnlOptions" + ' + 'ucrSaveLogical + ' + resources.ApplyResources(Me.ucrSaveLogical, "ucrSaveLogical") + Me.ucrSaveLogical.Name = "ucrSaveLogical" + ' + 'ucrChkSort + ' + Me.ucrChkSort.Checked = False + resources.ApplyResources(Me.ucrChkSort, "ucrChkSort") + Me.ucrChkSort.Name = "ucrChkSort" + ' 'ucrBase ' resources.ApplyResources(Me.ucrBase, "ucrBase") @@ -140,13 +179,23 @@ Partial Class dlgCompareColumns resources.ApplyResources(Me.ucrSelectorCompareColumns, "ucrSelectorCompareColumns") Me.ucrSelectorCompareColumns.Name = "ucrSelectorCompareColumns" ' + 'ucrChkUnique + ' + Me.ucrChkUnique.Checked = False + resources.ApplyResources(Me.ucrChkUnique, "ucrChkUnique") + Me.ucrChkUnique.Name = "ucrChkUnique" + ' 'dlgCompareColumns ' resources.ApplyResources(Me, "$this") Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font + Me.Controls.Add(Me.lblTolerance) + Me.Controls.Add(Me.ucrInputTolerance) + Me.Controls.Add(Me.rdoByValue) + Me.Controls.Add(Me.rdoByRow) + Me.Controls.Add(Me.ucrPnlOptions) Me.Controls.Add(Me.ucrSaveLogical) Me.Controls.Add(Me.ucrChkSort) - Me.Controls.Add(Me.ucrChkUnique) Me.Controls.Add(Me.grpComparisions) Me.Controls.Add(Me.ucrBase) Me.Controls.Add(Me.lblSecondColumn) @@ -154,6 +203,7 @@ Partial Class dlgCompareColumns Me.Controls.Add(Me.ucrReceiverSecond) Me.Controls.Add(Me.ucrReceiverFirst) Me.Controls.Add(Me.ucrSelectorCompareColumns) + Me.Controls.Add(Me.ucrChkUnique) Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow Me.MaximizeBox = False Me.MinimizeBox = False @@ -180,4 +230,9 @@ Partial Class dlgCompareColumns Friend WithEvents ucrChkUnion As ucrCheck Friend WithEvents ucrChkAllValues As ucrCheck Friend WithEvents ucrSaveLogical As ucrSave + Friend WithEvents lblTolerance As Label + Friend WithEvents rdoByValue As RadioButton + Friend WithEvents rdoByRow As RadioButton + Friend WithEvents ucrPnlOptions As UcrPanel + Friend WithEvents ucrInputTolerance As ucrInputComboBox End Class diff --git a/instat/dlgCompareColumns.resx b/instat/dlgCompareColumns.resx index bdb35dcbfab..52be4a37db7 100644 --- a/instat/dlgCompareColumns.resx +++ b/instat/dlgCompareColumns.resx @@ -127,7 +127,7 @@ - 270, 45 + 267, 83 67, 13 @@ -148,7 +148,7 @@ $this - 6 + 10 True @@ -157,7 +157,7 @@ NoControl - 270, 98 + 267, 136 85, 13 @@ -178,10 +178,10 @@ $this - 5 + 9 - 11, 127 + 11, 122 210, 20 @@ -202,7 +202,7 @@ 0 - 11, 101 + 11, 104 210, 20 @@ -223,7 +223,7 @@ 1 - 11, 75 + 11, 78 210, 20 @@ -244,7 +244,7 @@ 2 - 11, 49 + 11, 52 210, 20 @@ -265,7 +265,7 @@ 3 - 11, 23 + 11, 26 210, 20 @@ -286,7 +286,7 @@ 4 - 10, 232 + 10, 270 271, 154 @@ -307,13 +307,163 @@ $this + 7 + + + True + + + NoControl + + + 267, 200 + + + 61, 13 + + + 118 + + + Tolerance: + + + lblTolerance + + + System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + $this + + + 0 + + + Button + + + Flat + + + NoControl + + + 180, 13 + + + 96, 28 + + + 115 + + + By Value + + + MiddleCenter + + + rdoByValue + + + System.Windows.Forms.RadioButton, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + $this + + + 2 + + + Button + + + Flat + + + NoControl + + + 84, 13 + + + 98, 28 + + + 116 + + + By Row + + + MiddleCenter + + + rdoByRow + + + System.Windows.Forms.RadioButton, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + $this + + 3 + + 328, 197 + + + 62, 21 + + + 120 + + + ucrInputTolerance + + + instat.ucrInputComboBox, instat, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null + + + $this + + + 1 + + + 67, 8 + + + 5, 5, 5, 5 + + + 228, 37 + + + 114 + + + ucrPnlOptions + + + instat.UcrPanel, instat, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null + + + $this + + + 4 + - 11, 392 + 11, 426 + + + 4, 5, 4, 5 - 380, 24 + 396, 24 8 @@ -328,10 +478,10 @@ $this - 0 + 5 - 270, 204 + 270, 242 115, 20 @@ -349,31 +499,10 @@ $this - 1 - - - 21, 204 - - - 210, 20 - - - 5 - - - ucrChkUnique - - - instat.ucrCheck, instat, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null - - - $this - - - 2 + 6 - 11, 418 + 11, 456 410, 52 @@ -391,7 +520,7 @@ $this - 4 + 8 True @@ -400,16 +529,16 @@ 6, 13 - 420, 475 + 420, 522 - 270, 60 + 267, 98 0, 0, 0, 0 - 120, 20 + 124, 20 2 @@ -424,10 +553,10 @@ $this - 8 + 12 - 10, 10 + 10, 48 0, 0, 0, 0 @@ -448,7 +577,28 @@ $this - 9 + 13 + + + 21, 240 + + + 210, 24 + + + 5 + + + ucrChkUnique + + + instat.ucrCheck, instat, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null + + + $this + + + 14 CenterScreen @@ -463,13 +613,13 @@ System.Windows.Forms.Form, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - 270, 113 + 267, 151 0, 0, 0, 0 - 120, 20 + 124, 20 4 @@ -484,6 +634,6 @@ $this - 7 + 11 \ No newline at end of file diff --git a/instat/dlgCompareColumns.vb b/instat/dlgCompareColumns.vb index 1cc87eb5632..22b38f2f9bf 100644 --- a/instat/dlgCompareColumns.vb +++ b/instat/dlgCompareColumns.vb @@ -20,8 +20,10 @@ Public Class dlgCompareColumns Private bFirstLoad As Boolean = True Private bReset As Boolean = True - Private clsCompareColumns As New RFunction - Private clsYinXOperator As New ROperator + Private bRcodeSet As Boolean = False + Private clsCompareColumns, clsIfElseCompareFunction, clsAbsoluteFunction As New RFunction + Private clsAsCharacterFunctionOne, clsAsCharacterFunctionTwo, clsSummaryFunction As New RFunction + Private clsYinXOperator, clsIsEqualToOperator, clsSubtractOperator, clsLessorEqualToOperator As New ROperator Private Sub dlgCompareColumns_Load(sender As Object, e As EventArgs) Handles Me.Load If bFirstLoad Then @@ -39,7 +41,17 @@ Public Class dlgCompareColumns End Sub Private Sub InitialiseDialog() + Dim dctTolerance As New Dictionary(Of String, String) ucrBase.iHelpTopicID = 546 + + ucrPnlOptions.AddRadioButton(rdoByRow) + ucrPnlOptions.AddRadioButton(rdoByValue) + + ucrPnlOptions.AddFunctionNamesCondition(rdoByRow, "ifelse") + ucrPnlOptions.AddFunctionNamesCondition(rdoByValue, {"%in%", "compare_columns"}) + + ucrPnlOptions.AddToLinkedControls({ucrChkSort, ucrChkUnique}, {rdoByValue}, bNewLinkedAddRemoveParameter:=True, bNewLinkedHideIfParameterMissing:=True) + ucrReceiverFirst.SetParameter(New RParameter("x", 0)) ucrReceiverFirst.Selector = ucrSelectorCompareColumns ucrReceiverFirst.SetParameterIsRFunction() @@ -54,6 +66,16 @@ Public Class dlgCompareColumns ucrReceiverSecond.bOnlyLinkedToPrimaryDataFrames = False ucrReceiverSecond.bIncludeDataFrameInAssignment = True + ucrInputTolerance.SetParameter(New RParameter("tol", 1)) + dctTolerance.Add("0", "0") + dctTolerance.Add("0.005", "0.005") + dctTolerance.Add("0.0000000001", "0.0000000001") + ucrInputTolerance.SetItems(dctTolerance) + ucrInputTolerance.bAllowNonConditionValues = True + ucrInputTolerance.SetValidationTypeAsNumeric() + ucrInputTolerance.AddQuotesIfUnrecognised = False + ucrInputTolerance.SetLinkedDisplayControl(lblTolerance) + ucrChkUnique.SetParameter(New RParameter("use_unique", 2), bNewChangeParameterValue:=True) ucrChkUnique.SetText("Use unique values for comparison") ucrChkUnique.SetRDefault("TRUE") @@ -82,19 +104,29 @@ Public Class dlgCompareColumns ucrChkAllValues.SetText("All values if columns are equal") ucrChkAllValues.SetRDefault("TRUE") - ' Not setting data frame selector or prefix here because we need save control only linked to data frame of second selector which is not yet implemented - ucrSaveLogical.SetCheckBoxText("Save logical values for second column") + ucrSaveLogical.SetPrefix("compare") ucrSaveLogical.SetSaveTypeAsColumn() - ucrSaveLogical.SetIsTextBox() - ' This ensures the assign text is correctly cleared when resetting - ucrSaveLogical.bUpdateRCodeFromControl = False + ucrSaveLogical.SetDataFrameSelector(ucrSelectorCompareColumns.ucrAvailableDataFrames) + ucrSaveLogical.SetIsComboBox() + ucrSaveLogical.SetLabelText("New Column Name") + + ucrBase.clsRsyntax.iCallType = 2 End Sub Private Sub SetDefaults() clsCompareColumns = New RFunction + clsIfElseCompareFunction = New RFunction + clsAbsoluteFunction = New RFunction + clsAsCharacterFunctionOne = New RFunction + clsAsCharacterFunctionTwo = New RFunction + clsSummaryFunction = New RFunction clsYinXOperator = New ROperator + clsIsEqualToOperator = New ROperator + clsSubtractOperator = New ROperator + clsLessorEqualToOperator = New ROperator ucrBase.clsRsyntax.ClearCodes() + ucrInputTolerance.SetText("0") ucrSelectorCompareColumns.Reset() ucrReceiverFirst.SetMeAsReceiver() @@ -102,13 +134,46 @@ Public Class dlgCompareColumns clsCompareColumns.SetRCommand("compare_columns") clsYinXOperator.SetOperation("%in%") - ucrBase.clsRsyntax.SetBaseRFunction(clsCompareColumns) - ucrBase.clsRsyntax.iCallType = 2 + + clsAsCharacterFunctionOne.SetRCommand("as.character") + clsAsCharacterFunctionTwo.SetRCommand("as.character") + + clsIsEqualToOperator.SetOperation("==") + clsIsEqualToOperator.AddParameter("first", clsRFunctionParameter:=clsAsCharacterFunctionOne, iPosition:=0) + clsIsEqualToOperator.AddParameter("second", clsRFunctionParameter:=clsAsCharacterFunctionTwo, iPosition:=1) + + clsSubtractOperator.SetOperation("-") + + clsAbsoluteFunction.SetRCommand("abs") + clsAbsoluteFunction.AddParameter("x", clsROperatorParameter:=clsSubtractOperator, iPosition:=0) + + clsLessorEqualToOperator.SetOperation("<=") + clsLessorEqualToOperator.AddParameter("first", clsRFunctionParameter:=clsAbsoluteFunction, iPosition:=0) + clsLessorEqualToOperator.AddParameter("tol", "0", iPosition:=1) + + clsIfElseCompareFunction.SetRCommand("ifelse") + clsIfElseCompareFunction.AddParameter("test", clsROperatorParameter:=clsIsEqualToOperator, iPosition:=0) + clsIfElseCompareFunction.AddParameter("yes", "TRUE", iPosition:=1) + clsIfElseCompareFunction.AddParameter("no", "FALSE", iPosition:=2) + + clsSummaryFunction.SetRCommand("summary") + clsSummaryFunction.AddParameter("x", clsRFunctionParameter:=clsIfElseCompareFunction, bIncludeArgumentName:=False, iPosition:=1) + clsSummaryFunction.iCallType = 2 + + ucrBase.clsRsyntax.SetBaseRFunction(clsIfElseCompareFunction) End Sub Private Sub SetRCodeForControls(bReset As Boolean) + bRcodeSet = False ucrReceiverFirst.AddAdditionalCodeParameterPair(clsYinXOperator, New RParameter("right", iNewPosition:=1), iAdditionalPairNo:=1) + ucrReceiverFirst.AddAdditionalCodeParameterPair(clsAsCharacterFunctionOne, New RParameter("first", bNewIncludeArgumentName:=False, iNewPosition:=0), iAdditionalPairNo:=2) + ucrReceiverFirst.AddAdditionalCodeParameterPair(clsSubtractOperator, New RParameter("first", bNewIncludeArgumentName:=False, iNewPosition:=0), iAdditionalPairNo:=3) + ucrReceiverSecond.AddAdditionalCodeParameterPair(clsYinXOperator, New RParameter("left", iNewPosition:=0), iAdditionalPairNo:=1) + ucrReceiverSecond.AddAdditionalCodeParameterPair(clsAsCharacterFunctionTwo, New RParameter("second", bNewIncludeArgumentName:=False, iNewPosition:=1), iAdditionalPairNo:=2) + ucrReceiverSecond.AddAdditionalCodeParameterPair(clsSubtractOperator, New RParameter("second", bNewIncludeArgumentName:=False, iNewPosition:=1), iAdditionalPairNo:=3) + + ucrPnlOptions.SetRCode(ucrBase.clsRsyntax.clsBaseFunction, bReset) ucrReceiverFirst.SetRCode(clsCompareColumns, bReset) ucrReceiverSecond.SetRCode(clsCompareColumns, bReset) @@ -119,13 +184,30 @@ Public Class dlgCompareColumns ucrChkIntersection.SetRCode(clsCompareColumns, bReset) ucrChkUnion.SetRCode(clsCompareColumns, bReset) ucrChkAllValues.SetRCode(clsCompareColumns, bReset) + ucrInputTolerance.SetRCode(clsLessorEqualToOperator, bReset) - ucrSaveLogical.SetRCode(clsYinXOperator, bReset) + ucrSaveLogical.SetRCode(clsIfElseCompareFunction, bReset) + ucrSaveLogical.AddAdditionalRCode(clsYinXOperator, iAdditionalPairNo:=1) + bRcodeSet = True End Sub Private Sub TestOkEnabled() If Not ucrReceiverFirst.IsEmpty AndAlso Not ucrReceiverSecond.IsEmpty AndAlso ucrSaveLogical.IsComplete() Then - ucrBase.OKEnabled(True) + If rdoByRow.Checked Then + If {"integer", "numeric"}.Contains(ucrReceiverFirst.strCurrDataType) AndAlso {"integer", "numeric"}.Contains(ucrReceiverSecond.strCurrDataType) Then + ucrBase.OKEnabled(True) + ElseIf ucrReceiverFirst.strCurrDataType = "Date" AndAlso ucrReceiverSecond.strCurrDataType = "Date" Then + ucrBase.OKEnabled(True) + ElseIf {"factor", "character"}.Contains(ucrReceiverFirst.strCurrDataType) AndAlso {"factor", "character"}.Contains(ucrReceiverSecond.strCurrDataType) Then + ucrBase.OKEnabled(True) + ElseIf ucrReceiverFirst.strCurrDataType = "logical" AndAlso ucrReceiverSecond.strCurrDataType = "logical" Then + ucrBase.OKEnabled(True) + Else + ucrBase.OKEnabled(False) + End If + Else + ucrBase.OKEnabled(True) + End If Else ucrBase.OKEnabled(False) End If @@ -141,26 +223,56 @@ Public Class dlgCompareColumns TestOkEnabled() End Sub - Private Sub ucrReceiverSecond_ControlValueChanged(ucrChangedControl As ucrCore) Handles ucrReceiverSecond.ControlValueChanged - ' Needs to be done manually because data frame name should only be the data frame name from the second receiver's variable. - ucrSaveLogical.SetGlobalDataName(ucrReceiverSecond.GetDataName()) - End Sub - - Private Sub ucrSaveLogical_ControlValueChanged(ucrChangedControl As ucrCore) Handles ucrSaveLogical.ControlValueChanged - If ucrSaveLogical.ucrChkSave.Checked Then + Private Sub ucrPnlOptions_ControlValueChanged(ucrChangedControl As ucrCore) Handles ucrPnlOptions.ControlValueChanged + If rdoByValue.Checked Then + grpComparisions.Visible = True + ucrBase.clsRsyntax.SetBaseRFunction(clsCompareColumns) + ucrBase.clsRsyntax.RemoveFromAfterCodes(clsSummaryFunction) ucrBase.clsRsyntax.AddToAfterCodes(clsYinXOperator, iPosition:=1) Else + grpComparisions.Visible = False + ucrBase.clsRsyntax.SetBaseRFunction(clsIfElseCompareFunction) ucrBase.clsRsyntax.RemoveFromAfterCodes(clsYinXOperator) + ucrBase.clsRsyntax.AddToAfterCodes(clsSummaryFunction, iPosition:=1) End If + CheckDatatype() End Sub - Private Sub ucrReceiverFirst_ControlValueChanged(ucrChangedControl As ucrCore) Handles ucrReceiverFirst.ControlValueChanged - If Not ucrSaveLogical.bUserTyped Then - If ucrReceiverFirst.IsEmpty Then - ucrSaveLogical.SetName("") + Private Sub CheckDatatype() + If bRcodeSet Then + If rdoByRow.Checked Then + If {"integer", "numeric"}.Contains(ucrReceiverFirst.strCurrDataType) AndAlso {"integer", "numeric"}.Contains(ucrReceiverSecond.strCurrDataType) Then + ucrInputTolerance.Visible = True + clsIfElseCompareFunction.AddParameter("test", clsROperatorParameter:=clsLessorEqualToOperator, iPosition:=0) + ElseIf ucrReceiverFirst.strCurrDataType = "date" AndAlso ucrReceiverSecond.strCurrDataType = "date" Then + ucrInputTolerance.Visible = True + clsIfElseCompareFunction.AddParameter("test", clsROperatorParameter:=clsLessorEqualToOperator, iPosition:=0) + ElseIf {"factor", "character"}.Contains(ucrReceiverFirst.strCurrDataType) AndAlso {"factor", "character"}.Contains(ucrReceiverSecond.strCurrDataType) Then + ucrInputTolerance.Visible = False + clsIfElseCompareFunction.AddParameter("test", clsROperatorParameter:=clsIsEqualToOperator, iPosition:=0) + ElseIf ucrReceiverFirst.strCurrDataType = "logical" AndAlso ucrReceiverSecond.strCurrDataType = "logical" Then + ucrInputTolerance.Visible = False + clsIfElseCompareFunction.AddParameter("test", clsROperatorParameter:=clsIsEqualToOperator, iPosition:=0) + Else + MsgBox("Receivers must have the same data type, OK will not be enabled") + ucrInputTolerance.Visible = False + End If Else - ucrSaveLogical.SetName("in_" & ucrReceiverFirst.GetVariableNames(False)) + ucrInputTolerance.Visible = False End If End If + TestOkEnabled() + End Sub + + Private Sub ucrReceiverFirst_ValueChanged(sender As Object, e As EventArgs) Handles ucrReceiverFirst.ValueChanged + If Not ucrReceiverSecond.IsEmpty Then + CheckDatatype() + End If + End Sub + + Private Sub ucrReceiverSecond_ValueChanged(sender As Object, e As EventArgs) Handles ucrReceiverSecond.ValueChanged + If Not ucrReceiverFirst.IsEmpty Then + CheckDatatype() + End If End Sub End Class \ No newline at end of file diff --git a/instat/dlgImportDataset.vb b/instat/dlgImportDataset.vb index 7aef17acda3..87f096d6279 100644 --- a/instat/dlgImportDataset.vb +++ b/instat/dlgImportDataset.vb @@ -400,6 +400,7 @@ Public Class dlgImportDataset clsGetFilesList.AddParameter("ignore.case", "TRUE", iPosition:=3) clsImportMultipleFiles.AddParameter("file", clsRFunctionParameter:=clsGetFilesList, iPosition:=0) + clsImportMultipleFiles.AddParameter("stringsAsFactors", "TRUE") ucrBase.clsRsyntax.SetBaseRFunction(clsImport) @@ -548,6 +549,15 @@ Public Class dlgImportDataset ucrNudMaxRowsCSV.SetRCode(clsImportCSV, bReset) ucrChkMaxRowsCSV.SetRCode(clsImportCSV, bReset) + 'multiple controls + ucrInputSeparatorCSV.AddAdditionalCodeParameterPair(clsImportMultipleFiles, New RParameter("sep"), iAdditionalPairNo:=1) + ucrInputHeadersCSV.AddAdditionalCodeParameterPair(clsImportMultipleFiles, New RParameter("header"), iAdditionalPairNo:=1) + ucrInputDecimalCSV.AddAdditionalCodeParameterPair(clsImportMultipleFiles, New RParameter("dec"), iAdditionalPairNo:=1) + ucrInputEncodingCSV.AddAdditionalCodeParameterPair(clsImportMultipleFiles, New RParameter("encoding"), iAdditionalPairNo:=1) + ucrChkStringsAsFactorsCSV.AddAdditionalCodeParameterPair(clsImportMultipleFiles, New RParameter("stringsAsFactors"), iAdditionalPairNo:=1) + ucrNudRowsToSkipCSV.AddAdditionalCodeParameterPair(clsImportMultipleFiles, New RParameter("skip"), iAdditionalPairNo:=1) + ucrNudMaxRowsCSV.AddAdditionalCodeParameterPair(clsImportMultipleFiles, New RParameter("nrows", strParamValue:=ucrNudMaxRowsCSV.Value), iAdditionalPairNo:=1) + 'RDS CONTROLS ucrChkImportChangesLogRDS.SetRCode(clsImportRDS, bReset) ucrChkKeepExistingDataRDS.SetRCode(clsImportRDS, bReset) @@ -616,9 +626,7 @@ Public Class dlgImportDataset 'get the name of the file (without extension), with any special characters removed strFileName = GetCleanFileName(strFilePath) strCurrentDirectory = Path.GetDirectoryName(strFilePath) - If Not bFromLibrary Then - strFileExtension = Path.GetExtension(strFilePath).ToLower() - End If + strFileExtension = Path.GetExtension(strFilePath).ToLower() ElseIf Directory.Exists(strFilePath) AndAlso strNewFileExt <> "" Then strCurrentDirectory = strFilePath strFileExtension = strNewFileExt @@ -659,8 +667,13 @@ Public Class dlgImportDataset clsImportMultipleFiles.AddParameter("format", Chr(34) & strFileExtension.Substring(1) & Chr(34), iPosition:=1) End If ucrBase.clsRsyntax.SetBaseRFunction(clsImportMultipleFiles) + If strFileExtension = ".txt" OrElse strFileExtension = ".csv" OrElse strFileExtension = ".dly" Then + grpCSV.Text = "Import Options" + grpCSV.Location = New System.Drawing.Point(9, 50) 'set the location of the groupbox to adjust gaps in the form UI + grpCSV.Show() + End If Else - 'enable multiple files import for the following files only + 'don't enable multiple files import for the following files only; .rds, .xlsx, .xls ucrChkMultipleFiles.SetVisible(Not (strFileExtension = ".rds" OrElse strFileExtension = ".xlsx" OrElse strFileExtension = ".xls")) 'TODO This needs to be different when RDS is a data frame @@ -986,10 +999,12 @@ Public Class dlgImportDataset clsImportExcel.AddParameter("na", GetMissingValueRString(ucrInputMissingValueStringExcel.GetText())) ElseIf strFileType = "CSV" Then clsImportCSV.AddParameter("na.strings", GetMissingValueRString(ucrInputMissingValueStringCSV.GetText()), iPosition:=2) + clsImportMultipleFiles.AddParameter("na.strings", GetMissingValueRString(ucrInputMissingValueStringCSV.GetText()), iPosition:=2) ElseIf strFileType = "TXT" Then 'for separator we use the function used for csv If rdoSeparatortext.Checked Then clsImportCSV.AddParameter("na.strings", GetMissingValueRString(ucrInputMissingValueStringCSV.GetText()), iPosition:=2) + clsImportMultipleFiles.AddParameter("na.strings", GetMissingValueRString(ucrInputMissingValueStringCSV.GetText()), iPosition:=2) Else clsImportFixedWidthText.AddParameter("na", GetMissingValueRString(ucrInputMissingValueStringText.GetText()), iPosition:=2) End If diff --git a/instat/dlgSetupForDataEntry.Designer.vb b/instat/dlgSetupForDataEntry.Designer.vb new file mode 100644 index 00000000000..0d4db670bcf --- /dev/null +++ b/instat/dlgSetupForDataEntry.Designer.vb @@ -0,0 +1,39 @@ + _ +Partial Class dlgSetupForDataEntry + Inherits System.Windows.Forms.Form + + 'Form overrides dispose to clean up the component list. + _ + Protected Overrides Sub Dispose(ByVal disposing As Boolean) + Try + If disposing AndAlso components IsNot Nothing Then + components.Dispose() + End If + Finally + MyBase.Dispose(disposing) + End Try + End Sub + + 'Required by the Windows Form Designer + Private components As System.ComponentModel.IContainer + + 'NOTE: The following procedure is required by the Windows Form Designer + 'It can be modified using the Windows Form Designer. + 'Do not modify it using the code editor. + _ + Private Sub InitializeComponent() + Dim resources As System.ComponentModel.ComponentResourceManager = New System.ComponentModel.ComponentResourceManager(GetType(dlgSetupForDataEntry)) + Me.SuspendLayout() + ' + 'dlgSetupForDataEntry + ' + resources.ApplyResources(Me, "$this") + Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font + Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow + Me.MaximizeBox = False + Me.MinimizeBox = False + Me.Name = "dlgSetupForDataEntry" + Me.ResumeLayout(False) + + End Sub +End Class diff --git a/instat/dlgSetupForDataEntry.resx b/instat/dlgSetupForDataEntry.resx new file mode 100644 index 00000000000..4d35dcff75d --- /dev/null +++ b/instat/dlgSetupForDataEntry.resx @@ -0,0 +1,143 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + True + + + + 6, 13 + + + 439, 331 + + + + CenterScreen + + + dlgSetupForDataEntry + + + dlgSetupForDataEntry + + + System.Windows.Forms.Form, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/instat/dlgSetupForDataEntry.vb b/instat/dlgSetupForDataEntry.vb new file mode 100644 index 00000000000..621746412c3 --- /dev/null +++ b/instat/dlgSetupForDataEntry.vb @@ -0,0 +1,3 @@ +Public Class dlgSetupForDataEntry + +End Class \ No newline at end of file diff --git a/instat/frmMain.Designer.vb b/instat/frmMain.Designer.vb index 44e4ad98169..2b34a7ae071 100644 --- a/instat/frmMain.Designer.vb +++ b/instat/frmMain.Designer.vb @@ -207,6 +207,7 @@ Partial Class frmMain Me.mnuClimaticTidyandExamineMerge = New System.Windows.Forms.ToolStripMenuItem() Me.mnuClimaticTidyandExamineAppend = New System.Windows.Forms.ToolStripMenuItem() Me.ToolStripSeparator69 = New System.Windows.Forms.ToolStripSeparator() + Me.mnuSetupForDataEntry = New System.Windows.Forms.ToolStripMenuItem() Me.mnuTidyandExamineClimaticDataEntry = New System.Windows.Forms.ToolStripMenuItem() Me.ToolStripSeparator50 = New System.Windows.Forms.ToolStripSeparator() Me.mnuClimaticTidyandExamineOneVariableSummarize = New System.Windows.Forms.ToolStripMenuItem() @@ -1545,7 +1546,7 @@ Partial Class frmMain ' 'mnuClimaticTidyandExamine ' - Me.mnuClimaticTidyandExamine.DropDownItems.AddRange(New System.Windows.Forms.ToolStripItem() {Me.mnuClimaticTidyandExamineVisualiseData, Me.mnuClimaticTidyandExamineTidyDailyData, Me.mnuClimaticTidyandExamineNonNumericCases, Me.mnuClimaticTidyandExamineReplaceValues, Me.mnuClimaticTidyandExamineDuplicates, Me.ToolStripSeparator54, Me.mnuClimaticTidyandExamineStack, Me.mnuClimaticTidyandExamineUnstack, Me.mnuClimaticTidyandExamineMerge, Me.mnuClimaticTidyandExamineAppend, Me.ToolStripSeparator69, Me.mnuTidyandExamineClimaticDataEntry, Me.ToolStripSeparator50, Me.mnuClimaticTidyandExamineOneVariableSummarize, Me.mnuClimaticTidyandExamineOneVariableGraph, Me.mnuClimaticTidyandExamineOneVariableFrequencies}) + Me.mnuClimaticTidyandExamine.DropDownItems.AddRange(New System.Windows.Forms.ToolStripItem() {Me.mnuClimaticTidyandExamineVisualiseData, Me.mnuClimaticTidyandExamineTidyDailyData, Me.mnuClimaticTidyandExamineNonNumericCases, Me.mnuClimaticTidyandExamineReplaceValues, Me.mnuClimaticTidyandExamineDuplicates, Me.ToolStripSeparator54, Me.mnuClimaticTidyandExamineStack, Me.mnuClimaticTidyandExamineUnstack, Me.mnuClimaticTidyandExamineMerge, Me.mnuClimaticTidyandExamineAppend, Me.ToolStripSeparator69, Me.mnuSetupForDataEntry, Me.mnuTidyandExamineClimaticDataEntry, Me.ToolStripSeparator50, Me.mnuClimaticTidyandExamineOneVariableSummarize, Me.mnuClimaticTidyandExamineOneVariableGraph, Me.mnuClimaticTidyandExamineOneVariableFrequencies}) Me.mnuClimaticTidyandExamine.Name = "mnuClimaticTidyandExamine" resources.ApplyResources(Me.mnuClimaticTidyandExamine, "mnuClimaticTidyandExamine") ' @@ -1604,6 +1605,11 @@ Partial Class frmMain Me.ToolStripSeparator69.Name = "ToolStripSeparator69" resources.ApplyResources(Me.ToolStripSeparator69, "ToolStripSeparator69") ' + 'mnuSetupForDataEntry + ' + Me.mnuSetupForDataEntry.Name = "mnuSetupForDataEntry" + resources.ApplyResources(Me.mnuSetupForDataEntry, "mnuSetupForDataEntry") + ' 'mnuTidyandExamineClimaticDataEntry ' Me.mnuTidyandExamineClimaticDataEntry.Name = "mnuTidyandExamineClimaticDataEntry" @@ -4824,4 +4830,5 @@ Partial Class frmMain Friend WithEvents ToolStripSeparator70 As ToolStripSeparator Friend WithEvents mnuClimaticCheckDataCheckStationLocations As ToolStripMenuItem Friend WithEvents mnuClimaticFileImportfromClimateDataStore As ToolStripMenuItem + Friend WithEvents mnuSetupForDataEntry As ToolStripMenuItem End Class diff --git a/instat/frmMain.resx b/instat/frmMain.resx index 52cf944df81..8f3df258a4e 100644 --- a/instat/frmMain.resx +++ b/instat/frmMain.resx @@ -1151,6 +1151,15 @@ 212, 6 + + 215, 22 + + + Setup for Data Entry... + + + False + 215, 22 @@ -7446,6 +7455,12 @@ System.Windows.Forms.ToolStripSeparator, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + mnuSetupForDataEntry + + + System.Windows.Forms.ToolStripMenuItem, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + mnuTidyandExamineClimaticDataEntry diff --git a/instat/frmMain.vb b/instat/frmMain.vb index 6fd1c537d1f..7e4e8940136 100644 --- a/instat/frmMain.vb +++ b/instat/frmMain.vb @@ -2360,4 +2360,8 @@ Public Class frmMain Private Sub mnuClimaticFileImportfromClimateDataStore_Click(sender As Object, e As EventArgs) Handles mnuClimaticFileImportfromClimateDataStore.Click dlgImportERA5Data.ShowDialog() End Sub + + Private Sub mnuSetupForDataEntry_Click(sender As Object, e As EventArgs) Handles mnuSetupForDataEntry.Click + dlgSetupForDataEntry.ShowDialog() + End Sub End Class diff --git a/instat/instat.vbproj b/instat/instat.vbproj index 0e7c0910b4f..80622a9d431 100644 --- a/instat/instat.vbproj +++ b/instat/instat.vbproj @@ -332,6 +332,12 @@ Form + + dlgSetupForDataEntry.vb + + + Form + dlgTaylorDiagram.vb @@ -374,6 +380,12 @@ Form + + sdgCommentForDataEntry.vb + + + Form + sdgDistributionOptions.vb @@ -2782,6 +2794,9 @@ dlgSeasonalPlot.vb + + dlgSetupForDataEntry.vb + dlgTaylorDiagram.vb @@ -2803,6 +2818,9 @@ sdgClimaticNCMPMetadata.vb + + sdgCommentForDataEntry.vb + sdgDistributionOptions.vb diff --git a/instat/sdgClimaticDataEntry.Designer.vb b/instat/sdgClimaticDataEntry.Designer.vb index fb03f884814..36fbea4ee43 100644 --- a/instat/sdgClimaticDataEntry.Designer.vb +++ b/instat/sdgClimaticDataEntry.Designer.vb @@ -23,12 +23,15 @@ Partial Class sdgClimaticDataEntry _ Private Sub InitializeComponent() Me.components = New System.ComponentModel.Container() + Dim resources As System.ComponentModel.ComponentResourceManager = New System.ComponentModel.ComponentResourceManager(GetType(sdgClimaticDataEntry)) Me.SplitContainer1 = New System.Windows.Forms.SplitContainer() Me.grdDataEntry = New unvell.ReoGrid.ReoGridControl() + Me.ucrChkAddFlagFieldData = New instat.ucrCheck() + Me.cmdComment = New System.Windows.Forms.Button() + Me.cmdTransform = New System.Windows.Forms.Button() Me.cmdReset = New System.Windows.Forms.Button() - Me.ucrSdgPICSARainfalbuttons = New instat.ucrButtonsSubdialogue() + Me.ucrSdgBaseButtons = New instat.ucrButtonsSubdialogue() Me.ttCmdReset = New System.Windows.Forms.ToolTip(Me.components) - Me.cmdTransform = New System.Windows.Forms.Button() Me.ttCmdTransformButton = New System.Windows.Forms.ToolTip(Me.components) CType(Me.SplitContainer1, System.ComponentModel.ISupportInitialize).BeginInit() Me.SplitContainer1.Panel1.SuspendLayout() @@ -38,10 +41,8 @@ Partial Class sdgClimaticDataEntry ' 'SplitContainer1 ' - Me.SplitContainer1.Dock = System.Windows.Forms.DockStyle.Fill - Me.SplitContainer1.Location = New System.Drawing.Point(0, 0) + resources.ApplyResources(Me.SplitContainer1, "SplitContainer1") Me.SplitContainer1.Name = "SplitContainer1" - Me.SplitContainer1.Orientation = System.Windows.Forms.Orientation.Horizontal ' 'SplitContainer1.Panel1 ' @@ -49,20 +50,18 @@ Partial Class sdgClimaticDataEntry ' 'SplitContainer1.Panel2 ' + Me.SplitContainer1.Panel2.Controls.Add(Me.ucrChkAddFlagFieldData) + Me.SplitContainer1.Panel2.Controls.Add(Me.cmdComment) Me.SplitContainer1.Panel2.Controls.Add(Me.cmdTransform) Me.SplitContainer1.Panel2.Controls.Add(Me.cmdReset) - Me.SplitContainer1.Panel2.Controls.Add(Me.ucrSdgPICSARainfalbuttons) - Me.SplitContainer1.Size = New System.Drawing.Size(494, 295) - Me.SplitContainer1.SplitterDistance = 251 - Me.SplitContainer1.TabIndex = 0 + Me.SplitContainer1.Panel2.Controls.Add(Me.ucrSdgBaseButtons) ' 'grdDataEntry ' Me.grdDataEntry.BackColor = System.Drawing.Color.White Me.grdDataEntry.ColumnHeaderContextMenuStrip = Nothing - Me.grdDataEntry.Dock = System.Windows.Forms.DockStyle.Fill + resources.ApplyResources(Me.grdDataEntry, "grdDataEntry") Me.grdDataEntry.LeadHeaderContextMenuStrip = Nothing - Me.grdDataEntry.Location = New System.Drawing.Point(0, 0) Me.grdDataEntry.Name = "grdDataEntry" Me.grdDataEntry.RowHeaderContextMenuStrip = Nothing Me.grdDataEntry.Script = Nothing @@ -71,27 +70,35 @@ Partial Class sdgClimaticDataEntry Me.grdDataEntry.SheetTabVisible = True Me.grdDataEntry.SheetTabWidth = 154 Me.grdDataEntry.ShowScrollEndSpacing = True - Me.grdDataEntry.Size = New System.Drawing.Size(494, 251) - Me.grdDataEntry.TabIndex = 3 - Me.grdDataEntry.Text = "Variables" + ' + 'ucrChkAddFlagFieldData + ' + Me.ucrChkAddFlagFieldData.Checked = False + resources.ApplyResources(Me.ucrChkAddFlagFieldData, "ucrChkAddFlagFieldData") + Me.ucrChkAddFlagFieldData.Name = "ucrChkAddFlagFieldData" + ' + 'cmdComment + ' + resources.ApplyResources(Me.cmdComment, "cmdComment") + Me.cmdComment.Name = "cmdComment" + Me.cmdComment.UseVisualStyleBackColor = True + ' + 'cmdTransform + ' + resources.ApplyResources(Me.cmdTransform, "cmdTransform") + Me.cmdTransform.Name = "cmdTransform" + Me.cmdTransform.UseVisualStyleBackColor = True ' 'cmdReset ' - Me.cmdReset.ImeMode = System.Windows.Forms.ImeMode.NoControl - Me.cmdReset.Location = New System.Drawing.Point(410, 9) + resources.ApplyResources(Me.cmdReset, "cmdReset") Me.cmdReset.Name = "cmdReset" - Me.cmdReset.Size = New System.Drawing.Size(72, 24) - Me.cmdReset.TabIndex = 88 - Me.cmdReset.Text = "Reset" Me.cmdReset.UseVisualStyleBackColor = True ' - 'ucrSdgPICSARainfalbuttons + 'ucrSdgBaseButtons ' - Me.ucrSdgPICSARainfalbuttons.Location = New System.Drawing.Point(114, 5) - Me.ucrSdgPICSARainfalbuttons.Margin = New System.Windows.Forms.Padding(4) - Me.ucrSdgPICSARainfalbuttons.Name = "ucrSdgPICSARainfalbuttons" - Me.ucrSdgPICSARainfalbuttons.Size = New System.Drawing.Size(144, 30) - Me.ucrSdgPICSARainfalbuttons.TabIndex = 87 + resources.ApplyResources(Me.ucrSdgBaseButtons, "ucrSdgBaseButtons") + Me.ucrSdgBaseButtons.Name = "ucrSdgBaseButtons" ' 'ttCmdReset ' @@ -99,17 +106,6 @@ Partial Class sdgClimaticDataEntry Me.ttCmdReset.InitialDelay = 500 Me.ttCmdReset.ReshowDelay = 100 ' - 'cmdTransform - ' - Me.cmdTransform.Enabled = False - Me.cmdTransform.ImeMode = System.Windows.Forms.ImeMode.NoControl - Me.cmdTransform.Location = New System.Drawing.Point(270, 7) - Me.cmdTransform.Name = "cmdTransform" - Me.cmdTransform.Size = New System.Drawing.Size(104, 24) - Me.cmdTransform.TabIndex = 89 - Me.cmdTransform.Text = "Transform" - Me.cmdTransform.UseVisualStyleBackColor = True - ' 'ttCmdTransformButton ' Me.ttCmdTransformButton.AutoPopDelay = 10000 @@ -118,13 +114,10 @@ Partial Class sdgClimaticDataEntry ' 'sdgClimaticDataEntry ' - Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!) + resources.ApplyResources(Me, "$this") Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font - Me.ClientSize = New System.Drawing.Size(494, 295) Me.Controls.Add(Me.SplitContainer1) Me.Name = "sdgClimaticDataEntry" - Me.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent - Me.Text = "Climatic Data Entry" Me.SplitContainer1.Panel1.ResumeLayout(False) Me.SplitContainer1.Panel2.ResumeLayout(False) CType(Me.SplitContainer1, System.ComponentModel.ISupportInitialize).EndInit() @@ -134,10 +127,12 @@ Partial Class sdgClimaticDataEntry End Sub Friend WithEvents SplitContainer1 As SplitContainer - Friend WithEvents ucrSdgPICSARainfalbuttons As ucrButtonsSubdialogue + Friend WithEvents ucrSdgBaseButtons As ucrButtonsSubdialogue Friend WithEvents grdDataEntry As unvell.ReoGrid.ReoGridControl Friend WithEvents cmdReset As Button Friend WithEvents ttCmdReset As ToolTip Friend WithEvents cmdTransform As Button Friend WithEvents ttCmdTransformButton As ToolTip + Friend WithEvents cmdComment As Button + Friend WithEvents ucrChkAddFlagFieldData As ucrCheck End Class diff --git a/instat/sdgClimaticDataEntry.resx b/instat/sdgClimaticDataEntry.resx index 0c6206aa5b8..206d4a2c428 100644 --- a/instat/sdgClimaticDataEntry.resx +++ b/instat/sdgClimaticDataEntry.resx @@ -117,10 +117,259 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + Fill + + + + 0, 0 + + + Horizontal + + + Fill + + + 0, 0 + + + 647, 251 + + + + 3 + + + Variables + + + grdDataEntry + + + unvell.ReoGrid.ReoGridControl, unvell.ReoGrid, Version=2.1.0.0, Culture=neutral, PublicKeyToken=null + + + SplitContainer1.Panel1 + + + 0 + + + SplitContainer1.Panel1 + + + System.Windows.Forms.SplitterPanel, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + SplitContainer1 + + + 0 + + + False + + + 185, 10 + + + 146, 20 + + + 91 + + + ucrChkAddFlagFieldData + + + instat.ucrCheck, instat, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null + + + SplitContainer1.Panel2 + + + 0 + + + NoControl + + + 337, 7 + + + 90, 24 + + + 90 + + + Comment + + + cmdComment + + + System.Windows.Forms.Button, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + SplitContainer1.Panel2 + + + 1 + + + False + + + NoControl + + + 431, 7 + + + 104, 24 + + + 89 + + + Transform + + + cmdTransform + + + System.Windows.Forms.Button, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + SplitContainer1.Panel2 + + + 2 + + + NoControl + + + 541, 7 + + + 72, 24 + + + 88 + + + Reset + + + cmdReset + + + System.Windows.Forms.Button, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + SplitContainer1.Panel2 + + + 3 + + + 33, 5 + + + 4, 4, 4, 4 + + + 144, 30 + + + 87 + + + ucrSdgBaseButtons + + + instat.ucrButtonsSubdialogue, instat, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null + + + SplitContainer1.Panel2 + + + 4 + + + SplitContainer1.Panel2 + + + System.Windows.Forms.SplitterPanel, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + SplitContainer1 + + + 1 + + + 647, 295 + + + 251 + + + 0 + + + SplitContainer1 + + + System.Windows.Forms.SplitContainer, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + $this + + + 0 + 17, 17 161, 17 + + True + + + 6, 13 + + + 647, 295 + + + CenterParent + + + Climatic Data Entry + + + ttCmdReset + + + System.Windows.Forms.ToolTip, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + ttCmdTransformButton + + + System.Windows.Forms.ToolTip, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + sdgClimaticDataEntry + + + System.Windows.Forms.Form, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + \ No newline at end of file diff --git a/instat/sdgClimaticDataEntry.vb b/instat/sdgClimaticDataEntry.vb index 9199fa15b05..d2b5a93e826 100644 --- a/instat/sdgClimaticDataEntry.vb +++ b/instat/sdgClimaticDataEntry.vb @@ -21,6 +21,8 @@ Imports unvell.ReoGrid Imports unvell.ReoGrid.Events Public Class sdgClimaticDataEntry + Private lstColumnNames As New List(Of KeyValuePair(Of String, String())) + ''' ''' stores the row indices changed in the grid ''' key = grid row index, value = grid row name (which should always be a number) @@ -35,16 +37,34 @@ Public Class sdgClimaticDataEntry Private strDataFrameName As String Private clsSaveDataEntry As RFunction Private clsEditDataFrame As RFunction + Private clsCommentList As RFunction Private dfEditData As DataFrame Private strDateName As String Private lstElementsNames As List(Of String) Private lstViewVariablesNames As List(Of String) Private strStationColumnName As String - Private strDefaultValue As String + Private strDefaultValue As Double Private bNoDecimal As Boolean Private bAllowTrace As Boolean Private bTransform As Boolean Private dTranformValue As Double + Private bFirstLoad As Boolean = True + 'used to check if current options allow the grid to be editable + Private bAllowEdits As Boolean = True + Private strEntryType As String = "" + Private iMonthlyTotalsColIndex As Integer + + Private Sub sdgClimaticDataEntry_Load(sender As Object, e As EventArgs) Handles MyBase.Load + If bFirstLoad Then + InitialiseControls() + bFirstLoad = False + End If + autoTranslate(Me) + End Sub + + Private Sub InitialiseControls() + ucrChkAddFlagFieldData.SetText("Add flag field data") + End Sub ''' ''' returns the data changed for the passed column as an R vector string @@ -76,7 +96,7 @@ Public Class sdgClimaticDataEntry If bAllowTrace AndAlso newValue.ToUpper = "T" Then newValue = 0.03 ElseIf bTransform And IsNumeric(newValue) Then - newValue = newValue / dTranformValue + newValue = newValue * dTranformValue End If End If @@ -93,7 +113,6 @@ Public Class sdgClimaticDataEntry Public Function GetRowNamesChangedAsRVectorString() As String Return "c(" & String.Join(",", dctRowsChanged.Values.ToArray) & ")" End Function - Public Function NRowsChanged() As Integer Return dctRowsChanged.Count End Function @@ -103,8 +122,8 @@ Public Class sdgClimaticDataEntry grdCurrentWorkSheet = Nothing End Sub - Public Sub Setup(dfEditData As DataFrame, strDataFrameName As String, clsSaveDataEntry As RFunction, clsEditDataFrame As RFunction, strDateName As String, lstElementsNames As List(Of String), Optional lstViewVariablesNames As List(Of String) = Nothing, Optional strStationColumnName As String = "", Optional bDefaultValue As Boolean = False, Optional strDefaultValue As String = "", Optional bNoDecimal As Boolean = False, Optional bAllowTrace As Boolean = False, Optional bTransform As Boolean = False, Optional dTranformValue As Double = 0) - Dim lstColumnHeaders As String() + Public Sub Setup(dfEditData As DataFrame, strDataFrameName As String, clsSaveDataEntry As RFunction, clsEditDataFrame As RFunction, strDateName As String, lstElementsNames As List(Of String), Optional lstViewVariablesNames As List(Of String) = Nothing, Optional strStationColumnName As String = "", Optional bDefaultValue As Boolean = False, Optional strDefaultValue As Double = 0, Optional bNoDecimal As Boolean = False, Optional bAllowTrace As Boolean = False, Optional bTransform As Boolean = False, Optional dTranformValue As Double = 0, Optional MissingValueAsNA As Boolean = False, Optional strEntryType As String = "") + Dim arrColumnHeaders As String() grdDataEntry.Worksheets.Clear() dctRowsChanged.Clear() @@ -123,6 +142,11 @@ Public Class sdgClimaticDataEntry Me.bAllowTrace = bAllowTrace Me.bTransform = bTransform Me.dTranformValue = dTranformValue + Me.strEntryType = strEntryType + + bAllowEdits = True + cmdTransform.Text = "Transform" + cmdTransform.Enabled = bTransform If Not strStationColumnName = "" Then lstNonEditableColumns.Add(strStationColumnName) @@ -136,38 +160,99 @@ Public Class sdgClimaticDataEntry End If grdCurrentWorkSheet = grdDataEntry.CreateWorksheet(strDataFrameName) - lstColumnHeaders = dfEditData.ColumnNames + arrColumnHeaders = dfEditData.ColumnNames - grdCurrentWorkSheet.Columns = lstColumnHeaders.Count - For k = 0 To lstColumnHeaders.Count - 1 - grdCurrentWorkSheet.ColumnHeaders.Item(k).Text = lstColumnHeaders(k) - If Not lstElementsNames.Contains(lstColumnHeaders(k)) Then + grdCurrentWorkSheet.Columns = arrColumnHeaders.Count + For k = 0 To arrColumnHeaders.Count - 1 + grdCurrentWorkSheet.ColumnHeaders.Item(k).Text = arrColumnHeaders(k) + If Not lstElementsNames.Contains(arrColumnHeaders(k)) Then grdCurrentWorkSheet.ColumnHeaders(k).TextColor = Graphics.SolidColor.Black End If Next Dim dfValue As String Dim bNonEditableCell As Boolean + + 'set grid rows grdCurrentWorkSheet.Rows = dfEditData.RowCount For i As Integer = 0 To dfEditData.RowCount - 1 For j = 0 To grdCurrentWorkSheet.Columns - 1 - bNonEditableCell = lstNonEditableColumns.Contains(lstColumnHeaders(j)) + bNonEditableCell = lstNonEditableColumns.Contains(arrColumnHeaders(j)) dfValue = dfEditData.Item(i, j) If dfValue = "NaN" Then - dfValue = "NA" + If MissingValueAsNA Then + dfValue = "NA" + Else + dfValue = "" + End If End If - If bDefaultValue AndAlso Not bNonEditableCell AndAlso dfValue = "NA" Then + If bDefaultValue AndAlso Not bNonEditableCell Then dfValue = strDefaultValue End If grdCurrentWorkSheet.Item(row:=i, col:=j) = dfValue + If bDefaultValue AndAlso Not bNonEditableCell Then + grdCurrentWorkSheet.GetCell(i, j).Style.BackColor = Color.LightYellow + End If + If bNonEditableCell Then grdCurrentWorkSheet.GetCell(i, j).IsReadOnly = True End If Next grdCurrentWorkSheet.RowHeaders.Item(i).Text = dfEditData.RowNames(i) Next + + For i As Integer = 0 To grdCurrentWorkSheet.RowCount - 1 + If bDefaultValue Then + AddChangedRow(i) + End If + Next + + 'if entry by month then, add the monthly totals rows and set the calculated totals + If Me.strEntryType = "Month" Then + 'for monthly entry add 3 extra rows for; sum, calculated and difference + grdCurrentWorkSheet.AppendRows(3) + + Dim iLastRowIndex As Integer = grdCurrentWorkSheet.Rows - 1 + iMonthlyTotalsColIndex = Array.IndexOf(arrColumnHeaders, Me.strDateName) + + grdCurrentWorkSheet.Item(row:=iLastRowIndex - 2, col:=iMonthlyTotalsColIndex) = "Sum" + grdCurrentWorkSheet.Item(row:=iLastRowIndex - 1, col:=iMonthlyTotalsColIndex) = "Calculated" + grdCurrentWorkSheet.Item(row:=iLastRowIndex, col:=iMonthlyTotalsColIndex) = "Difference" + + 'set the monthly totals from the set rows + For i As Integer = 0 To iLastRowIndex - 3 + For j = iMonthlyTotalsColIndex + 1 To grdCurrentWorkSheet.Columns - 1 + 'dont set totals for non editable columns + If Not lstNonEditableColumns.Contains(arrColumnHeaders(j)) Then + SetMonthlyTotalsRows(i, j) + End If + Next + Next + + 'set the non editable cells for the added rows + For i As Integer = iLastRowIndex - 3 To iLastRowIndex + For j = 0 To grdCurrentWorkSheet.Columns - 1 + 'create the cell by setting the value if it does not exis + If grdCurrentWorkSheet.GetCell(row:=i, col:=j) Is Nothing Then + grdCurrentWorkSheet.Item(row:=i, col:=j) = "" + End If + 'all calculated and difference cells should be uneditable + If i = iLastRowIndex - 1 OrElse i = iLastRowIndex Then + grdCurrentWorkSheet.GetCell(row:=i, col:=j).IsReadOnly = True + Continue For + End If + + If lstNonEditableColumns.Contains(arrColumnHeaders(j)) Then + grdCurrentWorkSheet.GetCell(row:=i, col:=j).IsReadOnly = True + End If + Next + Next + + + End If + grdCurrentWorkSheet.SetRangeDataFormat(New RangePosition(0, 0, grdCurrentWorkSheet.Rows, grdCurrentWorkSheet.Columns), DataFormat.CellDataFormatFlag.Text) grdCurrentWorkSheet.SelectionForwardDirection = unvell.ReoGrid.SelectionForwardDirection.Down grdCurrentWorkSheet.SetSettings(unvell.ReoGrid.WorksheetSettings.Edit_DragSelectionToMoveCells, False) @@ -176,10 +261,43 @@ Public Class sdgClimaticDataEntry grdDataEntry.AddWorksheet(grdCurrentWorkSheet) grdDataEntry.SheetTabNewButtonVisible = False + SetColumnNames(strDataFrameName, dfEditData.ColumnNames()) + ttCmdReset.SetToolTip(cmdReset, "Clears all data entry.") ttCmdTransformButton.SetToolTip(cmdTransform, "When implemented, this is an option to show the transformed data.") End Sub + Public Sub SetColumnNames(strDataFrameName As String, strColumnNames As String()) + Dim iIndex As Integer + iIndex = lstColumnNames.FindIndex(Function(x) x.Key = strDataFrameName) + If iIndex <> -1 Then + lstColumnNames.RemoveAt(iIndex) + End If + lstColumnNames.Add(New KeyValuePair(Of String, String())(strDataFrameName, strColumnNames)) + End Sub + + Private Function SelectedColumnsAsArray() As String() + Dim strSelectedColumns As String() + Dim lstCurrentDataColumns As String() + + lstCurrentDataColumns = lstColumnNames.Find(Function(x) x.Key = grdDataEntry.CurrentWorksheet.Name).Value + + If lstColumnNames IsNot Nothing AndAlso lstColumnNames.Count > 0 Then + strSelectedColumns = New String(grdDataEntry.CurrentWorksheet.SelectionRange.Cols - 1) {} + For i As Integer = 0 To grdDataEntry.CurrentWorksheet.SelectionRange.Cols - 1 + strSelectedColumns(i) = lstCurrentDataColumns(i + grdDataEntry.CurrentWorksheet.SelectionRange.Col) + Next + Return strSelectedColumns + Else + strSelectedColumns = New String() {} + End If + Return strSelectedColumns + End Function + + Private Function GetFirstSelectedRow() As String + Return grdCurrentWorkSheet.RowHeaders.Item(grdDataEntry.CurrentWorksheet.SelectionRange.Row).Text + End Function + Private Sub grdCurrSheet_BeforeCellEdit(sender As Object, e As CellBeforeEditEventArgs) Handles grdCurrentWorkSheet.BeforeCellEdit ''todo. do this disabling of data entry be done when setting up the grid. Not here 'If lstNonEditableColumns.Contains(grdCurrentWorkSheet.ColumnHeaders(e.Cell.Column).Text) Then @@ -201,25 +319,38 @@ Public Class sdgClimaticDataEntry MsgBox("Pasting not yet implemented.", MsgBoxStyle.Information, "Pasting not implemented.") e.IsCancelled = True End Sub + Private Sub grdCurrSheet_AfterCellEdit(sender As Object, e As CellAfterEditEventArgs) Handles grdCurrentWorkSheet.AfterCellEdit Dim bValidValue As Boolean = True Dim newValue As String = e.NewData + If Not bAllowEdits Then + 'todo. set a better feedback message + MsgBox("Edits not allowed", MsgBoxStyle.Information, "No edits allowed.") + e.EndReason = EndEditReason.Cancel + Exit Sub + End If + If Not IsNumeric(newValue) AndAlso Not newValue = "NA" Then If Not (bAllowTrace AndAlso newValue.ToUpper = "T") Then MsgBox("Value is not numeric or NA.", MsgBoxStyle.Information, "Not numeric.") - e.EndReason = EndEditReason.Cancel bValidValue = False End If ElseIf bNoDecimal AndAlso newValue.Contains(".") Then MsgBox("Value should not be decimal otherwise uncheck No Decimal.", MsgBoxStyle.Information, "Not decimal Allowed.") - e.EndReason = EndEditReason.Cancel bValidValue = False End If If bValidValue Then - AddChangedRow(e.Cell.Row) + 'dont add any change in the last 3 rows if entry is by "Month" + If Not (strEntryType = "Month" AndAlso e.Cell.Row >= grdCurrentWorkSheet.Rows - 3) Then + AddChangedRow(e.Cell.Row) + End If + SetMonthlyTotalsRows(e.Cell.Row, e.Cell.Column, newValue) grdCurrentWorkSheet.GetCell(e.Cell.Row, e.Cell.Column).Style.BackColor = Color.Yellow + Else + e.EndReason = EndEditReason.Cancel + 'grdCurrentWorkSheet.FocusPos = New CellPosition(e.Cell.Address) End If End Sub @@ -242,9 +373,8 @@ Public Class sdgClimaticDataEntry End If End Sub - Private Sub sdgClimaticDataEntry_Closing(sender As Object, e As CancelEventArgs) Handles Me.Closing + Private Sub ucrSdgBaseButtons_ClickReturn(sender As Object, e As EventArgs) Handles ucrSdgBaseButtons.ClickReturn Dim i As Integer - If NRowsChanged() > 0 Then clsEditDataFrame.AddParameter(strDateName, "as.Date(" & GetRowsChangedAsRVectorString(strDateName, Chr(34)) & ")", iPosition:=1) i = 2 @@ -253,8 +383,88 @@ Public Class sdgClimaticDataEntry i = i + 1 Next clsSaveDataEntry.AddParameter("rows_changed", GetRowNamesChangedAsRVectorString(), iPosition:=2) + clsSaveDataEntry.AddParameter("comments_list", clsRFunctionParameter:=sdgCommentForDataEntry.clsList, iPosition:=3) Else clsSaveDataEntry.RemoveParameterByName("rows_changed") End If End Sub + + Private Sub cmdTransform_Click(sender As Object, e As EventArgs) Handles cmdTransform.Click + 'todo. check how translation will affect this, possibly use 2 buttons instead of one ? + If cmdTransform.Text = "Transform" Then + cmdTransform.Text = "UnTransform" + bAllowEdits = False + Else + cmdTransform.Text = "Transform" + bAllowEdits = True + End If + End Sub + + Private Sub cmdComment_Click(sender As Object, e As EventArgs) Handles cmdComment.Click + sdgCommentForDataEntry.SetPosition(grdCurrentWorkSheet.Name, GetFirstSelectedRow(), SelectedColumnsAsArray()(0)) + sdgCommentForDataEntry.SetRfunctions(clsNewSaveDataEntry:=clsSaveDataEntry) + sdgCommentForDataEntry.ShowDialog() + End Sub + + ''' + ''' sets the monthly totals; the last 3 rows in the grid + ''' + ''' + ''' + ''' + Private Sub SetMonthlyTotalsRows(iRowIndexSelected As Integer, iColIndexSelected As Integer, Optional strNewValue As String = Nothing) + Dim iLastRowIndex As Integer = grdCurrentWorkSheet.Rows - 1 + Dim strSumValue As String + Dim strValue As String + Dim dTotalCalculatedValue As Double + Dim dDifferenceValue As Double + + 'only do monthly totals for columns after the monthly total column + 'If Me.strEntryType <> "Month" OrElse iColIndexSelected <= iMonthlyTotalsColIndex Then + ' Exit Sub + 'End If + + 'only do monthly totals for columns after the monthly total column + 'also exit if its a "calculated" or "difference" row + If Me.strEntryType <> "Month" OrElse iColIndexSelected <= iMonthlyTotalsColIndex OrElse iRowIndexSelected = iLastRowIndex - 1 OrElse iRowIndexSelected = iLastRowIndex Then + Exit Sub + End If + + 'get user input sum value, if the new value is a "sum" value then just use the new value + If iRowIndexSelected = iLastRowIndex - 2 AndAlso strNewValue IsNot Nothing Then + strSumValue = strNewValue + Else + strSumValue = grdCurrentWorkSheet.Item(row:=iLastRowIndex - 2, col:=iColIndexSelected) + End If + + 'calculate the "calculated" value + For i As Integer = 0 To iLastRowIndex - 3 'exclude the 3 rows; sum, calculated and difference + 'if new value of the current cell row item is there + 'then just use the new value to get the calculated value + If iRowIndexSelected = i AndAlso strNewValue IsNot Nothing Then + strValue = strNewValue + Else + strValue = grdCurrentWorkSheet.Item(row:=i, col:=iColIndexSelected) + End If + + If IsNumeric(strValue) Then + dTotalCalculatedValue = dTotalCalculatedValue + Double.Parse(strValue) + End If + Next + + 'set the calculated value and round of to 2 d.p + dTotalCalculatedValue = Math.Round(dTotalCalculatedValue, 2) + grdCurrentWorkSheet.Item(row:=iLastRowIndex - 1, col:=iColIndexSelected) = dTotalCalculatedValue + + 'set difference value, only when there is a sum value else remove the difference + If IsNumeric(strSumValue) Then + dDifferenceValue = Math.Round(Double.Parse(strSumValue) - dTotalCalculatedValue, 2) + grdCurrentWorkSheet.Item(row:=iLastRowIndex, col:=iColIndexSelected) = dDifferenceValue + 'grdCurrentWorkSheet.GetCell(row:=iLastRowIndex, col:=iColIndexSelected).Style.BackColor = If(dDifferenceValue = 0, Color.LightGreen, Color.White) + Else + grdCurrentWorkSheet.Item(row:=iLastRowIndex, col:=iColIndexSelected) = "" + 'grdCurrentWorkSheet.GetCell(row:=iLastRowIndex, col:=iColIndexSelected).Style.BackColor = Color.White + End If + + End Sub End Class \ No newline at end of file diff --git a/instat/sdgClimaticDataEntryOptions.Designer.vb b/instat/sdgClimaticDataEntryOptions.Designer.vb index 242eadce913..dfdfe6bbc5c 100644 --- a/instat/sdgClimaticDataEntryOptions.Designer.vb +++ b/instat/sdgClimaticDataEntryOptions.Designer.vb @@ -22,16 +22,174 @@ Partial Class sdgClimaticDataEntryOptions '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(sdgClimaticDataEntryOptions)) + Me.grpRestrictEntry = New System.Windows.Forms.GroupBox() + Me.ucrChkAllowTrace = New instat.ucrCheck() + Me.ucrChkNoDecimal = New instat.ucrCheck() + Me.ttucrChkDefaultValue = New System.Windows.Forms.ToolTip(Me.components) + Me.lblBefore = New System.Windows.Forms.Label() + Me.lblAfter = New System.Windows.Forms.Label() + Me.ttucrChkTransform = New System.Windows.Forms.ToolTip(Me.components) + Me.ucrChkMissingValues = New instat.ucrCheck() + Me.ucrChkExtraRows = New instat.ucrCheck() + Me.ucrNudAfter = New instat.ucrNud() + Me.ucrNudBefore = New instat.ucrNud() + Me.ucrSdgPICSARainfalbuttons = New instat.ucrButtonsSubdialogue() + Me.ucrInputDefaultValue = New instat.ucrInputTextBox() + Me.ucrInputTransform = New instat.ucrInputComboBox() + Me.ucrChkDefaultValue = New instat.ucrCheck() + Me.ucrChkTransform = New instat.ucrCheck() + Me.grpRestrictEntry.SuspendLayout() Me.SuspendLayout() ' + 'grpRestrictEntry + ' + Me.grpRestrictEntry.Controls.Add(Me.ucrChkAllowTrace) + Me.grpRestrictEntry.Controls.Add(Me.ucrChkNoDecimal) + resources.ApplyResources(Me.grpRestrictEntry, "grpRestrictEntry") + Me.grpRestrictEntry.Name = "grpRestrictEntry" + Me.grpRestrictEntry.TabStop = False + ' + 'ucrChkAllowTrace + ' + Me.ucrChkAllowTrace.Checked = False + resources.ApplyResources(Me.ucrChkAllowTrace, "ucrChkAllowTrace") + Me.ucrChkAllowTrace.Name = "ucrChkAllowTrace" + ' + 'ucrChkNoDecimal + ' + Me.ucrChkNoDecimal.Checked = False + resources.ApplyResources(Me.ucrChkNoDecimal, "ucrChkNoDecimal") + Me.ucrChkNoDecimal.Name = "ucrChkNoDecimal" + ' + 'ttucrChkDefaultValue + ' + Me.ttucrChkDefaultValue.AutoPopDelay = 10000 + Me.ttucrChkDefaultValue.InitialDelay = 500 + Me.ttucrChkDefaultValue.ReshowDelay = 100 + ' + 'lblBefore + ' + resources.ApplyResources(Me.lblBefore, "lblBefore") + Me.lblBefore.Name = "lblBefore" + ' + 'lblAfter + ' + resources.ApplyResources(Me.lblAfter, "lblAfter") + Me.lblAfter.Name = "lblAfter" + ' + 'ttucrChkTransform + ' + Me.ttucrChkTransform.AutoPopDelay = 10000 + Me.ttucrChkTransform.InitialDelay = 500 + Me.ttucrChkTransform.ReshowDelay = 100 + ' + 'ucrChkMissingValues + ' + Me.ucrChkMissingValues.Checked = False + resources.ApplyResources(Me.ucrChkMissingValues, "ucrChkMissingValues") + Me.ucrChkMissingValues.Name = "ucrChkMissingValues" + ' + 'ucrChkExtraRows + ' + Me.ucrChkExtraRows.Checked = False + resources.ApplyResources(Me.ucrChkExtraRows, "ucrChkExtraRows") + Me.ucrChkExtraRows.Name = "ucrChkExtraRows" + ' + 'ucrNudAfter + ' + Me.ucrNudAfter.DecimalPlaces = New Decimal(New Integer() {0, 0, 0, 0}) + Me.ucrNudAfter.Increment = New Decimal(New Integer() {1, 0, 0, 0}) + resources.ApplyResources(Me.ucrNudAfter, "ucrNudAfter") + Me.ucrNudAfter.Maximum = New Decimal(New Integer() {100, 0, 0, 0}) + Me.ucrNudAfter.Minimum = New Decimal(New Integer() {0, 0, 0, 0}) + Me.ucrNudAfter.Name = "ucrNudAfter" + Me.ucrNudAfter.Value = New Decimal(New Integer() {0, 0, 0, 0}) + ' + 'ucrNudBefore + ' + Me.ucrNudBefore.DecimalPlaces = New Decimal(New Integer() {0, 0, 0, 0}) + Me.ucrNudBefore.Increment = New Decimal(New Integer() {1, 0, 0, 0}) + resources.ApplyResources(Me.ucrNudBefore, "ucrNudBefore") + Me.ucrNudBefore.Maximum = New Decimal(New Integer() {100, 0, 0, 0}) + Me.ucrNudBefore.Minimum = New Decimal(New Integer() {0, 0, 0, 0}) + Me.ucrNudBefore.Name = "ucrNudBefore" + Me.ucrNudBefore.Value = New Decimal(New Integer() {0, 0, 0, 0}) + ' + 'ucrSdgPICSARainfalbuttons + ' + resources.ApplyResources(Me.ucrSdgPICSARainfalbuttons, "ucrSdgPICSARainfalbuttons") + Me.ucrSdgPICSARainfalbuttons.Name = "ucrSdgPICSARainfalbuttons" + ' + 'ucrInputDefaultValue + ' + Me.ucrInputDefaultValue.AddQuotesIfUnrecognised = True + Me.ucrInputDefaultValue.IsMultiline = False + Me.ucrInputDefaultValue.IsReadOnly = False + resources.ApplyResources(Me.ucrInputDefaultValue, "ucrInputDefaultValue") + Me.ucrInputDefaultValue.Name = "ucrInputDefaultValue" + ' + 'ucrInputTransform + ' + Me.ucrInputTransform.AddQuotesIfUnrecognised = True + Me.ucrInputTransform.GetSetSelectedIndex = -1 + Me.ucrInputTransform.IsReadOnly = False + resources.ApplyResources(Me.ucrInputTransform, "ucrInputTransform") + Me.ucrInputTransform.Name = "ucrInputTransform" + ' + 'ucrChkDefaultValue + ' + Me.ucrChkDefaultValue.Checked = False + resources.ApplyResources(Me.ucrChkDefaultValue, "ucrChkDefaultValue") + Me.ucrChkDefaultValue.Name = "ucrChkDefaultValue" + ' + 'ucrChkTransform + ' + Me.ucrChkTransform.Checked = False + resources.ApplyResources(Me.ucrChkTransform, "ucrChkTransform") + Me.ucrChkTransform.Name = "ucrChkTransform" + ' 'sdgClimaticDataEntryOptions ' - Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!) + resources.ApplyResources(Me, "$this") Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font - Me.ClientSize = New System.Drawing.Size(443, 206) + Me.Controls.Add(Me.ucrChkMissingValues) + Me.Controls.Add(Me.lblAfter) + Me.Controls.Add(Me.lblBefore) + Me.Controls.Add(Me.ucrChkExtraRows) + Me.Controls.Add(Me.ucrNudAfter) + Me.Controls.Add(Me.ucrNudBefore) + Me.Controls.Add(Me.ucrSdgPICSARainfalbuttons) + Me.Controls.Add(Me.ucrInputDefaultValue) + Me.Controls.Add(Me.ucrInputTransform) + Me.Controls.Add(Me.grpRestrictEntry) + Me.Controls.Add(Me.ucrChkDefaultValue) + Me.Controls.Add(Me.ucrChkTransform) + Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow + Me.MaximizeBox = False + Me.MinimizeBox = False Me.Name = "sdgClimaticDataEntryOptions" - Me.Text = "sdgClimaticDataEntryOptions" + Me.grpRestrictEntry.ResumeLayout(False) Me.ResumeLayout(False) + Me.PerformLayout() End Sub + + Friend WithEvents ucrInputDefaultValue As ucrInputTextBox + Friend WithEvents ucrInputTransform As ucrInputComboBox + Friend WithEvents grpRestrictEntry As GroupBox + Friend WithEvents ucrChkAllowTrace As ucrCheck + Friend WithEvents ucrChkNoDecimal As ucrCheck + Friend WithEvents ucrChkDefaultValue As ucrCheck + Friend WithEvents ucrChkTransform As ucrCheck + Friend WithEvents ucrSdgPICSARainfalbuttons As ucrButtonsSubdialogue + Friend WithEvents ucrNudBefore As ucrNud + Friend WithEvents ucrNudAfter As ucrNud + Friend WithEvents ttucrChkDefaultValue As ToolTip + Friend WithEvents ucrChkExtraRows As ucrCheck + Friend WithEvents lblBefore As Label + Friend WithEvents lblAfter As Label + Friend WithEvents ttucrChkTransform As ToolTip + Friend WithEvents ucrChkMissingValues As ucrCheck End Class diff --git a/instat/sdgClimaticDataEntryOptions.resx b/instat/sdgClimaticDataEntryOptions.resx index 1af7de150c9..a0d6b12e229 100644 --- a/instat/sdgClimaticDataEntryOptions.resx +++ b/instat/sdgClimaticDataEntryOptions.resx @@ -117,4 +117,382 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + 109, 14 + + + 127, 20 + + + + 66 + + + ucrChkAllowTrace + + + instat.ucrCheck, instat, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null + + + grpRestrictEntry + + + 0 + + + 7, 14 + + + 113, 20 + + + 65 + + + ucrChkNoDecimal + + + instat.ucrCheck, instat, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null + + + grpRestrictEntry + + + 1 + + + 12, 63 + + + 243, 40 + + + 90 + + + Restrict Entry: + + + grpRestrictEntry + + + System.Windows.Forms.GroupBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + $this + + + 9 + + + 17, 17 + + + True + + + + NoControl + + + 102, 115 + + + 41, 13 + + + 98 + + + Before: + + + False + + + lblBefore + + + System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + $this + + + 2 + + + True + + + NoControl + + + 197, 115 + + + 32, 13 + + + 99 + + + After: + + + False + + + lblAfter + + + System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + $this + + + 1 + + + 116, 17 + + + 12, 138 + + + 181, 20 + + + 100 + + + ucrChkMissingValues + + + instat.ucrCheck, instat, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null + + + $this + + + 0 + + + False + + + 12, 112 + + + 93, 20 + + + 97 + + + ucrChkExtraRows + + + instat.ucrCheck, instat, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null + + + $this + + + 3 + + + 233, 112 + + + 50, 20 + + + 96 + + + False + + + ucrNudAfter + + + instat.ucrNud, instat, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null + + + $this + + + 4 + + + 143, 112 + + + 50, 20 + + + 95 + + + False + + + ucrNudBefore + + + instat.ucrNud, instat, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null + + + $this + + + 5 + + + 85, 165 + + + 4, 4, 4, 4 + + + 144, 30 + + + 93 + + + ucrSdgPICSARainfalbuttons + + + instat.ucrButtonsSubdialogue, instat, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null + + + $this + + + 6 + + + 102, 36 + + + 94, 21 + + + 92 + + + ucrInputDefaultValue + + + instat.ucrInputTextBox, instat, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null + + + $this + + + 7 + + + 102, 6 + + + 5, 5, 5, 5 + + + 94, 21 + + + 91 + + + ucrInputTransform + + + instat.ucrInputComboBox, instat, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null + + + $this + + + 8 + + + 12, 37 + + + 93, 20 + + + 89 + + + ucrChkDefaultValue + + + instat.ucrCheck, instat, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null + + + $this + + + 10 + + + 12, 8 + + + 83, 20 + + + 88 + + + ucrChkTransform + + + instat.ucrCheck, instat, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null + + + $this + + + 11 + + + True + + + 6, 13 + + + 304, 203 + + + CenterScreen + + + Options + + + ttucrChkDefaultValue + + + System.Windows.Forms.ToolTip, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + ttucrChkTransform + + + System.Windows.Forms.ToolTip, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + sdgClimaticDataEntryOptions + + + System.Windows.Forms.Form, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + \ No newline at end of file diff --git a/instat/sdgClimaticDataEntryOptions.vb b/instat/sdgClimaticDataEntryOptions.vb index 38466b71f67..506be48a764 100644 --- a/instat/sdgClimaticDataEntryOptions.vb +++ b/instat/sdgClimaticDataEntryOptions.vb @@ -1,3 +1,117 @@ -Public Class sdgClimaticDataEntryOptions +' R- Instat +' Copyright (C) 2015-2017 +' +' This program is free software: you can redistribute it and/or modify +' it under the terms of the GNU General Public License as published by +' the Free Software Foundation, either version 3 of the License, or +' (at your option) any later version. +' +' This program is distributed in the hope that it will be useful, +' but WITHOUT ANY WARRANTY; without even the implied warranty of +' MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +' GNU General Public License for more details. +' +' You should have received a copy of the GNU General Public License +' along with this program. If not, see . +Imports instat +Imports instat.Translations +Public Class sdgClimaticDataEntryOptions + Private bFirstLoad As Boolean = True + Private bMissing As Boolean = True + Private Sub sdgClimaticDataEntryOptions_Load(sender As Object, e As EventArgs) Handles MyBase.Load + If bFirstLoad Then + InitialiseControls() + SetDefaults() + bFirstLoad = False + End If + autoTranslate(Me) + End Sub + Private Sub InitialiseControls() + ucrChkTransform.SetText("Transform:") + ttucrChkTransform.SetToolTip(ucrChkTransform, "The values written to the data frame are transformed, usually multiplied, by the value given here.") + + ucrInputTransform.SetItems({"0.1", "25.4", "0.254"}) + ucrInputTransform.SetValidationTypeAsNumeric(dcmMin:=0.1) + ucrInputTransform.Visible = False + + ucrChkDefaultValue.SetText("Default Value:") + ucrInputDefaultValue.SetText("0") + ucrInputDefaultValue.Visible = False + + ucrChkMissingValues.SetText("Missing values shown as NA") + + ucrChkNoDecimal.SetText("No Decimal") + + ucrChkExtraRows.SetText("Extra Rows") + + ucrChkAllowTrace.SetText("Allow t for Trace") + ttucrChkDefaultValue.SetToolTip(ucrChkDefaultValue, "The data must be defined as climatic to recognise which variable is precipitation.") + End Sub + + Private Sub SetDefaults() + ucrChkDefaultValue.Checked = False + ucrChkAllowTrace.Checked = False + ucrChkTransform.Checked = False + ucrChkMissingValues.Checked = True + ucrInputTransform.GetSetSelectedIndex = 0 + End Sub + + Private Sub ucrChkDefaultValue_ControlValueChanged(ucrChangedControl As ucrCore) Handles ucrChkDefaultValue.ControlValueChanged + 'todo. can this "toggling" be done in another way? + ucrInputDefaultValue.Visible = ucrChkDefaultValue.Checked + End Sub + + Private Sub ucrChkTransform_ControlValueChanged(ucrChangedControl As ucrCore) Handles ucrChkTransform.ControlValueChanged + 'todo. can this "toggling" be done in another way? + ucrInputTransform.Visible = ucrChkTransform.Checked + End Sub + + Public ReadOnly Property NoDecimals As Boolean + Get + Return ucrChkNoDecimal.Checked + End Get + End Property + + Public ReadOnly Property UseDefault As Boolean + Get + Return ucrChkDefaultValue.Checked + End Get + End Property + Public ReadOnly Property MissingValueAsNA As Boolean + Get + Return bMissing + End Get + End Property + + + 'todo. why is this a string? + Public ReadOnly Property DefaultValue As Double + Get + Return If(String.IsNullOrEmpty(ucrInputDefaultValue.GetValue), 0, ucrInputDefaultValue.GetValue) + End Get + End Property + + Public ReadOnly Property AllowTrace As Boolean + Get + Return ucrChkAllowTrace.Checked + End Get + End Property + + Public ReadOnly Property Transform As Boolean + Get + Return ucrChkTransform.Checked + End Get + End Property + + Public ReadOnly Property TransformValue As Double + Get + 'todo. do explicit conversion. Currently ucrInputTransform validation type is number + Return If(String.IsNullOrEmpty(ucrInputTransform.GetValue), 0, ucrInputTransform.GetValue) + End Get + End Property + + Private Sub ucrChkMissingValues_ControlValueChanged(ucrChangedControl As ucrCore) Handles ucrChkMissingValues.ControlValueChanged + bMissing = ucrChkMissingValues.Checked + End Sub End Class \ No newline at end of file diff --git a/instat/sdgCommentForDataEntry.Designer.vb b/instat/sdgCommentForDataEntry.Designer.vb new file mode 100644 index 00000000000..f135e91c766 --- /dev/null +++ b/instat/sdgCommentForDataEntry.Designer.vb @@ -0,0 +1,196 @@ + _ +Partial Class sdgCommentForDataEntry + Inherits System.Windows.Forms.Form + + 'Form overrides dispose to clean up the component list. + _ + Protected Overrides Sub Dispose(ByVal disposing As Boolean) + Try + If disposing AndAlso components IsNot Nothing Then + components.Dispose() + End If + Finally + MyBase.Dispose(disposing) + End Try + End Sub + + 'Required by the Windows Form Designer + Private components As System.ComponentModel.IContainer + + 'NOTE: The following procedure is required by the Windows Form Designer + 'It can be modified using the Windows Form Designer. + '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(sdgCommentForDataEntry)) + Me.rdoColumn = New System.Windows.Forms.RadioButton() + Me.rdoDataFrame = New System.Windows.Forms.RadioButton() + Me.rdoCell = New System.Windows.Forms.RadioButton() + Me.rdoRow = New System.Windows.Forms.RadioButton() + Me.lblComment = New System.Windows.Forms.Label() + Me.lblColumn = New System.Windows.Forms.Label() + Me.lblRow = New System.Windows.Forms.Label() + Me.ucrInputRow = New instat.ucrInputTextBox() + Me.ucrSelectorAddComment = New instat.ucrSelectorByDataFrameAddRemove() + Me.ucrPnlCellRowColumnDataFrame = New instat.UcrPanel() + Me.ucrInputComment = New instat.ucrInputTextBox() + Me.ucrReceiverColumn = New instat.ucrReceiverSingle() + Me.ucrSdgBaseButtons = New instat.ucrButtonsSubdialogue() + Me.cmdAddComment = New System.Windows.Forms.Button() + Me.ttcmdAddComment = New System.Windows.Forms.ToolTip(Me.components) + Me.SuspendLayout() + ' + 'rdoColumn + ' + resources.ApplyResources(Me.rdoColumn, "rdoColumn") + Me.rdoColumn.FlatAppearance.BorderColor = System.Drawing.SystemColors.ActiveCaption + Me.rdoColumn.FlatAppearance.BorderSize = 2 + Me.rdoColumn.FlatAppearance.CheckedBackColor = System.Drawing.SystemColors.ActiveCaption + Me.rdoColumn.ForeColor = System.Drawing.SystemColors.ActiveCaptionText + Me.rdoColumn.Name = "rdoColumn" + Me.rdoColumn.UseVisualStyleBackColor = True + ' + 'rdoDataFrame + ' + resources.ApplyResources(Me.rdoDataFrame, "rdoDataFrame") + Me.rdoDataFrame.FlatAppearance.BorderColor = System.Drawing.SystemColors.ActiveCaption + Me.rdoDataFrame.FlatAppearance.BorderSize = 2 + Me.rdoDataFrame.FlatAppearance.CheckedBackColor = System.Drawing.SystemColors.ActiveCaption + Me.rdoDataFrame.ForeColor = System.Drawing.SystemColors.ActiveCaptionText + Me.rdoDataFrame.Name = "rdoDataFrame" + Me.rdoDataFrame.UseVisualStyleBackColor = True + ' + 'rdoCell + ' + resources.ApplyResources(Me.rdoCell, "rdoCell") + Me.rdoCell.FlatAppearance.BorderColor = System.Drawing.SystemColors.ActiveCaption + Me.rdoCell.FlatAppearance.BorderSize = 2 + Me.rdoCell.FlatAppearance.CheckedBackColor = System.Drawing.SystemColors.ActiveCaption + Me.rdoCell.ForeColor = System.Drawing.SystemColors.ControlText + Me.rdoCell.Name = "rdoCell" + Me.rdoCell.UseVisualStyleBackColor = True + ' + 'rdoRow + ' + resources.ApplyResources(Me.rdoRow, "rdoRow") + Me.rdoRow.FlatAppearance.BorderColor = System.Drawing.SystemColors.ActiveCaption + Me.rdoRow.FlatAppearance.BorderSize = 2 + Me.rdoRow.FlatAppearance.CheckedBackColor = System.Drawing.SystemColors.ActiveCaption + Me.rdoRow.ForeColor = System.Drawing.SystemColors.ActiveCaptionText + Me.rdoRow.Name = "rdoRow" + Me.rdoRow.UseVisualStyleBackColor = True + ' + 'lblComment + ' + resources.ApplyResources(Me.lblComment, "lblComment") + Me.lblComment.Name = "lblComment" + ' + 'lblColumn + ' + resources.ApplyResources(Me.lblColumn, "lblColumn") + Me.lblColumn.Name = "lblColumn" + ' + 'lblRow + ' + resources.ApplyResources(Me.lblRow, "lblRow") + Me.lblRow.Name = "lblRow" + ' + 'ucrInputRow + ' + Me.ucrInputRow.AddQuotesIfUnrecognised = True + Me.ucrInputRow.IsMultiline = False + Me.ucrInputRow.IsReadOnly = False + resources.ApplyResources(Me.ucrInputRow, "ucrInputRow") + Me.ucrInputRow.Name = "ucrInputRow" + ' + 'ucrSelectorAddComment + ' + Me.ucrSelectorAddComment.bDropUnusedFilterLevels = False + Me.ucrSelectorAddComment.bShowHiddenColumns = False + Me.ucrSelectorAddComment.bUseCurrentFilter = True + resources.ApplyResources(Me.ucrSelectorAddComment, "ucrSelectorAddComment") + Me.ucrSelectorAddComment.Name = "ucrSelectorAddComment" + ' + 'ucrPnlCellRowColumnDataFrame + ' + resources.ApplyResources(Me.ucrPnlCellRowColumnDataFrame, "ucrPnlCellRowColumnDataFrame") + Me.ucrPnlCellRowColumnDataFrame.Name = "ucrPnlCellRowColumnDataFrame" + ' + 'ucrInputComment + ' + Me.ucrInputComment.AddQuotesIfUnrecognised = True + Me.ucrInputComment.IsMultiline = False + Me.ucrInputComment.IsReadOnly = False + resources.ApplyResources(Me.ucrInputComment, "ucrInputComment") + Me.ucrInputComment.Name = "ucrInputComment" + ' + 'ucrReceiverColumn + ' + Me.ucrReceiverColumn.frmParent = Me + resources.ApplyResources(Me.ucrReceiverColumn, "ucrReceiverColumn") + Me.ucrReceiverColumn.Name = "ucrReceiverColumn" + Me.ucrReceiverColumn.Selector = Nothing + Me.ucrReceiverColumn.strNcFilePath = "" + Me.ucrReceiverColumn.ucrSelector = Nothing + ' + 'ucrSdgBaseButtons + ' + resources.ApplyResources(Me.ucrSdgBaseButtons, "ucrSdgBaseButtons") + Me.ucrSdgBaseButtons.Name = "ucrSdgBaseButtons" + ' + 'cmdAddComment + ' + resources.ApplyResources(Me.cmdAddComment, "cmdAddComment") + Me.cmdAddComment.Name = "cmdAddComment" + Me.cmdAddComment.UseVisualStyleBackColor = True + ' + 'ttcmdAddComment + ' + Me.ttcmdAddComment.AutoPopDelay = 10000 + Me.ttcmdAddComment.InitialDelay = 500 + Me.ttcmdAddComment.ReshowDelay = 100 + ' + 'sdgCommentForDataEntry + ' + resources.ApplyResources(Me, "$this") + Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font + Me.Controls.Add(Me.cmdAddComment) + Me.Controls.Add(Me.rdoColumn) + Me.Controls.Add(Me.rdoDataFrame) + Me.Controls.Add(Me.ucrInputRow) + Me.Controls.Add(Me.ucrSelectorAddComment) + Me.Controls.Add(Me.rdoCell) + Me.Controls.Add(Me.rdoRow) + Me.Controls.Add(Me.ucrPnlCellRowColumnDataFrame) + Me.Controls.Add(Me.ucrInputComment) + Me.Controls.Add(Me.lblComment) + Me.Controls.Add(Me.lblColumn) + Me.Controls.Add(Me.ucrReceiverColumn) + Me.Controls.Add(Me.lblRow) + Me.Controls.Add(Me.ucrSdgBaseButtons) + Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow + Me.MaximizeBox = False + Me.MinimizeBox = False + Me.Name = "sdgCommentForDataEntry" + Me.ResumeLayout(False) + Me.PerformLayout() + + End Sub + + Friend WithEvents ucrSdgBaseButtons As ucrButtonsSubdialogue + Friend WithEvents rdoColumn As RadioButton + Friend WithEvents rdoDataFrame As RadioButton + Friend WithEvents ucrInputRow As ucrInputTextBox + Friend WithEvents ucrSelectorAddComment As ucrSelectorByDataFrameAddRemove + Friend WithEvents rdoCell As RadioButton + Friend WithEvents rdoRow As RadioButton + Friend WithEvents ucrPnlCellRowColumnDataFrame As UcrPanel + Friend WithEvents ucrInputComment As ucrInputTextBox + Friend WithEvents lblComment As Label + Friend WithEvents lblColumn As Label + Friend WithEvents ucrReceiverColumn As ucrReceiverSingle + Friend WithEvents lblRow As Label + Friend WithEvents cmdAddComment As Button + Friend WithEvents ttcmdAddComment As ToolTip +End Class diff --git a/instat/sdgCommentForDataEntry.resx b/instat/sdgCommentForDataEntry.resx new file mode 100644 index 00000000000..8342f12c72d --- /dev/null +++ b/instat/sdgCommentForDataEntry.resx @@ -0,0 +1,567 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + + Button + + + None + + + + MiddleCenter + + + Flat + + + NoControl + + + 205, 8 + + + 100, 28 + + + + 92 + + + Column + + + MiddleCenter + + + rdoColumn + + + System.Windows.Forms.RadioButton, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + $this + + + 1 + + + Button + + + None + + + MiddleCenter + + + Flat + + + NoControl + + + 303, 8 + + + 100, 28 + + + 93 + + + Data Frame + + + MiddleCenter + + + rdoDataFrame + + + System.Windows.Forms.RadioButton, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + $this + + + 2 + + + Button + + + Flat + + + NoControl + + + 9, 8 + + + 100, 28 + + + 90 + + + Cell + + + MiddleCenter + + + rdoCell + + + System.Windows.Forms.RadioButton, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + $this + + + 5 + + + Button + + + None + + + MiddleCenter + + + Flat + + + NoControl + + + 107, 8 + + + 100, 28 + + + 91 + + + Row + + + MiddleCenter + + + rdoRow + + + System.Windows.Forms.RadioButton, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + $this + + + 6 + + + True + + + NoControl + + + 13, 238 + + + 54, 13 + + + 99 + + + Comment: + + + lblComment + + + System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + $this + + + 9 + + + True + + + NoControl + + + 265, 110 + + + 45, 13 + + + 97 + + + Column: + + + lblColumn + + + System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + $this + + + 10 + + + True + + + NoControl + + + 265, 68 + + + 32, 13 + + + 95 + + + Row: + + + lblRow + + + System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + $this + + + 12 + + + 301, 64 + + + 80, 21 + + + 96 + + + ucrInputRow + + + instat.ucrInputTextBox, instat, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null + + + $this + + + 3 + + + 9, 44 + + + 0, 0, 0, 0 + + + 210, 180 + + + 94 + + + ucrSelectorAddComment + + + instat.ucrSelectorByDataFrameAddRemove, instat, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null + + + $this + + + 4 + + + -5, 8 + + + 422, 29 + + + 89 + + + ucrPnlCellRowColumnDataFrame + + + instat.UcrPanel, instat, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null + + + $this + + + 7 + + + 71, 235 + + + 336, 47 + + + 100 + + + ucrInputComment + + + instat.ucrInputTextBox, instat, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null + + + $this + + + 8 + + + True + + + 6, 13 + + + 418, 328 + + + NoControl + + + 62, 293 + + + 90, 24 + + + 101 + + + Add Comment + + + cmdAddComment + + + System.Windows.Forms.Button, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + $this + + + 0 + + + 178, 291 + + + 4, 4, 4, 4 + + + 144, 30 + + + 88 + + + ucrSdgBaseButtons + + + instat.ucrButtonsSubdialogue, instat, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null + + + $this + + + 13 + + + CenterParent + + + Comment For Data Entry + + + ttcmdAddComment + + + System.Windows.Forms.ToolTip, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + sdgCommentForDataEntry + + + System.Windows.Forms.Form, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + 265, 125 + + + 0, 0, 0, 0 + + + 137, 20 + + + 98 + + + ucrReceiverColumn + + + instat.ucrReceiverSingle, instat, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null + + + $this + + + 11 + + + 17, 17 + + \ No newline at end of file diff --git a/instat/sdgCommentForDataEntry.vb b/instat/sdgCommentForDataEntry.vb new file mode 100644 index 00000000000..7f22897f1eb --- /dev/null +++ b/instat/sdgCommentForDataEntry.vb @@ -0,0 +1,184 @@ +' R- Instat +' Copyright (C) 2015-2017 +' +' This program is free software: you can redistribute it and/or modify +' it under the terms of the GNU General Public License as published by +' the Free Software Foundation, either version 3 of the License, or +' (at your option) any later version. +' +' This program is distributed in the hope that it will be useful, +' but WITHOUT ANY WARRANTY; without even the implied warranty of +' MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +' GNU General Public License for more details. +' +' You should have received a copy of the GNU General Public License +' along with this program. If not, see . + +Imports instat.Translations +Imports RDotNet +Public Class sdgCommentForDataEntry + Private bUseSelectedPosition As Boolean = False + Private strSelectedDataFrame As String = "" + Private strSelectedRow As String = "" + Private strSelectedColumn As String = "" + Private bFirstLoad As Boolean = True + Private bReset As Boolean = True + Private bClearComments As Boolean + Public clsList As RFunction + Private clsCommentsList As RFunction + Private clsSaveDataEntry As RFunction + Private clsGetKey As RFunction + Private iNumComments As Integer = 0 + + Private Sub sdgCommentForDataEntry_Load(sender As Object, e As EventArgs) Handles MyBase.Load + If bFirstLoad Then + InitialiseDialog() + bFirstLoad = False + End If + If bReset Then + SetDefaults() + End If + bReset = False + autoTranslate(Me) + SetRCodeForControls(bReset) + If bUseSelectedPosition Then + SetDefaultPosition() + End If + End Sub + + Private Sub InitialiseDialog() + ucrPnlCellRowColumnDataFrame.AddRadioButton(rdoCell) + ucrPnlCellRowColumnDataFrame.AddRadioButton(rdoRow) + ucrPnlCellRowColumnDataFrame.AddRadioButton(rdoColumn) + ucrPnlCellRowColumnDataFrame.AddRadioButton(rdoDataFrame) + + ucrPnlCellRowColumnDataFrame.AddParameterPresentCondition(rdoCell, "column") + ucrPnlCellRowColumnDataFrame.AddParameterPresentCondition(rdoCell, "row") + ucrPnlCellRowColumnDataFrame.AddParameterPresentCondition(rdoRow, "row") + ucrPnlCellRowColumnDataFrame.AddParameterPresentCondition(rdoColumn, "column") + ucrPnlCellRowColumnDataFrame.AddParameterPresentCondition(rdoColumn, "row", False) + ucrPnlCellRowColumnDataFrame.AddParameterPresentCondition(rdoRow, "column", False) + ucrPnlCellRowColumnDataFrame.AddParameterPresentCondition(rdoDataFrame, "column", False) + ucrPnlCellRowColumnDataFrame.AddParameterPresentCondition(rdoDataFrame, "row", False) + + + ucrPnlCellRowColumnDataFrame.AddToLinkedControls(ucrReceiverColumn, {rdoCell, rdoColumn}, bNewLinkedHideIfParameterMissing:=True, bNewLinkedAddRemoveParameter:=True) + ucrPnlCellRowColumnDataFrame.AddToLinkedControls(ucrInputRow, {rdoCell, rdoRow}, bNewLinkedHideIfParameterMissing:=True, bNewLinkedAddRemoveParameter:=True) + ucrInputRow.SetLinkedDisplayControl(lblRow) + ucrReceiverColumn.SetLinkedDisplayControl(lblColumn) + + ucrSelectorAddComment.SetParameter(New RParameter("data_name", 0)) + ucrSelectorAddComment.SetParameterIsString() + + ucrInputRow.SetParameter(New RParameter("row", iNewPosition:=1)) + ucrInputRow.SetValidationTypeAsNumeric() + + ucrReceiverColumn.Selector = ucrSelectorAddComment + ucrReceiverColumn.SetParameter(New RParameter("column", iNewPosition:=2)) + ucrReceiverColumn.SetParameterIsString() + + ucrInputComment.SetParameter(New RParameter("comment", iNewPosition:=3)) + + ttcmdAddComment.SetToolTip(cmdAddComment, "This is Enable when the key exits in the data frame and the input comment is not empty.") + End Sub + + Private Sub SetDefaults() + clsCommentsList = New RFunction + clsList = New RFunction + clsGetKey = New RFunction + + ucrSelectorAddComment.Reset() + ucrInputComment.IsMultiline = True + + cmdAddComment.Enabled = False + + ucrReceiverColumn.SetMeAsReceiver() + + clsGetKey.SetRCommand(frmMain.clsRLink.strInstatDataObject & "$get_keys") + clsGetKey.AddParameter("key_name", Chr(34) & "key" & Chr(34), iPosition:=0) + clsCommentsList.SetRCommand("list") + + clsList.SetRCommand("list") + bClearComments = True + End Sub + + Private Sub SetRCodeForControls(bReset As Boolean) + ucrSelectorAddComment.AddAdditionalCodeParameterPair(clsGetKey, ucrSelectorAddComment.GetParameter(), iAdditionalPairNo:=1) + ucrSelectorAddComment.SetRCode(clsCommentsList, bReset) + ucrInputComment.SetRCode(clsCommentsList, bReset) + ucrInputRow.SetRCode(clsCommentsList, bReset) + ucrReceiverColumn.SetRCode(clsCommentsList, bReset) + End Sub + + Private Sub SetDefaultPosition() + ucrSelectorAddComment.SetDataframe(strSelectedDataFrame) + ucrInputRow.SetName(strSelectedRow) + If strSelectedColumn <> "" AndAlso strSelectedRow <> "" Then + ucrReceiverColumn.Add(strSelectedColumn, strSelectedDataFrame) + rdoCell.Checked = True + ElseIf strSelectedColumn <> "" AndAlso strSelectedRow = "" Then + ucrReceiverColumn.Add(strSelectedColumn, strSelectedDataFrame) + rdoColumn.Checked = True + ElseIf strSelectedColumn = "" AndAlso strSelectedRow <> "" Then + rdoRow.Checked = True + Else + rdoDataFrame.Checked = True + End If + strSelectedDataFrame = "" + strSelectedRow = "" + strSelectedColumn = "" + bUseSelectedPosition = False + End Sub + + Public Sub SetRfunctions(clsNewSaveDataEntry As RFunction) + clsSaveDataEntry = clsNewSaveDataEntry + EnableDisableAddComment() + End Sub + + Private Sub EnableDisableAddComment() + If Not ucrInputComment.IsEmpty Then + Dim expTemp As SymbolicExpression + expTemp = frmMain.clsRLink.RunInternalScriptGetValue(clsGetKey.ToScript(), bSilent:=True) + If expTemp IsNot Nothing Then + cmdAddComment.Enabled = True + Else + cmdAddComment.Enabled = False + End If + End If + End Sub + + Public Sub SetPosition(strDataFrame As String, Optional strRow As String = "", Optional strColumn As String = "") + strSelectedDataFrame = strDataFrame + strSelectedRow = strRow + strSelectedColumn = strColumn + bUseSelectedPosition = True + End Sub + + Private Sub ucrPnlCellRowColumnDataFrame_ControlValueChanged(ucrChangedControl As ucrCore) Handles ucrPnlCellRowColumnDataFrame.ControlValueChanged + ucrSelectorAddComment.ShowColumnSelector(rdoCell.Checked OrElse rdoColumn.Checked) + End Sub + + Private Sub cmdAddComment_Click(sender As Object, e As EventArgs) Handles cmdAddComment.Click + clsList.AddParameter("C" & iNumComments, clsRFunctionParameter:=clsCommentsList, iPosition:=iNumComments) + iNumComments = iNumComments + 1 + Me.Close() + End Sub + + Public Function NbCommentEntered() As Integer + Return iNumComments + End Function + + Private Sub ucrInputComment_ControlContentsChanged(ucrChangedControl As ucrCore) Handles ucrInputComment.ControlContentsChanged + EnableDisableAddComment() + End Sub + + Public Sub ClearInputComment() + ucrInputComment.ResetText() + End Sub + Public Sub ClearComments() + If bClearComments Then + clsList.ClearParameters() + iNumComments = 0 + End If + End Sub +End Class \ No newline at end of file diff --git a/instat/static/InstatObject/R/data_object_R6.R b/instat/static/InstatObject/R/data_object_R6.R index 46acf29d161..733ebc0e4a8 100644 --- a/instat/static/InstatObject/R/data_object_R6.R +++ b/instat/static/InstatObject/R/data_object_R6.R @@ -3862,7 +3862,7 @@ DataSheet$set("public", "get_data_entry_data", function(station, date, elements, curr_data }) -DataSheet$set("public", "save_data_entry_data", function(new_data, rows_changed) { +DataSheet$set("public", "save_data_entry_data", function(new_data, rows_changed, ...) { if (nrow(new_data) != length(rows_changed)) stop("new_data must have the same number of rows as length of rows_changed.") curr_data <- self$get_data_frame(use_current_filter = FALSE) for (i in seq_along(rows_changed)) { diff --git a/instat/static/InstatObject/R/instat_object_R6.R b/instat/static/InstatObject/R/instat_object_R6.R index 5f41b665247..a5355fb9664 100644 --- a/instat/static/InstatObject/R/instat_object_R6.R +++ b/instat/static/InstatObject/R/instat_object_R6.R @@ -1183,7 +1183,7 @@ DataBook$set("public","get_keys", function(data_name, key_name) { # Note: This is a separate functionality to comments as defined in instat_comment.R # This is intended to be later integrated together. -DataBook$set("public","add_new_comment", function(data_name, row, column = "", comment) { +DataBook$set("public","add_new_comment", function(data_name, row = "", column = "", comment) { if (!self$has_key(data_name)) stop("A key must be defined in the data frame to add a comment. Use the Add Key dialog to define a key.") if (!".comment" %in% self$get_data_names()) { comment_df <- data.frame(sheet = character(0), @@ -1197,10 +1197,14 @@ DataBook$set("public","add_new_comment", function(data_name, row, column = "", c } comment_df <- self$get_data_frame(".comment", use_current_filter = FALSE) curr_df <- self$get_data_frame(data_name, use_current_filter = FALSE) + if(row != ""){ curr_row <- curr_df[row.names(curr_df) == row, ] key <- self$get_keys(data_name)[[1]] key_cols <- as.character(key) key_vals <- paste(sapply(curr_row[, key_cols], as.character), collapse = "__") + } else { + key_vals <- "" + } curr_comments <- comment_df[comment_df$sheet == data_name & comment_df$row == key_vals, ] new_id <- 1 if (nrow(curr_comments) > 0) new_id <- max(curr_comments$id) + 1 @@ -2523,7 +2527,19 @@ DataBook$set("public", "get_data_entry_data", function(data_name, station, date, self$get_data_objects(data_name)$get_data_entry_data(station = station, date = date, elements = elements, view_variables = view_variables, station_name = station_name, type = type, start_date = start_date, end_date = end_date) }) -DataBook$set("public", "save_data_entry_data", function(data_name, new_data, rows_changed) { +DataBook$set("public", "save_data_entry_data", function(data_name, new_data, rows_changed, comments_list = list()) { + if(!missing(comments_list)){ + for (i in seq_along(comments_list)) { + com <- comments_list[[i]] + if(!("row" %in% names(com))){ + com[["row"]] <- "" + } + if(!("column" %in% names(com))){ + com[["column"]] <- "" + } + self$add_new_comment(data_name = data_name, row = com$row, column = com$column, comment = com$comment) + } + } self$get_data_objects(data_name)$save_data_entry_data(new_data = new_data, rows_changed = rows_changed) } ) diff --git a/instat/ucrColumnMetadata.Designer.vb b/instat/ucrColumnMetadata.Designer.vb index 84be50970e8..48e806d4472 100644 --- a/instat/ucrColumnMetadata.Designer.vb +++ b/instat/ucrColumnMetadata.Designer.vb @@ -59,6 +59,7 @@ Partial Class ucrColumnMetadata Me.mnuLevelsLabels = New System.Windows.Forms.ToolStripMenuItem() Me.ToolStripSeparator1 = New System.Windows.Forms.ToolStripSeparator() Me.mnuSort = New System.Windows.Forms.ToolStripMenuItem() + Me.mnuAddComment = New System.Windows.Forms.ToolStripMenuItem() Me.mnuColumnFilter = New System.Windows.Forms.ToolStripMenuItem() Me.mnuClearColumnFilter = New System.Windows.Forms.ToolStripMenuItem() Me.statusColumnMenu = New System.Windows.Forms.ContextMenuStrip(Me.components) @@ -73,6 +74,7 @@ Partial Class ucrColumnMetadata Me.mnuDeleteLabels = New System.Windows.Forms.ToolStripMenuItem() Me.lblHeaderColumnMetadata = New System.Windows.Forms.Label() Me.tlpTableContainer = New System.Windows.Forms.TableLayoutPanel() + Me.mnuBottomAddComment = New System.Windows.Forms.ToolStripMenuItem() Me.cellContextMenuStrip.SuspendLayout() Me.columnContextMenuStrip.SuspendLayout() Me.statusColumnMenu.SuspendLayout() @@ -114,9 +116,9 @@ Partial Class ucrColumnMetadata ' 'columnContextMenuStrip ' - 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.ToolStripSeparator2, Me.mnuLevelsLabels, Me.ToolStripSeparator1, Me.mnuSort, 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.toolStripMenuItem2, Me.mnuConvertToFactor, Me.mnuCovertToOrderedFactors, Me.mnuConvertText, Me.mnuConvertToLogical, Me.mnuConvertVariate, Me.ToolStripSeparator2, Me.mnuLevelsLabels, Me.ToolStripSeparator1, Me.mnuSort, Me.mnuAddComment, Me.mnuColumnFilter, Me.mnuClearColumnFilter}) Me.columnContextMenuStrip.Name = "columnContextMenuStrip" - Me.columnContextMenuStrip.Size = New System.Drawing.Size(213, 352) + Me.columnContextMenuStrip.Size = New System.Drawing.Size(213, 374) ' 'mnuColumnRename ' @@ -212,6 +214,12 @@ Partial Class ucrColumnMetadata Me.mnuSort.Size = New System.Drawing.Size(212, 22) Me.mnuSort.Text = "Sort..." ' + 'mnuAddComment + ' + Me.mnuAddComment.Name = "mnuAddComment" + Me.mnuAddComment.Size = New System.Drawing.Size(212, 22) + Me.mnuAddComment.Text = "Add Comment..." + ' 'mnuColumnFilter ' Me.mnuColumnFilter.Name = "mnuColumnFilter" @@ -227,51 +235,51 @@ Partial Class ucrColumnMetadata 'statusColumnMenu ' Me.statusColumnMenu.ImageScalingSize = New System.Drawing.Size(20, 20) - Me.statusColumnMenu.Items.AddRange(New System.Windows.Forms.ToolStripItem() {Me.deleteDataFrame, Me.renameSheet, Me.hideSheet, Me.unhideSheet, Me.copySheet, Me.reorderSheet, Me.viewSheet}) + 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(163, 158) + Me.statusColumnMenu.Size = New System.Drawing.Size(181, 202) ' 'deleteDataFrame ' Me.deleteDataFrame.Name = "deleteDataFrame" - Me.deleteDataFrame.Size = New System.Drawing.Size(162, 22) + Me.deleteDataFrame.Size = New System.Drawing.Size(180, 22) Me.deleteDataFrame.Text = "Delete..." ' 'renameSheet ' Me.renameSheet.Name = "renameSheet" - Me.renameSheet.Size = New System.Drawing.Size(162, 22) + Me.renameSheet.Size = New System.Drawing.Size(180, 22) Me.renameSheet.Text = "Rename..." ' 'hideSheet ' Me.hideSheet.Name = "hideSheet" - Me.hideSheet.Size = New System.Drawing.Size(162, 22) + Me.hideSheet.Size = New System.Drawing.Size(180, 22) Me.hideSheet.Text = "Hide" ' 'unhideSheet ' Me.unhideSheet.Name = "unhideSheet" - Me.unhideSheet.Size = New System.Drawing.Size(162, 22) + Me.unhideSheet.Size = New System.Drawing.Size(180, 22) Me.unhideSheet.Text = "Unhide..." ' 'copySheet ' Me.copySheet.Name = "copySheet" - Me.copySheet.Size = New System.Drawing.Size(162, 22) + Me.copySheet.Size = New System.Drawing.Size(180, 22) Me.copySheet.Text = "Copy..." ' 'reorderSheet ' Me.reorderSheet.Enabled = False Me.reorderSheet.Name = "reorderSheet" - Me.reorderSheet.Size = New System.Drawing.Size(162, 22) + Me.reorderSheet.Size = New System.Drawing.Size(180, 22) Me.reorderSheet.Text = "Reorder..." ' 'viewSheet ' Me.viewSheet.Name = "viewSheet" - Me.viewSheet.Size = New System.Drawing.Size(162, 22) + Me.viewSheet.Size = New System.Drawing.Size(180, 22) Me.viewSheet.Text = "View Data Frame" ' 'propertiesContextMenuStrip @@ -315,6 +323,12 @@ Partial Class ucrColumnMetadata Me.tlpTableContainer.Size = New System.Drawing.Size(344, 138) Me.tlpTableContainer.TabIndex = 7 ' + 'mnuBottomAddComment + ' + Me.mnuBottomAddComment.Name = "mnuBottomAddComment" + Me.mnuBottomAddComment.Size = New System.Drawing.Size(180, 22) + Me.mnuBottomAddComment.Text = "Add Comment..." + ' 'ucrColumnMetadata ' Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!) @@ -365,4 +379,6 @@ Partial Class ucrColumnMetadata Friend WithEvents copySheet As ToolStripMenuItem Friend WithEvents reorderSheet As ToolStripMenuItem Friend WithEvents viewSheet As ToolStripMenuItem + Friend WithEvents mnuAddComment As ToolStripMenuItem + Friend WithEvents mnuBottomAddComment As ToolStripMenuItem End Class diff --git a/instat/ucrColumnMetadata.vb b/instat/ucrColumnMetadata.vb index 87368dc516f..7e8c3c495ea 100644 --- a/instat/ucrColumnMetadata.vb +++ b/instat/ucrColumnMetadata.vb @@ -536,4 +536,14 @@ Public Class ucrColumnMetadata Private Sub statusColumnMenu_Opening(sender As Object, e As CancelEventArgs) Handles statusColumnMenu.Opening hideSheet.Enabled = (grdVariables.Worksheets.Count > 1) End Sub + + Private Sub mnuAddComment_Click(sender As Object, e As EventArgs) Handles mnuAddComment.Click + dlgAddComment.SetPosition(strDataFrame:=grdCurrSheet.Name, strColumn:=GetSelectedVariableNamesAsArray()(0)) + dlgAddComment.ShowDialog() + End Sub + + Private Sub mnuBottomAddComment_Click(sender As Object, e As EventArgs) Handles mnuBottomAddComment.Click + dlgAddComment.SetPosition(strDataFrame:=grdCurrSheet.Name) + dlgAddComment.ShowDialog() + End Sub End Class \ No newline at end of file diff --git a/instat/ucrDataFrameMetadata.Designer.vb b/instat/ucrDataFrameMetadata.Designer.vb index 234fd08e20c..d2b8a59ea49 100644 --- a/instat/ucrDataFrameMetadata.Designer.vb +++ b/instat/ucrDataFrameMetadata.Designer.vb @@ -52,6 +52,7 @@ Partial Class ucrDataFrameMetadata Me.viewSheet = New System.Windows.Forms.ToolStripMenuItem() Me.lblHeaderDataFrameMetaData = New System.Windows.Forms.Label() Me.tlpTableContainer = New System.Windows.Forms.TableLayoutPanel() + Me.mnuAddComment = New System.Windows.Forms.ToolStripMenuItem() Me.cellContextMenuStrip.SuspendLayout() Me.rowRightClickMenu.SuspendLayout() Me.tlpTableContainer.SuspendLayout() @@ -92,51 +93,51 @@ Partial Class ucrDataFrameMetadata 'rowRightClickMenu ' Me.rowRightClickMenu.ImageScalingSize = New System.Drawing.Size(20, 20) - Me.rowRightClickMenu.Items.AddRange(New System.Windows.Forms.ToolStripItem() {Me.deleteDataFrame, Me.renameSheet, Me.hideSheet, Me.unhideSheet, Me.copySheet, Me.reorderSheet, Me.viewSheet}) + Me.rowRightClickMenu.Items.AddRange(New System.Windows.Forms.ToolStripItem() {Me.deleteDataFrame, Me.renameSheet, Me.mnuAddComment, Me.hideSheet, Me.unhideSheet, Me.copySheet, Me.reorderSheet, Me.viewSheet}) Me.rowRightClickMenu.Name = "statusColumnMenu" - Me.rowRightClickMenu.Size = New System.Drawing.Size(163, 158) + Me.rowRightClickMenu.Size = New System.Drawing.Size(181, 202) ' 'deleteDataFrame ' Me.deleteDataFrame.Name = "deleteDataFrame" - Me.deleteDataFrame.Size = New System.Drawing.Size(162, 22) + Me.deleteDataFrame.Size = New System.Drawing.Size(180, 22) Me.deleteDataFrame.Text = "Delete..." ' 'renameSheet ' Me.renameSheet.Name = "renameSheet" - Me.renameSheet.Size = New System.Drawing.Size(162, 22) + Me.renameSheet.Size = New System.Drawing.Size(180, 22) Me.renameSheet.Text = "Rename..." ' 'hideSheet ' Me.hideSheet.Name = "hideSheet" - Me.hideSheet.Size = New System.Drawing.Size(162, 22) + Me.hideSheet.Size = New System.Drawing.Size(180, 22) Me.hideSheet.Text = "Hide" ' 'unhideSheet ' Me.unhideSheet.Name = "unhideSheet" - Me.unhideSheet.Size = New System.Drawing.Size(162, 22) + Me.unhideSheet.Size = New System.Drawing.Size(180, 22) Me.unhideSheet.Text = "Unhide..." ' 'copySheet ' Me.copySheet.Name = "copySheet" - Me.copySheet.Size = New System.Drawing.Size(162, 22) + Me.copySheet.Size = New System.Drawing.Size(180, 22) Me.copySheet.Text = "Copy..." ' 'reorderSheet ' Me.reorderSheet.Enabled = False Me.reorderSheet.Name = "reorderSheet" - Me.reorderSheet.Size = New System.Drawing.Size(162, 22) + Me.reorderSheet.Size = New System.Drawing.Size(180, 22) Me.reorderSheet.Text = "Reorder..." ' 'viewSheet ' Me.viewSheet.Name = "viewSheet" - Me.viewSheet.Size = New System.Drawing.Size(162, 22) + Me.viewSheet.Size = New System.Drawing.Size(180, 22) Me.viewSheet.Text = "View Data Frame" ' 'lblHeaderDataFrameMetaData @@ -167,6 +168,12 @@ Partial Class ucrDataFrameMetadata Me.tlpTableContainer.Size = New System.Drawing.Size(477, 317) Me.tlpTableContainer.TabIndex = 8 ' + 'mnuAddComment + ' + Me.mnuAddComment.Name = "mnuAddComment" + Me.mnuAddComment.Size = New System.Drawing.Size(180, 22) + Me.mnuAddComment.Text = "Add Comment..." + ' 'ucrDataFrameMetadata ' Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!) @@ -194,4 +201,5 @@ Partial Class ucrDataFrameMetadata Friend WithEvents copySheet As ToolStripMenuItem Friend WithEvents reorderSheet As ToolStripMenuItem Friend WithEvents viewSheet As ToolStripMenuItem + Friend WithEvents mnuAddComment As ToolStripMenuItem End Class diff --git a/instat/ucrDataFrameMetadata.vb b/instat/ucrDataFrameMetadata.vb index 095f4a1234e..4f8c3457018 100644 --- a/instat/ucrDataFrameMetadata.vb +++ b/instat/ucrDataFrameMetadata.vb @@ -214,4 +214,9 @@ Public Class ucrDataFrameMetadata Private Sub rowRightClickMenu_Opening(sender As Object, e As EventArgs) Handles rowRightClickMenu.Opening hideSheet.Enabled = (grdMetaData.CurrentWorksheet.RowCount > 1) End Sub + + Private Sub mnuAddComment_Click(sender As Object, e As EventArgs) Handles mnuAddComment.Click + dlgAddComment.SetPosition(strDataFrame:=grdCurrSheet.Name) + dlgAddComment.ShowDialog() + End Sub End Class \ No newline at end of file diff --git a/instat/ucrDataView.Designer.vb b/instat/ucrDataView.Designer.vb index 3d52f98357a..9c40b66ad71 100644 --- a/instat/ucrDataView.Designer.vb +++ b/instat/ucrDataView.Designer.vb @@ -60,13 +60,6 @@ Partial Class ucrDataView Me.mnuColumnFilter = New System.Windows.Forms.ToolStripMenuItem() Me.mnuClearColumnFilter = New System.Windows.Forms.ToolStripMenuItem() Me.cellContextMenuStrip = New System.Windows.Forms.ContextMenuStrip(Me.components) - Me.mnuCell = New System.Windows.Forms.ToolStripMenuItem() - Me.mnuCellCutRange = New System.Windows.Forms.ToolStripMenuItem() - Me.mnuCellCopyRange = New System.Windows.Forms.ToolStripMenuItem() - Me.mnuCellPasteRange = New System.Windows.Forms.ToolStripMenuItem() - Me.mnuCellHelp = New System.Windows.Forms.ToolStripMenuItem() - Me.ToolStripSeparator8 = New System.Windows.Forms.ToolStripSeparator() - Me.mnuCellAddComment = New System.Windows.Forms.ToolStripMenuItem() Me.ToolStripSeparator3 = New System.Windows.Forms.ToolStripSeparator() Me.mnuRenameColumn = New System.Windows.Forms.ToolStripMenuItem() Me.mnuDuplColumn = New System.Windows.Forms.ToolStripMenuItem() @@ -81,6 +74,7 @@ Partial Class ucrDataView Me.mnuLebelsLevel = New System.Windows.Forms.ToolStripMenuItem() Me.ToolStripSeparator7 = New System.Windows.Forms.ToolStripSeparator() Me.mnuSorts = New System.Windows.Forms.ToolStripMenuItem() + Me.mnuComment = New System.Windows.Forms.ToolStripMenuItem() Me.mnuFilters = New System.Windows.Forms.ToolStripMenuItem() Me.mnuRemoveCurrentFilters = New System.Windows.Forms.ToolStripMenuItem() Me.rowContextMenuStrip = New System.Windows.Forms.ContextMenuStrip(Me.components) @@ -119,6 +113,8 @@ 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.columnContextMenuStrip.SuspendLayout() Me.cellContextMenuStrip.SuspendLayout() Me.rowContextMenuStrip.SuspendLayout() @@ -153,9 +149,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.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.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, 352) + Me.columnContextMenuStrip.Size = New System.Drawing.Size(213, 374) ' 'mnuColumnRename ' @@ -265,56 +261,10 @@ Partial Class ucrDataView 'cellContextMenuStrip ' Me.cellContextMenuStrip.ImageScalingSize = New System.Drawing.Size(20, 20) - Me.cellContextMenuStrip.Items.AddRange(New System.Windows.Forms.ToolStripItem() {Me.mnuCell, 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.mnuFilters, Me.mnuRemoveCurrentFilters}) + 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) ' - 'mnuCell - ' - Me.mnuCell.DropDownItems.AddRange(New System.Windows.Forms.ToolStripItem() {Me.mnuCellCutRange, Me.mnuCellCopyRange, Me.mnuCellPasteRange, Me.mnuCellHelp, Me.ToolStripSeparator8, Me.mnuCellAddComment}) - Me.mnuCell.Name = "mnuCell" - Me.mnuCell.Size = New System.Drawing.Size(212, 22) - Me.mnuCell.Text = "Cell" - ' - 'mnuCellCutRange - ' - Me.mnuCellCutRange.Enabled = False - Me.mnuCellCutRange.Name = "mnuCellCutRange" - Me.mnuCellCutRange.Size = New System.Drawing.Size(162, 22) - Me.mnuCellCutRange.Text = "Cut" - Me.mnuCellCutRange.Visible = False - ' - 'mnuCellCopyRange - ' - Me.mnuCellCopyRange.Name = "mnuCellCopyRange" - Me.mnuCellCopyRange.Size = New System.Drawing.Size(162, 22) - Me.mnuCellCopyRange.Text = "Copy" - ' - 'mnuCellPasteRange - ' - Me.mnuCellPasteRange.Enabled = False - Me.mnuCellPasteRange.Name = "mnuCellPasteRange" - Me.mnuCellPasteRange.Size = New System.Drawing.Size(162, 22) - Me.mnuCellPasteRange.Text = "Paste" - Me.mnuCellPasteRange.Visible = False - ' - 'mnuCellHelp - ' - Me.mnuCellHelp.Name = "mnuCellHelp" - Me.mnuCellHelp.Size = New System.Drawing.Size(162, 22) - Me.mnuCellHelp.Text = "Help" - ' - 'ToolStripSeparator8 - ' - Me.ToolStripSeparator8.Name = "ToolStripSeparator8" - Me.ToolStripSeparator8.Size = New System.Drawing.Size(159, 6) - ' - 'mnuCellAddComment - ' - Me.mnuCellAddComment.Name = "mnuCellAddComment" - Me.mnuCellAddComment.Size = New System.Drawing.Size(162, 22) - Me.mnuCellAddComment.Text = "Add Comment..." - ' 'ToolStripSeparator3 ' Me.ToolStripSeparator3.Name = "ToolStripSeparator3" @@ -395,6 +345,12 @@ Partial Class ucrDataView Me.mnuSorts.Size = New System.Drawing.Size(212, 22) Me.mnuSorts.Text = "Sort..." ' + 'mnuComment + ' + Me.mnuComment.Name = "mnuComment" + Me.mnuComment.Size = New System.Drawing.Size(212, 22) + Me.mnuComment.Text = "Add Comment..." + ' 'mnuFilters ' Me.mnuFilters.Name = "mnuFilters" @@ -465,51 +421,51 @@ Partial Class ucrDataView 'statusColumnMenu ' Me.statusColumnMenu.ImageScalingSize = New System.Drawing.Size(20, 20) - Me.statusColumnMenu.Items.AddRange(New System.Windows.Forms.ToolStripItem() {Me.deleteDataFrame, Me.renameSheet, Me.HideSheet, Me.unhideSheet, Me.CopySheet, Me.reorderSheet, Me.ViewSheet}) + 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(163, 158) + Me.statusColumnMenu.Size = New System.Drawing.Size(181, 202) ' 'deleteDataFrame ' Me.deleteDataFrame.Name = "deleteDataFrame" - Me.deleteDataFrame.Size = New System.Drawing.Size(162, 22) + Me.deleteDataFrame.Size = New System.Drawing.Size(180, 22) Me.deleteDataFrame.Text = "Delete..." ' 'renameSheet ' Me.renameSheet.Name = "renameSheet" - Me.renameSheet.Size = New System.Drawing.Size(162, 22) + Me.renameSheet.Size = New System.Drawing.Size(180, 22) Me.renameSheet.Text = "Rename..." ' 'HideSheet ' Me.HideSheet.Name = "HideSheet" - Me.HideSheet.Size = New System.Drawing.Size(162, 22) + Me.HideSheet.Size = New System.Drawing.Size(180, 22) Me.HideSheet.Text = "Hide" ' 'unhideSheet ' Me.unhideSheet.Name = "unhideSheet" - Me.unhideSheet.Size = New System.Drawing.Size(162, 22) + Me.unhideSheet.Size = New System.Drawing.Size(180, 22) Me.unhideSheet.Text = "Unhide..." ' 'CopySheet ' Me.CopySheet.Name = "CopySheet" - Me.CopySheet.Size = New System.Drawing.Size(162, 22) + Me.CopySheet.Size = New System.Drawing.Size(180, 22) Me.CopySheet.Text = "Copy..." ' 'reorderSheet ' Me.reorderSheet.Enabled = False Me.reorderSheet.Name = "reorderSheet" - Me.reorderSheet.Size = New System.Drawing.Size(162, 22) + Me.reorderSheet.Size = New System.Drawing.Size(180, 22) Me.reorderSheet.Text = "Reorder..." ' 'ViewSheet ' Me.ViewSheet.Name = "ViewSheet" - Me.ViewSheet.Size = New System.Drawing.Size(162, 22) + Me.ViewSheet.Size = New System.Drawing.Size(180, 22) Me.ViewSheet.Text = "View Data Frame" ' 'lblRowDisplay @@ -744,6 +700,18 @@ 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 + ' + Me.mnuBottomAddComment.Name = "mnuBottomAddComment" + Me.mnuBottomAddComment.Size = New System.Drawing.Size(180, 22) + Me.mnuBottomAddComment.Text = "Add Comment..." + ' 'ucrDataView ' Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!) @@ -811,7 +779,6 @@ Partial Class ucrDataView Friend WithEvents mnuLevelsLabels As ToolStripMenuItem Friend WithEvents ToolStripSeparator1 As ToolStripSeparator Friend WithEvents mnuReorderColumns As ToolStripMenuItem - Friend WithEvents mnuCell As ToolStripMenuItem Friend WithEvents ToolStripSeparator3 As ToolStripSeparator Friend WithEvents mnuRenameColumn As ToolStripMenuItem Friend WithEvents mnuDuplColumn As ToolStripMenuItem @@ -828,10 +795,6 @@ Partial Class ucrDataView Friend WithEvents mnuSorts As ToolStripMenuItem Private WithEvents mnuFilters As ToolStripMenuItem Private WithEvents mnuRemoveCurrentFilters As ToolStripMenuItem - Private WithEvents mnuCellCutRange As ToolStripMenuItem - Private WithEvents mnuCellCopyRange As ToolStripMenuItem - Private WithEvents mnuCellPasteRange As ToolStripMenuItem - Friend WithEvents mnuCellHelp As ToolStripMenuItem Friend WithEvents panelSectionsAll As Panel Friend WithEvents linkStartOpenLibrary As LinkLabel Friend WithEvents linkStartOpenFile As LinkLabel @@ -847,6 +810,7 @@ Partial Class ucrDataView Friend WithEvents panelSectionRecent As Panel Friend WithEvents panelSectionHelp As Panel Friend WithEvents panelSectionStart As Panel - Friend WithEvents mnuCellAddComment As ToolStripMenuItem - Friend WithEvents ToolStripSeparator8 As ToolStripSeparator + Friend WithEvents mnuComment As ToolStripMenuItem + Friend WithEvents mnuColumnAddComment As ToolStripMenuItem + Friend WithEvents mnuBottomAddComment As ToolStripMenuItem End Class diff --git a/instat/ucrDataView.resx b/instat/ucrDataView.resx index 597e9a37e9b..2ee0f1a21ce 100644 --- a/instat/ucrDataView.resx +++ b/instat/ucrDataView.resx @@ -130,6 +130,6 @@ 548, 17 - 91 + 57 \ No newline at end of file diff --git a/instat/ucrDataView.vb b/instat/ucrDataView.vb index 20437d13024..007a1876b3f 100644 --- a/instat/ucrDataView.vb +++ b/instat/ucrDataView.vb @@ -685,10 +685,6 @@ Public Class ucrDataView End If End Sub - Private Sub mnuCellCopyRange_Click(sender As Object, e As EventArgs) Handles mnuCellCopyRange.Click - grdData.CurrentWorksheet.Copy() - End Sub - Private Sub ViewSheet_Click(sender As Object, e As EventArgs) Handles ViewSheet.Click Dim strScript As String = "" Dim strTemp As String @@ -724,7 +720,7 @@ Public Class ucrDataView dlgAddComment.ShowDialog() End Sub - Private Sub AddCommentToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles mnuCellAddComment.Click + Private Sub mnuComment_Click(sender As Object, e As EventArgs) Handles mnuComment.Click dlgAddComment.SetPosition(grdCurrSheet.Name, GetFirstSelectedRow(), SelectedColumnsAsArray()(0)) dlgAddComment.ShowDialog() End Sub @@ -800,15 +796,6 @@ Public Class ucrDataView dlgReorderColumns.ShowDialog() End Sub - Private Sub mnuHelp_Click(sender As Object, e As EventArgs) Handles mnuCellHelp.Click - Help.ShowHelp(Me, frmMain.strStaticPath & "\" & frmMain.strHelpFilePath, HelpNavigator.TopicId, "134") - End Sub - - Private Sub lblHeaderDataView_Click(sender As Object, e As EventArgs) Handles lblHeaderDataView.Click - - - End Sub - Private Sub mnuRenameColumn_Click(sender As Object, e As EventArgs) Handles mnuRenameColumn.Click dlgName.SetCurrentColumn(SelectedColumnsAsArray()(0), grdCurrSheet.Name) dlgName.ShowDialog() @@ -972,6 +959,29 @@ Public Class ucrDataView End Sub Private Sub cellContextMenuStrip_Opening(sender As Object, e As CancelEventArgs) Handles cellContextMenuStrip.Opening + Dim iSelectedCols As Integer + Dim strColumns() As String + Dim strType As String + + strColumns = SelectedColumnsAsArray() + If strColumns IsNot Nothing AndAlso strColumns.Count > 0 Then + iSelectedCols = grdData.CurrentWorksheet.SelectionRange.Cols + strType = frmMain.clsRLink.GetColumnType(grdCurrSheet.Name, strColumns(0)) + mnuLebelsLevel.Enabled = (iSelectedCols = 1 AndAlso strType.Contains("factor")) + Else + MsgBox("Developer error: SelectedColumnsAsArray() expected to return an array with at least one element.") + mnuLebelsLevel.Enabled = False + End If mnuRemoveCurrentFilters.Enabled = Not String.Equals(strFilterName, strNoFilter) End Sub + + Private Sub mnuColumnAddComment_Click(sender As Object, e As EventArgs) Handles mnuColumnAddComment.Click + dlgAddComment.SetPosition(strDataFrame:=grdCurrSheet.Name, strColumn:=SelectedColumnsAsArray()(0)) + dlgAddComment.ShowDialog() + End Sub + + Private Sub mnuBottomAddComment_Click(sender As Object, e As EventArgs) Handles mnuBottomAddComment.Click + dlgAddComment.SetPosition(strDataFrame:=grdCurrSheet.Name) + dlgAddComment.ShowDialog() + End Sub End Class diff --git a/packages/System.Data.SQLite.Core.1.0.113.7/.signature.p7s b/packages/System.Data.SQLite.Core.1.0.113.7/.signature.p7s new file mode 100644 index 00000000000..3f86ee1201e Binary files /dev/null and b/packages/System.Data.SQLite.Core.1.0.113.7/.signature.p7s differ