Skip to content

Commit

Permalink
Merge pull request #43 from africanmathsinitiative/master
Browse files Browse the repository at this point in the history
Updating Master
  • Loading branch information
Haward Ketoyo authored Mar 17, 2021
2 parents d30a2cc + fd5c9cb commit 27f50d8
Show file tree
Hide file tree
Showing 32 changed files with 3,257 additions and 3,388 deletions.
73 changes: 37 additions & 36 deletions instat/dlgAddLink.vb
Original file line number Diff line number Diff line change
Expand Up @@ -101,34 +101,36 @@ Public Class dlgAddLink
Dim strColumnNames As String()
Dim clsGetKeys As New RFunction

lvwLinkViewBox.Items.Clear()

lblKeys.Text = ucrDataSelectorTo.cboAvailableDataFrames.SelectedItem & " Keys:"
clsGetKeys.SetRCommand(frmMain.clsRLink.strInstatDataObject & "$get_keys")
clsGetKeys.AddParameter("data_name", Chr(34) & ucrDataSelectorTo.cboAvailableDataFrames.SelectedItem & Chr(34))
lstKeys = frmMain.clsRLink.RunInternalScriptGetValue(clsGetKeys.ToScript).AsList

clsColumnNames.SetRCommand(frmMain.clsRLink.strInstatDataObject & "$get_column_names")
clsColumnNames.AddParameter("data_name", Chr(34) & ucrDataSelectorFrom.cboAvailableDataFrames.SelectedItem & Chr(34))
strColumnNames = frmMain.clsRLink.RunInternalScriptGetValue(clsColumnNames.ToScript).AsCharacter().ToArray

For i = 0 To lstKeys.Count - 1
chrKeyColumns = lstKeys(i).AsCharacter
strKeyColumns = String.Join(", ", chrKeyColumns.ToArray)
If chrKeyColumns IsNot Nothing Then
lviTemp = New ListViewItem({lstKeys.Names(i), strKeyColumns})
clsColumnNames.AddParameter("to_columns", "c(" & strKeyColumns & ")")
bCanAutoLink = chrKeyColumns.ToArray.All(Function(strCol) strColumnNames.Contains(strCol))
If bCanAutoLink Then
lviTemp.BackColor = Color.LightGreen
ucrBase.OKEnabled(True)
Else
lviTemp.BackColor = Color.LightCoral
ucrBase.OKEnabled(False)
If ucrDataSelectorTo.cboAvailableDataFrames.Text <> "" Then
lvwLinkViewBox.Items.Clear()

lblKeys.Text = ucrDataSelectorTo.cboAvailableDataFrames.SelectedItem & " Keys:"
clsGetKeys.SetRCommand(frmMain.clsRLink.strInstatDataObject & "$get_keys")
clsGetKeys.AddParameter("data_name", Chr(34) & ucrDataSelectorTo.cboAvailableDataFrames.SelectedItem & Chr(34))
lstKeys = frmMain.clsRLink.RunInternalScriptGetValue(clsGetKeys.ToScript).AsList

clsColumnNames.SetRCommand(frmMain.clsRLink.strInstatDataObject & "$get_column_names")
clsColumnNames.AddParameter("data_name", Chr(34) & ucrDataSelectorFrom.cboAvailableDataFrames.SelectedItem & Chr(34))
strColumnNames = frmMain.clsRLink.RunInternalScriptGetValue(clsColumnNames.ToScript).AsCharacter().ToArray

For i = 0 To lstKeys.Count - 1
chrKeyColumns = lstKeys(i).AsCharacter
strKeyColumns = String.Join(", ", chrKeyColumns.ToArray)
If chrKeyColumns IsNot Nothing Then
lviTemp = New ListViewItem({lstKeys.Names(i), strKeyColumns})
clsColumnNames.AddParameter("to_columns", "c(" & strKeyColumns & ")")
bCanAutoLink = chrKeyColumns.ToArray.All(Function(strCol) strColumnNames.Contains(strCol))
If bCanAutoLink Then
lviTemp.BackColor = Color.LightGreen
ucrBase.OKEnabled(True)
Else
lviTemp.BackColor = Color.LightCoral
ucrBase.OKEnabled(False)
End If
lvwLinkViewBox.Items.Add(lviTemp)
End If
lvwLinkViewBox.Items.Add(lviTemp)
End If
Next
Next
End If
End Sub

