Skip to content

Commit

Permalink
Merge pull request #24 from africanmathsinitiative/master
Browse files Browse the repository at this point in the history
updating master
  • Loading branch information
shadrackkibet authored May 2, 2017
2 parents e62bcef + 089911e commit 1a20ca2
Show file tree
Hide file tree
Showing 9 changed files with 364 additions and 108 deletions.
116 changes: 65 additions & 51 deletions instat/dlgConvertColumns.Designer.vb

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

56 changes: 29 additions & 27 deletions instat/dlgConvertColumns.vb
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ Public Class dlgConvertColumns
Public bFirstLoad As Boolean = True
Public bToFactorOnly As Boolean = False
Private bReset As Boolean = True
Private clsDefaultFunction As New RFunction

Private Sub dlgConvertColumns_Load(sender As Object, e As EventArgs) Handles Me.Load
autoTranslate(Me)
Expand All @@ -39,23 +40,6 @@ Public Class dlgConvertColumns
SetToFactorStatus(bToFactorOnly)
End Sub

Public Sub SetRCodeForControls(bReset As Boolean)
SetRCode(Me, ucrBase.clsRsyntax.clsBaseFunction, bReset)
End Sub

Private Sub SetToFactorStatus(bToFactorOnly As Boolean)
If bToFactorOnly Then
rdoFactor.Checked = True
rdoCharacter.Enabled = False
rdoInteger.Enabled = False
rdoNumeric.Enabled = False
Else
rdoCharacter.Enabled = True
rdoInteger.Enabled = True
rdoNumeric.Enabled = True
End If
End Sub

Private Sub InitialiseDialog()
ucrBase.iHelpTopicID = 67

Expand All @@ -75,10 +59,11 @@ Public Class dlgConvertColumns
ucrPnlConvertTo.AddRadioButton(rdoInteger, Chr(34) & "integer" & Chr(34))
ucrPnlConvertTo.AddToLinkedControls(ucrChkSpecifyDecimalsToDisplay, {rdoFactor, rdoOrderedFactor}, bNewLinkedAddRemoveParameter:=True, bNewLinkedHideIfParameterMissing:=True)

ucrPnlFactorToNumericOptions.SetParameter(New RParameter("factor_numeric", 3))
ucrPnlFactorToNumericOptions.AddRadioButton(rdoConvertLevels, Chr(34) & "by_levels" & Chr(34))
ucrPnlFactorToNumericOptions.AddRadioButton(rdoConvertOrdinals, Chr(34) & "by_ordinals" & Chr(34))
ucrPnlFactorToNumericOptions.SetRDefault(Chr(34) & "by_levels" & Chr(34))
ucrPnlFactorToNumericOptions.SetParameter(New RParameter("factor_values", 3))
ucrPnlFactorToNumericOptions.AddRadioButton(rdoDefault, "NULL")
ucrPnlFactorToNumericOptions.AddRadioButton(rdoConvertLevels, Chr(34) & "force_values" & Chr(34))
ucrPnlFactorToNumericOptions.AddRadioButton(rdoConvertOrdinals, Chr(34) & "force_ordinals" & Chr(34))
ucrPnlFactorToNumericOptions.SetRDefault("NULL")
ucrPnlFactorToNumericOptions.SetLinkedDisplayControl(grpFactorToNumericOptions)

ucrPnlConvertTo.AddToLinkedControls(ucrPnlFactorToNumericOptions, {rdoNumeric}, bNewLinkedAddRemoveParameter:=True, bNewLinkedHideIfParameterMissing:=True)
Expand All @@ -100,20 +85,18 @@ Public Class dlgConvertColumns
End Sub

Private Sub SetDefaults()
Dim clsDefaultFunction As New RFunction
clsDefaultFunction = New RFunction

ucrSelectorDataFrameColumns.Reset()
SetToFactorStatus(bToFactorOnly)

clsDefaultFunction.SetRCommand(frmMain.clsRLink.strInstatDataObject & "$convert_column_to_type")
clsDefaultFunction.AddParameter("to_type", Chr(34) & "factor" & Chr(34))
ucrBase.clsRsyntax.SetBaseRFunction(clsDefaultFunction.Clone())
ucrBase.clsRsyntax.SetBaseRFunction(clsDefaultFunction)
End Sub

Private Sub ucrBase_ClickReset(sender As Object, e As EventArgs) Handles ucrBase.ClickReset
SetDefaults()
SetRCodeForControls(True)
TestOKEnabled()
Private Sub SetRCodeForControls(bReset As Boolean)
SetRCode(Me, ucrBase.clsRsyntax.clsBaseFunction, bReset)
End Sub

Private Sub TestOKEnabled()
Expand All @@ -128,6 +111,25 @@ Public Class dlgConvertColumns
End If
End Sub

Private Sub ucrBase_ClickReset(sender As Object, e As EventArgs) Handles ucrBase.ClickReset
SetDefaults()
SetRCodeForControls(True)
TestOKEnabled()
End Sub

Private Sub SetToFactorStatus(bToFactorOnly As Boolean)
If bToFactorOnly Then
rdoFactor.Checked = True
rdoCharacter.Enabled = False
rdoInteger.Enabled = False
rdoNumeric.Enabled = False
Else
rdoCharacter.Enabled = True
rdoInteger.Enabled = True
rdoNumeric.Enabled = True
End If
End Sub

Private Sub ucrChkSpecifyDecimalsToDisplay_ControlValueChanged(ucrChangedControl As ucrCore) Handles ucrChkSpecifyDecimalsToDisplay.ControlValueChanged
If ucrChkSpecifyDecimalsToDisplay.Checked Then
ucrReceiverColumnsToConvert.SetDataType("numeric")
Expand Down
52 changes: 52 additions & 0 deletions instat/dlgTransformClimatic.Designer.vb

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

Loading

0 comments on commit 1a20ca2

Please sign in to comment.