diff --git a/instat/dlgConvertColumnsToFactors.Designer.vb b/instat/dlgConvertColumnsToFactors.Designer.vb index e7d9f3f2c9c..9fc4b943a6e 100644 --- a/instat/dlgConvertColumnsToFactors.Designer.vb +++ b/instat/dlgConvertColumnsToFactors.Designer.vb @@ -22,73 +22,183 @@ Partial Class dlgConvertColumnsToFactors 'Do not modify it using the code editor. _ Private Sub InitializeComponent() - Me.ucrBase = New instat.ucrButtons() - Me.ucrDataFrameSelector = New instat.ucrDataFrame() - Me.ucrAddRemove = New instat.ucrSelectorAddRemove() - Me.ucrReceiverColumnsToConvert = New instat.ucrReceiverMultiple() Me.lblColumnsToConvert = New System.Windows.Forms.Label() + Me.grpToType = New System.Windows.Forms.GroupBox() + Me.rdoInteger = New System.Windows.Forms.RadioButton() + Me.rdoCharacter = New System.Windows.Forms.RadioButton() + Me.rdoFactor = New System.Windows.Forms.RadioButton() + Me.rdoNumeric = New System.Windows.Forms.RadioButton() + Me.cboFactorNumeric = New System.Windows.Forms.ComboBox() + Me.lblFactorNumeric = New System.Windows.Forms.Label() + Me.ucrSelectorDataFrameColumns = New instat.ucrSelectorByDataFrameAddRemove() + Me.ucrReceiverColumnsToConvert = New instat.ucrReceiverMultiple() + Me.ucrBase = New instat.ucrButtons() + Me.grpFactorNumeric = New System.Windows.Forms.GroupBox() + Me.grpToType.SuspendLayout() + Me.grpFactorNumeric.SuspendLayout() Me.SuspendLayout() ' - 'ucrBase + 'lblColumnsToConvert ' - Me.ucrBase.Location = New System.Drawing.Point(0, 244) - Me.ucrBase.Name = "ucrBase" - Me.ucrBase.Size = New System.Drawing.Size(410, 53) - Me.ucrBase.TabIndex = 0 + Me.lblColumnsToConvert.AutoSize = True + Me.lblColumnsToConvert.Location = New System.Drawing.Point(263, 50) + Me.lblColumnsToConvert.Name = "lblColumnsToConvert" + Me.lblColumnsToConvert.Size = New System.Drawing.Size(98, 13) + Me.lblColumnsToConvert.TabIndex = 1 + Me.lblColumnsToConvert.Tag = "Columns_to_convert" + Me.lblColumnsToConvert.Text = "Columns to convert" + ' + 'grpToType + ' + Me.grpToType.Controls.Add(Me.rdoInteger) + Me.grpToType.Controls.Add(Me.rdoCharacter) + Me.grpToType.Controls.Add(Me.rdoFactor) + Me.grpToType.Controls.Add(Me.rdoNumeric) + Me.grpToType.Location = New System.Drawing.Point(18, 183) + Me.grpToType.Name = "grpToType" + Me.grpToType.Size = New System.Drawing.Size(101, 132) + Me.grpToType.TabIndex = 4 + Me.grpToType.TabStop = False + Me.grpToType.Tag = "To_type" + Me.grpToType.Text = "To type" + ' + 'rdoInteger + ' + Me.rdoInteger.AutoSize = True + Me.rdoInteger.Location = New System.Drawing.Point(7, 96) + Me.rdoInteger.Name = "rdoInteger" + Me.rdoInteger.Size = New System.Drawing.Size(58, 17) + Me.rdoInteger.TabIndex = 3 + Me.rdoInteger.TabStop = True + Me.rdoInteger.Tag = "Integer" + Me.rdoInteger.Text = "Integer" + Me.rdoInteger.UseVisualStyleBackColor = True + ' + 'rdoCharacter ' - 'ucrDataFrameSelector + Me.rdoCharacter.AutoSize = True + Me.rdoCharacter.Location = New System.Drawing.Point(7, 70) + Me.rdoCharacter.Name = "rdoCharacter" + Me.rdoCharacter.Size = New System.Drawing.Size(70, 17) + Me.rdoCharacter.TabIndex = 2 + Me.rdoCharacter.TabStop = True + Me.rdoCharacter.Tag = "character" + Me.rdoCharacter.Text = "character" + Me.rdoCharacter.UseVisualStyleBackColor = True ' - Me.ucrDataFrameSelector.Location = New System.Drawing.Point(0, 3) - Me.ucrDataFrameSelector.Name = "ucrDataFrameSelector" - Me.ucrDataFrameSelector.Size = New System.Drawing.Size(127, 41) - Me.ucrDataFrameSelector.TabIndex = 1 + 'rdoFactor ' - 'ucrAddRemove + Me.rdoFactor.AutoSize = True + Me.rdoFactor.Location = New System.Drawing.Point(7, 18) + Me.rdoFactor.Name = "rdoFactor" + Me.rdoFactor.Size = New System.Drawing.Size(52, 17) + Me.rdoFactor.TabIndex = 1 + Me.rdoFactor.TabStop = True + Me.rdoFactor.Tag = "factor" + Me.rdoFactor.Text = "factor" + Me.rdoFactor.UseVisualStyleBackColor = True ' - Me.ucrAddRemove.Location = New System.Drawing.Point(0, 67) - Me.ucrAddRemove.Name = "ucrAddRemove" - Me.ucrAddRemove.Size = New System.Drawing.Size(203, 127) - Me.ucrAddRemove.TabIndex = 2 + 'rdoNumeric + ' + Me.rdoNumeric.AutoSize = True + Me.rdoNumeric.Location = New System.Drawing.Point(7, 44) + Me.rdoNumeric.Name = "rdoNumeric" + Me.rdoNumeric.Size = New System.Drawing.Size(62, 17) + Me.rdoNumeric.TabIndex = 0 + Me.rdoNumeric.TabStop = True + Me.rdoNumeric.Tag = "numeric" + Me.rdoNumeric.Text = "numeric" + Me.rdoNumeric.UseVisualStyleBackColor = True + ' + 'cboFactorNumeric + ' + Me.cboFactorNumeric.AllowDrop = True + Me.cboFactorNumeric.FormattingEnabled = True + Me.cboFactorNumeric.Items.AddRange(New Object() {"by_levels", "by_ordinals"}) + Me.cboFactorNumeric.Location = New System.Drawing.Point(92, 12) + Me.cboFactorNumeric.Name = "cboFactorNumeric" + Me.cboFactorNumeric.Size = New System.Drawing.Size(121, 21) + Me.cboFactorNumeric.TabIndex = 5 + Me.cboFactorNumeric.Tag = "by_levels" + Me.cboFactorNumeric.Text = "by_levels" + ' + 'lblFactorNumeric + ' + Me.lblFactorNumeric.AutoSize = True + Me.lblFactorNumeric.Location = New System.Drawing.Point(6, 16) + Me.lblFactorNumeric.Name = "lblFactorNumeric" + Me.lblFactorNumeric.Size = New System.Drawing.Size(80, 13) + Me.lblFactorNumeric.TabIndex = 6 + Me.lblFactorNumeric.Tag = "Factor_numeric" + Me.lblFactorNumeric.Text = "Factor_numeric" + ' + 'ucrSelectorDataFrameColumns + ' + Me.ucrSelectorDataFrameColumns.Location = New System.Drawing.Point(4, 2) + Me.ucrSelectorDataFrameColumns.Name = "ucrSelectorDataFrameColumns" + Me.ucrSelectorDataFrameColumns.Size = New System.Drawing.Size(242, 179) + Me.ucrSelectorDataFrameColumns.TabIndex = 0 ' 'ucrReceiverColumnsToConvert ' - Me.ucrReceiverColumnsToConvert.Location = New System.Drawing.Point(229, 85) + Me.ucrReceiverColumnsToConvert.Location = New System.Drawing.Point(257, 65) Me.ucrReceiverColumnsToConvert.Name = "ucrReceiverColumnsToConvert" + Me.ucrReceiverColumnsToConvert.Selector = Nothing Me.ucrReceiverColumnsToConvert.Size = New System.Drawing.Size(121, 104) - Me.ucrReceiverColumnsToConvert.TabIndex = 3 + Me.ucrReceiverColumnsToConvert.TabIndex = 2 ' - 'lblColumnsToConvert + 'ucrBase ' - Me.lblColumnsToConvert.AutoSize = True - Me.lblColumnsToConvert.Location = New System.Drawing.Point(235, 70) - Me.lblColumnsToConvert.Name = "lblColumnsToConvert" - Me.lblColumnsToConvert.Size = New System.Drawing.Size(98, 13) - Me.lblColumnsToConvert.TabIndex = 4 - Me.lblColumnsToConvert.Tag = "Columns_to_convert" - Me.lblColumnsToConvert.Text = "Columns to convert" + Me.ucrBase.Location = New System.Drawing.Point(0, 326) + Me.ucrBase.Name = "ucrBase" + Me.ucrBase.Size = New System.Drawing.Size(410, 53) + Me.ucrBase.TabIndex = 3 + ' + 'grpFactorNumeric + ' + Me.grpFactorNumeric.Controls.Add(Me.lblFactorNumeric) + Me.grpFactorNumeric.Controls.Add(Me.cboFactorNumeric) + Me.grpFactorNumeric.Location = New System.Drawing.Point(144, 187) + Me.grpFactorNumeric.Name = "grpFactorNumeric" + Me.grpFactorNumeric.Size = New System.Drawing.Size(217, 57) + Me.grpFactorNumeric.TabIndex = 7 + Me.grpFactorNumeric.TabStop = False ' 'dlgConvertColumnsToFactors ' Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!) Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font - Me.ClientSize = New System.Drawing.Size(407, 295) + Me.ClientSize = New System.Drawing.Size(407, 382) + Me.Controls.Add(Me.grpFactorNumeric) + Me.Controls.Add(Me.grpToType) + Me.Controls.Add(Me.ucrSelectorDataFrameColumns) Me.Controls.Add(Me.lblColumnsToConvert) Me.Controls.Add(Me.ucrReceiverColumnsToConvert) - Me.Controls.Add(Me.ucrAddRemove) - Me.Controls.Add(Me.ucrDataFrameSelector) Me.Controls.Add(Me.ucrBase) Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow Me.Name = "dlgConvertColumnsToFactors" - Me.Tag = "Convert_columns_to_factors" - Me.Text = "Convert Columns To Factors" + Me.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen + Me.Tag = "Convert_columns" + Me.Text = "Convert Columns" + Me.grpToType.ResumeLayout(False) + Me.grpToType.PerformLayout() + Me.grpFactorNumeric.ResumeLayout(False) + Me.grpFactorNumeric.PerformLayout() Me.ResumeLayout(False) Me.PerformLayout() End Sub Friend WithEvents ucrBase As ucrButtons - Friend WithEvents ucrDataFrameSelector As ucrDataFrame - Friend WithEvents ucrAddRemove As ucrSelectorAddRemove Friend WithEvents ucrReceiverColumnsToConvert As ucrReceiverMultiple Friend WithEvents lblColumnsToConvert As Label + Friend WithEvents ucrSelectorDataFrameColumns As ucrSelectorByDataFrameAddRemove + Friend WithEvents grpToType As GroupBox + Friend WithEvents rdoInteger As RadioButton + Friend WithEvents rdoCharacter As RadioButton + Friend WithEvents rdoFactor As RadioButton + Friend WithEvents rdoNumeric As RadioButton + Friend WithEvents cboFactorNumeric As ComboBox + Friend WithEvents lblFactorNumeric As Label + Friend WithEvents grpFactorNumeric As GroupBox End Class diff --git a/instat/dlgConvertColumnsToFactors.vb b/instat/dlgConvertColumnsToFactors.vb index 5bbe601230e..69cce79034e 100644 --- a/instat/dlgConvertColumnsToFactors.vb +++ b/instat/dlgConvertColumnsToFactors.vb @@ -13,6 +13,92 @@ ' ' You should have received a copy of the GNU General Public License k ' along with this program. If not, see . +Imports instat.Translations + Public Class dlgConvertColumnsToFactors + Public bFirstLoad As Boolean = True + + Private Sub ucrSelectorDataFrameColumns_Load(sender As Object, e As EventArgs) Handles ucrSelectorDataFrameColumns.Load + ucrBase.clsRsyntax.SetFunction(frmMain.clsRLink.strInstatDataObject & "$convert_column_to_type") + + ucrReceiverColumnsToConvert.Selector = ucrSelectorDataFrameColumns + autoTranslate(Me) + ucrBase.iHelpTopicID = 34 + + If bFirstLoad Then + SetDefaults() + bFirstLoad = False + + End If + + TestOKEnabled() + + End Sub + + Private Sub SetDefaults() + ucrSelectorDataFrameColumns.Reset() + ucrSelectorDataFrameColumns.Focus() + ucrReceiverColumnsToConvert.SetMeAsReceiver() + rdoFactor.Checked = True + + + TestOKEnabled() + End Sub + + Private Sub ucrSelectorDataFrameolumns_DataFrameChanged() Handles ucrSelectorDataFrameColumns.DataFrameChanged + ucrBase.clsRsyntax.AddParameter("data_name", Chr(34) & ucrSelectorDataFrameColumns.ucrAvailableDataFrames.cboAvailableDataFrames.SelectedItem & Chr(34)) + + End Sub + + Private Sub ucrReceiverColumnsToConvert_SelectionChanged() Handles ucrReceiverColumnsToConvert.SelectionChanged + ucrBase.clsRsyntax.AddParameter("col_names", ucrReceiverColumnsToConvert.GetVariableNames) + TestOKEnabled() + End Sub + + Private Sub grpForConvertToType_CheckedChanged(sender As Object, e As EventArgs) Handles rdoFactor.CheckedChanged, rdoNumeric.CheckedChanged, rdoCharacter.CheckedChanged, rdoInteger.CheckedChanged + If rdoFactor.Checked Then + grpFactorNumeric.Visible = True + ucrBase.clsRsyntax.AddParameter("to_type", Chr(34) & "factor" & Chr(34)) + TestOKEnabled() + + ElseIf rdoNumeric.Checked Then + grpFactorNumeric.Visible = False + ucrBase.clsRsyntax.AddParameter("to_type", Chr(34) & "numeric" & Chr(34)) + TestOKEnabled() + ElseIf rdoCharacter.Checked Then + grpFactorNumeric.Visible = False + ucrBase.clsRsyntax.AddParameter("to_type", Chr(34) & "character" & Chr(34)) + TestOKEnabled() + ElseIf rdoInteger.Checked Then + grpFactorNumeric.Visible = False + ucrBase.clsRsyntax.AddParameter("to_type", Chr(34) & "integer" & Chr(34)) + TestOKEnabled() + Else + ucrBase.clsRsyntax.RemoveParameter("to_type") + grpFactorNumeric.Visible = False + + 'the else case should never happen but is there just in case + End If + End Sub + + Private Sub ucrBase_ClickReset(sender As Object, e As EventArgs) Handles ucrBase.ClickReset + SetDefaults() + TestOKEnabled() + + End Sub + + + Private Sub TestOKEnabled() + If ucrReceiverColumnsToConvert.IsEmpty() = False And (rdoFactor.Checked = True Or rdoNumeric.Checked = True Or rdoCharacter.Checked = True Or rdoInteger.Checked = True) Then + ucrBase.OKEnabled(True) + Else + ucrBase.OKEnabled(False) + End If + End Sub + + Private Sub cboFactorNumeric_SelectedValueChanged(sender As Object, e As EventArgs) Handles cboFactorNumeric.SelectedValueChanged + + ucrBase.clsRsyntax.AddParameter("factor_numeric", cboFactorNumeric.SelectedItem.ToString) + End Sub End Class \ No newline at end of file