Private Sub lvwLinkViewBox_SelectedIndexChanged(sender As Object, e As EventArgs) Handles lvwLinkViewBox.SelectedIndexChanged
Expand All @@ -151,20 +153,19 @@ Public Class dlgAddLink
TestOKEnabled()
End Sub

Private Sub ucrDataSelectorTo_ControlValueChanged(ucrChangedControl As ucrCore) Handles ucrDataSelectorTo.ControlValueChanged
UpdateKeys()
TestOKEnabled()
End Sub

Private Sub ucrDataSelectorFrom_ControlContentsChanged(ucrChangedControl As ucrCore) Handles ucrDataSelectorFrom.ControlContentsChanged, ucrInputLinkName.ControlContentsChanged, ucrInputSelectedKey.ControlContentsChanged
TestOKEnabled()
End Sub

Private Function IsSelectionValidKey() As Boolean
If lvwLinkViewBox.SelectedItems.Count = 1 Then
Return lvwLinkViewBox.SelectedItems(0).BackColor = Color.LightGreen
Else
Return False
End If
End Function

Private Sub ucrDataSelectorTo_ControlValueChanged(ucrChangedControl As ucrCore) Handles ucrDataSelectorTo.ControlValueChanged
UpdateKeys()
End Sub

Private Sub CoreControls_ControlContentsChanged(ucrChangedControl As ucrCore) Handles ucrDataSelectorFrom.ControlContentsChanged, ucrDataSelectorTo.ControlContentsChanged, ucrInputLinkName.ControlContentsChanged, ucrInputSelectedKey.ControlContentsChanged
TestOKEnabled()
End Sub
End Class
10 changes: 5 additions & 5 deletions instat/dlgCalculator.vb
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ Public Class dlgCalculator
Private iBasicWidth As Integer
Private strDefaultKeyboard As String
' Note: This list needs to be updated when a new keyboard is added.
Private strKeyboards() As String = {"Maths", "Logical and Symbols", "Summary", "Strings (Character Columns)", "Factor", "Probability", "Dates", "Transform", "Circular", "Wakefield", "Modifier", "Symbols", "HydroGOF"}
Private strKeyboards() As String = {"Maths", "Logical and Symbols", "Summary", "Strings (Character Columns)", "Factor", "Probability", "Dates/Times", "Transform", "Circular", "Wakefield", "Modifier", "Symbols", "HydroGOF"}


Private Sub dlgCalculator_Load(sender As Object, e As EventArgs) Handles MyBase.Load
Expand All @@ -53,6 +53,7 @@ Public Class dlgCalculator
ucrCalc.Reset()
ucrCalc.ucrSelectorForCalculations.Reset()
ucrCalc.ucrSaveResultInto.Reset()
ucrCalc.ucrSaveResultInto.ucrChkSave.Checked = True
ucrCalc.chkShowParameters.Checked = False
ucrCalc.ucrSaveResultInto.SetRCode(ucrBase.clsRsyntax.clsBaseCommandString)
SaveResults()
Expand Down Expand Up @@ -82,8 +83,7 @@ Public Class dlgCalculator
ucrCalc.ucrSaveResultInto.SetPrefix("calc")
ucrCalc.ucrSaveResultInto.SetSaveTypeAsColumn()
ucrCalc.ucrSaveResultInto.SetIsComboBox()
ucrCalc.ucrSaveResultInto.SetCheckBoxText("Save Result:")
ucrCalc.ucrSaveResultInto.ucrChkSave.Checked = True
ucrCalc.ucrSaveResultInto.SetCheckBoxText("Save Result ")

