Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Initial implementation of transform preview #12

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 2 additions & 9 deletions instat/dlgClimaticDataEntry.vb
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,7 @@ Public Class dlgClimaticDataEntry
dTranformValue:=sdgClimaticDataEntryOptions.TransformValue)
End If
sdgClimaticDataEntry.ShowDialog()
SetNumberRowsChangedText(sdgClimaticDataEntry.NRowsChanged)
bSubdialogFirstLoad = False
bChange = False
TestOkEnabled()
Expand Down Expand Up @@ -301,15 +302,7 @@ Public Class dlgClimaticDataEntry
bSubdialogFirstLoad = True
End Sub

Private Sub ucrChkNoDecimal_ControlValueChanged(ucrChangedControl As ucrCore)
'bChange = True
'If ucrChkDefaultValue.Checked OrElse ucrChkNoDecimal.Checked OrElse ucrChkAllowTrace.Checked OrElse ucrChkTransform.Checked Then
' bState = True
'Else
' bState = False
'End If
End Sub
Public Sub GetNumberRowsChanged(nval As Integer)
Private Sub SetNumberRowsChangedText(nval As Integer)
lblNbRowsChanged1.Visible = True
lblNbRowsChanged1.ForeColor = Color.Red
lblNbRowsChanged1.Text = nval & " row(s) entered"
Expand Down
30 changes: 25 additions & 5 deletions instat/sdgClimaticDataEntry.vb
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@ Public Class sdgClimaticDataEntry
Private bLastChangeValid As Boolean
Private strLastChangedCellAddress As String
Private bFirstLoad As Boolean = True
'used to check if current options allow the grid to be editable
Private bAllowEdits As Boolean = True

Private Sub sdgClimaticDataEntry_Load(sender As Object, e As EventArgs) Handles MyBase.Load
If bFirstLoad Then
Expand Down Expand Up @@ -137,6 +139,9 @@ Public Class sdgClimaticDataEntry
Me.bTransform = bTransform
Me.dTranformValue = dTranformValue

bAllowEdits = True
cmdTransform.Enabled = bTransform

If Not strStationColumnName = "" Then
lstNonEditableColumns.Add(strStationColumnName)
End If
Expand Down Expand Up @@ -218,6 +223,13 @@ Public Class sdgClimaticDataEntry
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.")
Expand Down Expand Up @@ -259,13 +271,8 @@ Public Class sdgClimaticDataEntry
End If
End Sub

Private Sub sdgClimaticDataEntry_Closing(sender As Object, e As CancelEventArgs) Handles Me.Closing

End Sub

Private Sub ucrSdgBaseButtons_ClickReturn(sender As Object, e As EventArgs) Handles ucrSdgBaseButtons.ClickReturn
Dim i As Integer
dlgClimaticDataEntry.GetNumberRowsChanged(NRowsChanged())
If NRowsChanged() > 0 Then
clsEditDataFrame.AddParameter(strDateName, "as.Date(" & GetRowsChangedAsRVectorString(strDateName, Chr(34)) & ")", iPosition:=1)
i = 2
Expand All @@ -285,4 +292,17 @@ Public Class sdgClimaticDataEntry
grdCurrentWorkSheet.FocusPos = New CellPosition(strLastChangedCellAddress)
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


End Class