ucrCalc.ucrSaveResultInto.SetDataFrameSelector(ucrCalc.ucrSelectorForCalculations.ucrAvailableDataFrames)
ucrCalc.ucrTryCalculator.StrvecOutputRequired()
Expand Down Expand Up @@ -149,8 +149,8 @@ Public Class dlgCalculator
Me.Width = iBasicWidth * 1.4
Case "Probability"
Me.Width = iBasicWidth * 1.5
Case "Dates"
Me.Width = iBasicWidth * 1.3
Case "Dates/Times"
Me.Width = iBasicWidth * 1.37
Case "Transform"
Me.Width = iBasicWidth * 1.37
Case "Circular"
Expand Down
2 changes: 1 addition & 1 deletion instat/dlgCombine.vb
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ Public Class dlgCombine
ucrChkLexOrder.SetRDefault("FALSE")

' Input Column Name
ucrNewColName.SetIsTextBox()
ucrNewColName.SetIsComboBox()
ucrNewColName.SetPrefix("Interact")
ucrNewColName.SetSaveTypeAsColumn()
ucrNewColName.SetDataFrameSelector(ucrSelectorCombineFactors.ucrAvailableDataFrames)
Expand Down
2 changes: 1 addition & 1 deletion instat/dlgCombineText.vb
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ Public Class dlgCombineText
ucrInputSeparator.bAllowNonConditionValues = True

' ucrSaveColumn
ucrSaveColumn.SetIsTextBox()
ucrSaveColumn.SetIsComboBox()
ucrSaveColumn.SetPrefix("Combine")
ucrSaveColumn.SetSaveTypeAsColumn()
ucrSaveColumn.SetDataFrameSelector(ucrSelectorForCombineText.ucrAvailableDataFrames)
Expand Down
3 changes: 2 additions & 1 deletion instat/dlgCountinFactor.vb
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,12 @@ Public Class dlgCountinFactor
ucrCountReceiver.bUseFilteredData = False

' ucrNewColName
ucrNewColName.SetIsTextBox()
ucrNewColName.SetIsComboBox()
ucrNewColName.SetPrefix("Count")
ucrNewColName.SetSaveTypeAsColumn()
ucrNewColName.SetDataFrameSelector(ucrCountSelector.ucrAvailableDataFrames)
ucrNewColName.SetLabelText("New Column Name:")
ucrNewColName.setLinkedReceiver(ucrCountReceiver)
End Sub

Private Sub SetDefaults()
Expand Down
2 changes: 1 addition & 1 deletion instat/dlgDuplicateColumns.vb
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ Public Class dlgDuplicateColumns
ucrSaveColumn.SetSaveTypeAsColumn()
ucrSaveColumn.SetDataFrameSelector(ucrSelectorForDuplicateColumn.ucrAvailableDataFrames)
ucrSaveColumn.SetLabelText("New Column Name:")
ucrSaveColumn.SetIsTextBox()
ucrSaveColumn.SetIsComboBox()
ucrSaveColumn.setLinkedReceiver(ucrReceiverDuplicateColumns) 'added

End Sub
Expand Down
2 changes: 1 addition & 1 deletion instat/dlgEnter.vb
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ Public Class dlgEnter
ucrBase.clsRsyntax.SetCommandString("")
ucrSaveEnterResultInto.SetSaveTypeAsColumn()
ucrSaveEnterResultInto.SetPrefix("enter")
ucrSaveEnterResultInto.SetIsTextBox()
ucrSaveEnterResultInto.SetIsComboBox()
ucrSaveEnterResultInto.SetDataFrameSelector(ucrDataFrameEnter)
ucrSaveEnterResultInto.SetLabelText("Enter Result Into:")

Expand Down
2 changes: 1 addition & 1 deletion instat/dlgFindNonnumericValues.vb
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ Public Class dlgFindNonnumericValues
'save control
ucrSaveColumn.SetPrefix("nonum")
ucrSaveColumn.SetSaveTypeAsColumn()
ucrSaveColumn.SetIsTextBox()
ucrSaveColumn.SetIsComboBox()
ucrSaveColumn.SetLabelText("Logical Column:")
ucrSaveColumn.SetDataFrameSelector(ucrSelectorShowNonNumericValues.ucrAvailableDataFrames)

Expand Down
21 changes: 13 additions & 8 deletions instat/dlgImportDataset.Designer.vb

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 27f50d8

Please sign in to comment.