diff --git a/instat/Interface/IDataViewGrid.vb b/instat/Interface/IDataViewGrid.vb index 29bc0f8c89a..26866cf8848 100644 --- a/instat/Interface/IDataViewGrid.vb +++ b/instat/Interface/IDataViewGrid.vb @@ -23,6 +23,8 @@ Public Interface IDataViewGrid Event ReplaceValueInData(strNewValue As String, strColumnName As String, strRowText As String) + Event DeleteValuesToDataframe() + Event WorksheetChanged() Event WorksheetRemoved(worksheet As clsWorksheetAdapter) diff --git a/instat/Interface/IGrid.vb b/instat/Interface/IGrid.vb index 5fce312b0d8..2481acdd25b 100644 --- a/instat/Interface/IGrid.vb +++ b/instat/Interface/IGrid.vb @@ -28,6 +28,8 @@ Public Interface IGrid Function GetSelectedRows() As List(Of String) + Function GetSelectedColumnIndexes() As List(Of String) + Function GetWorksheet(strName As String) As clsWorksheetAdapter Sub RemoveOldWorksheets() diff --git a/instat/Model/DataFrame/clsDataFrame.vb b/instat/Model/DataFrame/clsDataFrame.vb index 89c2c4c6773..cbc133de0be 100644 --- a/instat/Model/DataFrame/clsDataFrame.vb +++ b/instat/Model/DataFrame/clsDataFrame.vb @@ -24,19 +24,19 @@ Public Class clsDataFrame Private _clsPrepareFunctions As clsPrepareFunctionsForGrids Private _clsVisiblePage As clsDataFramePage Private _clsColumnMetaData As clsColumnMetaData - Private _clsFilter As clsDataFrameFilter + Private _clsFilterOrColumnSelection As clsDataFrameFilterOrColumnSelection Private _strName As String Private _RLink As RLink Private _iTotalRowCount As Integer Private _iTotalColumnCount As Integer ''' - ''' Filter information + ''' Filter or column selection information ''' ''' - Public ReadOnly Property clsFilter() As clsDataFrameFilter + Public ReadOnly Property clsFilterOrColumnSelection() As clsDataFrameFilterOrColumnSelection Get - Return _clsFilter + Return _clsFilterOrColumnSelection End Get End Property @@ -51,7 +51,7 @@ Public Class clsDataFrame End Property ''' - ''' Column meta data for the dataframe + ''' Column metadata for the dataframe ''' ''' Public ReadOnly Property clsColumnMetaData As clsColumnMetaData @@ -142,7 +142,7 @@ Public Class clsDataFrame _strName = strName _clsPrepareFunctions = New clsPrepareFunctionsForGrids(rLink, strName) _clsVisiblePage = New clsDataFramePage(rLink, strName) - _clsFilter = New clsDataFrameFilter(rLink, strName) + _clsFilterOrColumnSelection = New clsDataFrameFilterOrColumnSelection(rLink, strName) _clsColumnMetaData = New clsColumnMetaData(rLink, strName) End Sub @@ -168,9 +168,9 @@ Public Class clsDataFrame If _clsVisiblePage.RefreshData() Then _iTotalRowCount = _RLink.GetDataFrameLength(_strName, False) _iTotalColumnCount = _RLink.GetDataFrameColumnCount(_strName) - _clsFilter.RefreshData() - If _clsFilter.bFilterApplied Then - _clsVisiblePage.SetTotalRowAndColumnCounts(_iTotalColumnCount, _clsFilter.iFilteredRowCount) + _clsFilterOrColumnSelection.RefreshData() + If _clsFilterOrColumnSelection.bFilterApplied Then + _clsVisiblePage.SetTotalRowAndColumnCounts(_iTotalColumnCount, _clsFilterOrColumnSelection.iFilteredRowCount) Else _clsVisiblePage.SetTotalRowAndColumnCounts(_iTotalColumnCount, _iTotalRowCount) End If diff --git a/instat/Model/DataFrame/clsDataFrameFilter.vb b/instat/Model/DataFrame/clsDataFrameFilter.vb index 831477257b9..999b059c04d 100644 --- a/instat/Model/DataFrame/clsDataFrameFilter.vb +++ b/instat/Model/DataFrame/clsDataFrameFilter.vb @@ -19,7 +19,7 @@ Imports RDotNet ''' ''' Holds filter information for the dataframe ''' -Public Class clsDataFrameFilter +Public Class clsDataFrameFilterOrColumnSelection Protected _strDataFrameName As String Protected _RLink As RLink diff --git a/instat/Model/RCommand/clsPrepareFunctionsForGrids.vb b/instat/Model/RCommand/clsPrepareFunctionsForGrids.vb index 87546528b9c..3b34230761e 100644 --- a/instat/Model/RCommand/clsPrepareFunctionsForGrids.vb +++ b/instat/Model/RCommand/clsPrepareFunctionsForGrids.vb @@ -312,6 +312,7 @@ Public Class clsPrepareFunctionsForGrids End If _RLink.RunScript(clsReplaceValue.ToScript(), strComment:="Replace Value In Data") End Sub + ''' ''' Get the column type for a given column ''' @@ -321,5 +322,20 @@ Public Class clsPrepareFunctionsForGrids Return _RLink.GetColumnType(_strDataFrame, strColumnName) End Function + ''' + ''' Description: To Delete one or many cells + ''' the delete cell function is to be used to Replace selected values with NA + ''' in the dataframe. + ''' + ''' + ''' + Public Sub DeleteCells(lstRowNames As List(Of String), lstColumnNames As List(Of String)) + Dim clsDeleteCells As New RFunction + clsDeleteCells.SetRCommand(_RLink.strInstatDataObject & "$replace_values_with_NA") + clsDeleteCells.AddParameter("data_name", Chr(34) & _strDataFrame & Chr(34)) + clsDeleteCells.AddParameter("column_index", _RLink.GetListAsRString(lstColumnNames, bWithQuotes:=False)) + clsDeleteCells.AddParameter("row_index", _RLink.GetListAsRString(lstRowNames, bWithQuotes:=False)) + _RLink.RunScript(clsDeleteCells.ToScript(), strComment:="Right click menu: Delete Cell(s)") + End Sub End Class diff --git a/instat/UserControl/ucrOutputPage.vb b/instat/UserControl/ucrOutputPage.vb index d402d772d3e..f8ff320d6f0 100644 --- a/instat/UserControl/ucrOutputPage.vb +++ b/instat/UserControl/ucrOutputPage.vb @@ -182,6 +182,7 @@ Public Class ucrOutputPage panel.Controls.Add(checkBox) _checkBoxes.Add(checkBox) AddHandler checkBox.Click, AddressOf checkButton_Click + AddHandler checkBox.MouseLeave, AddressOf panelContents_MouseLeave End Sub Private Sub AddNewScript(outputElement As clsOutputElement) @@ -195,6 +196,7 @@ Public Class ucrOutputPage panel.Controls.SetChildIndex(richTextBox, 0) SetRichTextBoxHeight(richTextBox) AddHandler richTextBox.KeyUp, AddressOf richTextBox_CopySelectedText + AddHandler richTextBox.MouseLeave, AddressOf panelContents_MouseLeave End Sub Private Function CopyOneImageOnly() As Boolean @@ -256,6 +258,7 @@ Public Class ucrOutputPage panel.Controls.SetChildIndex(richTextBox, 0) SetRichTextBoxHeight(richTextBox) AddHandler richTextBox.KeyUp, AddressOf richTextBox_CopySelectedText + AddHandler richTextBox.MouseLeave, AddressOf panelContents_MouseLeave End Sub Private Sub AddNewImageOutput(outputElement As clsOutputElement) @@ -294,6 +297,10 @@ Public Class ucrOutputPage End If End Sub + Private Sub panelContents_MouseLeave(sender As Object, e As EventArgs) + pnlMain.Focus() + End Sub + Private Sub CopySelectedTextToClipBoard(richText As RichTextBox, richTextFormat As String) Dim strClip As String = String.Empty Dim dto As New DataObject() diff --git a/instat/UserControls/DataGrid/Linux/ucrDataViewLinuxGrid.vb b/instat/UserControls/DataGrid/Linux/ucrDataViewLinuxGrid.vb index 9d6de5928cc..1ef9b871f22 100644 --- a/instat/UserControls/DataGrid/Linux/ucrDataViewLinuxGrid.vb +++ b/instat/UserControls/DataGrid/Linux/ucrDataViewLinuxGrid.vb @@ -27,6 +27,8 @@ Public Class ucrDataViewLinuxGrid Public Event PasteValuesToDataframe() Implements IDataViewGrid.PasteValuesToDataframe + Public Event DeleteValueToDataframe() Implements IDataViewGrid.DeleteValuesToDataframe + Public Event WorksheetChanged() Implements IDataViewGrid.WorksheetChanged Public Event WorksheetRemoved(worksheet As clsWorksheetAdapter) Implements IDataViewGrid.WorksheetRemoved @@ -46,7 +48,7 @@ Public Class ucrDataViewLinuxGrid Public Sub AddRowData(dataFrame As clsDataFrame) Implements IDataViewGrid.AddRowData Dim dataGrid = GetDataGridFromSelectedTab() - If dataFrame.clsFilter.bFilterApplied Then + If dataFrame.clsFilterOrColumnSelection.bFilterApplied Then dataGrid.RowHeadersDefaultCellStyle.ForeColor = Color.Red Else dataGrid.RowHeadersDefaultCellStyle.ForeColor = Color.DarkBlue @@ -112,6 +114,9 @@ Public Class ucrDataViewLinuxGrid If ctrlV Or shiftIns Then RaiseEvent PasteValuesToDataframe() End If + If e.KeyCode = Keys.Delete OrElse e.KeyCode = Keys.Back Then + RaiseEvent DeleteValueToDataframe() + End If End Sub Private Function GetCurrentDataFrameFocus() As clsDataFrame @@ -141,5 +146,4 @@ Public Class ucrDataViewLinuxGrid Private Sub tcTabs_SelectedIndexChanged(sender As Object, e As EventArgs) Handles tcTabs.SelectedIndexChanged RaiseEvent WorksheetChanged() End Sub - End Class \ No newline at end of file diff --git a/instat/UserControls/DataGrid/Linux/ucrLinuxGrid.vb b/instat/UserControls/DataGrid/Linux/ucrLinuxGrid.vb index cfade7d21d7..c25addeedfa 100644 --- a/instat/UserControls/DataGrid/Linux/ucrLinuxGrid.vb +++ b/instat/UserControls/DataGrid/Linux/ucrLinuxGrid.vb @@ -112,12 +112,30 @@ Public MustInherit Class ucrLinuxGrid Public Function GetSelectedRows() As List(Of String) Implements IGrid.GetSelectedRows Dim lstSelectedRows As New List(Of String) Dim dataGrid = GetGrid(tcTabs.SelectedTab) - For Each row As DataGridViewRow In dataGrid.SelectedRows - lstSelectedRows.Add(row.HeaderCell.Value) + 'For Each row As DataGridViewRow In dataGrid.SelectedRows + ' lstSelectedRows.Add(row.HeaderCell.Value) + 'Next + For i As Integer = 0 To dataGrid.GetCellCount(DataGridViewElementStates.Selected) - 1 + lstSelectedRows.Add(dataGrid.SelectedCells(i).RowIndex.ToString + 1) Next + lstSelectedRows = lstSelectedRows.Distinct.ToList Return lstSelectedRows End Function + + Public Function GetSelectedColumnIndexes() As List(Of String) Implements IGrid.GetSelectedColumnIndexes + Dim lstSelectedColumnIndexes As New List(Of String) + Dim dataGrid = GetGrid(tcTabs.SelectedTab) + 'For Each column As DataGridViewColumn In dataGrid.SelectedColumns + ' lstSelectedColumnIndexes.Add(column.HeaderCell.Value) + 'Next + For i As Integer = 0 To dataGrid.GetCellCount(DataGridViewElementStates.Selected) - 1 + lstSelectedColumnIndexes.Add(dataGrid.SelectedCells(i).ColumnIndex.ToString + 1) + Next + lstSelectedColumnIndexes = lstSelectedColumnIndexes.Distinct.ToList + Return lstSelectedColumnIndexes + End Function + Public Function GetWorksheet(name As String) As clsWorksheetAdapter Implements IGrid.GetWorksheet For Each tabPage As TabPage In tcTabs.TabPages If tabPage.Text = name Then diff --git a/instat/UserControls/DataGrid/ReoGrid/ucrDataViewReoGrid.vb b/instat/UserControls/DataGrid/ReoGrid/ucrDataViewReoGrid.vb index 98e64373c90..8458b084c2f 100644 --- a/instat/UserControls/DataGrid/ReoGrid/ucrDataViewReoGrid.vb +++ b/instat/UserControls/DataGrid/ReoGrid/ucrDataViewReoGrid.vb @@ -26,16 +26,27 @@ Public Class ucrDataViewReoGrid Public Event ReplaceValueInData(strNewValue As String, strColumnName As String, strRowText As String) Implements IDataViewGrid.ReplaceValueInData + Public Event DeleteValueToDataframe() Implements IDataViewGrid.DeleteValuesToDataframe + Public Event WorksheetChanged() Implements IDataViewGrid.WorksheetChanged Public Event WorksheetRemoved(worksheet As clsWorksheetAdapter) Implements IDataViewGrid.WorksheetRemoved + Public Sub AddColumns(visiblePage As clsDataFramePage) Implements IDataViewGrid.AddColumns Dim workSheetColumnHeader As ColumnHeader + Dim variableTextColour As Color + grdData.CurrentWorksheet.Columns = visiblePage.lstColumns.Count + + If GetCurrentDataFrameFocus.clsFilterOrColumnSelection.bColumnSelectionApplied Then + variableTextColour = Color.Red + Else + variableTextColour = Color.DarkBlue + End If For i = 0 To visiblePage.lstColumns.Count - 1 workSheetColumnHeader = grdData.CurrentWorksheet.ColumnHeaders(i) workSheetColumnHeader.Text = visiblePage.lstColumns(i).strDisplayName - workSheetColumnHeader.TextColor = visiblePage.lstColumns(i).clsColour + workSheetColumnHeader.TextColor = variableTextColour workSheetColumnHeader.Style.BackColor = visiblePage.lstColumns(i).clsBackGroundColour Next End Sub @@ -51,7 +62,7 @@ Public Class ucrDataViewReoGrid grdData.CurrentWorksheet.Rows = dataFrame.iDisplayedRowCount UpdateWorksheetSettings(grdData.CurrentWorksheet) - If dataFrame.clsFilter.bFilterApplied Then + If dataFrame.clsFilterOrColumnSelection.bFilterApplied Then textColour = Color.Red Else textColour = Color.DarkBlue @@ -84,7 +95,7 @@ Public Class ucrDataViewReoGrid AddHandler worksheet.BeforeCut, AddressOf Worksheet_BeforeCut AddHandler worksheet.BeforePaste, AddressOf Worksheet_BeforePaste AddHandler worksheet.BeforeRangeMove, AddressOf Worksheet_BeforeRangeMove - AddHandler worksheet.BeforeCellKeyDown, AddressOf Worksheet_BeforeCellKeyDown + AddHandler worksheet.BeforeCellKeyDown, AddressOf Worksheet_BeforeCellsKeyDown AddHandler worksheet.CellDataChanged, AddressOf Worksheet_CellDataChanged End Sub @@ -149,4 +160,12 @@ Public Class ucrDataViewReoGrid Private Sub Worksheet_CellDataChanged(sender As Object, e As CellEventArgs) RaiseEvent CellDataChanged() End Sub + + Private Sub Worksheet_BeforeCellsKeyDown(sender As Object, e As BeforeCellKeyDownEventArgs) + e.IsCancelled = True + If e.KeyCode = unvell.ReoGrid.Interaction.KeyCode.Delete OrElse e.KeyCode = unvell.ReoGrid.Interaction.KeyCode.Back Then + RaiseEvent DeleteValueToDataframe() + End If + End Sub + End Class diff --git a/instat/UserControls/DataGrid/ReoGrid/ucrReoGrid.vb b/instat/UserControls/DataGrid/ReoGrid/ucrReoGrid.vb index a1862afb6a2..fe1758caa35 100644 --- a/instat/UserControls/DataGrid/ReoGrid/ucrReoGrid.vb +++ b/instat/UserControls/DataGrid/ReoGrid/ucrReoGrid.vb @@ -79,6 +79,15 @@ Public MustInherit Class ucrReoGrid Return lstSelectedRows End Function + Public Function GetSelectedColumnIndexes() As List(Of String) Implements IGrid.GetSelectedColumnIndexes + Dim lstSelectedColumnIndexes As New List(Of String) + Dim clsRange As RangePosition = grdData.CurrentWorksheet.SelectionRange + For i As Integer = clsRange.Col To clsRange.Col + clsRange.Cols - 1 + lstSelectedColumnIndexes.Add(grdData.CurrentWorksheet.ColumnHeaders.Item(i).Index + 1) + Next + Return lstSelectedColumnIndexes + End Function + Public Function GetWorksheet(name As String) As clsWorksheetAdapter Implements IGrid.GetWorksheet Dim worksheet = grdData.Worksheets.Where(Function(x) x.Name = name).FirstOrDefault If worksheet IsNot Nothing Then diff --git a/instat/dlgDeleteObjects.Designer.vb b/instat/dlgDeleteObjects.Designer.vb index bb74dc161ec..1373bbcd2ee 100644 --- a/instat/dlgDeleteObjects.Designer.vb +++ b/instat/dlgDeleteObjects.Designer.vb @@ -39,11 +39,11 @@ Partial Class dlgDeleteObjects Private Sub InitializeComponent() Me.lblObjectsToDelete = New System.Windows.Forms.Label() + Me.lblType = New System.Windows.Forms.Label() + Me.ucrInputComboType = New instat.ucrInputComboBox() Me.ucrReceiverObjectsToDelete = New instat.ucrReceiverMultiple() Me.ucrSelectorDeleteObject = New instat.ucrSelectorByDataFrameAddRemove() Me.ucrBase = New instat.ucrButtons() - Me.ucrInputComboType = New instat.ucrInputComboBox() - Me.lblType = New System.Windows.Forms.Label() Me.SuspendLayout() ' 'lblObjectsToDelete @@ -56,6 +56,26 @@ Partial Class dlgDeleteObjects Me.lblObjectsToDelete.Tag = "Objects_to_Delete" Me.lblObjectsToDelete.Text = "Objects to Delete:" ' + 'lblType + ' + Me.lblType.AutoSize = True + Me.lblType.Location = New System.Drawing.Point(251, 149) + Me.lblType.Name = "lblType" + Me.lblType.Size = New System.Drawing.Size(34, 13) + Me.lblType.TabIndex = 3 + Me.lblType.Text = "Type:" + ' + 'ucrInputComboType + ' + Me.ucrInputComboType.AddQuotesIfUnrecognised = True + Me.ucrInputComboType.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink + Me.ucrInputComboType.GetSetSelectedIndex = -1 + Me.ucrInputComboType.IsReadOnly = False + Me.ucrInputComboType.Location = New System.Drawing.Point(254, 165) + Me.ucrInputComboType.Name = "ucrInputComboType" + Me.ucrInputComboType.Size = New System.Drawing.Size(120, 21) + Me.ucrInputComboType.TabIndex = 4 + ' 'ucrReceiverObjectsToDelete ' Me.ucrReceiverObjectsToDelete.AutoSize = True @@ -90,26 +110,6 @@ Partial Class dlgDeleteObjects Me.ucrBase.Size = New System.Drawing.Size(405, 52) Me.ucrBase.TabIndex = 5 ' - 'ucrInputComboType - ' - Me.ucrInputComboType.AddQuotesIfUnrecognised = True - Me.ucrInputComboType.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink - Me.ucrInputComboType.GetSetSelectedIndex = -1 - Me.ucrInputComboType.IsReadOnly = False - Me.ucrInputComboType.Location = New System.Drawing.Point(254, 165) - Me.ucrInputComboType.Name = "ucrInputComboType" - Me.ucrInputComboType.Size = New System.Drawing.Size(92, 21) - Me.ucrInputComboType.TabIndex = 4 - ' - 'lblType - ' - Me.lblType.AutoSize = True - Me.lblType.Location = New System.Drawing.Point(251, 149) - Me.lblType.Name = "lblType" - Me.lblType.Size = New System.Drawing.Size(34, 13) - Me.lblType.TabIndex = 3 - Me.lblType.Text = "Type:" - ' 'dlgDeleteObjects ' Me.AutoScaleDimensions = New System.Drawing.SizeF(96.0!, 96.0!) diff --git a/instat/dlgDeleteObjects.vb b/instat/dlgDeleteObjects.vb index 05fd504c3a4..018bf8b2ee3 100644 --- a/instat/dlgDeleteObjects.vb +++ b/instat/dlgDeleteObjects.vb @@ -53,13 +53,13 @@ Public Class dlgDeleteObjects ucrInputComboType.SetParameter(New RParameter("object_type", 2)) dctTypes.Add("Objects", Chr(34) & "object" & Chr(34)) dctTypes.Add("Filters", Chr(34) & "filter" & Chr(34)) + dctTypes.Add("Column selections", Chr(34) & "column_selection" & Chr(34)) dctTypes.Add("Calculations", Chr(34) & "calculation" & Chr(34)) dctTypes.Add("Tables", Chr(34) & "table" & Chr(34)) dctTypes.Add("Graphs", Chr(34) & "graph" & Chr(34)) dctTypes.Add("Models", Chr(34) & "model" & Chr(34)) ucrInputComboType.SetItems(dctTypes) ucrInputComboType.SetDropDownStyleAsNonEditable() - End Sub Private Sub SetDefaults() diff --git a/instat/dlgDeleteRowsOrColums.Designer.vb b/instat/dlgDeleteRowsOrColums.Designer.vb index 149a0811cbc..773ed4761f3 100644 --- a/instat/dlgDeleteRowsOrColums.Designer.vb +++ b/instat/dlgDeleteRowsOrColums.Designer.vb @@ -19,7 +19,7 @@ Partial Class dlgDeleteRowsOrColums 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 @@ -36,7 +36,7 @@ Partial Class dlgDeleteRowsOrColums '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.lblNumberofRows = New System.Windows.Forms.Label() Me.lblColumnsToDelete = New System.Windows.Forms.Label() @@ -44,6 +44,9 @@ Partial Class dlgDeleteRowsOrColums Me.rdoColumns = New System.Windows.Forms.RadioButton() Me.rdoRows = New System.Windows.Forms.RadioButton() Me.lblTo = New System.Windows.Forms.Label() + Me.rdoEmpty = New System.Windows.Forms.RadioButton() + Me.ucrChkEmptyRows = New instat.ucrCheck() + Me.ucrChkEmptyColumns = New instat.ucrCheck() Me.ucrNudTo = New instat.ucrNud() Me.ucrPnlColumnsOrRows = New instat.UcrPanel() Me.ucrDataFrameLengthForDeleteRows = New instat.ucrDataFrameLength() @@ -71,7 +74,7 @@ Partial Class dlgDeleteRowsOrColums Me.lblColumnsToDelete.Location = New System.Drawing.Point(254, 89) Me.lblColumnsToDelete.Name = "lblColumnsToDelete" Me.lblColumnsToDelete.Size = New System.Drawing.Size(96, 13) - Me.lblColumnsToDelete.TabIndex = 4 + Me.lblColumnsToDelete.TabIndex = 5 Me.lblColumnsToDelete.Tag = "Columns_to_Delete" Me.lblColumnsToDelete.Text = "Columns to Delete:" ' @@ -95,7 +98,7 @@ Partial Class dlgDeleteRowsOrColums Me.rdoColumns.FlatStyle = System.Windows.Forms.FlatStyle.Flat Me.rdoColumns.ForeColor = System.Drawing.SystemColors.ControlText Me.rdoColumns.ImeMode = System.Windows.Forms.ImeMode.NoControl - Me.rdoColumns.Location = New System.Drawing.Point(105, 12) + Me.rdoColumns.Location = New System.Drawing.Point(58, 12) Me.rdoColumns.Name = "rdoColumns" Me.rdoColumns.Size = New System.Drawing.Size(100, 28) Me.rdoColumns.TabIndex = 1 @@ -114,7 +117,7 @@ Partial Class dlgDeleteRowsOrColums Me.rdoRows.FlatStyle = System.Windows.Forms.FlatStyle.Flat Me.rdoRows.ForeColor = System.Drawing.SystemColors.ActiveCaptionText Me.rdoRows.ImeMode = System.Windows.Forms.ImeMode.NoControl - Me.rdoRows.Location = New System.Drawing.Point(203, 12) + Me.rdoRows.Location = New System.Drawing.Point(158, 12) Me.rdoRows.Name = "rdoRows" Me.rdoRows.Size = New System.Drawing.Size(100, 28) Me.rdoRows.TabIndex = 2 @@ -129,10 +132,45 @@ Partial Class dlgDeleteRowsOrColums Me.lblTo.Location = New System.Drawing.Point(51, 169) Me.lblTo.Name = "lblTo" Me.lblTo.Size = New System.Drawing.Size(23, 13) - Me.lblTo.TabIndex = 10 + Me.lblTo.TabIndex = 12 Me.lblTo.Tag = "" Me.lblTo.Text = "To:" ' + 'rdoEmpty + ' + Me.rdoEmpty.Appearance = System.Windows.Forms.Appearance.Button + Me.rdoEmpty.FlatAppearance.BorderColor = System.Drawing.SystemColors.ActiveCaption + Me.rdoEmpty.FlatAppearance.BorderSize = 2 + Me.rdoEmpty.FlatAppearance.CheckedBackColor = System.Drawing.SystemColors.ActiveCaption + Me.rdoEmpty.FlatStyle = System.Windows.Forms.FlatStyle.Flat + Me.rdoEmpty.ForeColor = System.Drawing.SystemColors.ControlText + Me.rdoEmpty.ImeMode = System.Windows.Forms.ImeMode.NoControl + Me.rdoEmpty.Location = New System.Drawing.Point(258, 12) + Me.rdoEmpty.Name = "rdoEmpty" + Me.rdoEmpty.Size = New System.Drawing.Size(100, 28) + Me.rdoEmpty.TabIndex = 3 + Me.rdoEmpty.Text = "Empty" + Me.rdoEmpty.TextAlign = System.Drawing.ContentAlignment.MiddleCenter + Me.rdoEmpty.UseVisualStyleBackColor = True + ' + 'ucrChkEmptyRows + ' + Me.ucrChkEmptyRows.AutoSize = True + Me.ucrChkEmptyRows.Checked = False + Me.ucrChkEmptyRows.Location = New System.Drawing.Point(11, 141) + Me.ucrChkEmptyRows.Name = "ucrChkEmptyRows" + Me.ucrChkEmptyRows.Size = New System.Drawing.Size(109, 23) + Me.ucrChkEmptyRows.TabIndex = 10 + ' + 'ucrChkEmptyColumns + ' + Me.ucrChkEmptyColumns.AutoSize = True + Me.ucrChkEmptyColumns.Checked = False + Me.ucrChkEmptyColumns.Location = New System.Drawing.Point(11, 106) + Me.ucrChkEmptyColumns.Name = "ucrChkEmptyColumns" + Me.ucrChkEmptyColumns.Size = New System.Drawing.Size(108, 23) + Me.ucrChkEmptyColumns.TabIndex = 7 + ' 'ucrNudTo ' Me.ucrNudTo.AutoSize = True @@ -143,15 +181,15 @@ Partial Class dlgDeleteRowsOrColums Me.ucrNudTo.Minimum = New Decimal(New Integer() {0, 0, 0, 0}) Me.ucrNudTo.Name = "ucrNudTo" Me.ucrNudTo.Size = New System.Drawing.Size(82, 20) - Me.ucrNudTo.TabIndex = 11 + Me.ucrNudTo.TabIndex = 13 Me.ucrNudTo.Value = New Decimal(New Integer() {0, 0, 0, 0}) ' 'ucrPnlColumnsOrRows ' Me.ucrPnlColumnsOrRows.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink - Me.ucrPnlColumnsOrRows.Location = New System.Drawing.Point(97, 11) + Me.ucrPnlColumnsOrRows.Location = New System.Drawing.Point(53, 11) Me.ucrPnlColumnsOrRows.Name = "ucrPnlColumnsOrRows" - Me.ucrPnlColumnsOrRows.Size = New System.Drawing.Size(214, 29) + Me.ucrPnlColumnsOrRows.Size = New System.Drawing.Size(321, 29) Me.ucrPnlColumnsOrRows.TabIndex = 0 ' 'ucrDataFrameLengthForDeleteRows @@ -160,7 +198,7 @@ Partial Class dlgDeleteRowsOrColums Me.ucrDataFrameLengthForDeleteRows.Location = New System.Drawing.Point(100, 104) Me.ucrDataFrameLengthForDeleteRows.Name = "ucrDataFrameLengthForDeleteRows" Me.ucrDataFrameLengthForDeleteRows.Size = New System.Drawing.Size(62, 24) - Me.ucrDataFrameLengthForDeleteRows.TabIndex = 7 + Me.ucrDataFrameLengthForDeleteRows.TabIndex = 8 Me.ucrDataFrameLengthForDeleteRows.ucrDataFrameSelector = Nothing ' 'ucrNudFrom @@ -173,7 +211,7 @@ Partial Class dlgDeleteRowsOrColums Me.ucrNudFrom.Minimum = New Decimal(New Integer() {0, 0, 0, 0}) Me.ucrNudFrom.Name = "ucrNudFrom" Me.ucrNudFrom.Size = New System.Drawing.Size(82, 20) - Me.ucrNudFrom.TabIndex = 9 + Me.ucrNudFrom.TabIndex = 11 Me.ucrNudFrom.Value = New Decimal(New Integer() {0, 0, 0, 0}) ' 'ucrSelectorForDeleteColumns @@ -186,7 +224,7 @@ Partial Class dlgDeleteRowsOrColums Me.ucrSelectorForDeleteColumns.Margin = New System.Windows.Forms.Padding(0) Me.ucrSelectorForDeleteColumns.Name = "ucrSelectorForDeleteColumns" Me.ucrSelectorForDeleteColumns.Size = New System.Drawing.Size(213, 183) - Me.ucrSelectorForDeleteColumns.TabIndex = 3 + Me.ucrSelectorForDeleteColumns.TabIndex = 4 ' 'ucrReceiverForColumnsToDelete ' @@ -198,24 +236,27 @@ Partial Class dlgDeleteRowsOrColums Me.ucrReceiverForColumnsToDelete.Selector = Nothing Me.ucrReceiverForColumnsToDelete.Size = New System.Drawing.Size(120, 100) Me.ucrReceiverForColumnsToDelete.strNcFilePath = "" - Me.ucrReceiverForColumnsToDelete.TabIndex = 5 + Me.ucrReceiverForColumnsToDelete.TabIndex = 6 Me.ucrReceiverForColumnsToDelete.ucrSelector = Nothing ' 'ucrBase ' Me.ucrBase.AutoSize = True Me.ucrBase.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink - Me.ucrBase.Location = New System.Drawing.Point(9, 243) + Me.ucrBase.Location = New System.Drawing.Point(5, 238) Me.ucrBase.Name = "ucrBase" Me.ucrBase.Size = New System.Drawing.Size(405, 52) - Me.ucrBase.TabIndex = 12 + Me.ucrBase.TabIndex = 14 ' 'dlgDeleteRowsOrColums ' Me.AutoScaleDimensions = New System.Drawing.SizeF(96.0!, 96.0!) Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi Me.AutoSize = True - Me.ClientSize = New System.Drawing.Size(416, 299) + Me.ClientSize = New System.Drawing.Size(416, 294) + Me.Controls.Add(Me.ucrChkEmptyRows) + Me.Controls.Add(Me.ucrChkEmptyColumns) + Me.Controls.Add(Me.rdoEmpty) Me.Controls.Add(Me.lblTo) Me.Controls.Add(Me.ucrNudTo) Me.Controls.Add(Me.rdoColumns) @@ -254,4 +295,7 @@ Partial Class dlgDeleteRowsOrColums Friend WithEvents ucrPnlColumnsOrRows As UcrPanel Friend WithEvents lblTo As Label Friend WithEvents ucrNudTo As ucrNud + Friend WithEvents rdoEmpty As RadioButton + Friend WithEvents ucrChkEmptyRows As ucrCheck + Friend WithEvents ucrChkEmptyColumns As ucrCheck End Class diff --git a/instat/dlgDeleteRowsOrColums.vb b/instat/dlgDeleteRowsOrColums.vb index d509dd43ca7..081b75bf61f 100644 --- a/instat/dlgDeleteRowsOrColums.vb +++ b/instat/dlgDeleteRowsOrColums.vb @@ -20,6 +20,8 @@ Public Class dlgDeleteRowsOrColums Private bReset As Boolean = True Private clsOperatorRowNames As New ROperator Private clsDeleteRows, clsDeleteColumns As RFunction + Private clsRemoveEmptyColumns, clsConcFunction As New RFunction + Private clsDummyFunction As New RFunction Private Sub dlgDeleteRows_Load(sender As Object, e As EventArgs) Handles Me.Load If bFirstLoad Then InitialiseDialog() @@ -37,16 +39,21 @@ Public Class dlgDeleteRowsOrColums Private Sub InitialiseDialog() ucrBase.iHelpTopicID = 165 + ucrBase.clsRsyntax.iCallType = 2 + ucrBase.clsRsyntax.bExcludeAssignedFunctionOutput = False ucrPnlColumnsOrRows.AddRadioButton(rdoColumns) ucrPnlColumnsOrRows.AddRadioButton(rdoRows) - ucrPnlColumnsOrRows.AddFunctionNamesCondition(rdoColumns, frmMain.clsRLink.strInstatDataObject & "$remove_columns_in_data") - ucrPnlColumnsOrRows.AddFunctionNamesCondition(rdoRows, frmMain.clsRLink.strInstatDataObject & "$remove_rows_in_data") + ucrPnlColumnsOrRows.AddRadioButton(rdoEmpty) + ucrPnlColumnsOrRows.AddParameterValuesCondition(rdoColumns, "checked", "columns") + ucrPnlColumnsOrRows.AddParameterValuesCondition(rdoRows, "checked", "rows") + ucrPnlColumnsOrRows.AddParameterValuesCondition(rdoEmpty, "checked", "empty") ucrPnlColumnsOrRows.AddToLinkedControls(ucrReceiverForColumnsToDelete, {rdoColumns}, bNewLinkedAddRemoveParameter:=True, bNewLinkedHideIfParameterMissing:=True) ucrPnlColumnsOrRows.AddToLinkedControls(ucrNudFrom, {rdoRows}, bNewLinkedHideIfParameterMissing:=True) ucrPnlColumnsOrRows.AddToLinkedControls(ucrNudTo, {rdoRows}, bNewLinkedHideIfParameterMissing:=True) ucrPnlColumnsOrRows.AddToLinkedControls(ucrDataFrameLengthForDeleteRows, {rdoRows}, bNewLinkedHideIfParameterMissing:=True) + ucrPnlColumnsOrRows.AddToLinkedControls({ucrChkEmptyRows, ucrChkEmptyColumns}, {rdoEmpty}, bNewLinkedAddRemoveParameter:=True, bNewLinkedHideIfParameterMissing:=True) ucrSelectorForDeleteColumns.SetParameter(New RParameter("data_name", 0)) ucrSelectorForDeleteColumns.SetParameterIsString() @@ -63,6 +70,14 @@ Public Class dlgDeleteRowsOrColums ucrNudTo.SetParameter(New RParameter("To", 1)) ucrNudTo.SetLinkedDisplayControl(lblTo) + ucrChkEmptyColumns.SetText("Columns") + ucrChkEmptyColumns.AddParameterPresentCondition(True, "x") + ucrChkEmptyColumns.AddParameterPresentCondition(False, "x", False) + + ucrChkEmptyRows.SetText("Rows") + ucrChkEmptyRows.AddParameterPresentCondition(True, "y") + ucrChkEmptyRows.AddParameterPresentCondition(False, "y", False) + ucrDataFrameLengthForDeleteRows.SetLinkedDisplayControl(lblNumberofRows) ucrDataFrameLengthForDeleteRows.SetDataFrameSelector(ucrSelectorForDeleteColumns.ucrAvailableDataFrames) End Sub @@ -71,6 +86,9 @@ Public Class dlgDeleteRowsOrColums clsDeleteColumns = New RFunction clsDeleteRows = New RFunction clsOperatorRowNames = New ROperator + clsRemoveEmptyColumns = New RFunction + clsConcFunction = New RFunction + clsDummyFunction = New RFunction ucrSelectorForDeleteColumns.Reset() @@ -82,16 +100,28 @@ Public Class dlgDeleteRowsOrColums clsOperatorRowNames.AddParameter("To", 1, iPosition:=1) clsDeleteRows.AddParameter("row_names", clsROperatorParameter:=clsOperatorRowNames) + + clsConcFunction.SetRCommand("c") + clsConcFunction.AddParameter("x", Chr(34) & "cols" & Chr(34), iPosition:=0, bIncludeArgumentName:=False) + clsConcFunction.AddParameter("y", Chr(34) & "rows" & Chr(34), iPosition:=1, bIncludeArgumentName:=False) + + clsRemoveEmptyColumns.SetRCommand(frmMain.clsRLink.strInstatDataObject & "$remove_empty") + clsRemoveEmptyColumns.AddParameter("which", clsRFunctionParameter:=clsConcFunction, iPosition:=0) + + clsDummyFunction.AddParameter("checked", "columns", iPosition:=0) + ucrBase.clsRsyntax.SetBaseRFunction(clsDeleteColumns) End Sub Private Sub SetRCodeForControls(bReset As Boolean) ucrSelectorForDeleteColumns.AddAdditionalCodeParameterPair(clsDeleteColumns, ucrSelectorForDeleteColumns.GetParameter, iAdditionalPairNo:=1) - ucrPnlColumnsOrRows.SetRCode(ucrBase.clsRsyntax.clsBaseFunction) + ucrPnlColumnsOrRows.SetRCode(clsDummyFunction, bReset) ucrReceiverForColumnsToDelete.SetRCode(clsDeleteColumns) ucrSelectorForDeleteColumns.SetRCode(clsDeleteRows) ucrNudTo.SetRCode(clsOperatorRowNames, bReset) ucrNudFrom.SetRCode(clsOperatorRowNames, bReset) + ucrChkEmptyColumns.SetRCode(clsConcFunction, bReset) + ucrChkEmptyRows.SetRCode(clsConcFunction, bReset) End Sub Private Sub TestOKEnabled() @@ -107,6 +137,12 @@ Public Class dlgDeleteRowsOrColums Else ucrBase.OKEnabled(False) End If + ElseIf rdoEmpty.Checked Then + If ucrChkEmptyColumns.Checked OrElse ucrChkEmptyRows.Checked Then + ucrBase.OKEnabled(True) + Else + ucrBase.OKEnabled(False) + End If Else ucrBase.OKEnabled(False) End If @@ -126,20 +162,23 @@ Public Class dlgDeleteRowsOrColums Private Sub ucrPnlColumnsOrRows_ControlValueChanged(ucrChangedControl As ucrCore) Handles ucrPnlColumnsOrRows.ControlValueChanged If rdoColumns.Checked Then + clsDummyFunction.AddParameter("checked", "columns", iPosition:=0) ucrBase.clsRsyntax.SetBaseRFunction(clsDeleteColumns) ucrSelectorForDeleteColumns.SetVariablesVisible(True) ElseIf rdoRows.Checked Then + clsDummyFunction.AddParameter("checked", "rows", iPosition:=0) ucrBase.clsRsyntax.SetBaseRFunction(clsDeleteRows) ucrSelectorForDeleteColumns.SetVariablesVisible(False) + ElseIf rdoEmpty.Checked Then + clsDummyFunction.AddParameter("checked", "empty", iPosition:=0) + ucrBase.clsRsyntax.SetBaseRFunction(clsRemoveEmptyColumns) + ucrSelectorForDeleteColumns.SetVariablesVisible(False) End If End Sub Private Sub ucrSelectorForDeleteColumns_ControlValueChanged(ucrChangedControl As ucrCore) Handles ucrSelectorForDeleteColumns.ControlValueChanged SetMaxMin() - End Sub - - Private Sub CoreControls_ControlContentsChanged(ucrChangedControl As ucrCore) Handles ucrReceiverForColumnsToDelete.ControlContentsChanged, ucrNudFrom.ControlContentsChanged, ucrPnlColumnsOrRows.ControlContentsChanged, ucrNudTo.ControlContentsChanged - TestOKEnabled() + clsRemoveEmptyColumns.AddParameter("data_name", Chr(34) & ucrSelectorForDeleteColumns.strCurrentDataFrame & Chr(34), iPosition:=0) End Sub Private Sub SetMaxMin() @@ -152,4 +191,23 @@ Public Class dlgDeleteRowsOrColums ucrNudTo.SetMinMax(1, iLength) End If End Sub + + Private Sub ucrChkEmptyColumns_ControlValueChanged(ucrChangedControl As ucrCore) Handles ucrChkEmptyColumns.ControlValueChanged, ucrChkEmptyRows.ControlValueChanged + If ucrChkEmptyRows.Checked Then + clsConcFunction.AddParameter("y", Chr(34) & "rows" & Chr(34), iPosition:=1, bIncludeArgumentName:=False) + Else + clsConcFunction.RemoveParameterByName("y") + End If + If ucrChkEmptyColumns.Checked Then + clsConcFunction.AddParameter("x", Chr(34) & "cols" & Chr(34), iPosition:=0, bIncludeArgumentName:=False) + Else + clsConcFunction.RemoveParameterByName("x") + End If + End Sub + + Private Sub CoreControls_ControlContentsChanged(ucrChangedControl As ucrCore) Handles ucrReceiverForColumnsToDelete.ControlContentsChanged, + ucrNudFrom.ControlContentsChanged, ucrPnlColumnsOrRows.ControlContentsChanged, ucrNudTo.ControlContentsChanged, + ucrChkEmptyColumns.ControlContentsChanged, ucrChkEmptyRows.ControlContentsChanged + TestOKEnabled() + End Sub End Class \ No newline at end of file diff --git a/instat/dlgDescribeTwoVarGraph.Designer.vb b/instat/dlgDescribeTwoVarGraph.Designer.vb index a6c0a7bb981..8a997b99a1e 100644 --- a/instat/dlgDescribeTwoVarGraph.Designer.vb +++ b/instat/dlgDescribeTwoVarGraph.Designer.vb @@ -52,27 +52,59 @@ Partial Class dlgDescribeTwoVarGraph Me.lblBy = New System.Windows.Forms.Label() Me.lblSecondType = New System.Windows.Forms.Label() Me.grpOptions = New System.Windows.Forms.GroupBox() - Me.ucrInputPosition = New instat.ucrInputComboBox() Me.lblPosition = New System.Windows.Forms.Label() Me.ucrNudTransparency = New instat.ucrNud() Me.ucrNudJitter = New instat.ucrNud() Me.lblPointTransparency = New System.Windows.Forms.Label() Me.lblPointJitter = New System.Windows.Forms.Label() + Me.ucrChkFlipCoordinates = New instat.ucrCheck() Me.ucrChkFreeScaleYAxis = New instat.ucrCheck() - Me.ucrFlipCoordinates = New instat.ucrCheck() + Me.ucrInputPosition = New instat.ucrInputComboBox() + Me.rdoPairs = New System.Windows.Forms.RadioButton() + Me.rdoBy = New System.Windows.Forms.RadioButton() + Me.lblColour = New System.Windows.Forms.Label() + Me.grpTypeOfDispaly = New System.Windows.Forms.GroupBox() + Me.ucrInputLowerNA = New instat.ucrInputComboBox() + Me.ucrInputLowerDiscrete = New instat.ucrInputComboBox() + Me.ucrInputLowerCombo = New instat.ucrInputComboBox() + Me.ucrInputLowerContinous = New instat.ucrInputComboBox() + Me.ucrChkDiagonal = New instat.ucrCheck() + Me.ucrChkLower = New instat.ucrCheck() + Me.ucrChkUpper = New instat.ucrCheck() + Me.ucrReceiverColour = New instat.ucrReceiverSingle() + Me.ucrPnlByPairs = New instat.UcrPanel() Me.ucrSaveGraph = New instat.ucrSave() Me.ucrReceiverSecondVar = New instat.ucrReceiverSingle() Me.ucrSelectorTwoVarGraph = New instat.ucrSelectorByDataFrameAddRemove() Me.ucrBase = New instat.ucrButtons() Me.ucrReceiverFirstVars = New instat.ucrVariablesAsFactor() + Me.lblLowerContinous = New System.Windows.Forms.Label() + Me.lblLowerCombo = New System.Windows.Forms.Label() + Me.lblLowerDiscrete = New System.Windows.Forms.Label() + Me.lblLowerNA = New System.Windows.Forms.Label() + Me.lblUpperNA = New System.Windows.Forms.Label() + Me.lblUpperDiscrete = New System.Windows.Forms.Label() + Me.lblUpperCombo = New System.Windows.Forms.Label() + Me.lblUpperContinous = New System.Windows.Forms.Label() + Me.ucrInputUpperNA = New instat.ucrInputComboBox() + Me.ucrInputUpperDiscrete = New instat.ucrInputComboBox() + Me.ucrInputUpperCombo = New instat.ucrInputComboBox() + Me.ucrInputUpperContinous = New instat.ucrInputComboBox() + Me.lblDiagonalContinuous = New System.Windows.Forms.Label() + Me.ucrInputDiagonalContinous = New instat.ucrInputComboBox() + Me.lblDiagonalDiscrete = New System.Windows.Forms.Label() + Me.ucrInputDiagonalDiscrete = New instat.ucrInputComboBox() + Me.lblDiagonalNA = New System.Windows.Forms.Label() + Me.ucrInputDiagonalNA = New instat.ucrInputComboBox() Me.grpSummaries.SuspendLayout() Me.grpOptions.SuspendLayout() + Me.grpTypeOfDispaly.SuspendLayout() Me.SuspendLayout() ' 'cmdOptions ' Me.cmdOptions.ImeMode = System.Windows.Forms.ImeMode.NoControl - Me.cmdOptions.Location = New System.Drawing.Point(10, 197) + Me.cmdOptions.Location = New System.Drawing.Point(10, 227) Me.cmdOptions.Name = "cmdOptions" Me.cmdOptions.Size = New System.Drawing.Size(119, 23) Me.cmdOptions.TabIndex = 5 @@ -84,7 +116,7 @@ Partial Class dlgDescribeTwoVarGraph ' Me.lblSecondVariable.AutoSize = True Me.lblSecondVariable.ImeMode = System.Windows.Forms.ImeMode.NoControl - Me.lblSecondVariable.Location = New System.Drawing.Point(268, 165) + Me.lblSecondVariable.Location = New System.Drawing.Point(285, 201) Me.lblSecondVariable.Name = "lblSecondVariable" Me.lblSecondVariable.Size = New System.Drawing.Size(88, 13) Me.lblSecondVariable.TabIndex = 3 @@ -94,7 +126,7 @@ Partial Class dlgDescribeTwoVarGraph ' Me.lblFirstVariables.AutoSize = True Me.lblFirstVariables.ImeMode = System.Windows.Forms.ImeMode.NoControl - Me.lblFirstVariables.Location = New System.Drawing.Point(268, 45) + Me.lblFirstVariables.Location = New System.Drawing.Point(290, 65) Me.lblFirstVariables.Name = "lblFirstVariables" Me.lblFirstVariables.Size = New System.Drawing.Size(81, 13) Me.lblFirstVariables.TabIndex = 2 @@ -112,7 +144,7 @@ Partial Class dlgDescribeTwoVarGraph Me.grpSummaries.Controls.Add(Me.lblGraph) Me.grpSummaries.Controls.Add(Me.lblBy) Me.grpSummaries.Controls.Add(Me.lblSecondType) - Me.grpSummaries.Location = New System.Drawing.Point(10, 221) + Me.grpSummaries.Location = New System.Drawing.Point(10, 253) Me.grpSummaries.Name = "grpSummaries" Me.grpSummaries.Size = New System.Drawing.Size(210, 72) Me.grpSummaries.TabIndex = 15 @@ -212,32 +244,21 @@ Partial Class dlgDescribeTwoVarGraph ' 'grpOptions ' - Me.grpOptions.Controls.Add(Me.ucrInputPosition) Me.grpOptions.Controls.Add(Me.lblPosition) Me.grpOptions.Controls.Add(Me.ucrNudTransparency) Me.grpOptions.Controls.Add(Me.ucrNudJitter) Me.grpOptions.Controls.Add(Me.lblPointTransparency) Me.grpOptions.Controls.Add(Me.lblPointJitter) + Me.grpOptions.Controls.Add(Me.ucrChkFlipCoordinates) Me.grpOptions.Controls.Add(Me.ucrChkFreeScaleYAxis) - Me.grpOptions.Controls.Add(Me.ucrFlipCoordinates) - Me.grpOptions.Location = New System.Drawing.Point(236, 203) + Me.grpOptions.Controls.Add(Me.ucrInputPosition) + Me.grpOptions.Location = New System.Drawing.Point(226, 252) Me.grpOptions.Name = "grpOptions" Me.grpOptions.Size = New System.Drawing.Size(171, 111) Me.grpOptions.TabIndex = 16 Me.grpOptions.TabStop = False Me.grpOptions.Text = "Options" ' - 'ucrInputPosition - ' - Me.ucrInputPosition.AddQuotesIfUnrecognised = True - Me.ucrInputPosition.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink - Me.ucrInputPosition.GetSetSelectedIndex = -1 - Me.ucrInputPosition.IsReadOnly = False - Me.ucrInputPosition.Location = New System.Drawing.Point(54, 63) - Me.ucrInputPosition.Name = "ucrInputPosition" - Me.ucrInputPosition.Size = New System.Drawing.Size(111, 21) - Me.ucrInputPosition.TabIndex = 13 - ' 'lblPosition ' Me.lblPosition.AutoSize = True @@ -293,6 +314,15 @@ Partial Class dlgDescribeTwoVarGraph Me.lblPointJitter.TabIndex = 8 Me.lblPointJitter.Text = "Point Jitter:" ' + 'ucrChkFlipCoordinates + ' + Me.ucrChkFlipCoordinates.AutoSize = True + Me.ucrChkFlipCoordinates.Checked = False + Me.ucrChkFlipCoordinates.Location = New System.Drawing.Point(6, 19) + Me.ucrChkFlipCoordinates.Name = "ucrChkFlipCoordinates" + Me.ucrChkFlipCoordinates.Size = New System.Drawing.Size(159, 23) + Me.ucrChkFlipCoordinates.TabIndex = 6 + ' 'ucrChkFreeScaleYAxis ' Me.ucrChkFreeScaleYAxis.AutoSize = True @@ -302,19 +332,191 @@ Partial Class dlgDescribeTwoVarGraph Me.ucrChkFreeScaleYAxis.Size = New System.Drawing.Size(159, 23) Me.ucrChkFreeScaleYAxis.TabIndex = 7 ' - 'ucrFlipCoordinates + 'ucrInputPosition ' - Me.ucrFlipCoordinates.AutoSize = True - Me.ucrFlipCoordinates.Checked = False - Me.ucrFlipCoordinates.Location = New System.Drawing.Point(6, 19) - Me.ucrFlipCoordinates.Name = "ucrFlipCoordinates" - Me.ucrFlipCoordinates.Size = New System.Drawing.Size(159, 23) - Me.ucrFlipCoordinates.TabIndex = 6 + Me.ucrInputPosition.AddQuotesIfUnrecognised = True + Me.ucrInputPosition.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink + Me.ucrInputPosition.GetSetSelectedIndex = -1 + Me.ucrInputPosition.IsReadOnly = False + Me.ucrInputPosition.Location = New System.Drawing.Point(54, 63) + Me.ucrInputPosition.Name = "ucrInputPosition" + Me.ucrInputPosition.Size = New System.Drawing.Size(111, 21) + Me.ucrInputPosition.TabIndex = 13 + ' + 'rdoPairs + ' + Me.rdoPairs.Appearance = System.Windows.Forms.Appearance.Button + Me.rdoPairs.FlatAppearance.BorderColor = System.Drawing.SystemColors.ActiveCaption + Me.rdoPairs.FlatAppearance.BorderSize = 2 + Me.rdoPairs.FlatAppearance.CheckedBackColor = System.Drawing.SystemColors.ActiveCaption + Me.rdoPairs.FlatStyle = System.Windows.Forms.FlatStyle.Flat + Me.rdoPairs.ImeMode = System.Windows.Forms.ImeMode.NoControl + Me.rdoPairs.Location = New System.Drawing.Point(76, 9) + Me.rdoPairs.Name = "rdoPairs" + Me.rdoPairs.Size = New System.Drawing.Size(129, 27) + Me.rdoPairs.TabIndex = 19 + Me.rdoPairs.TabStop = True + Me.rdoPairs.Text = "Pairs" + Me.rdoPairs.TextAlign = System.Drawing.ContentAlignment.MiddleCenter + Me.rdoPairs.UseVisualStyleBackColor = True + ' + 'rdoBy + ' + Me.rdoBy.Appearance = System.Windows.Forms.Appearance.Button + Me.rdoBy.FlatAppearance.BorderColor = System.Drawing.SystemColors.ActiveCaption + Me.rdoBy.FlatAppearance.BorderSize = 2 + Me.rdoBy.FlatAppearance.CheckedBackColor = System.Drawing.SystemColors.ActiveCaption + Me.rdoBy.FlatStyle = System.Windows.Forms.FlatStyle.Flat + Me.rdoBy.ImeMode = System.Windows.Forms.ImeMode.NoControl + Me.rdoBy.Location = New System.Drawing.Point(203, 9) + Me.rdoBy.Name = "rdoBy" + Me.rdoBy.Size = New System.Drawing.Size(129, 27) + Me.rdoBy.TabIndex = 18 + Me.rdoBy.TabStop = True + Me.rdoBy.Text = "By" + Me.rdoBy.TextAlign = System.Drawing.ContentAlignment.MiddleCenter + Me.rdoBy.UseVisualStyleBackColor = True + ' + 'lblColour + ' + Me.lblColour.AutoSize = True + Me.lblColour.ImeMode = System.Windows.Forms.ImeMode.NoControl + Me.lblColour.Location = New System.Drawing.Point(283, 201) + Me.lblColour.Name = "lblColour" + Me.lblColour.Size = New System.Drawing.Size(88, 13) + Me.lblColour.TabIndex = 20 + Me.lblColour.Text = "Colour (Optional):" + ' + 'grpTypeOfDispaly + ' + Me.grpTypeOfDispaly.Controls.Add(Me.lblDiagonalNA) + Me.grpTypeOfDispaly.Controls.Add(Me.ucrInputDiagonalNA) + Me.grpTypeOfDispaly.Controls.Add(Me.lblDiagonalDiscrete) + Me.grpTypeOfDispaly.Controls.Add(Me.ucrInputDiagonalDiscrete) + Me.grpTypeOfDispaly.Controls.Add(Me.lblDiagonalContinuous) + Me.grpTypeOfDispaly.Controls.Add(Me.ucrInputDiagonalContinous) + Me.grpTypeOfDispaly.Controls.Add(Me.lblUpperNA) + Me.grpTypeOfDispaly.Controls.Add(Me.lblUpperDiscrete) + Me.grpTypeOfDispaly.Controls.Add(Me.lblUpperCombo) + Me.grpTypeOfDispaly.Controls.Add(Me.lblUpperContinous) + Me.grpTypeOfDispaly.Controls.Add(Me.ucrInputUpperNA) + Me.grpTypeOfDispaly.Controls.Add(Me.ucrInputUpperDiscrete) + Me.grpTypeOfDispaly.Controls.Add(Me.ucrInputUpperCombo) + Me.grpTypeOfDispaly.Controls.Add(Me.ucrInputUpperContinous) + Me.grpTypeOfDispaly.Controls.Add(Me.lblLowerNA) + Me.grpTypeOfDispaly.Controls.Add(Me.lblLowerDiscrete) + Me.grpTypeOfDispaly.Controls.Add(Me.lblLowerCombo) + Me.grpTypeOfDispaly.Controls.Add(Me.lblLowerContinous) + Me.grpTypeOfDispaly.Controls.Add(Me.ucrInputLowerNA) + Me.grpTypeOfDispaly.Controls.Add(Me.ucrInputLowerDiscrete) + Me.grpTypeOfDispaly.Controls.Add(Me.ucrInputLowerCombo) + Me.grpTypeOfDispaly.Controls.Add(Me.ucrInputLowerContinous) + Me.grpTypeOfDispaly.Controls.Add(Me.ucrChkDiagonal) + Me.grpTypeOfDispaly.Controls.Add(Me.ucrChkLower) + Me.grpTypeOfDispaly.Controls.Add(Me.ucrChkUpper) + Me.grpTypeOfDispaly.Location = New System.Drawing.Point(10, 252) + Me.grpTypeOfDispaly.Name = "grpTypeOfDispaly" + Me.grpTypeOfDispaly.Size = New System.Drawing.Size(422, 151) + Me.grpTypeOfDispaly.TabIndex = 22 + Me.grpTypeOfDispaly.TabStop = False + Me.grpTypeOfDispaly.Text = "Type Of Dispaly" + ' + 'ucrInputLowerNA + ' + Me.ucrInputLowerNA.AddQuotesIfUnrecognised = True + Me.ucrInputLowerNA.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink + Me.ucrInputLowerNA.GetSetSelectedIndex = -1 + Me.ucrInputLowerNA.IsReadOnly = False + Me.ucrInputLowerNA.Location = New System.Drawing.Point(68, 127) + Me.ucrInputLowerNA.Name = "ucrInputLowerNA" + Me.ucrInputLowerNA.Size = New System.Drawing.Size(61, 21) + Me.ucrInputLowerNA.TabIndex = 22 + ' + 'ucrInputLowerDiscrete + ' + Me.ucrInputLowerDiscrete.AddQuotesIfUnrecognised = True + Me.ucrInputLowerDiscrete.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink + Me.ucrInputLowerDiscrete.GetSetSelectedIndex = -1 + Me.ucrInputLowerDiscrete.IsReadOnly = False + Me.ucrInputLowerDiscrete.Location = New System.Drawing.Point(68, 100) + Me.ucrInputLowerDiscrete.Name = "ucrInputLowerDiscrete" + Me.ucrInputLowerDiscrete.Size = New System.Drawing.Size(61, 21) + Me.ucrInputLowerDiscrete.TabIndex = 5 + ' + 'ucrInputLowerCombo + ' + Me.ucrInputLowerCombo.AddQuotesIfUnrecognised = True + Me.ucrInputLowerCombo.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink + Me.ucrInputLowerCombo.GetSetSelectedIndex = -1 + Me.ucrInputLowerCombo.IsReadOnly = False + Me.ucrInputLowerCombo.Location = New System.Drawing.Point(68, 73) + Me.ucrInputLowerCombo.Name = "ucrInputLowerCombo" + Me.ucrInputLowerCombo.Size = New System.Drawing.Size(61, 21) + Me.ucrInputLowerCombo.TabIndex = 4 + ' + 'ucrInputLowerContinous + ' + Me.ucrInputLowerContinous.AddQuotesIfUnrecognised = True + Me.ucrInputLowerContinous.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink + Me.ucrInputLowerContinous.GetSetSelectedIndex = -1 + Me.ucrInputLowerContinous.IsReadOnly = False + Me.ucrInputLowerContinous.Location = New System.Drawing.Point(68, 46) + Me.ucrInputLowerContinous.Name = "ucrInputLowerContinous" + Me.ucrInputLowerContinous.Size = New System.Drawing.Size(61, 21) + Me.ucrInputLowerContinous.TabIndex = 3 + ' + 'ucrChkDiagonal + ' + Me.ucrChkDiagonal.AutoSize = True + Me.ucrChkDiagonal.Checked = False + Me.ucrChkDiagonal.Location = New System.Drawing.Point(154, 17) + Me.ucrChkDiagonal.Name = "ucrChkDiagonal" + Me.ucrChkDiagonal.Size = New System.Drawing.Size(100, 23) + Me.ucrChkDiagonal.TabIndex = 2 + ' + 'ucrChkLower + ' + Me.ucrChkLower.AutoSize = True + Me.ucrChkLower.Checked = False + Me.ucrChkLower.Location = New System.Drawing.Point(6, 17) + Me.ucrChkLower.Name = "ucrChkLower" + Me.ucrChkLower.Size = New System.Drawing.Size(100, 23) + Me.ucrChkLower.TabIndex = 1 + ' + 'ucrChkUpper + ' + Me.ucrChkUpper.AutoSize = True + Me.ucrChkUpper.Checked = False + Me.ucrChkUpper.Location = New System.Drawing.Point(296, 17) + Me.ucrChkUpper.Name = "ucrChkUpper" + Me.ucrChkUpper.Size = New System.Drawing.Size(120, 23) + Me.ucrChkUpper.TabIndex = 0 + ' + 'ucrReceiverColour + ' + Me.ucrReceiverColour.AutoSize = True + Me.ucrReceiverColour.frmParent = Me + Me.ucrReceiverColour.Location = New System.Drawing.Point(287, 216) + Me.ucrReceiverColour.Margin = New System.Windows.Forms.Padding(0) + Me.ucrReceiverColour.Name = "ucrReceiverColour" + Me.ucrReceiverColour.Selector = Nothing + Me.ucrReceiverColour.Size = New System.Drawing.Size(120, 20) + Me.ucrReceiverColour.strNcFilePath = "" + Me.ucrReceiverColour.TabIndex = 21 + Me.ucrReceiverColour.ucrSelector = Nothing + ' + 'ucrPnlByPairs + ' + Me.ucrPnlByPairs.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink + Me.ucrPnlByPairs.Location = New System.Drawing.Point(73, 5) + Me.ucrPnlByPairs.Name = "ucrPnlByPairs" + Me.ucrPnlByPairs.Size = New System.Drawing.Size(276, 31) + Me.ucrPnlByPairs.TabIndex = 17 ' 'ucrSaveGraph ' Me.ucrSaveGraph.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink - Me.ucrSaveGraph.Location = New System.Drawing.Point(10, 319) + Me.ucrSaveGraph.Location = New System.Drawing.Point(10, 405) Me.ucrSaveGraph.Margin = New System.Windows.Forms.Padding(4, 5, 4, 5) Me.ucrSaveGraph.Name = "ucrSaveGraph" Me.ucrSaveGraph.Size = New System.Drawing.Size(339, 24) @@ -324,7 +526,7 @@ Partial Class dlgDescribeTwoVarGraph ' Me.ucrReceiverSecondVar.AutoSize = True Me.ucrReceiverSecondVar.frmParent = Me - Me.ucrReceiverSecondVar.Location = New System.Drawing.Point(270, 180) + Me.ucrReceiverSecondVar.Location = New System.Drawing.Point(287, 216) Me.ucrReceiverSecondVar.Margin = New System.Windows.Forms.Padding(0) Me.ucrReceiverSecondVar.Name = "ucrReceiverSecondVar" Me.ucrReceiverSecondVar.Selector = Nothing @@ -339,7 +541,7 @@ Partial Class dlgDescribeTwoVarGraph Me.ucrSelectorTwoVarGraph.bDropUnusedFilterLevels = False Me.ucrSelectorTwoVarGraph.bShowHiddenColumns = False Me.ucrSelectorTwoVarGraph.bUseCurrentFilter = True - Me.ucrSelectorTwoVarGraph.Location = New System.Drawing.Point(10, 10) + Me.ucrSelectorTwoVarGraph.Location = New System.Drawing.Point(10, 41) Me.ucrSelectorTwoVarGraph.Margin = New System.Windows.Forms.Padding(0) Me.ucrSelectorTwoVarGraph.Name = "ucrSelectorTwoVarGraph" Me.ucrSelectorTwoVarGraph.Size = New System.Drawing.Size(213, 183) @@ -349,7 +551,7 @@ Partial Class dlgDescribeTwoVarGraph ' Me.ucrBase.AutoSize = True Me.ucrBase.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink - Me.ucrBase.Location = New System.Drawing.Point(10, 347) + Me.ucrBase.Location = New System.Drawing.Point(10, 431) Me.ucrBase.Name = "ucrBase" Me.ucrBase.Size = New System.Drawing.Size(405, 52) Me.ucrBase.TabIndex = 8 @@ -358,7 +560,7 @@ Partial Class dlgDescribeTwoVarGraph ' Me.ucrReceiverFirstVars.AutoSize = True Me.ucrReceiverFirstVars.frmParent = Me - Me.ucrReceiverFirstVars.Location = New System.Drawing.Point(268, 30) + Me.ucrReceiverFirstVars.Location = New System.Drawing.Point(290, 50) Me.ucrReceiverFirstVars.Name = "ucrReceiverFirstVars" Me.ucrReceiverFirstVars.Selector = Nothing Me.ucrReceiverFirstVars.Size = New System.Drawing.Size(120, 138) @@ -367,13 +569,205 @@ Partial Class dlgDescribeTwoVarGraph Me.ucrReceiverFirstVars.ucrSelector = Nothing Me.ucrReceiverFirstVars.ucrVariableSelector = Nothing ' + 'lblLowerContinous + ' + Me.lblLowerContinous.AutoSize = True + Me.lblLowerContinous.ImeMode = System.Windows.Forms.ImeMode.NoControl + Me.lblLowerContinous.Location = New System.Drawing.Point(1, 50) + Me.lblLowerContinous.Name = "lblLowerContinous" + Me.lblLowerContinous.Size = New System.Drawing.Size(63, 13) + Me.lblLowerContinous.TabIndex = 23 + Me.lblLowerContinous.Text = "Continuous:" + ' + 'lblLowerCombo + ' + Me.lblLowerCombo.AutoSize = True + Me.lblLowerCombo.ImeMode = System.Windows.Forms.ImeMode.NoControl + Me.lblLowerCombo.Location = New System.Drawing.Point(1, 78) + Me.lblLowerCombo.Name = "lblLowerCombo" + Me.lblLowerCombo.Size = New System.Drawing.Size(43, 13) + Me.lblLowerCombo.TabIndex = 24 + Me.lblLowerCombo.Text = "Combo:" + ' + 'lblLowerDiscrete + ' + Me.lblLowerDiscrete.AutoSize = True + Me.lblLowerDiscrete.ImeMode = System.Windows.Forms.ImeMode.NoControl + Me.lblLowerDiscrete.Location = New System.Drawing.Point(1, 105) + Me.lblLowerDiscrete.Name = "lblLowerDiscrete" + Me.lblLowerDiscrete.Size = New System.Drawing.Size(49, 13) + Me.lblLowerDiscrete.TabIndex = 25 + Me.lblLowerDiscrete.Text = "Discrete:" + ' + 'lblLowerNA + ' + Me.lblLowerNA.AutoSize = True + Me.lblLowerNA.ImeMode = System.Windows.Forms.ImeMode.NoControl + Me.lblLowerNA.Location = New System.Drawing.Point(3, 130) + Me.lblLowerNA.Name = "lblLowerNA" + Me.lblLowerNA.Size = New System.Drawing.Size(25, 13) + Me.lblLowerNA.TabIndex = 26 + Me.lblLowerNA.Text = "NA:" + ' + 'lblUpperNA + ' + Me.lblUpperNA.AutoSize = True + Me.lblUpperNA.ImeMode = System.Windows.Forms.ImeMode.NoControl + Me.lblUpperNA.Location = New System.Drawing.Point(292, 131) + Me.lblUpperNA.Name = "lblUpperNA" + Me.lblUpperNA.Size = New System.Drawing.Size(25, 13) + Me.lblUpperNA.TabIndex = 34 + Me.lblUpperNA.Text = "NA:" + ' + 'lblUpperDiscrete + ' + Me.lblUpperDiscrete.AutoSize = True + Me.lblUpperDiscrete.ImeMode = System.Windows.Forms.ImeMode.NoControl + Me.lblUpperDiscrete.Location = New System.Drawing.Point(290, 104) + Me.lblUpperDiscrete.Name = "lblUpperDiscrete" + Me.lblUpperDiscrete.Size = New System.Drawing.Size(49, 13) + Me.lblUpperDiscrete.TabIndex = 33 + Me.lblUpperDiscrete.Text = "Discrete:" + ' + 'lblUpperCombo + ' + Me.lblUpperCombo.AutoSize = True + Me.lblUpperCombo.ImeMode = System.Windows.Forms.ImeMode.NoControl + Me.lblUpperCombo.Location = New System.Drawing.Point(290, 77) + Me.lblUpperCombo.Name = "lblUpperCombo" + Me.lblUpperCombo.Size = New System.Drawing.Size(43, 13) + Me.lblUpperCombo.TabIndex = 32 + Me.lblUpperCombo.Text = "Combo:" + ' + 'lblUpperContinous + ' + Me.lblUpperContinous.AutoSize = True + Me.lblUpperContinous.ImeMode = System.Windows.Forms.ImeMode.NoControl + Me.lblUpperContinous.Location = New System.Drawing.Point(290, 50) + Me.lblUpperContinous.Name = "lblUpperContinous" + Me.lblUpperContinous.Size = New System.Drawing.Size(63, 13) + Me.lblUpperContinous.TabIndex = 31 + Me.lblUpperContinous.Text = "Continuous:" + ' + 'ucrInputUpperNA + ' + Me.ucrInputUpperNA.AddQuotesIfUnrecognised = True + Me.ucrInputUpperNA.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink + Me.ucrInputUpperNA.GetSetSelectedIndex = -1 + Me.ucrInputUpperNA.IsReadOnly = False + Me.ucrInputUpperNA.Location = New System.Drawing.Point(357, 127) + Me.ucrInputUpperNA.Name = "ucrInputUpperNA" + Me.ucrInputUpperNA.Size = New System.Drawing.Size(61, 21) + Me.ucrInputUpperNA.TabIndex = 30 + ' + 'ucrInputUpperDiscrete + ' + Me.ucrInputUpperDiscrete.AddQuotesIfUnrecognised = True + Me.ucrInputUpperDiscrete.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink + Me.ucrInputUpperDiscrete.GetSetSelectedIndex = -1 + Me.ucrInputUpperDiscrete.IsReadOnly = False + Me.ucrInputUpperDiscrete.Location = New System.Drawing.Point(357, 100) + Me.ucrInputUpperDiscrete.Name = "ucrInputUpperDiscrete" + Me.ucrInputUpperDiscrete.Size = New System.Drawing.Size(61, 21) + Me.ucrInputUpperDiscrete.TabIndex = 29 + ' + 'ucrInputUpperCombo + ' + Me.ucrInputUpperCombo.AddQuotesIfUnrecognised = True + Me.ucrInputUpperCombo.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink + Me.ucrInputUpperCombo.GetSetSelectedIndex = -1 + Me.ucrInputUpperCombo.IsReadOnly = False + Me.ucrInputUpperCombo.Location = New System.Drawing.Point(357, 73) + Me.ucrInputUpperCombo.Name = "ucrInputUpperCombo" + Me.ucrInputUpperCombo.Size = New System.Drawing.Size(61, 21) + Me.ucrInputUpperCombo.TabIndex = 28 + ' + 'ucrInputUpperContinous + ' + Me.ucrInputUpperContinous.AddQuotesIfUnrecognised = True + Me.ucrInputUpperContinous.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink + Me.ucrInputUpperContinous.GetSetSelectedIndex = -1 + Me.ucrInputUpperContinous.IsReadOnly = False + Me.ucrInputUpperContinous.Location = New System.Drawing.Point(357, 46) + Me.ucrInputUpperContinous.Name = "ucrInputUpperContinous" + Me.ucrInputUpperContinous.Size = New System.Drawing.Size(61, 21) + Me.ucrInputUpperContinous.TabIndex = 27 + ' + 'lblDiagonalContinuous + ' + Me.lblDiagonalContinuous.AutoSize = True + Me.lblDiagonalContinuous.ImeMode = System.Windows.Forms.ImeMode.NoControl + Me.lblDiagonalContinuous.Location = New System.Drawing.Point(149, 50) + Me.lblDiagonalContinuous.Name = "lblDiagonalContinuous" + Me.lblDiagonalContinuous.Size = New System.Drawing.Size(63, 13) + Me.lblDiagonalContinuous.TabIndex = 36 + Me.lblDiagonalContinuous.Text = "Continuous:" + ' + 'ucrInputDiagonalContinous + ' + Me.ucrInputDiagonalContinous.AddQuotesIfUnrecognised = True + Me.ucrInputDiagonalContinous.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink + Me.ucrInputDiagonalContinous.GetSetSelectedIndex = -1 + Me.ucrInputDiagonalContinous.IsReadOnly = False + Me.ucrInputDiagonalContinous.Location = New System.Drawing.Point(216, 46) + Me.ucrInputDiagonalContinous.Name = "ucrInputDiagonalContinous" + Me.ucrInputDiagonalContinous.Size = New System.Drawing.Size(61, 21) + Me.ucrInputDiagonalContinous.TabIndex = 35 + ' + 'lblDiagonalDiscrete + ' + Me.lblDiagonalDiscrete.AutoSize = True + Me.lblDiagonalDiscrete.ImeMode = System.Windows.Forms.ImeMode.NoControl + Me.lblDiagonalDiscrete.Location = New System.Drawing.Point(150, 77) + Me.lblDiagonalDiscrete.Name = "lblDiagonalDiscrete" + Me.lblDiagonalDiscrete.Size = New System.Drawing.Size(49, 13) + Me.lblDiagonalDiscrete.TabIndex = 38 + Me.lblDiagonalDiscrete.Text = "Discrete:" + ' + 'ucrInputDiagonalDiscrete + ' + Me.ucrInputDiagonalDiscrete.AddQuotesIfUnrecognised = True + Me.ucrInputDiagonalDiscrete.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink + Me.ucrInputDiagonalDiscrete.GetSetSelectedIndex = -1 + Me.ucrInputDiagonalDiscrete.IsReadOnly = False + Me.ucrInputDiagonalDiscrete.Location = New System.Drawing.Point(216, 73) + Me.ucrInputDiagonalDiscrete.Name = "ucrInputDiagonalDiscrete" + Me.ucrInputDiagonalDiscrete.Size = New System.Drawing.Size(61, 21) + Me.ucrInputDiagonalDiscrete.TabIndex = 37 + ' + 'lblDiagonalNA + ' + Me.lblDiagonalNA.AutoSize = True + Me.lblDiagonalNA.ImeMode = System.Windows.Forms.ImeMode.NoControl + Me.lblDiagonalNA.Location = New System.Drawing.Point(152, 105) + Me.lblDiagonalNA.Name = "lblDiagonalNA" + Me.lblDiagonalNA.Size = New System.Drawing.Size(25, 13) + Me.lblDiagonalNA.TabIndex = 40 + Me.lblDiagonalNA.Text = "NA:" + ' + 'ucrInputDiagonalNA + ' + Me.ucrInputDiagonalNA.AddQuotesIfUnrecognised = True + Me.ucrInputDiagonalNA.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink + Me.ucrInputDiagonalNA.GetSetSelectedIndex = -1 + Me.ucrInputDiagonalNA.IsReadOnly = False + Me.ucrInputDiagonalNA.Location = New System.Drawing.Point(216, 100) + Me.ucrInputDiagonalNA.Name = "ucrInputDiagonalNA" + Me.ucrInputDiagonalNA.Size = New System.Drawing.Size(61, 21) + Me.ucrInputDiagonalNA.TabIndex = 39 + ' 'dlgDescribeTwoVarGraph ' Me.AutoScaleDimensions = New System.Drawing.SizeF(96.0!, 96.0!) Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi Me.AutoSize = True - Me.ClientSize = New System.Drawing.Size(419, 401) - Me.Controls.Add(Me.grpOptions) + Me.ClientSize = New System.Drawing.Size(438, 491) + Me.Controls.Add(Me.grpTypeOfDispaly) + Me.Controls.Add(Me.lblColour) + Me.Controls.Add(Me.ucrReceiverColour) + Me.Controls.Add(Me.rdoPairs) + Me.Controls.Add(Me.rdoBy) + Me.Controls.Add(Me.ucrPnlByPairs) Me.Controls.Add(Me.grpSummaries) Me.Controls.Add(Me.ucrSaveGraph) Me.Controls.Add(Me.lblFirstVariables) @@ -383,6 +777,7 @@ Partial Class dlgDescribeTwoVarGraph Me.Controls.Add(Me.ucrSelectorTwoVarGraph) Me.Controls.Add(Me.ucrBase) Me.Controls.Add(Me.ucrReceiverFirstVars) + Me.Controls.Add(Me.grpOptions) Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow Me.MaximizeBox = False Me.MinimizeBox = False @@ -393,6 +788,8 @@ Partial Class dlgDescribeTwoVarGraph Me.grpSummaries.PerformLayout() Me.grpOptions.ResumeLayout(False) Me.grpOptions.PerformLayout() + Me.grpTypeOfDispaly.ResumeLayout(False) + Me.grpTypeOfDispaly.PerformLayout() Me.ResumeLayout(False) Me.PerformLayout() @@ -406,7 +803,7 @@ Partial Class dlgDescribeTwoVarGraph Friend WithEvents ucrReceiverFirstVars As ucrVariablesAsFactor Friend WithEvents lblFirstVariables As Label Friend WithEvents ucrSaveGraph As ucrSave - Friend WithEvents ucrFlipCoordinates As ucrCheck + Friend WithEvents ucrChkFlipCoordinates As ucrCheck Friend WithEvents grpSummaries As GroupBox Friend WithEvents lblFirstType As Label Friend WithEvents lblGraph As Label @@ -425,4 +822,35 @@ Partial Class dlgDescribeTwoVarGraph Friend WithEvents ucrNudJitter As ucrNud Friend WithEvents lblPointTransparency As Label Friend WithEvents lblPointJitter As Label + Friend WithEvents ucrPnlByPairs As UcrPanel + Friend WithEvents rdoPairs As RadioButton + Friend WithEvents rdoBy As RadioButton + Friend WithEvents lblColour As Label + Friend WithEvents ucrReceiverColour As ucrReceiverSingle + Friend WithEvents grpTypeOfDispaly As GroupBox + Friend WithEvents ucrChkDiagonal As ucrCheck + Friend WithEvents ucrChkLower As ucrCheck + Friend WithEvents ucrChkUpper As ucrCheck + Friend WithEvents ucrInputLowerContinous As ucrInputComboBox + Friend WithEvents ucrInputLowerDiscrete As ucrInputComboBox + Friend WithEvents ucrInputLowerCombo As ucrInputComboBox + Friend WithEvents ucrInputLowerNA As ucrInputComboBox + Friend WithEvents lblLowerCombo As Label + Friend WithEvents lblLowerContinous As Label + Friend WithEvents lblLowerNA As Label + Friend WithEvents lblLowerDiscrete As Label + Friend WithEvents lblDiagonalNA As Label + Friend WithEvents ucrInputDiagonalNA As ucrInputComboBox + Friend WithEvents lblDiagonalDiscrete As Label + Friend WithEvents ucrInputDiagonalDiscrete As ucrInputComboBox + Friend WithEvents lblDiagonalContinuous As Label + Friend WithEvents ucrInputDiagonalContinous As ucrInputComboBox + Friend WithEvents lblUpperNA As Label + Friend WithEvents lblUpperDiscrete As Label + Friend WithEvents lblUpperCombo As Label + Friend WithEvents lblUpperContinous As Label + Friend WithEvents ucrInputUpperNA As ucrInputComboBox + Friend WithEvents ucrInputUpperDiscrete As ucrInputComboBox + Friend WithEvents ucrInputUpperCombo As ucrInputComboBox + Friend WithEvents ucrInputUpperContinous As ucrInputComboBox End Class \ No newline at end of file diff --git a/instat/dlgDescribeTwoVarGraph.vb b/instat/dlgDescribeTwoVarGraph.vb index 44d72103ee0..01fb712e258 100644 --- a/instat/dlgDescribeTwoVarGraph.vb +++ b/instat/dlgDescribeTwoVarGraph.vb @@ -17,25 +17,16 @@ Imports instat.Translations Public Class dlgDescribeTwoVarGraph - Public strFirstVariablesType, strSecondVariableType As String - - Private clsBaseOperator As New ROperator - Private clsRGGplotFunction, clsRFacet As New RFunction - Private clsThemeFunction As New RFunction - Private dctThemeFunctions As Dictionary(Of String, RFunction) - Private clsGlobalAes As RFunction - Private clsLabsFunction As New RFunction - Private clsXlabsFunction As New RFunction - Private clsYlabFunction As New RFunction - Private clsXScaleContinuousFunction As New RFunction - Private clsYScaleContinuousFunction As New RFunction - Private clsCoordPolarFunction As New RFunction - Private clsCoordPolarStartOperator As New ROperator - Private clsXScaleDateFunction As New RFunction - Private clsYScaleDateFunction As New RFunction - Private clsScaleFillViridisFunction As New RFunction - Private clsScaleColourViridisFunction As New RFunction - + Private clsBaseOperator, clsCoordPolarStartOperator As New ROperator + Private clsRGGplotFunction, clsRFacet, clsThemeFunction, clsGlobalAes, clsLabsFunction, clsXlabsFunction, + clsYlabFunction, clsXScaleContinuousFunction, clsYScaleContinuousFunction, clsCoordPolarFunction, + clsXScaleDateFunction, clsYScaleDateFunction, clsScaleFillViridisFunction, clsScaleColourViridisFunction As New RFunction + 'Geoms + Private clsGeomJitter, clsGeomViolin, clsGeomBar, clsGeomMosaic, clsGeomBoxplot, + clsGeomPoint, clsGeomLine, clsStatSummaryHline, clsStatSummaryCrossbar, + clsGeomFreqPoly, clsGeomHistogram, clsGeomDensity, clsAnnotateFunction, clsGGpairsFunction, + clsDummyFunction, clsGGpairAesFunction, clsUpperListFunction, clsLowerListFunction, + clsDiagonalListFunction As New RFunction ' Use this aes for numeric by numeric graphs e.g. scatter and line plots Private clsAesNumericByNumeric As RFunction ' Use this aes for categorical by categorical bar graphs @@ -54,23 +45,10 @@ Public Class dlgDescribeTwoVarGraph Private clsAesStatSummaryHlineNumericByCategorical As RFunction ' Use this aes for categorical by numeric when the x axis is the numeric variable(s) e.g. boxplot, violin, point Private clsAesCategoricalByNumericXNumeric As RFunction - - 'Geoms - Private clsGeomJitter As New RFunction - Private clsGeomViolin As New RFunction - Private clsGeomBar As New RFunction - Private clsGeomMosaic As New RFunction - Private clsGeomBoxplot As New RFunction - Private clsGeomPoint As New RFunction - Private clsGeomLine As New RFunction - Private clsStatSummaryHline As New RFunction - Private clsStatSummaryCrossbar As New RFunction - Private clsGeomFreqPoly As New RFunction - Private clsGeomHistogram As New RFunction - Private clsGeomDensity As New RFunction - Private clsAnnotateFunction As New RFunction Private strGeomParameterNames() As String = {"geom_jitter", "geom_violin", "geom_bar", "geom_mosaic", "geom_boxplot", "geom_point", "geom_line", "stat_summary_hline", "stat_summary_crossline", "geom_freqpoly", "geom_histogram", "geom_density"} + Private strFirstVariablesType, strSecondVariableType As String + Private dctThemeFunctions As Dictionary(Of String, RFunction) Private bFirstLoad As Boolean = True Private bReset As Boolean = True Private bRCodeSet As Boolean = True @@ -100,17 +78,37 @@ Public Class dlgDescribeTwoVarGraph ucrBase.clsRsyntax.iCallType = 3 ucrBase.clsRsyntax.bExcludeAssignedFunctionOutput = False + ucrPnlByPairs.AddRadioButton(rdoBy) + ucrPnlByPairs.AddRadioButton(rdoPairs) + ucrPnlByPairs.AddParameterValuesCondition(rdoBy, "checked", "by") + ucrPnlByPairs.AddParameterValuesCondition(rdoPairs, "checked", "pair") + + ucrPnlByPairs.AddToLinkedControls({ucrReceiverSecondVar, ucrInputCategoricalByCategorical, + ucrChkFlipCoordinates}, {rdoBy}, bNewLinkedHideIfParameterMissing:=True) + ucrPnlByPairs.AddToLinkedControls({ucrChkLower, ucrReceiverColour}, {rdoPairs}, bNewLinkedHideIfParameterMissing:=True) + + ucrChkLower.SetLinkedDisplayControl(grpTypeOfDispaly) + ucrSelectorTwoVarGraph.SetParameter(New RParameter("data", 0)) ucrSelectorTwoVarGraph.SetParameterIsrfunction() ucrReceiverFirstVars.Selector = ucrSelectorTwoVarGraph ucrReceiverFirstVars.SetMultipleOnlyStatus(True) - ucrReceiverFirstVars.ucrMultipleVariables.SetSingleTypeStatus(True, bIsCategoricalNumeric:=True) + ucrReceiverFirstVars.ucrMultipleVariables.SetSingleTypeStatus(False) + + ucrReceiverColour.SetParameter(New RParameter("colour", iNewPosition:=0)) + ucrReceiverColour.SetParameterIsString() + ucrReceiverColour.SetDataType("factor") + ucrReceiverColour.strSelectorHeading = "Factors" + ucrReceiverColour.Selector = ucrSelectorTwoVarGraph + ucrReceiverColour.SetLinkedDisplayControl(lblColour) + ucrReceiverColour.bWithQuotes = False ucrReceiverSecondVar.SetParameter(New RParameter("fill", 0)) ucrReceiverSecondVar.Selector = ucrSelectorTwoVarGraph ucrReceiverSecondVar.SetParameterIsString() ucrReceiverSecondVar.bWithQuotes = False + ucrReceiverSecondVar.SetLinkedDisplayControl(lblSecondVariable) ucrInputNumericByNumeric.SetItems({"Scatter plot", "Line plot", "Line plot + points"}) ucrInputNumericByNumeric.SetName("Scatter plot") @@ -125,6 +123,7 @@ Public Class dlgDescribeTwoVarGraph ucrInputCategoricalByNumeric.SetItems(strNumericCategoricalPlots) ucrInputCategoricalByNumeric.SetName("Summary Plot + Points") ucrInputCategoricalByNumeric.SetDropDownStyleAsNonEditable() + ucrInputCategoricalByCategorical.SetLinkedDisplayControl(grpSummaries) ucrInputCategoricalByCategorical.SetItems({"Bar Chart", "Mosaic Plot"}) ucrInputCategoricalByCategorical.SetName("Bar Chart") @@ -134,8 +133,9 @@ Public Class dlgDescribeTwoVarGraph clsCoordFlipFunc.SetRCommand("coord_flip") clsCoordFlipParam.SetArgumentName("coord_flip") clsCoordFlipParam.SetArgument(clsCoordFlipFunc) - ucrFlipCoordinates.SetText("Flip Coordinates") - ucrFlipCoordinates.SetParameter(clsCoordFlipParam, bNewChangeParameterValue:=False, bNewAddRemoveParameter:=True) + ucrChkFlipCoordinates.SetText("Flip Coordinates") + ucrChkFlipCoordinates.SetParameter(clsCoordFlipParam, bNewChangeParameterValue:=False, bNewAddRemoveParameter:=True) + ucrChkFlipCoordinates.SetLinkedDisplayControl(grpOptions) ucrChkFreeScaleYAxis.SetText("Free Scale Y Axis") ucrChkFreeScaleYAxis.SetParameter(New RParameter("scales", iNewPosition:=3), bNewChangeParameterValue:=False, bNewAddRemoveParameter:=False) @@ -167,6 +167,70 @@ Public Class dlgDescribeTwoVarGraph ucrNudTransparency.SetLinkedDisplayControl(lblPointTransparency) ucrNudTransparency.SetRDefault(1) + ucrChkDiagonal.SetText("Diagonal") + ucrChkDiagonal.AddParameterPresentCondition(True, "diag") + ucrChkDiagonal.AddParameterPresentCondition(False, "diag", False) + ucrChkDiagonal.AddToLinkedControls({ucrInputDiagonalContinous, ucrInputDiagonalDiscrete, + ucrInputDiagonalNA}, {True}, bNewLinkedHideIfParameterMissing:=True) + + ucrChkLower.SetText("Lower") + ucrChkLower.AddParameterPresentCondition(True, "lower") + ucrChkLower.AddParameterPresentCondition(False, "lower", False) + ucrChkLower.AddToLinkedControls({ucrInputLowerContinous, ucrInputLowerDiscrete, ucrInputLowerCombo, + ucrInputLowerNA}, {True}, bNewLinkedHideIfParameterMissing:=True) + + ucrChkUpper.SetText("Upper") + ucrChkUpper.AddParameterPresentCondition(True, "upper") + ucrChkUpper.AddParameterPresentCondition(False, "upper", False) + ucrChkUpper.AddToLinkedControls({ucrInputUpperContinous, ucrInputUpperDiscrete, ucrInputUpperCombo, + ucrInputUpperNA}, {True}, bNewLinkedHideIfParameterMissing:=True) + + ucrInputLowerContinous.SetParameter(New RParameter("continuous", iNewPosition:=0)) + ucrInputLowerContinous.SetItems({"points", "smooth", "smooth_loess", "density", "cor", "blank"}, bAddConditions:=True) + ucrInputLowerContinous.SetLinkedDisplayControl(lblLowerContinous) + + ucrInputLowerCombo.SetParameter(New RParameter("combo", iNewPosition:=1)) + ucrInputLowerCombo.SetItems({"box", "box_no_facet", "dot", "dot_no_facet", "facethist", "facetdensity", + "denstrip", "blank"}, bAddConditions:=True) + ucrInputLowerCombo.SetLinkedDisplayControl(lblLowerCombo) + + ucrInputLowerDiscrete.SetParameter(New RParameter("discrete", iNewPosition:=2)) + ucrInputLowerDiscrete.SetItems({"facetbar", "ratio", "blank"}, bAddConditions:=True) + ucrInputLowerDiscrete.SetLinkedDisplayControl(lblLowerDiscrete) + + ucrInputLowerNA.SetParameter(New RParameter("na", iNewPosition:=3)) + ucrInputLowerNA.SetItems({"na", "blank"}, bAddConditions:=True) + ucrInputLowerNA.SetLinkedDisplayControl(lblLowerNA) + + ucrInputUpperContinous.SetParameter(New RParameter("continuous", iNewPosition:=0)) + ucrInputUpperContinous.SetItems({"point", "smooth", "smooth_loess", "density", "cor", "blank"}, bAddConditions:=True) + ucrInputUpperContinous.SetLinkedDisplayControl(lblUpperContinous) + + ucrInputUpperCombo.SetParameter(New RParameter("combo", iNewPosition:=1)) + ucrInputUpperCombo.SetItems({"box", "box_no_facet", "dot", "dot_no_facet", "facethist", "facetdensity", + "denstrip", "blank"}, bAddConditions:=True) + ucrInputUpperCombo.SetLinkedDisplayControl(lblUpperCombo) + + ucrInputUpperDiscrete.SetParameter(New RParameter("discrete", iNewPosition:=2)) + ucrInputUpperDiscrete.SetItems({"facetbar", "count", "ratio", "blank"}, bAddConditions:=True) + ucrInputUpperDiscrete.SetLinkedDisplayControl(lblUpperDiscrete) + + ucrInputUpperNA.SetParameter(New RParameter("na", iNewPosition:=3)) + ucrInputUpperNA.SetItems({"na", "blank"}, bAddConditions:=True) + ucrInputUpperNA.SetLinkedDisplayControl(lblUpperNA) + + ucrInputDiagonalContinous.SetParameter(New RParameter("continuous", iNewPosition:=0)) + ucrInputDiagonalContinous.SetItems({"densityDiag", "barDiag", "blankDiag"}, bAddConditions:=True) + ucrInputDiagonalContinous.SetLinkedDisplayControl(lblDiagonalContinuous) + + ucrInputDiagonalDiscrete.SetParameter(New RParameter("discrete", iNewPosition:=1)) + ucrInputDiagonalDiscrete.SetItems({"barDiag", "blankDiag"}, bAddConditions:=True) + ucrInputDiagonalDiscrete.SetLinkedDisplayControl(lblDiagonalDiscrete) + + ucrInputDiagonalNA.SetParameter(New RParameter("na", iNewPosition:=2)) + ucrInputDiagonalNA.SetItems({"naDiag", "blankDiag"}, bAddConditions:=True) + ucrInputDiagonalNA.SetLinkedDisplayControl(lblDiagonalNA) + ucrSaveGraph.SetPrefix("two_var") ucrSaveGraph.SetSaveTypeAsGraph() ucrSaveGraph.SetDataFrameSelector(ucrSelectorTwoVarGraph.ucrAvailableDataFrames) @@ -176,7 +240,9 @@ Public Class dlgDescribeTwoVarGraph End Sub Private Sub SetDefaults() + clsGGpairsFunction = New RFunction clsRGGplotFunction = New RFunction + clsDummyFunction = New RFunction clsRFacet = New RFunction clsThemeFunction = GgplotDefaults.clsDefaultThemeFunction.Clone() dctThemeFunctions = New Dictionary(Of String, RFunction)(GgplotDefaults.dctThemeFunctions) @@ -216,7 +282,10 @@ Public Class dlgDescribeTwoVarGraph clsAesCategoricalByNumericXNumeric = New RFunction clsAesStatSummaryHlineCategoricalByNumeric = New RFunction clsAesStatSummaryHlineNumericByCategorical = New RFunction - + clsGGpairAesFunction = New RFunction + clsUpperListFunction = New RFunction + clsLowerListFunction = New RFunction + clsDiagonalListFunction = New RFunction clsBaseOperator = New ROperator bResetSubdialog = True @@ -225,8 +294,34 @@ Public Class dlgDescribeTwoVarGraph ucrSaveGraph.Reset() ucrSelectorTwoVarGraph.Reset() + cmdOptions.Enabled = False ucrReceiverFirstVars.SetMeAsReceiver() + clsDummyFunction.AddParameter("checked", "pair", iPosition:=0) + + clsUpperListFunction.SetRCommand("list") + clsUpperListFunction.AddParameter("continuous", Chr(34) & "cor" & Chr(34), iPosition:=0) + clsUpperListFunction.AddParameter("combo", Chr(34) & "box_no_facet" & Chr(34), iPosition:=1) + clsUpperListFunction.AddParameter("discrete", Chr(34) & "count" & Chr(34), iPosition:=2) + clsUpperListFunction.AddParameter("na", Chr(34) & "na" & Chr(34), iPosition:=3) + + clsLowerListFunction.SetRCommand("list") + clsLowerListFunction.AddParameter("continuous", Chr(34) & "points" & Chr(34), iPosition:=0) + clsLowerListFunction.AddParameter("combo", Chr(34) & "facethist" & Chr(34), iPosition:=1) + clsLowerListFunction.AddParameter("discrete", Chr(34) & "facetbar" & Chr(34), iPosition:=2) + clsLowerListFunction.AddParameter("na", Chr(34) & "na" & Chr(34), iPosition:=3) + + clsDiagonalListFunction.SetRCommand("list") + clsDiagonalListFunction.AddParameter("continuous", Chr(34) & "densityDiag" & Chr(34), iPosition:=0) + clsDiagonalListFunction.AddParameter("discrete", Chr(34) & "barDiag" & Chr(34), iPosition:=1) + clsDiagonalListFunction.AddParameter("na", Chr(34) & "naDiag" & Chr(34), iPosition:=2) + + clsGGpairAesFunction.SetPackageName("ggplot2") + clsGGpairAesFunction.SetRCommand("aes") + + clsGGpairsFunction.SetPackageName("GGally") + clsGGpairsFunction.SetRCommand("ggpairs") + clsBaseOperator.SetOperation("+") clsRGGplotFunction.SetPackageName("ggplot2") @@ -338,13 +433,13 @@ Public Class dlgDescribeTwoVarGraph clsBaseOperator.AddParameter("ggplot", clsRFunctionParameter:=clsRGGplotFunction, iPosition:=0) clsBaseOperator.SetAssignTo("last_graph", strTempDataframe:=ucrSelectorTwoVarGraph.ucrAvailableDataFrames.cboAvailableDataFrames.Text, strTempGraph:="last_graph") - ucrBase.clsRsyntax.SetBaseROperator(clsBaseOperator) + ucrBase.clsRsyntax.SetBaseRFunction(clsGGpairsFunction) + AddDataFrame() ' bResetSubdialog = True End Sub Private Sub SetRCodeForControls(bReset As Boolean) bRCodeSet = False - ucrReceiverSecondVar.AddAdditionalCodeParameterPair(clsAesNumericByCategoricalYNumeric, New RParameter("x", 0), iAdditionalPairNo:=1) ucrReceiverSecondVar.AddAdditionalCodeParameterPair(clsAesNumericByCategoricalXNumeric, New RParameter("colour", 2), iAdditionalPairNo:=2) ucrReceiverSecondVar.AddAdditionalCodeParameterPair(clsAesCategoricalByNumericYNumeric, New RParameter("y", 1), iAdditionalPairNo:=3) @@ -352,15 +447,32 @@ Public Class dlgDescribeTwoVarGraph ucrReceiverSecondVar.AddAdditionalCodeParameterPair(clsAesNumericByNumeric, New RParameter("x", 0), iAdditionalPairNo:=5) ucrReceiverSecondVar.AddAdditionalCodeParameterPair(clsGgmosaicProduct, New RParameter("1", 1, bNewIncludeArgumentName:=False), iAdditionalPairNo:=6) ucrReceiverSecondVar.AddAdditionalCodeParameterPair(clsAesStatSummaryHlineCategoricalByNumeric, New RParameter("y", 1), iAdditionalPairNo:=7) + ucrSaveGraph.AddAdditionalRCode(clsGGpairsFunction, bReset) ucrSelectorTwoVarGraph.SetRCode(clsRGGplotFunction, bReset) ucrReceiverSecondVar.SetRCode(clsAesCategoricalByCategoricalBarChart, bReset) ucrSaveGraph.SetRCode(clsBaseOperator, bReset) - ucrFlipCoordinates.SetRCode(clsBaseOperator, bReset) + ucrChkFlipCoordinates.SetRCode(clsBaseOperator, bReset) ucrChkFreeScaleYAxis.SetRCode(clsRFacet, bReset) ucrInputPosition.SetRCode(clsGeomBar, bReset) ucrNudJitter.SetRCode(clsGeomJitter, bReset) ucrNudTransparency.SetRCode(clsGeomJitter, bReset) + ucrPnlByPairs.SetRCode(clsDummyFunction, bReset) + ucrReceiverColour.SetRCode(clsGGpairAesFunction, bReset) + ucrInputLowerContinous.SetRCode(clsLowerListFunction, bReset) + ucrInputLowerDiscrete.SetRCode(clsLowerListFunction, bReset) + ucrInputLowerCombo.SetRCode(clsLowerListFunction, bReset) + ucrInputLowerNA.SetRCode(clsLowerListFunction, bReset) + ucrInputUpperContinous.SetRCode(clsUpperListFunction, bReset) + ucrInputUpperDiscrete.SetRCode(clsUpperListFunction, bReset) + ucrInputUpperCombo.SetRCode(clsUpperListFunction, bReset) + ucrInputUpperNA.SetRCode(clsUpperListFunction, bReset) + ucrInputDiagonalContinous.SetRCode(clsDiagonalListFunction, bReset) + ucrInputDiagonalDiscrete.SetRCode(clsDiagonalListFunction, bReset) + ucrInputDiagonalNA.SetRCode(clsDiagonalListFunction, bReset) + ucrChkLower.SetRCode(clsGGpairsFunction, bReset) + ucrChkUpper.SetRCode(clsGGpairsFunction, bReset) + ucrChkDiagonal.SetRCode(clsGGpairsFunction, bReset) bRCodeSet = True Results() @@ -368,7 +480,9 @@ Public Class dlgDescribeTwoVarGraph End Sub Private Sub TestOkEnabled() - If Not ucrReceiverFirstVars.IsEmpty AndAlso Not ucrReceiverSecondVar.IsEmpty AndAlso ucrSaveGraph.IsComplete Then + If rdoBy.Checked AndAlso Not ucrReceiverFirstVars.IsEmpty AndAlso Not ucrReceiverSecondVar.IsEmpty AndAlso ucrSaveGraph.IsComplete Then + ucrBase.OKEnabled(True) + ElseIf rdoPairs.Checked AndAlso Not ucrReceiverFirstVars.IsEmpty Then ucrBase.OKEnabled(True) Else ucrBase.OKEnabled(False) @@ -619,6 +733,7 @@ Public Class dlgDescribeTwoVarGraph Private Sub ucrReceiverFirstVars_ControlValueChanged(ucrChangedControl As ucrCore) Handles ucrReceiverFirstVars.ControlValueChanged Results() + clsGGpairsFunction.AddParameter("columns", ucrReceiverFirstVars.ucrMultipleVariables.GetVariableNames(), iPosition:=1) End Sub Private Sub ucrReceiverSecondVar_ControlValueChanged(ucrChangedControl As ucrCore) Handles ucrReceiverSecondVar.ControlValueChanged @@ -627,8 +742,7 @@ Public Class dlgDescribeTwoVarGraph Results() End Sub - - Private Sub Controls_ControlContentsChanged(ucrChangedControl As ucrCore) Handles ucrReceiverSecondVar.ControlContentsChanged, ucrReceiverFirstVars.ControlContentsChanged, ucrSaveGraph.ControlContentsChanged + Private Sub Controls_ControlContentsChanged(ucrChangedControl As ucrCore) Handles ucrReceiverSecondVar.ControlContentsChanged, ucrReceiverFirstVars.ControlContentsChanged, ucrSaveGraph.ControlContentsChanged, ucrPnlByPairs.ControlContentsChanged TestOkEnabled() End Sub @@ -741,7 +855,7 @@ Public Class dlgDescribeTwoVarGraph Return clsBaseOperator.ContainsParameter("coord_flip") End Function - Private Sub ucrFlipCoordinates_ControlValueChanged(ucrChangedControl As ucrCore) Handles ucrFlipCoordinates.ControlValueChanged + Private Sub ucrFlipCoordinates_ControlValueChanged(ucrChangedControl As ucrCore) Handles ucrChkFlipCoordinates.ControlValueChanged Dim clsScaleParam As RParameter If bRCodeSet Then @@ -755,11 +869,74 @@ Public Class dlgDescribeTwoVarGraph End If ucrChkFreeScaleYAxis.ClearConditions() ucrChkFreeScaleYAxis.AddParameterPresentCondition(True, "scales") - If ucrFlipCoordinates.Checked Then + If ucrChkFlipCoordinates.Checked Then ucrChkFreeScaleYAxis.AddParameterValuesCondition(True, "scales", {Chr(34) & "free" & Chr(34), Chr(34) & "free_x" & Chr(34)}) Else ucrChkFreeScaleYAxis.AddParameterValuesCondition(True, "scales", {Chr(34) & "free" & Chr(34), Chr(34) & "free_y" & Chr(34)}) End If End If End Sub + + Private Sub ucrPnlByPairs_ControlValueChanged(ucrChangedControl As ucrCore) Handles ucrPnlByPairs.ControlValueChanged + ucrReceiverFirstVars.ucrMultipleVariables.Clear() + If rdoBy.Checked Then + cmdOptions.Enabled = True + ucrReceiverFirstVars.ucrMultipleVariables.SetSingleTypeStatus(True, bIsCategoricalNumeric:=True) + Else + cmdOptions.Enabled = False + ucrReceiverFirstVars.ucrMultipleVariables.SetSingleTypeStatus(False) + End If + If bRCodeSet Then + If rdoBy.Checked Then + ucrBase.clsRsyntax.SetBaseROperator(clsBaseOperator) + clsDummyFunction.AddParameter("checked", "by", iPosition:=0) + Else + ucrBase.clsRsyntax.SetBaseRFunction(clsGGpairsFunction) + clsDummyFunction.AddParameter("checked", "pair", iPosition:=0) + End If + End If + AddRemoveColourParameter() + End Sub + + Private Sub ucrSelectorTwoVarGraph_ControlValueChanged(ucrChangedControl As ucrCore) Handles ucrSelectorTwoVarGraph.ControlValueChanged + AddDataFrame() + End Sub + + Private Sub AddDataFrame() + Dim clsGetDataFrameFunction As RFunction = ucrSelectorTwoVarGraph.ucrAvailableDataFrames.clsCurrDataFrame.Clone + clsGetDataFrameFunction.RemoveParameterByName("stack_data") + clsGGpairsFunction.AddParameter("data", clsRFunctionParameter:=clsGetDataFrameFunction, iPosition:=0) + End Sub + + Private Sub ucrReceiverColour_ControlValueChanged(ucrChangedControl As ucrCore) Handles ucrReceiverColour.ControlValueChanged + AddRemoveColourParameter() + End Sub + + Private Sub AddRemoveColourParameter() + If Not ucrReceiverColour.IsEmpty And rdoPairs.Checked Then + clsGGpairsFunction.AddParameter("colour", clsRFunctionParameter:=clsGGpairAesFunction, bIncludeArgumentName:=False, iPosition:=2) + Else + clsGGpairsFunction.RemoveParameterByName("colour") + End If + End Sub + + Private Sub LowerUpperDiagonal_ControlValueChanged(ucrChangedControl As ucrCore) Handles ucrChkLower.ControlValueChanged, ucrChkUpper.ControlValueChanged, ucrChkDiagonal.ControlValueChanged + If bRCodeSet Then + If ucrChkDiagonal.Checked Then + clsGGpairsFunction.AddParameter("diag", clsRFunctionParameter:=clsDiagonalListFunction, iPosition:=3) + Else + clsGGpairsFunction.RemoveParameterByName("diag") + End If + If ucrChkLower.Checked Then + clsGGpairsFunction.AddParameter("lower", clsRFunctionParameter:=clsLowerListFunction, iPosition:=4) + Else + clsGGpairsFunction.RemoveParameterByName("lower") + End If + If ucrChkUpper.Checked Then + clsGGpairsFunction.AddParameter("upper", clsRFunctionParameter:=clsUpperListFunction, iPosition:=5) + Else + clsGGpairsFunction.RemoveParameterByName("upper") + End If + End If + End Sub End Class \ No newline at end of file diff --git a/instat/dlgFromLibrary.Designer.vb b/instat/dlgFromLibrary.Designer.vb index 0706e4d5a92..49a863ebf1f 100644 --- a/instat/dlgFromLibrary.Designer.vb +++ b/instat/dlgFromLibrary.Designer.vb @@ -46,10 +46,10 @@ Partial Class dlgFromLibrary Me.cmdHelp = New System.Windows.Forms.Button() Me.rdoDefaultDatasets = New System.Windows.Forms.RadioButton() Me.rdoInstatCollection = New System.Windows.Forms.RadioButton() + Me.ucrNewDataFrameName = New instat.ucrSave() Me.ucrInputPackages = New instat.ucrInputComboBox() Me.ucrBase = New instat.ucrButtons() Me.ucrPnlOptions = New instat.UcrPanel() - Me.ucrNewDataFrameName = New instat.ucrSave() Me.SuspendLayout() ' 'cmdLibraryCollection @@ -102,7 +102,7 @@ Partial Class dlgFromLibrary Me.cmdHelp.Name = "cmdHelp" Me.cmdHelp.Size = New System.Drawing.Size(75, 23) Me.cmdHelp.TabIndex = 8 - Me.cmdHelp.Text = "Help" + Me.cmdHelp.Text = "R Help" Me.cmdHelp.UseVisualStyleBackColor = True ' 'rdoDefaultDatasets @@ -141,6 +141,15 @@ Partial Class dlgFromLibrary Me.rdoInstatCollection.TextAlign = System.Drawing.ContentAlignment.MiddleCenter Me.rdoInstatCollection.UseVisualStyleBackColor = False ' + 'ucrNewDataFrameName + ' + Me.ucrNewDataFrameName.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink + Me.ucrNewDataFrameName.Location = New System.Drawing.Point(10, 259) + Me.ucrNewDataFrameName.Margin = New System.Windows.Forms.Padding(4, 5, 4, 5) + Me.ucrNewDataFrameName.Name = "ucrNewDataFrameName" + Me.ucrNewDataFrameName.Size = New System.Drawing.Size(315, 22) + Me.ucrNewDataFrameName.TabIndex = 7 + ' 'ucrInputPackages ' Me.ucrInputPackages.AddQuotesIfUnrecognised = True @@ -172,15 +181,6 @@ Partial Class dlgFromLibrary Me.ucrPnlOptions.Size = New System.Drawing.Size(316, 44) Me.ucrPnlOptions.TabIndex = 0 ' - 'ucrNewDataFrameName - ' - Me.ucrNewDataFrameName.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink - Me.ucrNewDataFrameName.Location = New System.Drawing.Point(10, 259) - Me.ucrNewDataFrameName.Margin = New System.Windows.Forms.Padding(4, 5, 4, 5) - Me.ucrNewDataFrameName.Name = "ucrNewDataFrameName" - Me.ucrNewDataFrameName.Size = New System.Drawing.Size(315, 22) - Me.ucrNewDataFrameName.TabIndex = 7 - ' 'dlgFromLibrary ' Me.AutoScaleDimensions = New System.Drawing.SizeF(96.0!, 96.0!) @@ -201,7 +201,7 @@ Partial Class dlgFromLibrary Me.MinimizeBox = False Me.Name = "dlgFromLibrary" Me.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen - Me.Text = "Open Dataset from Library" + Me.Text = "Import From Library" Me.ResumeLayout(False) Me.PerformLayout() diff --git a/instat/dlgRandomSample.designer.vb b/instat/dlgRandomSample.designer.vb index 47c04c79fd2..3aef9ee539c 100644 --- a/instat/dlgRandomSample.designer.vb +++ b/instat/dlgRandomSample.designer.vb @@ -19,7 +19,7 @@ Partial Class dlgRandomSample 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 @@ -36,7 +36,7 @@ Partial Class dlgRandomSample '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() Me.lblSampleSize = New System.Windows.Forms.Label() @@ -97,7 +97,7 @@ Partial Class dlgRandomSample 'ucrSaveRandomSample ' Me.ucrSaveRandomSample.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink - Me.ucrSaveRandomSample.Location = New System.Drawing.Point(10, 219) + Me.ucrSaveRandomSample.Location = New System.Drawing.Point(10, 232) Me.ucrSaveRandomSample.Margin = New System.Windows.Forms.Padding(4, 5, 4, 5) Me.ucrSaveRandomSample.Name = "ucrSaveRandomSample" Me.ucrSaveRandomSample.Size = New System.Drawing.Size(365, 22) @@ -170,7 +170,7 @@ Partial Class dlgRandomSample ' Me.ucrBase.AutoSize = True Me.ucrBase.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink - Me.ucrBase.Location = New System.Drawing.Point(10, 248) + Me.ucrBase.Location = New System.Drawing.Point(10, 262) Me.ucrBase.Name = "ucrBase" Me.ucrBase.Size = New System.Drawing.Size(405, 52) Me.ucrBase.TabIndex = 9 @@ -179,7 +179,7 @@ Partial Class dlgRandomSample ' Me.AutoScaleDimensions = New System.Drawing.SizeF(96.0!, 96.0!) Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi - Me.ClientSize = New System.Drawing.Size(479, 300) + Me.ClientSize = New System.Drawing.Size(479, 336) Me.Controls.Add(Me.ucrInputRngKind) Me.Controls.Add(Me.ucrChkRngKind) Me.Controls.Add(Me.ucrSaveRandomSample) diff --git a/instat/dlgRandomSample.vb b/instat/dlgRandomSample.vb index b35d577d709..bd9515c9759 100644 --- a/instat/dlgRandomSample.vb +++ b/instat/dlgRandomSample.vb @@ -87,6 +87,7 @@ Public Class dlgRandomSample clsMultipleSamplesFunction = New RFunction clsDistributionFunction = New RFunction clsRNGKindFunction = New RFunction + ucrBase.clsRsyntax.ClearCodes() ucrSelectorRandomSamples.Reset() ucrSaveRandomSample.Reset() @@ -100,11 +101,11 @@ Public Class dlgRandomSample ucrDistWithParameters.SetParameters() clsMultipleSamplesFunction.SetRCommand("replicate") - clsMultipleSamplesFunction.AddParameter("n", 1) + clsMultipleSamplesFunction.AddParameter("n", 1, iPosition:=0) clsDistributionFunction = ucrDistWithParameters.clsCurrRFunction - clsMultipleSamplesFunction.AddParameter("expr", clsRFunctionParameter:=clsDistributionFunction) + clsMultipleSamplesFunction.AddParameter("expr", clsRFunctionParameter:=clsDistributionFunction, iPosition:=1) ucrBase.clsRsyntax.SetBaseRFunction(clsMultipleSamplesFunction) ucrBase.clsRsyntax.SetAssignTo(strAssignToName:=ucrSaveRandomSample.GetText, strTempDataframe:=ucrSelectorRandomSamples.cboAvailableDataFrames.Text, strTempColumn:=ucrSaveRandomSample.GetText, bAssignToIsPrefix:=True) @@ -173,7 +174,9 @@ Public Class dlgRandomSample SetNewColumName() End Sub - Private Sub ucrSaveRandomSample_ControlContentsChanged(ucrChangedControl As ucrCore) Handles ucrSaveRandomSample.ControlContentsChanged, ucrSelectorRandomSamples.ControlContentsChanged, ucrChkSetSeed.ControlContentsChanged, ucrNudSeed.ControlContentsChanged, ucrSampleSize.ControlContentsChanged, ucrInputRngKind.ControlContentsChanged, ucrChkRngKind.ControlContentsChanged + Private Sub ucrSaveRandomSample_ControlContentsChanged(ucrChangedControl As ucrCore) Handles ucrSaveRandomSample.ControlContentsChanged, ucrSelectorRandomSamples.ControlContentsChanged, + ucrChkSetSeed.ControlContentsChanged, ucrNudSeed.ControlContentsChanged, ucrSampleSize.ControlContentsChanged, ucrInputRngKind.ControlContentsChanged, + ucrChkRngKind.ControlContentsChanged TestOKEnabled() End Sub diff --git a/instat/dlgRenameObjects.Designer.vb b/instat/dlgRenameObjects.Designer.vb index 09454c6dc28..fd37c9950c1 100644 --- a/instat/dlgRenameObjects.Designer.vb +++ b/instat/dlgRenameObjects.Designer.vb @@ -119,7 +119,7 @@ Partial Class dlgRenameObjects Me.ucrInputType.IsReadOnly = False Me.ucrInputType.Location = New System.Drawing.Point(262, 153) Me.ucrInputType.Name = "ucrInputType" - Me.ucrInputType.Size = New System.Drawing.Size(82, 21) + Me.ucrInputType.Size = New System.Drawing.Size(120, 21) Me.ucrInputType.TabIndex = 6 ' 'lblType diff --git a/instat/dlgRenameObjects.vb b/instat/dlgRenameObjects.vb index d700babc012..3b8b65f260d 100644 --- a/instat/dlgRenameObjects.vb +++ b/instat/dlgRenameObjects.vb @@ -22,6 +22,7 @@ Public Class dlgRenameObjects Dim strSelectedColumn As String = "" Dim strSelectedDataFrame As String = "" Private clsDefaultFunction As New RFunction + Private dctTypes As New Dictionary(Of String, String) Private Sub dlgRenameObjects_Load(sender As Object, e As EventArgs) Handles MyBase.Load If bFirstLoad Then @@ -49,7 +50,6 @@ Public Class dlgRenameObjects End Sub Private Sub InitialiseDialog() - Dim dctType As New Dictionary(Of String, String) ucrBase.iHelpTopicID = 350 'ucrSelector @@ -67,13 +67,14 @@ Public Class dlgRenameObjects ucrInputNewName.SetValidationTypeAsRVariable() ucrInputType.SetParameter(New RParameter("object_type", 3)) - dctType.Add("Objects", Chr(34) & "object" & Chr(34)) - dctType.Add("Filters", Chr(34) & "filter" & Chr(34)) - dctType.Add("Calculations", Chr(34) & "calculation" & Chr(34)) - dctType.Add("Tables", Chr(34) & "table" & Chr(34)) - dctType.Add("Graphs", Chr(34) & "graph" & Chr(34)) - dctType.Add("Models", Chr(34) & "model" & Chr(34)) - ucrInputType.SetItems(dctType) + dctTypes.Add("Objects", Chr(34) & "object" & Chr(34)) + dctTypes.Add("Filters", Chr(34) & "filter" & Chr(34)) + dctTypes.Add("Column selections", Chr(34) & "column_selection" & Chr(34)) + dctTypes.Add("Calculations", Chr(34) & "calculation" & Chr(34)) + dctTypes.Add("Tables", Chr(34) & "table" & Chr(34)) + dctTypes.Add("Graphs", Chr(34) & "graph" & Chr(34)) + dctTypes.Add("Models", Chr(34) & "model" & Chr(34)) + ucrInputType.SetItems(dctTypes) ucrInputType.SetDropDownStyleAsNonEditable() End Sub @@ -124,26 +125,13 @@ Public Class dlgRenameObjects End Sub Private Sub ucrInputType_ControlValueChanged(ucrChangedControl As ucrCore) Handles ucrInputType.ControlValueChanged - Select Case ucrInputType.GetValue() - Case "Objects" - ucrReceiverCurrentName.SetItemType("object") - ucrReceiverCurrentName.strSelectorHeading = "Objects" - Case "Filters" - ucrReceiverCurrentName.SetItemType("filter") - ucrReceiverCurrentName.strSelectorHeading = "Filters" - Case "Calculations" - ucrReceiverCurrentName.SetItemType("calculation") - ucrReceiverCurrentName.strSelectorHeading = "Calculations" - Case "Tables" - ucrReceiverCurrentName.SetItemType("table") - ucrReceiverCurrentName.strSelectorHeading = "Tables" - Case "Graphs" - ucrReceiverCurrentName.SetItemType("graph") - ucrReceiverCurrentName.strSelectorHeading = "Graphs" - Case "Models" - ucrReceiverCurrentName.SetItemType("model") - ucrReceiverCurrentName.strSelectorHeading = "Models" - End Select + Dim key As String = dctTypes.Keys(ucrInputType.cboInput.SelectedIndex) + Dim value As String = "" + + If key IsNot Nothing AndAlso dctTypes.TryGetValue(key, value) Then + ucrReceiverCurrentName.strSelectorHeading = key + ucrReceiverCurrentName.SetItemType(value.Replace(Chr(34), "")) + End If End Sub Private Sub CoreControls_ContentsChanged() Handles ucrInputNewName.ControlContentsChanged, ucrSelectorForRenameObject.ControlContentsChanged, ucrReceiverCurrentName.ControlContentsChanged diff --git a/instat/dlgSelect.vb b/instat/dlgSelect.vb index 740428e07e2..77c24b2d15f 100644 --- a/instat/dlgSelect.vb +++ b/instat/dlgSelect.vb @@ -35,6 +35,8 @@ Public Class dlgSelect Private Sub InitialiseDialog() ucrBase.iHelpTopicID = 597 + ucrBase.clsRsyntax.iCallType = 2 + ucrInputSelectPreview.txtInput.ReadOnly = True ucrReceiverSelect.SetItemType("column_selection") ucrReceiverSelect.strSelectorHeading = "Column selections" diff --git a/instat/dlgSelectColumns.Designer.vb b/instat/dlgSelectColumns.Designer.vb index 56440696846..9f94031b7a5 100644 --- a/instat/dlgSelectColumns.Designer.vb +++ b/instat/dlgSelectColumns.Designer.vb @@ -34,6 +34,7 @@ Partial Class dlgSelectColumns Me.lblTo = New System.Windows.Forms.Label() Me.lblFrom = New System.Windows.Forms.Label() Me.lblColumnType = New System.Windows.Forms.Label() + Me.ucrChkNot = New instat.ucrCheck() Me.ucrInputColumnType = New instat.ucrInputComboBox() Me.ucrNudTo = New instat.ucrNud() Me.ucrNudFrom = New instat.ucrNud() @@ -103,7 +104,7 @@ Partial Class dlgSelectColumns ' Me.cmdAddCondition.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!) Me.cmdAddCondition.ImeMode = System.Windows.Forms.ImeMode.NoControl - Me.cmdAddCondition.Location = New System.Drawing.Point(275, 85) + Me.cmdAddCondition.Location = New System.Drawing.Point(276, 107) Me.cmdAddCondition.Name = "cmdAddCondition" Me.cmdAddCondition.Size = New System.Drawing.Size(112, 30) Me.cmdAddCondition.TabIndex = 12 @@ -172,6 +173,15 @@ Partial Class dlgSelectColumns Me.lblColumnType.Text = "Column Type:" Me.lblColumnType.Visible = False ' + 'ucrChkNot + ' + Me.ucrChkNot.AutoSize = True + Me.ucrChkNot.Checked = False + Me.ucrChkNot.Location = New System.Drawing.Point(276, 81) + Me.ucrChkNot.Name = "ucrChkNot" + Me.ucrChkNot.Size = New System.Drawing.Size(110, 23) + Me.ucrChkNot.TabIndex = 23 + ' 'ucrInputColumnType ' Me.ucrInputColumnType.AddQuotesIfUnrecognised = True @@ -305,6 +315,7 @@ Partial Class dlgSelectColumns Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi Me.AutoSize = True Me.ClientSize = New System.Drawing.Size(518, 464) + Me.Controls.Add(Me.ucrChkNot) Me.Controls.Add(Me.lblColumnType) Me.Controls.Add(Me.ucrInputColumnType) Me.Controls.Add(Me.lblFrom) @@ -362,4 +373,5 @@ Partial Class dlgSelectColumns Friend WithEvents ucrNudFrom As ucrNud Friend WithEvents ucrInputColumnType As ucrInputComboBox Friend WithEvents lblColumnType As Label + Friend WithEvents ucrChkNot As ucrCheck End Class diff --git a/instat/dlgSelectColumns.vb b/instat/dlgSelectColumns.vb index 177a87764c9..d44c4894eb7 100644 --- a/instat/dlgSelectColumns.vb +++ b/instat/dlgSelectColumns.vb @@ -31,6 +31,7 @@ Public Class dlgSelectColumns SetDefaults() End If SetRcodeForControls(bReset) + EnableDisableAddConditionButton() bReset = False autoTranslate(Me) End Sub @@ -46,17 +47,17 @@ Public Class dlgSelectColumns ucrReceiverMultipleVariables.SetParameter(New RParameter("x", 0)) ucrReceiverMultipleVariables.SetParameterIsString() - ucrInputSelectOperation.SetItems({"Columns", "Starts with", "Ends with", "Contains", "Matches", "Numeric range", "Last column"}) + ucrInputSelectOperation.SetItems({"Columns", "Starts with", "Ends with", "Contains", "Matches", "Numeric range", "Last column", "Where"}) ucrInputSelectOperation.SetDropDownStyleAsNonEditable() - ucrInputColumnType.SetItems({"Numeric", "Factor", "Character"}) + ucrInputColumnType.SetItems({"Numeric", "Factor", "Character", "Logical", "Variable label", "Empty columns", "NA columns"}) ucrInputColumnType.SetDropDownStyleAsNonEditable() ucrInputSelectOperation.AddToLinkedControls(ucrChkIgnoreCase, {"Starts with", "Ends with", "Contains", "Matches"}, bNewLinkedHideIfParameterMissing:=True) ucrInputSelectOperation.AddToLinkedControls(ucrReceiverMultipleVariables, {"Columns"}, bNewLinkedHideIfParameterMissing:=True) ucrInputSelectOperation.AddToLinkedControls({ucrNudFrom, ucrNudTo}, {"Numeric range"}, bNewLinkedAddRemoveParameter:=True, bNewLinkedHideIfParameterMissing:=True) ucrInputSelectOperation.AddToLinkedControls(ucrInputText, {"Numeric range", "Starts with", "Ends with", "Contains", "Matches"}, bNewLinkedHideIfParameterMissing:=True) - 'ucrInputSelectOperation.AddToLinkedControls(ucrInputColumnType, {"Where"}, bNewLinkedHideIfParameterMissing:=True)' TODO: uncomment once selection using where is added + ucrInputSelectOperation.AddToLinkedControls(ucrInputColumnType, {"Where"}, bNewLinkedHideIfParameterMissing:=True) ucrReceiverMultipleVariables.SetLinkedDisplayControl(lblSeclectedColumns) ucrInputText.SetLinkedDisplayControl(lblString) ucrNudFrom.SetLinkedDisplayControl(lblFrom) @@ -82,6 +83,8 @@ Public Class dlgSelectColumns ucrNudTo.SetParameter(New RParameter("to", 1)) ucrNudTo.SetMinMax(1, Integer.MaxValue) + + ucrChkNot.SetText("Add not") End Sub Private Sub SetDefaults() @@ -89,7 +92,6 @@ Public Class dlgSelectColumns clsConditionsList = New RFunction clsFromToOperation = New ROperator - ucrSelectorForColumnSelection.Reset() ucrInputSelectOperation.SetText("Columns") ucrInputColumnType.SetText("Numeric") @@ -106,14 +108,14 @@ Public Class dlgSelectColumns End Sub Private Sub SetRcodeForControls(bReset As Boolean) - ucrSelectorForColumnSelection.SetRCode(clsAddColumnSelection, bReset) - ucrNudFrom.SetRCode(clsFromToOperation, bReset) - ucrNudTo.SetRCode(clsFromToOperation, bReset) + ucrSelectorForColumnSelection.SetRCode(clsAddColumnSelection, bReset, bCloneIfNeeded:=True) + ucrNudFrom.SetRCode(clsFromToOperation, bReset, bCloneIfNeeded:=True) + ucrNudTo.SetRCode(clsFromToOperation, bReset, bCloneIfNeeded:=True) End Sub - Public Sub SetDefaultDataFrame(Optional strDefaultDataframe As String = "") + Public Sub SetDefaultDataFrame(Optional strDefaultDataframe As String = "", Optional bEnableDataframe As Boolean = False) If strDefaultDataframe <> "" Then - ucrSelectorForColumnSelection.SetDataframe(strDefaultDataframe, bEnableDataframe:=False) + ucrSelectorForColumnSelection.SetDataframe(strDefaultDataframe, bEnableDataframe:=bEnableDataframe) ucrSelectorForColumnSelection.ucrAvailableDataFrames.Enabled = False 'Note: This is potentially a duplication because for some reason setting bEnableDataframe:=False in line 117 changes internally End If End Sub @@ -196,22 +198,34 @@ Public Class dlgSelectColumns clsParametersList.AddParameter("prefix", Chr(34) & ucrInputText.GetText & Chr(34), iPosition:=0) clsParametersList.AddParameter("range", clsROperatorParameter:=clsFromToOperation, iPosition:=1) strValue = clsFromToOperation.ToScript - 'TODO: this will be needed when selection depending of variable type e.g factors,characters etc is added! - 'Case "Where" - 'clsCurrentConditionList.AddParameter("operation", Chr(34) & "where" & Chr(34), iPosition:=0) - 'If ucrInputColumnType.GetText = "Numeric" Then - 'clsParametersList.AddParameter("fn", "is.numeric", iPosition:=0) - 'ElseIf ucrInputColumnType.GetText = "Factor" Then - 'clsParametersList.AddParameter("fn", "is.factor", iPosition:=0) - 'ElseIf ucrInputColumnType.GetText = "Character" Then - 'clsParametersList.AddParameter("fn", "is.character", iPosition:=0) - 'End If + Case "Where" + strValue = ucrInputColumnType.GetText + clsCurrentConditionList.AddParameter("operation", Chr(34) & "tidyselect::where" & Chr(34), iPosition:=0) + If strValue = "Numeric" Then + clsParametersList.AddParameter("fn", "is.numeric", iPosition:=0) + ElseIf strValue = "Factor" Then + clsParametersList.AddParameter("fn", "is.factor", iPosition:=0) + ElseIf strValue = "Character" Then + clsParametersList.AddParameter("fn", "is.character", iPosition:=0) + ElseIf strValue = "Logical" Then + clsParametersList.AddParameter("fn", "is.logical", iPosition:=0) + ElseIf strValue = "Variable label" Then + clsParametersList.AddParameter("fn", "is.containlabel", iPosition:=0) + ElseIf strValue = "Empty columns" Then + clsParametersList.AddParameter("fn", "is.emptyvariable", iPosition:=0) + ElseIf strValue = "NA columns" Then + clsParametersList.AddParameter("fn", "is.NAvariable", iPosition:=0) + End If Case "Last column" strValue = "Last column" clsCurrentConditionList.AddParameter("operation", Chr(34) & "tidyselect::last_col" & Chr(34), iPosition:=0) End Select clsCurrentConditionList.AddParameter("parameters", clsRFunctionParameter:=clsParametersList, iPosition:=1) - + If ucrChkNot.Checked Then + clsCurrentConditionList.AddParameter("negation", "TRUE", iPosition:=2) + Else + clsCurrentConditionList.RemoveParameterByName("negation") + End If clsConditionsList.AddParameter("C" & clsConditionsList.clsParameters.Count, clsRFunctionParameter:=(clsCurrentConditionList)) lviCondition = New ListViewItem({ucrInputSelectOperation.GetText, strValue}) lstColumnSelections.Items.Add(lviCondition) @@ -245,12 +259,12 @@ Public Class dlgSelectColumns bEnableOrDisable = False End If Case "Where" - 'add where instance when enabled + bEnableOrDisable = Not ucrInputColumnType.IsEmpty End Select cmdAddCondition.Enabled = bEnableOrDisable End Sub - Private Sub ucrReceiverMultipleVariables_ControlValueChanged(ucrChangedControl As ucrCore) Handles ucrReceiverMultipleVariables.ControlValueChanged, ucrInputSelectOperation.ControlValueChanged, ucrNudFrom.ControlValueChanged, ucrNudTo.ControlValueChanged, ucrInputText.ControlContentsChanged + Private Sub ucrReceiverMultipleVariables_ControlValueChanged(ucrChangedControl As ucrCore) Handles ucrReceiverMultipleVariables.ControlValueChanged, ucrInputSelectOperation.ControlValueChanged, ucrNudFrom.ControlValueChanged, ucrNudTo.ControlValueChanged, ucrInputText.ControlContentsChanged, ucrInputColumnType.ControlContentsChanged EnableDisableAddConditionButton() End Sub @@ -259,6 +273,7 @@ Public Class dlgSelectColumns If lstColumnSelections.Items.Count > 0 Then frmMain.clsRLink.RunScript(clsAddColumnSelection.ToScript, strComment:="Column selection subdialog: Created new column selection", bSilent:=True) dlgSelect.ucrReceiverSelect.Add(ucrInputSelectName.GetText()) + sdgDataOptions.ucrReceiverSelect.Add(ucrInputSelectName.GetText) lstColumnSelections.Items.Clear() clsConditionsList.ClearParameters() End If @@ -268,13 +283,11 @@ Public Class dlgSelectColumns If Not cmdAddCondition.Enabled Then Exit Sub End If - Dim result As MsgBoxResult = MessageBox.Show( text:="Are you sure you want to return to the main dialog?" & Environment.NewLine & "The condition for " & ucrInputSelectOperation.GetText & " has not been added." & Environment.NewLine & "Click the ""Add Condition"" button if you want to add it.", caption:="Return to main dialog?", buttons:=MessageBoxButtons.YesNo, icon:=MessageBoxIcon.Information) e.Cancel = result = MsgBoxResult.No - End Sub End Class \ No newline at end of file diff --git a/instat/dlgTransform.Designer.vb b/instat/dlgTransform.Designer.vb index cea3fd272f8..c3df268c5ff 100644 --- a/instat/dlgTransform.Designer.vb +++ b/instat/dlgTransform.Designer.vb @@ -59,6 +59,9 @@ Partial Class dlgTransform Me.rdoLead = New System.Windows.Forms.RadioButton() Me.rdoLag = New System.Windows.Forms.RadioButton() Me.grpNumericOptions = New System.Windows.Forms.GroupBox() + Me.ucrInputLogicalValues = New instat.ucrInputTextBox() + Me.ucrInputLogicOperations = New instat.ucrInputComboBox() + Me.rdoLogical = New System.Windows.Forms.RadioButton() Me.ucrChkOmitNA = New instat.ucrCheck() Me.ucrNudLagPosition = New instat.ucrNud() Me.lblLagPosition = New System.Windows.Forms.Label() @@ -273,7 +276,7 @@ Partial Class dlgTransform ' Me.rdoRoundOf.AutoSize = True Me.rdoRoundOf.ImeMode = System.Windows.Forms.ImeMode.NoControl - Me.rdoRoundOf.Location = New System.Drawing.Point(11, 19) + Me.rdoRoundOf.Location = New System.Drawing.Point(11, 18) Me.rdoRoundOf.Name = "rdoRoundOf" Me.rdoRoundOf.Size = New System.Drawing.Size(57, 17) Me.rdoRoundOf.TabIndex = 14 @@ -285,7 +288,7 @@ Partial Class dlgTransform ' Me.rdoSignificantDigits.AutoSize = True Me.rdoSignificantDigits.ImeMode = System.Windows.Forms.ImeMode.NoControl - Me.rdoSignificantDigits.Location = New System.Drawing.Point(11, 47) + Me.rdoSignificantDigits.Location = New System.Drawing.Point(11, 44) Me.rdoSignificantDigits.Name = "rdoSignificantDigits" Me.rdoSignificantDigits.Size = New System.Drawing.Size(68, 17) Me.rdoSignificantDigits.TabIndex = 15 @@ -297,7 +300,7 @@ Partial Class dlgTransform ' Me.rdoStandardize.AutoSize = True Me.rdoStandardize.ImeMode = System.Windows.Forms.ImeMode.NoControl - Me.rdoStandardize.Location = New System.Drawing.Point(11, 75) + Me.rdoStandardize.Location = New System.Drawing.Point(11, 70) Me.rdoStandardize.Name = "rdoStandardize" Me.rdoStandardize.Size = New System.Drawing.Size(81, 17) Me.rdoStandardize.TabIndex = 17 @@ -309,7 +312,7 @@ Partial Class dlgTransform ' Me.rdoDifference.AutoSize = True Me.rdoDifference.ImeMode = System.Windows.Forms.ImeMode.NoControl - Me.rdoDifference.Location = New System.Drawing.Point(11, 159) + Me.rdoDifference.Location = New System.Drawing.Point(11, 148) Me.rdoDifference.Name = "rdoDifference" Me.rdoDifference.Size = New System.Drawing.Size(74, 17) Me.rdoDifference.TabIndex = 18 @@ -321,7 +324,7 @@ Partial Class dlgTransform ' Me.rdoLead.AutoSize = True Me.rdoLead.ImeMode = System.Windows.Forms.ImeMode.NoControl - Me.rdoLead.Location = New System.Drawing.Point(11, 131) + Me.rdoLead.Location = New System.Drawing.Point(11, 122) Me.rdoLead.Name = "rdoLead" Me.rdoLead.Size = New System.Drawing.Size(49, 17) Me.rdoLead.TabIndex = 19 @@ -333,7 +336,7 @@ Partial Class dlgTransform ' Me.rdoLag.AutoSize = True Me.rdoLag.ImeMode = System.Windows.Forms.ImeMode.NoControl - Me.rdoLag.Location = New System.Drawing.Point(11, 103) + Me.rdoLag.Location = New System.Drawing.Point(11, 96) Me.rdoLag.Name = "rdoLag" Me.rdoLag.Size = New System.Drawing.Size(43, 17) Me.rdoLag.TabIndex = 20 @@ -343,6 +346,9 @@ Partial Class dlgTransform ' 'grpNumericOptions ' + Me.grpNumericOptions.Controls.Add(Me.ucrInputLogicalValues) + Me.grpNumericOptions.Controls.Add(Me.ucrInputLogicOperations) + Me.grpNumericOptions.Controls.Add(Me.rdoLogical) Me.grpNumericOptions.Controls.Add(Me.ucrChkOmitNA) Me.grpNumericOptions.Controls.Add(Me.rdoDifference) Me.grpNumericOptions.Controls.Add(Me.ucrNudLagPosition) @@ -368,11 +374,45 @@ Partial Class dlgTransform Me.grpNumericOptions.TabStop = False Me.grpNumericOptions.Text = "Options" ' + 'ucrInputLogicalValues + ' + Me.ucrInputLogicalValues.AddQuotesIfUnrecognised = True + Me.ucrInputLogicalValues.AutoSize = True + Me.ucrInputLogicalValues.IsMultiline = False + Me.ucrInputLogicalValues.IsReadOnly = False + Me.ucrInputLogicalValues.Location = New System.Drawing.Point(138, 174) + Me.ucrInputLogicalValues.Name = "ucrInputLogicalValues" + Me.ucrInputLogicalValues.Size = New System.Drawing.Size(51, 21) + Me.ucrInputLogicalValues.TabIndex = 36 + ' + 'ucrInputLogicOperations + ' + Me.ucrInputLogicOperations.AddQuotesIfUnrecognised = True + Me.ucrInputLogicOperations.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink + Me.ucrInputLogicOperations.GetSetSelectedIndex = -1 + Me.ucrInputLogicOperations.IsReadOnly = False + Me.ucrInputLogicOperations.Location = New System.Drawing.Point(76, 174) + Me.ucrInputLogicOperations.Name = "ucrInputLogicOperations" + Me.ucrInputLogicOperations.Size = New System.Drawing.Size(59, 21) + Me.ucrInputLogicOperations.TabIndex = 35 + ' + 'rdoLogical + ' + Me.rdoLogical.AutoSize = True + Me.rdoLogical.ImeMode = System.Windows.Forms.ImeMode.NoControl + Me.rdoLogical.Location = New System.Drawing.Point(11, 174) + Me.rdoLogical.Name = "rdoLogical" + Me.rdoLogical.Size = New System.Drawing.Size(59, 17) + Me.rdoLogical.TabIndex = 34 + Me.rdoLogical.TabStop = True + Me.rdoLogical.Text = "Logical" + Me.rdoLogical.UseVisualStyleBackColor = True + ' 'ucrChkOmitNA ' Me.ucrChkOmitNA.AutoSize = True Me.ucrChkOmitNA.Checked = False - Me.ucrChkOmitNA.Location = New System.Drawing.Point(109, 75) + Me.ucrChkOmitNA.Location = New System.Drawing.Point(109, 70) Me.ucrChkOmitNA.Name = "ucrChkOmitNA" Me.ucrChkOmitNA.Size = New System.Drawing.Size(75, 23) Me.ucrChkOmitNA.TabIndex = 33 @@ -382,7 +422,7 @@ Partial Class dlgTransform Me.ucrNudLagPosition.AutoSize = True Me.ucrNudLagPosition.DecimalPlaces = New Decimal(New Integer() {0, 0, 0, 0}) Me.ucrNudLagPosition.Increment = New Decimal(New Integer() {1, 0, 0, 0}) - Me.ucrNudLagPosition.Location = New System.Drawing.Point(138, 101) + Me.ucrNudLagPosition.Location = New System.Drawing.Point(138, 94) Me.ucrNudLagPosition.Maximum = New Decimal(New Integer() {100, 0, 0, 0}) Me.ucrNudLagPosition.Minimum = New Decimal(New Integer() {0, 0, 0, 0}) Me.ucrNudLagPosition.Name = "ucrNudLagPosition" @@ -394,7 +434,7 @@ Partial Class dlgTransform ' Me.lblLagPosition.AutoSize = True Me.lblLagPosition.ImeMode = System.Windows.Forms.ImeMode.NoControl - Me.lblLagPosition.Location = New System.Drawing.Point(83, 105) + Me.lblLagPosition.Location = New System.Drawing.Point(83, 98) Me.lblLagPosition.Name = "lblLagPosition" Me.lblLagPosition.Size = New System.Drawing.Size(52, 13) Me.lblLagPosition.TabIndex = 24 @@ -404,7 +444,7 @@ Partial Class dlgTransform ' Me.lblRoundofDigits.AutoSize = True Me.lblRoundofDigits.ImeMode = System.Windows.Forms.ImeMode.NoControl - Me.lblRoundofDigits.Location = New System.Drawing.Point(82, 21) + Me.lblRoundofDigits.Location = New System.Drawing.Point(82, 20) Me.lblRoundofDigits.Name = "lblRoundofDigits" Me.lblRoundofDigits.Size = New System.Drawing.Size(53, 13) Me.lblRoundofDigits.TabIndex = 23 @@ -415,7 +455,7 @@ Partial Class dlgTransform Me.ucrNudRoundOfDigits.AutoSize = True Me.ucrNudRoundOfDigits.DecimalPlaces = New Decimal(New Integer() {0, 0, 0, 0}) Me.ucrNudRoundOfDigits.Increment = New Decimal(New Integer() {1, 0, 0, 0}) - Me.ucrNudRoundOfDigits.Location = New System.Drawing.Point(138, 17) + Me.ucrNudRoundOfDigits.Location = New System.Drawing.Point(138, 16) Me.ucrNudRoundOfDigits.Maximum = New Decimal(New Integer() {100, 0, 0, 0}) Me.ucrNudRoundOfDigits.Minimum = New Decimal(New Integer() {0, 0, 0, 0}) Me.ucrNudRoundOfDigits.Name = "ucrNudRoundOfDigits" @@ -428,7 +468,7 @@ Partial Class dlgTransform Me.ucrNudDiffLag.AutoSize = True Me.ucrNudDiffLag.DecimalPlaces = New Decimal(New Integer() {0, 0, 0, 0}) Me.ucrNudDiffLag.Increment = New Decimal(New Integer() {1, 0, 0, 0}) - Me.ucrNudDiffLag.Location = New System.Drawing.Point(138, 157) + Me.ucrNudDiffLag.Location = New System.Drawing.Point(138, 146) Me.ucrNudDiffLag.Maximum = New Decimal(New Integer() {100, 0, 0, 0}) Me.ucrNudDiffLag.Minimum = New Decimal(New Integer() {0, 0, 0, 0}) Me.ucrNudDiffLag.Name = "ucrNudDiffLag" @@ -441,7 +481,7 @@ Partial Class dlgTransform Me.ucrNudLagLeadPosition.AutoSize = True Me.ucrNudLagLeadPosition.DecimalPlaces = New Decimal(New Integer() {0, 0, 0, 0}) Me.ucrNudLagLeadPosition.Increment = New Decimal(New Integer() {1, 0, 0, 0}) - Me.ucrNudLagLeadPosition.Location = New System.Drawing.Point(138, 129) + Me.ucrNudLagLeadPosition.Location = New System.Drawing.Point(138, 120) Me.ucrNudLagLeadPosition.Maximum = New Decimal(New Integer() {100, 0, 0, 0}) Me.ucrNudLagLeadPosition.Minimum = New Decimal(New Integer() {0, 0, 0, 0}) Me.ucrNudLagLeadPosition.Name = "ucrNudLagLeadPosition" @@ -454,7 +494,7 @@ Partial Class dlgTransform Me.ucrNudSignifDigits.AutoSize = True Me.ucrNudSignifDigits.DecimalPlaces = New Decimal(New Integer() {0, 0, 0, 0}) Me.ucrNudSignifDigits.Increment = New Decimal(New Integer() {1, 0, 0, 0}) - Me.ucrNudSignifDigits.Location = New System.Drawing.Point(138, 45) + Me.ucrNudSignifDigits.Location = New System.Drawing.Point(138, 42) Me.ucrNudSignifDigits.Maximum = New Decimal(New Integer() {100, 0, 0, 0}) Me.ucrNudSignifDigits.Minimum = New Decimal(New Integer() {0, 0, 0, 0}) Me.ucrNudSignifDigits.Name = "ucrNudSignifDigits" @@ -466,7 +506,7 @@ Partial Class dlgTransform ' Me.lblDiffLag.AutoSize = True Me.lblDiffLag.ImeMode = System.Windows.Forms.ImeMode.NoControl - Me.lblDiffLag.Location = New System.Drawing.Point(107, 161) + Me.lblDiffLag.Location = New System.Drawing.Point(107, 150) Me.lblDiffLag.Name = "lblDiffLag" Me.lblDiffLag.Size = New System.Drawing.Size(28, 13) Me.lblDiffLag.TabIndex = 18 @@ -476,7 +516,7 @@ Partial Class dlgTransform ' Me.lblDigits.AutoSize = True Me.lblDigits.ImeMode = System.Windows.Forms.ImeMode.NoControl - Me.lblDigits.Location = New System.Drawing.Point(99, 48) + Me.lblDigits.Location = New System.Drawing.Point(99, 45) Me.lblDigits.Name = "lblDigits" Me.lblDigits.Size = New System.Drawing.Size(36, 13) Me.lblDigits.TabIndex = 15 @@ -486,7 +526,7 @@ Partial Class dlgTransform ' Me.lblLagLeadPosition.AutoSize = True Me.lblLagLeadPosition.ImeMode = System.Windows.Forms.ImeMode.NoControl - Me.lblLagLeadPosition.Location = New System.Drawing.Point(83, 133) + Me.lblLagLeadPosition.Location = New System.Drawing.Point(83, 124) Me.lblLagLeadPosition.Name = "lblLagLeadPosition" Me.lblLagLeadPosition.Size = New System.Drawing.Size(52, 13) Me.lblLagLeadPosition.TabIndex = 17 @@ -495,9 +535,9 @@ Partial Class dlgTransform 'ucrPnlNumericOptions ' Me.ucrPnlNumericOptions.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink - Me.ucrPnlNumericOptions.Location = New System.Drawing.Point(6, 19) + Me.ucrPnlNumericOptions.Location = New System.Drawing.Point(6, 14) Me.ucrPnlNumericOptions.Name = "ucrPnlNumericOptions" - Me.ucrPnlNumericOptions.Size = New System.Drawing.Size(79, 174) + Me.ucrPnlNumericOptions.Size = New System.Drawing.Size(79, 179) Me.ucrPnlNumericOptions.TabIndex = 0 ' 'grpNonNegative @@ -510,7 +550,7 @@ Partial Class dlgTransform Me.grpNonNegative.Controls.Add(Me.rdoLogToBase10) Me.grpNonNegative.Controls.Add(Me.ucrChkAddConstant) Me.grpNonNegative.Controls.Add(Me.ucrPnlNonNegative) - Me.grpNonNegative.Location = New System.Drawing.Point(238, 128) + Me.grpNonNegative.Location = New System.Drawing.Point(233, 126) Me.grpNonNegative.Name = "grpNonNegative" Me.grpNonNegative.Size = New System.Drawing.Size(195, 149) Me.grpNonNegative.TabIndex = 9 @@ -893,8 +933,10 @@ Partial Class dlgTransform Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi Me.AutoSize = True Me.ClientSize = New System.Drawing.Size(440, 445) - Me.Controls.Add(Me.cmdUpdatePreview) + Me.Controls.Add(Me.grpNumericOptions) Me.Controls.Add(Me.grpNonNegative) + Me.Controls.Add(Me.grpTies) + Me.Controls.Add(Me.cmdUpdatePreview) Me.Controls.Add(Me.ucrChkEditPreview) Me.Controls.Add(Me.ucrChkPreview) Me.Controls.Add(Me.ucrInputPreview) @@ -920,8 +962,6 @@ Partial Class dlgTransform Me.Controls.Add(Me.ucrSelectorForRank) Me.Controls.Add(Me.ucrChkMissingLast) Me.Controls.Add(Me.ucrChkDecreasing) - Me.Controls.Add(Me.grpNumericOptions) - Me.Controls.Add(Me.grpTies) Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow Me.MaximizeBox = False Me.MinimizeBox = False @@ -963,7 +1003,6 @@ Partial Class dlgTransform Friend WithEvents ucrChkDecreasing As ucrCheck Friend WithEvents rdoSignificantDigits As RadioButton Friend WithEvents rdoRoundOf As RadioButton - Friend WithEvents ucrPnlNumericOptions As UcrPanel Friend WithEvents grpNumericOptions As GroupBox Friend WithEvents rdoLead As RadioButton Friend WithEvents rdoDifference As RadioButton @@ -1007,4 +1046,8 @@ Partial Class dlgTransform Friend WithEvents ucrInputConstant As ucrInputComboBox Friend WithEvents ucrInputPower As ucrInputComboBox Friend WithEvents cmdUpdatePreview As Button + Friend WithEvents ucrInputLogicalValues As ucrInputTextBox + Friend WithEvents ucrInputLogicOperations As ucrInputComboBox + Friend WithEvents rdoLogical As RadioButton + Friend WithEvents ucrPnlNumericOptions As UcrPanel End Class diff --git a/instat/dlgTransform.vb b/instat/dlgTransform.vb index 3d89457ded4..d70d5efca1a 100644 --- a/instat/dlgTransform.vb +++ b/instat/dlgTransform.vb @@ -19,36 +19,38 @@ Imports instat.Translations Public Class dlgTransform Public bFirstLoad As Boolean = True Private bReset As Boolean = True - Private clsRankFunction As RFunction - Private clsSortFunction As RFunction - Private clsRoundFunction As RFunction - Private clsSignifFunction As RFunction - Private clsLagFunction As RFunction - Private clsLeadFunction As RFunction - Private clsDiffFunction As RFunction - Private clsConcDiffFunction As RFunction - Private clsReplicateFunction As RFunction - Private clsMeanFunction As RFunction - Private clsStandardDevFunction As RFunction - Private clsSubtractOperator As ROperator - Private clsDivisionOperator As ROperator - Private clsSquarerootFunction As RFunction - Private clsAddConstantOperator As ROperator - Private clsNaturalLogFunction As RFunction - Private clsLogBase10Function As RFunction - Private clsPowerOperator As ROperator - Private clsScaleSubtractOperator As ROperator - Private clsScaleMultiplyOperator As ROperator - Private clsScaleDivideOperator As ROperator - Private clsScaleAddOperator As ROperator - Private clsScaleMeanFunction As RFunction - Private clsScaleMinFunction As RFunction - Private clsPreviewOperator As ROperator - Private clsDummyTransformFunction As RFunction + Private clsRankFunction As New RFunction + Private clsSortFunction As New RFunction + Private clsRoundFunction As New RFunction + Private clsSignifFunction As New RFunction + Private clsLagFunction As New RFunction + Private clsLeadFunction As New RFunction + Private clsDiffFunction As New RFunction + Private clsConcDiffFunction As New RFunction + Private clsReplicateFunction As New RFunction + Private clsMeanFunction As New RFunction + Private clsStandardDevFunction As New RFunction + Private clsSubtractOperator As New ROperator + Private clsDivisionOperator As New ROperator + Private clsSquarerootFunction As New RFunction + Private clsAddConstantOperator As New ROperator + Private clsNaturalLogFunction As New RFunction + Private clsLogBase10Function As New RFunction + Private clsPowerOperator As New ROperator + Private clsScaleSubtractOperator As New ROperator + Private clsScaleMultiplyOperator As New ROperator + Private clsScaleDivideOperator As New ROperator + Private clsScaleAddOperator As New ROperator + Private clsScaleMeanFunction As New RFunction + Private clsScaleMinFunction As New RFunction + Private clsPreviewOperator As New ROperator + Private clsDummyTransformFunction As New RFunction Private clsConstantDummyFunction As New RFunction - Private clsNumericDummyFunction As RFunction - Private clsNonNegativeDummyFunction As RFunction + Private clsNumericDummyFunction As New RFunction + Private clsNonNegativeDummyFunction As New RFunction Private clsPreviewTextFunction As New RCodeStructure + Private clsBooleanOperator As New ROperator + Private clsIsNAFunction As New RFunction Private bResetRCode As Boolean = True Private Sub dlgRank_Load(sender As Object, e As EventArgs) Handles MyBase.Load @@ -124,6 +126,7 @@ Public Class dlgTransform ucrPnlNumericOptions.AddRadioButton(rdoLag) ucrPnlNumericOptions.AddRadioButton(rdoLead) ucrPnlNumericOptions.AddRadioButton(rdoDifference) + ucrPnlNumericOptions.AddRadioButton(rdoLogical) ucrPnlNumericOptions.AddParameterValuesCondition(rdoRoundOf, "check", "round") ucrPnlNumericOptions.AddParameterValuesCondition(rdoSignificantDigits, "check", "signif") @@ -131,6 +134,7 @@ Public Class dlgTransform ucrPnlNumericOptions.AddParameterValuesCondition(rdoLag, "check", "lag") ucrPnlNumericOptions.AddParameterValuesCondition(rdoLead, "check", "lead") ucrPnlNumericOptions.AddParameterValuesCondition(rdoDifference, "check", "diff") + ucrPnlNumericOptions.AddParameterValuesCondition(rdoLogical, "check", "logical") ucrPnlNonNegative.AddRadioButton(rdoSquareRoot) ucrPnlNonNegative.AddRadioButton(rdoLogToBase10) @@ -148,6 +152,7 @@ Public Class dlgTransform ucrPnlNumericOptions.AddToLinkedControls(ucrNudDiffLag, {rdoDifference}, bNewLinkedHideIfParameterMissing:=True) ucrPnlNumericOptions.AddToLinkedControls(ucrNudLagPosition, {rdoLag}, bNewLinkedHideIfParameterMissing:=True) ucrPnlNumericOptions.AddToLinkedControls(ucrChkOmitNA, {rdoStandardize}, bNewLinkedAddRemoveParameter:=True, bNewLinkedHideIfParameterMissing:=True) + ucrPnlNumericOptions.AddToLinkedControls({ucrInputLogicOperations}, {rdoLogical}, bNewLinkedHideIfParameterMissing:=True) ucrPnlNonNegative.AddToLinkedControls(ucrInputPower, {rdoPower}, bNewLinkedHideIfParameterMissing:=True) ucrPnlTransformOptions.AddToLinkedControls(ucrPnlMissingValues, {rdoRank}, bNewLinkedAddRemoveParameter:=True, bNewLinkedHideIfParameterMissing:=True) ucrPnlTransformOptions.AddToLinkedControls(ucrPnlTies, {rdoRank}, bNewLinkedAddRemoveParameter:=True, bNewLinkedHideIfParameterMissing:=True) @@ -162,6 +167,7 @@ Public Class dlgTransform ucrChkDivide.AddToLinkedControls(ucrInputDivide, {True}, bNewLinkedAddRemoveParameter:=True, bNewLinkedHideIfParameterMissing:=True, bNewLinkedChangeToDefaultState:=True, objNewDefaultState:="1") ucrChkAdd.AddToLinkedControls(ucrInputAdd, {True}, bNewLinkedAddRemoveParameter:=True, bNewLinkedHideIfParameterMissing:=True, bNewLinkedChangeToDefaultState:=True, objNewDefaultState:="0") ucrChkPreview.AddToLinkedControls({ucrInputPreview, ucrChkEditPreview}, {True}, bNewLinkedAddRemoveParameter:=True, bNewLinkedHideIfParameterMissing:=True) + ucrInputLogicOperations.AddToLinkedControls({ucrInputLogicalValues}, {"==", "<", "<=", ">", ">=", "!=", "%in%"}, bNewLinkedHideIfParameterMissing:=True) ucrNudSignifDigits.SetLinkedDisplayControl(lblDigits) ucrNudRoundOfDigits.SetLinkedDisplayControl(lblRoundofDigits) @@ -194,6 +200,13 @@ Public Class dlgTransform ucrNudLagPosition.SetParameter(New RParameter("lag", 1)) ucrNudLagPosition.SetMinMax(iNewMin:=1, iNewMax:=Integer.MaxValue) + ucrInputLogicalValues.SetParameter(New RParameter("x", 1)) + ucrInputLogicalValues.AddQuotesIfUnrecognised = False + ucrInputLogicalValues.SetValidationTypeAsNumeric() + + ucrInputLogicOperations.SetItems({"==", "<", "<=", ">", ">=", "!=", "%in%", "is.na", "!is.na"}) + ucrInputLogicOperations.SetDropDownStyleAsNonEditable() + ucrInputPower.SetParameter(New RParameter("y", 1)) dctPowerValues.Add("1", "1") dctPowerValues.Add("2", "2") @@ -316,10 +329,13 @@ Public Class dlgTransform clsNumericDummyFunction = New RFunction clsNonNegativeDummyFunction = New RFunction clsPreviewTextFunction = New RCodeStructure + clsBooleanOperator = New ROperator + clsIsNAFunction = New RFunction ucrSelectorForRank.Reset() ucrReceiverRank.SetMeAsReceiver() ucrSaveNew.Reset() + ucrInputLogicOperations.SetText("==") clsConstantDummyFunction.AddParameter("checked", "FALSE", iPosition:=0) clsConstantDummyFunction.AddParameter("preview", "TRUE", iPosition:=1) @@ -404,6 +420,9 @@ Public Class dlgTransform clsPreviewOperator.bBrackets = False clsPreviewOperator.bToScriptAsRString = False + clsBooleanOperator.SetOperation("==") + clsIsNAFunction.SetRCommand("is.na") + clsDummyTransformFunction.AddParameter("check", "numeric", iPosition:=0) clsNumericDummyFunction.AddParameter("check", "round", iPosition:=0) clsNonNegativeDummyFunction.AddParameter("check", "sqrt", iPosition:=0) @@ -427,6 +446,8 @@ Public Class dlgTransform ucrReceiverRank.AddAdditionalCodeParameterPair(clsScaleSubtractOperator, New RParameter("x", 0), iAdditionalPairNo:=11) ucrReceiverRank.AddAdditionalCodeParameterPair(clsScaleMeanFunction, New RParameter("x", 0), iAdditionalPairNo:=12) ucrReceiverRank.AddAdditionalCodeParameterPair(clsScaleMinFunction, New RParameter("x", 0), iAdditionalPairNo:=13) + ucrReceiverRank.AddAdditionalCodeParameterPair(clsBooleanOperator, New RParameter("x", 0), iAdditionalPairNo:=14) + ucrReceiverRank.AddAdditionalCodeParameterPair(clsIsNAFunction, New RParameter("x", 0), iAdditionalPairNo:=15) ucrChkOmitNA.AddAdditionalCodeParameterPair(clsStandardDevFunction, ucrChkOmitNA.GetParameter(), iAdditionalPairNo:=1) ucrSaveNew.AddAdditionalRCode(clsLeadFunction, iAdditionalPairNo:=1) @@ -442,6 +463,8 @@ Public Class dlgTransform ucrSaveNew.AddAdditionalRCode(clsPowerOperator, iAdditionalPairNo:=11) ucrSaveNew.AddAdditionalRCode(clsScaleAddOperator, iAdditionalPairNo:=12) ucrSaveNew.AddAdditionalRCode(clsPreviewOperator, iAdditionalPairNo:=13) + ucrSaveNew.AddAdditionalRCode(clsBooleanOperator, iAdditionalPairNo:=14) + ucrSaveNew.AddAdditionalRCode(clsIsNAFunction, iAdditionalPairNo:=15) ucrPnlTransformOptions.SetRCode(clsDummyTransformFunction, bReset) ucrReceiverRank.SetRCode(clsRankFunction, bReset) @@ -470,7 +493,15 @@ Public Class dlgTransform End Sub Private Sub TestOKEnabled() - ucrBase.OKEnabled(Not ucrReceiverRank.IsEmpty() AndAlso ucrSaveNew.IsComplete) + If rdoNumeric.Checked AndAlso rdoLogical.Checked Then + If Not ucrInputLogicOperations.GetText = "is.na" AndAlso Not ucrInputLogicOperations.GetText = "!is.na" Then + ucrBase.OKEnabled(Not ucrReceiverRank.IsEmpty() AndAlso ucrSaveNew.IsComplete AndAlso Not ucrInputLogicalValues.IsEmpty) + Else + ucrBase.OKEnabled(Not ucrReceiverRank.IsEmpty() AndAlso ucrSaveNew.IsComplete) + End If + Else + ucrBase.OKEnabled(Not ucrReceiverRank.IsEmpty() AndAlso ucrSaveNew.IsComplete) + End If End Sub Private Sub NewDefaultName() @@ -486,84 +517,118 @@ Public Class dlgTransform ucrChkEditPreview.Checked = False End Sub - Private Sub ucrPnlTransformOptions_ControlValueChanged(ucrChangedControl As ucrCore) Handles ucrPnlTransformOptions.ControlValueChanged, ucrPnlNumericOptions.ControlValueChanged, - ucrPnlNonNegative.ControlValueChanged, ucrReceiverRank.ControlValueChanged, ucrNudRoundOfDigits.ControlValueChanged, ucrNudSignifDigits.ControlValueChanged, ucrNudLagPosition.ControlValueChanged, - ucrNudLagLeadPosition.ControlValueChanged, ucrNudDiffLag.ControlValueChanged, ucrPnlMissingValues.ControlValueChanged, ucrChkDecreasing.ControlValueChanged, ucrChkMissingLast.ControlValueChanged, - ucrChkAddConstant.ControlValueChanged, ucrChkMissingLast.ControlValueChanged, ucrPnlTies.ControlValueChanged, ucrInputPower.ControlValueChanged, ucrInputConstant.ControlValueChanged, - ucrInputAdd.ControlValueChanged, ucrInputDivide.ControlValueChanged, ucrInputMultiply.ControlValueChanged, ucrInputSubtract.ControlValueChanged, ucrChkAdd.ControlValueChanged, - ucrChkMultiply.ControlValueChanged, ucrChkSubtract.ControlValueChanged, ucrChkDivide.ControlValueChanged, ucrChkOmitNA.ControlValueChanged, ucrChkPreview.ControlValueChanged - ucrBase.clsRsyntax.ClearCodes() - If rdoRank.Checked Then - clsPreviewTextFunction = clsRankFunction.Clone - clsDummyTransformFunction.AddParameter("check", "rank", iPosition:=0) - ucrBase.clsRsyntax.SetBaseRFunction(clsRankFunction) - ElseIf rdoSort.Checked Then - clsPreviewTextFunction = clsSortFunction.Clone - clsDummyTransformFunction.AddParameter("check", "sort", iPosition:=0) - ucrBase.clsRsyntax.SetBaseRFunction(clsSortFunction) - ElseIf rdoNumeric.Checked Then - clsDummyTransformFunction.AddParameter("check", "numeric", iPosition:=0) - If rdoRoundOf.Checked Then - clsPreviewTextFunction = clsRoundFunction.Clone - clsNumericDummyFunction.AddParameter("check", "round", iPosition:=0) - ucrBase.clsRsyntax.SetBaseRFunction(clsRoundFunction) - ElseIf rdoSignificantDigits.Checked Then - clsPreviewTextFunction = clsSignifFunction.Clone - clsNumericDummyFunction.AddParameter("check", "signif", iPosition:=0) - ucrBase.clsRsyntax.SetBaseRFunction(clsSignifFunction) - ElseIf rdoLag.Checked Then - clsPreviewTextFunction = clsLagFunction.Clone - clsNumericDummyFunction.AddParameter("check", "lag", iPosition:=0) - ucrBase.clsRsyntax.SetBaseRFunction(clsLagFunction) - ElseIf rdoLead.Checked Then - clsPreviewTextFunction = clsLeadFunction.Clone - clsNumericDummyFunction.AddParameter("check", "lead", iPosition:=0) - ucrBase.clsRsyntax.SetBaseRFunction(clsLeadFunction) - ElseIf rdoDifference.Checked Then - clsPreviewTextFunction = clsConcDiffFunction.Clone - clsNumericDummyFunction.AddParameter("check", "diff", iPosition:=0) - ucrBase.clsRsyntax.SetBaseRFunction(clsConcDiffFunction) - ElseIf rdoStandardize.Checked Then - clsPreviewTextFunction = clsDivisionOperator.Clone - clsNumericDummyFunction.AddParameter("check", "standardise", iPosition:=0) - ucrBase.clsRsyntax.SetBaseROperator(clsDivisionOperator) - End If - ElseIf rdoNonNegative.Checked Then - UpdateConstantParameter() - clsDummyTransformFunction.AddParameter("check", "non-negative", iPosition:=0) - If rdoSquareRoot.Checked Then - clsPreviewTextFunction = clsSquarerootFunction.Clone - ucrBase.clsRsyntax.SetBaseRFunction(clsSquarerootFunction) - clsNonNegativeDummyFunction.AddParameter("check", "sqrt", iPosition:=0) - ElseIf rdoPower.Checked Then - clsPreviewTextFunction = clsPowerOperator.Clone - clsNonNegativeDummyFunction.AddParameter("check", "power", iPosition:=0) - ucrBase.clsRsyntax.SetBaseROperator(clsPowerOperator) - ElseIf rdoLogToBase10.Checked Then - clsPreviewTextFunction = clsLogBase10Function.Clone - clsNonNegativeDummyFunction.AddParameter("check", "log10", iPosition:=0) - ucrBase.clsRsyntax.SetBaseRFunction(clsLogBase10Function) - ElseIf rdoNaturalLog.Checked Then - clsPreviewTextFunction = clsNaturalLogFunction.Clone - clsNonNegativeDummyFunction.AddParameter("check", "log", iPosition:=0) - ucrBase.clsRsyntax.SetBaseRFunction(clsNaturalLogFunction) + Private Sub ucrPnlTransformOptions_ControlValueChanged(ucrChangedControl As ucrCore) Handles ucrPnlTransformOptions.ControlValueChanged, ucrPnlNumericOptions.ControlValueChanged, ucrInputLogicalValues.ControlValueChanged, + ucrPnlNonNegative.ControlValueChanged, ucrPnlMissingValues.ControlValueChanged, ucrPnlTies.ControlValueChanged, ucrChkPreview.ControlValueChanged, ucrReceiverRank.ControlValueChanged, ucrNudDiffLag.ControlValueChanged, ucrNudLagLeadPosition.ControlValueChanged, + ucrNudLagPosition.ControlValueChanged, ucrNudRoundOfDigits.ControlValueChanged, ucrNudSignifDigits.ControlValueChanged, ucrInputPower.ControlValueChanged, ucrInputMultiply.ControlValueChanged, + ucrInputDivide.ControlValueChanged, ucrInputConstant.ControlValueChanged, ucrInputAdd.ControlValueChanged, ucrChkOmitNA.ControlValueChanged, ucrInputLogicOperations.ControlValueChanged, ucrChkAddConstant.ControlValueChanged, + ucrChkMissingLast.ControlValueChanged, ucrChkDecreasing.ControlValueChanged, ucrChkDivide.ControlValueChanged, ucrChkAdd.ControlValueChanged, ucrChkMultiply.ControlValueChanged, ucrChkSubtract.ControlValueChanged + If bResetRCode Then + ucrBase.clsRsyntax.ClearCodes() + If rdoRank.Checked Then + clsPreviewTextFunction = clsRankFunction.Clone + clsDummyTransformFunction.AddParameter("check", "rank", iPosition:=0) + ucrBase.clsRsyntax.SetBaseRFunction(clsRankFunction) + ElseIf rdoSort.Checked Then + clsPreviewTextFunction = clsSortFunction.Clone + clsDummyTransformFunction.AddParameter("check", "sort", iPosition:=0) + ucrBase.clsRsyntax.SetBaseRFunction(clsSortFunction) + ElseIf rdoNumeric.Checked Then + clsDummyTransformFunction.AddParameter("check", "numeric", iPosition:=0) + If rdoRoundOf.Checked Then + clsPreviewTextFunction = clsRoundFunction.Clone + clsNumericDummyFunction.AddParameter("check", "round", iPosition:=0) + ucrBase.clsRsyntax.SetBaseRFunction(clsRoundFunction) + ElseIf rdoSignificantDigits.Checked Then + clsPreviewTextFunction = clsSignifFunction.Clone + clsNumericDummyFunction.AddParameter("check", "signif", iPosition:=0) + ucrBase.clsRsyntax.SetBaseRFunction(clsSignifFunction) + ElseIf rdoLag.Checked Then + clsPreviewTextFunction = clsLagFunction.Clone + clsNumericDummyFunction.AddParameter("check", "lag", iPosition:=0) + ucrBase.clsRsyntax.SetBaseRFunction(clsLagFunction) + ElseIf rdoLead.Checked Then + clsPreviewTextFunction = clsLeadFunction.Clone + clsNumericDummyFunction.AddParameter("check", "lead", iPosition:=0) + ucrBase.clsRsyntax.SetBaseRFunction(clsLeadFunction) + ElseIf rdoDifference.Checked Then + clsPreviewTextFunction = clsConcDiffFunction.Clone + clsNumericDummyFunction.AddParameter("check", "diff", iPosition:=0) + ucrBase.clsRsyntax.SetBaseRFunction(clsConcDiffFunction) + ElseIf rdoStandardize.Checked Then + clsPreviewTextFunction = clsDivisionOperator.Clone + clsNumericDummyFunction.AddParameter("check", "standardise", iPosition:=0) + ucrBase.clsRsyntax.SetBaseROperator(clsDivisionOperator) + ElseIf rdoLogical.Checked Then + clsNumericDummyFunction.AddParameter("check", "logical", iPosition:=0) + clsPreviewTextFunction = clsBooleanOperator.Clone + ucrBase.clsRsyntax.SetBaseROperator(clsBooleanOperator) + Select Case ucrInputLogicOperations.GetText + Case "==" + clsBooleanOperator.SetOperation("==") + Case "<" + clsBooleanOperator.SetOperation("<") + Case "<=" + clsBooleanOperator.SetOperation("<=") + Case ">" + clsBooleanOperator.SetOperation(">") + Case ">=" + clsBooleanOperator.SetOperation(">=") + Case "!=" + clsBooleanOperator.SetOperation("!=") + Case "%in%" + clsBooleanOperator.SetOperation("%in%") + Case "is.na" + clsIsNAFunction.SetRCommand("is.na") + clsPreviewTextFunction = clsIsNAFunction.Clone + ucrBase.clsRsyntax.SetBaseRFunction(clsIsNAFunction) + Case "!is.na" + clsIsNAFunction.SetRCommand("!is.na") + clsPreviewTextFunction = clsIsNAFunction.Clone + ucrBase.clsRsyntax.SetBaseRFunction(clsIsNAFunction) + End Select + End If + ElseIf rdoNonNegative.Checked Then + UpdateConstantParameter() + clsDummyTransformFunction.AddParameter("check", "non-negative", iPosition:=0) + If rdoSquareRoot.Checked Then + clsPreviewTextFunction = clsSquarerootFunction.Clone + ucrBase.clsRsyntax.SetBaseRFunction(clsSquarerootFunction) + clsNonNegativeDummyFunction.AddParameter("check", "sqrt", iPosition:=0) + ElseIf rdoPower.Checked Then + clsPreviewTextFunction = clsPowerOperator.Clone + clsNonNegativeDummyFunction.AddParameter("check", "power", iPosition:=0) + ucrBase.clsRsyntax.SetBaseROperator(clsPowerOperator) + ElseIf rdoLogToBase10.Checked Then + clsPreviewTextFunction = clsLogBase10Function.Clone + clsNonNegativeDummyFunction.AddParameter("check", "log10", iPosition:=0) + ucrBase.clsRsyntax.SetBaseRFunction(clsLogBase10Function) + ElseIf rdoNaturalLog.Checked Then + clsPreviewTextFunction = clsNaturalLogFunction.Clone + clsNonNegativeDummyFunction.AddParameter("check", "log", iPosition:=0) + ucrBase.clsRsyntax.SetBaseRFunction(clsNaturalLogFunction) + End If + ElseIf rdoScale.Checked Then + clsDummyTransformFunction.AddParameter("check", "scale", iPosition:=0) + clsPreviewTextFunction = clsScaleAddOperator.Clone + ucrBase.clsRsyntax.SetBaseROperator(clsScaleAddOperator) End If - ElseIf rdoScale.Checked Then - clsDummyTransformFunction.AddParameter("check", "scale", iPosition:=0) - clsPreviewTextFunction = clsScaleAddOperator.Clone - ucrBase.clsRsyntax.SetBaseROperator(clsScaleAddOperator) End If + SetPreviewText() + UpdateNonNegativeParameters() + NewDefaultName() + ResetPreview() + End Sub + + Private Sub SetPreviewText() clsPreviewTextFunction.RemoveAssignTo() If Not ucrReceiverRank.IsEmpty Then - ucrInputPreview.SetText(clsPreviewTextFunction.ToScript) + ucrInputPreview.SetText(clsPreviewTextFunction.ToScript()) Else ucrInputPreview.SetText("") End If - NewDefaultName() - ResetPreview() End Sub - Private Sub ucrReceiverRank_ControlValueChanged(ucrChangedControl As ucrCore) Handles ucrReceiverRank.ControlValueChanged + Private Sub UpdateNonNegativeParameters() If Not ucrReceiverRank.IsEmpty Then clsSquarerootFunction.AddParameter("x", clsRFunctionParameter:=ucrReceiverRank.GetVariables, iPosition:=0) clsNaturalLogFunction.AddParameter("x", clsRFunctionParameter:=ucrReceiverRank.GetVariables, iPosition:=0) @@ -593,15 +658,6 @@ Public Class dlgTransform End If End Sub - Private Sub ucrChkAddConstant_ControlValueChanged(ucrChangedControl As ucrCore) Handles ucrChkAddConstant.ControlValueChanged, ucrPnlNonNegative.ControlValueChanged, ucrInputConstant.ControlValueChanged, ucrInputPreview.ControlValueChanged - UpdateConstantParameter() - End Sub - - Private Sub Controls_ControlContentsChanged(ucrChangedControl As ucrCore) Handles ucrReceiverRank.ControlContentsChanged, ucrSaveNew.ControlContentsChanged, ucrPnlTransformOptions.ControlContentsChanged, ucrPnlNumericOptions.ControlContentsChanged, ucrPnlNonNegative.ControlContentsChanged, ucrChkDivide.ControlContentsChanged, - ucrChkMultiply.ControlContentsChanged, ucrChkSubtract.ControlContentsChanged, ucrChkAdd.ControlContentsChanged, ucrChkPreview.ControlContentsChanged, ucrChkAddConstant.ControlContentsChanged, ucrInputPower.ControlContentsChanged, ucrInputPreview.ControlContentsChanged - TestOKEnabled() - End Sub - Private Sub ResetPreview() If Not bResetRCode Then Exit Sub @@ -630,4 +686,23 @@ Public Class dlgTransform ucrBase.clsRsyntax.RemoveFromAfterCodes(clsPreviewOperator) End If End Sub -End Class + + Private Sub ucrInputLogicalValues_TextChanged(sender As Object, e As EventArgs) Handles ucrInputLogicalValues.TextChanged + SetPreviewText() + End Sub + + Private Sub ucrInputLogicalValues_ControlValueChanged(ucrChangedControl As ucrCore) Handles ucrInputLogicalValues.ControlValueChanged + If Not ucrInputLogicalValues.IsEmpty Then + clsBooleanOperator.AddParameter("right", ucrInputLogicalValues.GetText, iPosition:=1) + Else + clsBooleanOperator.RemoveParameterByName("right") + End If + End Sub + + Private Sub Controls_ControlContentsChanged(ucrChangedControl As ucrCore) Handles ucrReceiverRank.ControlContentsChanged, ucrSaveNew.ControlContentsChanged, + ucrPnlTransformOptions.ControlContentsChanged, ucrPnlNumericOptions.ControlContentsChanged, ucrPnlNonNegative.ControlContentsChanged, ucrChkDivide.ControlContentsChanged, + ucrChkMultiply.ControlContentsChanged, ucrChkSubtract.ControlContentsChanged, ucrChkAdd.ControlContentsChanged, ucrChkPreview.ControlContentsChanged, + ucrChkAddConstant.ControlContentsChanged, ucrInputPower.ControlContentsChanged, ucrInputPreview.ControlContentsChanged, ucrInputLogicalValues.ControlContentsChanged, ucrInputLogicOperations.ControlContentsChanged + TestOKEnabled() + End Sub +End Class \ No newline at end of file diff --git a/instat/dlgViewLabelsAndLevels.Designer.vb b/instat/dlgViewLabelsAndLevels.Designer.vb index 7a8a629191b..7c70f2d0d38 100644 --- a/instat/dlgViewLabelsAndLevels.Designer.vb +++ b/instat/dlgViewLabelsAndLevels.Designer.vb @@ -40,17 +40,17 @@ Partial Class dlgViewFactorLabels Private Sub InitializeComponent() Me.lblFactorColumns = New System.Windows.Forms.Label() Me.grpSummaryStatistics = New System.Windows.Forms.GroupBox() - Me.ucrChkShowPercentage = New instat.ucrCheck() - Me.ucrChkShowFrequencies = New instat.ucrCheck() - Me.ucrChkShowMissingValues = New instat.ucrCheck() Me.grpDisplayOptions = New System.Windows.Forms.GroupBox() - Me.ucrChkSortByName = New instat.ucrCheck() - Me.ucrChkAlternateColour = New instat.ucrCheck() - Me.ucrChkShowId = New instat.ucrCheck() Me.grpLabels = New System.Windows.Forms.GroupBox() Me.ucrChkShowType = New instat.ucrCheck() Me.ucrChkShowValues = New instat.ucrCheck() Me.ucrChkShowLabels = New instat.ucrCheck() + Me.ucrChkSortByName = New instat.ucrCheck() + Me.ucrChkAlternateColour = New instat.ucrCheck() + Me.ucrChkShowId = New instat.ucrCheck() + Me.ucrChkShowPercentage = New instat.ucrCheck() + Me.ucrChkShowFrequencies = New instat.ucrCheck() + Me.ucrChkShowMissingValues = New instat.ucrCheck() Me.ucrBase = New instat.ucrButtons() Me.ucrReceiverVariables = New instat.ucrReceiverMultiple() Me.ucrSelectorViewLabelsAndLevels = New instat.ucrSelectorByDataFrameAddRemove() @@ -81,33 +81,6 @@ Partial Class dlgViewFactorLabels Me.grpSummaryStatistics.TabStop = False Me.grpSummaryStatistics.Text = "Summary Statistics" ' - 'ucrChkShowPercentage - ' - Me.ucrChkShowPercentage.AutoSize = True - Me.ucrChkShowPercentage.Checked = False - Me.ucrChkShowPercentage.Location = New System.Drawing.Point(7, 41) - Me.ucrChkShowPercentage.Name = "ucrChkShowPercentage" - Me.ucrChkShowPercentage.Size = New System.Drawing.Size(154, 23) - Me.ucrChkShowPercentage.TabIndex = 1 - ' - 'ucrChkShowFrequencies - ' - Me.ucrChkShowFrequencies.AutoSize = True - Me.ucrChkShowFrequencies.Checked = False - Me.ucrChkShowFrequencies.Location = New System.Drawing.Point(7, 17) - Me.ucrChkShowFrequencies.Name = "ucrChkShowFrequencies" - Me.ucrChkShowFrequencies.Size = New System.Drawing.Size(143, 23) - Me.ucrChkShowFrequencies.TabIndex = 0 - ' - 'ucrChkShowMissingValues - ' - Me.ucrChkShowMissingValues.AutoSize = True - Me.ucrChkShowMissingValues.Checked = False - Me.ucrChkShowMissingValues.Location = New System.Drawing.Point(7, 65) - Me.ucrChkShowMissingValues.Name = "ucrChkShowMissingValues" - Me.ucrChkShowMissingValues.Size = New System.Drawing.Size(143, 23) - Me.ucrChkShowMissingValues.TabIndex = 2 - ' 'grpDisplayOptions ' Me.grpDisplayOptions.Controls.Add(Me.ucrChkSortByName) @@ -120,33 +93,6 @@ Partial Class dlgViewFactorLabels Me.grpDisplayOptions.TabStop = False Me.grpDisplayOptions.Text = "Display Options" ' - 'ucrChkSortByName - ' - Me.ucrChkSortByName.AutoSize = True - Me.ucrChkSortByName.Checked = False - Me.ucrChkSortByName.Location = New System.Drawing.Point(4, 42) - Me.ucrChkSortByName.Name = "ucrChkSortByName" - Me.ucrChkSortByName.Size = New System.Drawing.Size(133, 23) - Me.ucrChkSortByName.TabIndex = 1 - ' - 'ucrChkAlternateColour - ' - Me.ucrChkAlternateColour.AutoSize = True - Me.ucrChkAlternateColour.Checked = False - Me.ucrChkAlternateColour.Location = New System.Drawing.Point(4, 66) - Me.ucrChkAlternateColour.Name = "ucrChkAlternateColour" - Me.ucrChkAlternateColour.Size = New System.Drawing.Size(142, 23) - Me.ucrChkAlternateColour.TabIndex = 2 - ' - 'ucrChkShowId - ' - Me.ucrChkShowId.AutoSize = True - Me.ucrChkShowId.Checked = False - Me.ucrChkShowId.Location = New System.Drawing.Point(4, 18) - Me.ucrChkShowId.Name = "ucrChkShowId" - Me.ucrChkShowId.Size = New System.Drawing.Size(133, 23) - Me.ucrChkShowId.TabIndex = 0 - ' 'grpLabels ' Me.grpLabels.Controls.Add(Me.ucrChkShowType) @@ -186,6 +132,60 @@ Partial Class dlgViewFactorLabels Me.ucrChkShowLabels.Size = New System.Drawing.Size(190, 23) Me.ucrChkShowLabels.TabIndex = 1 ' + 'ucrChkSortByName + ' + Me.ucrChkSortByName.AutoSize = True + Me.ucrChkSortByName.Checked = False + Me.ucrChkSortByName.Location = New System.Drawing.Point(4, 42) + Me.ucrChkSortByName.Name = "ucrChkSortByName" + Me.ucrChkSortByName.Size = New System.Drawing.Size(133, 23) + Me.ucrChkSortByName.TabIndex = 1 + ' + 'ucrChkAlternateColour + ' + Me.ucrChkAlternateColour.AutoSize = True + Me.ucrChkAlternateColour.Checked = False + Me.ucrChkAlternateColour.Location = New System.Drawing.Point(4, 66) + Me.ucrChkAlternateColour.Name = "ucrChkAlternateColour" + Me.ucrChkAlternateColour.Size = New System.Drawing.Size(142, 23) + Me.ucrChkAlternateColour.TabIndex = 2 + ' + 'ucrChkShowId + ' + Me.ucrChkShowId.AutoSize = True + Me.ucrChkShowId.Checked = False + Me.ucrChkShowId.Location = New System.Drawing.Point(4, 18) + Me.ucrChkShowId.Name = "ucrChkShowId" + Me.ucrChkShowId.Size = New System.Drawing.Size(133, 23) + Me.ucrChkShowId.TabIndex = 0 + ' + 'ucrChkShowPercentage + ' + Me.ucrChkShowPercentage.AutoSize = True + Me.ucrChkShowPercentage.Checked = False + Me.ucrChkShowPercentage.Location = New System.Drawing.Point(7, 41) + Me.ucrChkShowPercentage.Name = "ucrChkShowPercentage" + Me.ucrChkShowPercentage.Size = New System.Drawing.Size(154, 23) + Me.ucrChkShowPercentage.TabIndex = 1 + ' + 'ucrChkShowFrequencies + ' + Me.ucrChkShowFrequencies.AutoSize = True + Me.ucrChkShowFrequencies.Checked = False + Me.ucrChkShowFrequencies.Location = New System.Drawing.Point(7, 17) + Me.ucrChkShowFrequencies.Name = "ucrChkShowFrequencies" + Me.ucrChkShowFrequencies.Size = New System.Drawing.Size(143, 23) + Me.ucrChkShowFrequencies.TabIndex = 0 + ' + 'ucrChkShowMissingValues + ' + Me.ucrChkShowMissingValues.AutoSize = True + Me.ucrChkShowMissingValues.Checked = False + Me.ucrChkShowMissingValues.Location = New System.Drawing.Point(7, 65) + Me.ucrChkShowMissingValues.Name = "ucrChkShowMissingValues" + Me.ucrChkShowMissingValues.Size = New System.Drawing.Size(143, 23) + Me.ucrChkShowMissingValues.TabIndex = 2 + ' 'ucrBase ' Me.ucrBase.AutoSize = True @@ -238,7 +238,7 @@ Partial Class dlgViewFactorLabels Me.MinimizeBox = False Me.Name = "dlgViewFactorLabels" Me.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen - Me.Text = "View Labels/Levels" + Me.Text = "View/Delete Labels" Me.grpSummaryStatistics.ResumeLayout(False) Me.grpSummaryStatistics.PerformLayout() Me.grpDisplayOptions.ResumeLayout(False) diff --git a/instat/frmMain.Designer.vb b/instat/frmMain.Designer.vb index 823cf675f30..317a494d249 100644 --- a/instat/frmMain.Designer.vb +++ b/instat/frmMain.Designer.vb @@ -450,7 +450,6 @@ Partial Class frmMain Me.mnuPrepareDataFrameProtectColumn = New System.Windows.Forms.ToolStripMenuItem() Me.mnuPrepareDataFrameHideColumns = New System.Windows.Forms.ToolStripMenuItem() Me.mnuPrepareDataFrameFreezeColumns = New System.Windows.Forms.ToolStripMenuItem() - Me.mnuPrepareDataFrameColumnStructure = New System.Windows.Forms.ToolStripMenuItem() Me.mnuPrepareDataframeColourByProperty = New System.Windows.Forms.ToolStripMenuItem() Me.mnuPrepareCheckData = New System.Windows.Forms.ToolStripMenuItem() Me.mnuPrepareCheckDataVisualiseData = New System.Windows.Forms.ToolStripMenuItem() @@ -635,7 +634,6 @@ Partial Class frmMain Me.mnuOptionsByContextCheckDataOneVariableSummarise = New System.Windows.Forms.ToolStripMenuItem() Me.mnuOptionsByContextCheckDataOneVariableGraph = New System.Windows.Forms.ToolStripMenuItem() Me.mnuOptionsByContextCheckDataOneVariableFrequencies = New System.Windows.Forms.ToolStripMenuItem() - Me.mnuOptionsByContextDefineOptionsByContexts = New System.Windows.Forms.ToolStripMenuItem() Me.mnuOptionsByContextPrepare = New System.Windows.Forms.ToolStripMenuItem() Me.mnuOptionsByContextPrepareCalculateDIfferenceBetweenOptions = New System.Windows.Forms.ToolStripMenuItem() Me.ToolStripSeparator48 = New System.Windows.Forms.ToolStripSeparator() @@ -677,6 +675,9 @@ Partial Class frmMain Me.mnuDataFrameMetadata = New System.Windows.Forms.ToolStripMenuItem() Me.mnuScriptFile = New System.Windows.Forms.ToolStripMenuItem() Me.mnuLogFile = New System.Windows.Forms.ToolStripMenuItem() + Me.mnuOptionsByContextDefine = New System.Windows.Forms.ToolStripMenuItem() + Me.mnuOptionsByContextDefineOnStation = New System.Windows.Forms.ToolStripMenuItem() + Me.mnuOptionsByContextDefineOnFarm = New System.Windows.Forms.ToolStripMenuItem() Me.stsStrip.SuspendLayout() Me.Tool_strip.SuspendLayout() Me.mnuBar.SuspendLayout() @@ -2891,7 +2892,7 @@ Partial Class frmMain Me.mnuEditFind.Enabled = False Me.mnuEditFind.Name = "mnuEditFind" Me.mnuEditFind.ShortcutKeys = CType((System.Windows.Forms.Keys.Control Or System.Windows.Forms.Keys.F), System.Windows.Forms.Keys) - Me.mnuEditFind.Size = New System.Drawing.Size(207, 22) + Me.mnuEditFind.Size = New System.Drawing.Size(244, 22) Me.mnuEditFind.Tag = "Find" Me.mnuEditFind.Text = "Find" ' @@ -2899,14 +2900,14 @@ Partial Class frmMain ' Me.mnuEditFindNext.Enabled = False Me.mnuEditFindNext.Name = "mnuEditFindNext" - Me.mnuEditFindNext.Size = New System.Drawing.Size(207, 22) + Me.mnuEditFindNext.Size = New System.Drawing.Size(244, 22) Me.mnuEditFindNext.Text = "Find Next" ' 'mnuEditReplace ' Me.mnuEditReplace.Enabled = False Me.mnuEditReplace.Name = "mnuEditReplace" - Me.mnuEditReplace.Size = New System.Drawing.Size(207, 22) + Me.mnuEditReplace.Size = New System.Drawing.Size(244, 22) Me.mnuEditReplace.Tag = "Replace" Me.mnuEditReplace.Text = "Replace" ' @@ -2915,7 +2916,7 @@ Partial Class frmMain Me.mnuEditCut.Enabled = False Me.mnuEditCut.Name = "mnuEditCut" Me.mnuEditCut.ShortcutKeys = CType((System.Windows.Forms.Keys.Control Or System.Windows.Forms.Keys.X), System.Windows.Forms.Keys) - Me.mnuEditCut.Size = New System.Drawing.Size(207, 22) + Me.mnuEditCut.Size = New System.Drawing.Size(244, 22) Me.mnuEditCut.Tag = "Cut" Me.mnuEditCut.Text = "Cut" ' @@ -2923,7 +2924,7 @@ Partial Class frmMain ' Me.mnuEditCopy.Name = "mnuEditCopy" Me.mnuEditCopy.ShortcutKeys = CType((System.Windows.Forms.Keys.Control Or System.Windows.Forms.Keys.C), System.Windows.Forms.Keys) - Me.mnuEditCopy.Size = New System.Drawing.Size(207, 22) + Me.mnuEditCopy.Size = New System.Drawing.Size(244, 22) Me.mnuEditCopy.Tag = "Copy" Me.mnuEditCopy.Text = "Copy" ' @@ -2932,7 +2933,7 @@ Partial Class frmMain Me.mnuEditCopySpecial.Name = "mnuEditCopySpecial" Me.mnuEditCopySpecial.ShortcutKeys = CType(((System.Windows.Forms.Keys.Control Or System.Windows.Forms.Keys.Alt) _ Or System.Windows.Forms.Keys.C), System.Windows.Forms.Keys) - Me.mnuEditCopySpecial.Size = New System.Drawing.Size(207, 22) + Me.mnuEditCopySpecial.Size = New System.Drawing.Size(244, 22) Me.mnuEditCopySpecial.Tag = "Copy_Special" Me.mnuEditCopySpecial.Text = "Copy Special" ' @@ -2940,7 +2941,7 @@ Partial Class frmMain ' Me.mnuEditPaste.Name = "mnuEditPaste" Me.mnuEditPaste.ShortcutKeys = CType((System.Windows.Forms.Keys.Control Or System.Windows.Forms.Keys.V), System.Windows.Forms.Keys) - Me.mnuEditPaste.Size = New System.Drawing.Size(207, 22) + Me.mnuEditPaste.Size = New System.Drawing.Size(244, 22) Me.mnuEditPaste.Tag = "Paste" Me.mnuEditPaste.Text = "Paste" ' @@ -2949,14 +2950,14 @@ Partial Class frmMain Me.mnuPasteSpecial.Name = "mnuPasteSpecial" Me.mnuPasteSpecial.ShortcutKeys = CType(((System.Windows.Forms.Keys.Control Or System.Windows.Forms.Keys.Alt) _ Or System.Windows.Forms.Keys.V), System.Windows.Forms.Keys) - Me.mnuPasteSpecial.Size = New System.Drawing.Size(207, 22) + Me.mnuPasteSpecial.Size = New System.Drawing.Size(244, 22) Me.mnuPasteSpecial.Tag = "Paste" - Me.mnuPasteSpecial.Text = "Paste Special" + Me.mnuPasteSpecial.Text = "Paste New Columns" ' 'mnuEditPasteNewDataFrame ' Me.mnuEditPasteNewDataFrame.Name = "mnuEditPasteNewDataFrame" - Me.mnuEditPasteNewDataFrame.Size = New System.Drawing.Size(207, 22) + Me.mnuEditPasteNewDataFrame.Size = New System.Drawing.Size(244, 22) Me.mnuEditPasteNewDataFrame.Tag = "Paste" Me.mnuEditPasteNewDataFrame.Text = "Paste New Data Frame" ' @@ -2964,19 +2965,19 @@ Partial Class frmMain ' Me.mnuEditSelectAll.Name = "mnuEditSelectAll" Me.mnuEditSelectAll.ShortcutKeys = CType((System.Windows.Forms.Keys.Control Or System.Windows.Forms.Keys.A), System.Windows.Forms.Keys) - Me.mnuEditSelectAll.Size = New System.Drawing.Size(207, 22) + Me.mnuEditSelectAll.Size = New System.Drawing.Size(244, 22) Me.mnuEditSelectAll.Tag = "Select_All" Me.mnuEditSelectAll.Text = "Select All " ' 'ToolStripSeparator71 ' Me.ToolStripSeparator71.Name = "ToolStripSeparator71" - Me.ToolStripSeparator71.Size = New System.Drawing.Size(204, 6) + Me.ToolStripSeparator71.Size = New System.Drawing.Size(241, 6) ' 'mnuEditScript ' Me.mnuEditScript.Name = "mnuEditScript" - Me.mnuEditScript.Size = New System.Drawing.Size(207, 22) + Me.mnuEditScript.Size = New System.Drawing.Size(244, 22) Me.mnuEditScript.Text = "Script" ' 'stsStrip @@ -3406,7 +3407,7 @@ Partial Class frmMain ' 'mnuPrepareDataFrame ' - Me.mnuPrepareDataFrame.DropDownItems.AddRange(New System.Windows.Forms.ToolStripItem() {Me.mnuPrepareDataFrameViewData, Me.mnuPrepareDataFrameRenameColumn, Me.mnuPrepareDataFrameDuplicateColumn, Me.mnuPrepareDataFrameRowNumbersNames, Me.ToolStripSeparator1, Me.mnuPrepareDataFrameSort, Me.mnuPrepareDataFrameFilter, Me.mnuPrepareDataFrameSelectColumns, Me.mnuPrepareDataFrameReplaceValues, Me.mnuPrepareDataFrameConvertColumns, Me.ToolStripSeparator2, Me.mnuPrepareDataFrameReorderColumns, Me.mnuPrepareDataFrameInsertColumnsRows, Me.mnuPrepareDataFrameDeleteColumnsRows, Me.mnuPrepareDataFrameProtectColumn, Me.mnuPrepareDataFrameHideColumns, Me.mnuPrepareDataFrameFreezeColumns, Me.mnuPrepareDataFrameColumnStructure, Me.mnuPrepareDataframeColourByProperty}) + Me.mnuPrepareDataFrame.DropDownItems.AddRange(New System.Windows.Forms.ToolStripItem() {Me.mnuPrepareDataFrameViewData, Me.mnuPrepareDataFrameRenameColumn, Me.mnuPrepareDataFrameDuplicateColumn, Me.mnuPrepareDataFrameRowNumbersNames, Me.ToolStripSeparator1, Me.mnuPrepareDataFrameSort, Me.mnuPrepareDataFrameFilter, Me.mnuPrepareDataFrameSelectColumns, Me.mnuPrepareDataFrameReplaceValues, Me.mnuPrepareDataFrameConvertColumns, Me.ToolStripSeparator2, Me.mnuPrepareDataFrameReorderColumns, Me.mnuPrepareDataFrameInsertColumnsRows, Me.mnuPrepareDataFrameDeleteColumnsRows, Me.mnuPrepareDataFrameProtectColumn, Me.mnuPrepareDataFrameHideColumns, Me.mnuPrepareDataFrameFreezeColumns, Me.mnuPrepareDataframeColourByProperty}) Me.mnuPrepareDataFrame.Name = "mnuPrepareDataFrame" Me.mnuPrepareDataFrame.Size = New System.Drawing.Size(186, 22) Me.mnuPrepareDataFrame.Tag = "Data_Frame" @@ -3529,13 +3530,6 @@ Partial Class frmMain Me.mnuPrepareDataFrameFreezeColumns.Text = "Freeze Columns..." Me.mnuPrepareDataFrameFreezeColumns.Visible = False ' - 'mnuPrepareDataFrameColumnStructure - ' - Me.mnuPrepareDataFrameColumnStructure.Name = "mnuPrepareDataFrameColumnStructure" - Me.mnuPrepareDataFrameColumnStructure.Size = New System.Drawing.Size(200, 22) - Me.mnuPrepareDataFrameColumnStructure.Tag = "Column_Structure..." - Me.mnuPrepareDataFrameColumnStructure.Text = "Column Structure..." - ' 'mnuPrepareDataframeColourByProperty ' Me.mnuPrepareDataframeColourByProperty.Name = "mnuPrepareDataframeColourByProperty" @@ -3735,104 +3729,104 @@ Partial Class frmMain 'mnuPrepareColumnFactorConvertToFactor ' Me.mnuPrepareColumnFactorConvertToFactor.Name = "mnuPrepareColumnFactorConvertToFactor" - Me.mnuPrepareColumnFactorConvertToFactor.Size = New System.Drawing.Size(179, 22) + Me.mnuPrepareColumnFactorConvertToFactor.Size = New System.Drawing.Size(182, 22) Me.mnuPrepareColumnFactorConvertToFactor.Tag = "Convert_To_Factor" Me.mnuPrepareColumnFactorConvertToFactor.Text = "Convert To Factor..." ' 'mnuPrepareColumnFactorRecodeNumeric ' Me.mnuPrepareColumnFactorRecodeNumeric.Name = "mnuPrepareColumnFactorRecodeNumeric" - Me.mnuPrepareColumnFactorRecodeNumeric.Size = New System.Drawing.Size(179, 22) + Me.mnuPrepareColumnFactorRecodeNumeric.Size = New System.Drawing.Size(182, 22) Me.mnuPrepareColumnFactorRecodeNumeric.Tag = "Recode_Numeric..." Me.mnuPrepareColumnFactorRecodeNumeric.Text = "Recode Numeric..." ' 'mnuPrepareColumnFactorCountInFactor ' Me.mnuPrepareColumnFactorCountInFactor.Name = "mnuPrepareColumnFactorCountInFactor" - Me.mnuPrepareColumnFactorCountInFactor.Size = New System.Drawing.Size(179, 22) + Me.mnuPrepareColumnFactorCountInFactor.Size = New System.Drawing.Size(182, 22) Me.mnuPrepareColumnFactorCountInFactor.Text = "Count in Factor..." ' 'ToolStripSeparator12 ' Me.ToolStripSeparator12.Name = "ToolStripSeparator12" - Me.ToolStripSeparator12.Size = New System.Drawing.Size(176, 6) + Me.ToolStripSeparator12.Size = New System.Drawing.Size(179, 6) ' 'mnuPrepareColumnFactorRecodeFactor ' Me.mnuPrepareColumnFactorRecodeFactor.Name = "mnuPrepareColumnFactorRecodeFactor" - Me.mnuPrepareColumnFactorRecodeFactor.Size = New System.Drawing.Size(179, 22) + Me.mnuPrepareColumnFactorRecodeFactor.Size = New System.Drawing.Size(182, 22) Me.mnuPrepareColumnFactorRecodeFactor.Tag = "Recode_Factor..." Me.mnuPrepareColumnFactorRecodeFactor.Text = "Recode Factor..." ' 'mnuPrepareColumnFactorCombineFactors ' Me.mnuPrepareColumnFactorCombineFactors.Name = "mnuPrepareColumnFactorCombineFactors" - Me.mnuPrepareColumnFactorCombineFactors.Size = New System.Drawing.Size(179, 22) + Me.mnuPrepareColumnFactorCombineFactors.Size = New System.Drawing.Size(182, 22) Me.mnuPrepareColumnFactorCombineFactors.Tag = "Combine_Factors..." Me.mnuPrepareColumnFactorCombineFactors.Text = "Combine Factors..." ' 'mnuPrepareColumnFactorDummyVariables ' Me.mnuPrepareColumnFactorDummyVariables.Name = "mnuPrepareColumnFactorDummyVariables" - Me.mnuPrepareColumnFactorDummyVariables.Size = New System.Drawing.Size(179, 22) + Me.mnuPrepareColumnFactorDummyVariables.Size = New System.Drawing.Size(182, 22) Me.mnuPrepareColumnFactorDummyVariables.Tag = "Dummy_Variables..." Me.mnuPrepareColumnFactorDummyVariables.Text = "Dummy Variables..." ' 'ToolStripSeparator14 ' Me.ToolStripSeparator14.Name = "ToolStripSeparator14" - Me.ToolStripSeparator14.Size = New System.Drawing.Size(176, 6) + Me.ToolStripSeparator14.Size = New System.Drawing.Size(179, 6) ' 'mnuPrepareColumnFactorLevelsLabels ' Me.mnuPrepareColumnFactorLevelsLabels.Name = "mnuPrepareColumnFactorLevelsLabels" - Me.mnuPrepareColumnFactorLevelsLabels.Size = New System.Drawing.Size(179, 22) + Me.mnuPrepareColumnFactorLevelsLabels.Size = New System.Drawing.Size(182, 22) Me.mnuPrepareColumnFactorLevelsLabels.Tag = "Levels/Labels..." Me.mnuPrepareColumnFactorLevelsLabels.Text = "Levels/Labels..." ' 'mnuPrepareFactorViewLabels ' Me.mnuPrepareFactorViewLabels.Name = "mnuPrepareFactorViewLabels" - Me.mnuPrepareFactorViewLabels.Size = New System.Drawing.Size(179, 22) - Me.mnuPrepareFactorViewLabels.Text = "View Labels..." + Me.mnuPrepareFactorViewLabels.Size = New System.Drawing.Size(182, 22) + Me.mnuPrepareFactorViewLabels.Text = "View/Delete Labels..." ' 'mnuPrepareColumnFactorReorderLevels ' Me.mnuPrepareColumnFactorReorderLevels.Name = "mnuPrepareColumnFactorReorderLevels" - Me.mnuPrepareColumnFactorReorderLevels.Size = New System.Drawing.Size(179, 22) + Me.mnuPrepareColumnFactorReorderLevels.Size = New System.Drawing.Size(182, 22) Me.mnuPrepareColumnFactorReorderLevels.Tag = "Reorder_Levels..." Me.mnuPrepareColumnFactorReorderLevels.Text = "Reorder Levels..." ' 'mnuPrepareColumnFactorReferenceLevel ' Me.mnuPrepareColumnFactorReferenceLevel.Name = "mnuPrepareColumnFactorReferenceLevel" - Me.mnuPrepareColumnFactorReferenceLevel.Size = New System.Drawing.Size(179, 22) + Me.mnuPrepareColumnFactorReferenceLevel.Size = New System.Drawing.Size(182, 22) Me.mnuPrepareColumnFactorReferenceLevel.Tag = "Reference_Level..." Me.mnuPrepareColumnFactorReferenceLevel.Text = "Reference Level..." ' 'mnuPrepareColumnFactorUnusedLevels ' Me.mnuPrepareColumnFactorUnusedLevels.Name = "mnuPrepareColumnFactorUnusedLevels" - Me.mnuPrepareColumnFactorUnusedLevels.Size = New System.Drawing.Size(179, 22) + Me.mnuPrepareColumnFactorUnusedLevels.Size = New System.Drawing.Size(182, 22) Me.mnuPrepareColumnFactorUnusedLevels.Tag = "Unused_Levels..." Me.mnuPrepareColumnFactorUnusedLevels.Text = "Unused Levels..." ' 'mnuPrepareColumnFactorContrasts ' Me.mnuPrepareColumnFactorContrasts.Name = "mnuPrepareColumnFactorContrasts" - Me.mnuPrepareColumnFactorContrasts.Size = New System.Drawing.Size(179, 22) + Me.mnuPrepareColumnFactorContrasts.Size = New System.Drawing.Size(182, 22) Me.mnuPrepareColumnFactorContrasts.Tag = "Contrasts..." Me.mnuPrepareColumnFactorContrasts.Text = "Contrasts..." ' 'ToolStripSeparator19 ' Me.ToolStripSeparator19.Name = "ToolStripSeparator19" - Me.ToolStripSeparator19.Size = New System.Drawing.Size(176, 6) + Me.ToolStripSeparator19.Size = New System.Drawing.Size(179, 6) ' 'mnuPrepareColumnFactorFactorDataFrame ' Me.mnuPrepareColumnFactorFactorDataFrame.Name = "mnuPrepareColumnFactorFactorDataFrame" - Me.mnuPrepareColumnFactorFactorDataFrame.Size = New System.Drawing.Size(179, 22) + Me.mnuPrepareColumnFactorFactorDataFrame.Size = New System.Drawing.Size(182, 22) Me.mnuPrepareColumnFactorFactorDataFrame.Tag = "Factor_Data_Frame" Me.mnuPrepareColumnFactorFactorDataFrame.Text = "Factor Data Frame..." ' @@ -4661,7 +4655,7 @@ Partial Class frmMain ' 'mnuOptionsByContext ' - Me.mnuOptionsByContext.DropDownItems.AddRange(New System.Windows.Forms.ToolStripItem() {Me.mnuOptionsByContextCheckData, Me.mnuOptionsByContextDefineOptionsByContexts, Me.mnuOptionsByContextPrepare, Me.mnuOptionsByContextDescribe, Me.mnuOptionsByContextModel}) + Me.mnuOptionsByContext.DropDownItems.AddRange(New System.Windows.Forms.ToolStripItem() {Me.mnuOptionsByContextCheckData, Me.mnuOptionsByContextDefine, Me.mnuOptionsByContextPrepare, Me.mnuOptionsByContextDescribe, Me.mnuOptionsByContextModel}) Me.mnuOptionsByContext.Name = "mnuOptionsByContext" Me.mnuOptionsByContext.Size = New System.Drawing.Size(122, 20) Me.mnuOptionsByContext.Text = "Options by Context" @@ -4670,7 +4664,7 @@ Partial Class frmMain ' Me.mnuOptionsByContextCheckData.DropDownItems.AddRange(New System.Windows.Forms.ToolStripItem() {Me.mnuOptionsByContextCheckDataDuplicates, Me.mnuOptionsByContextCheckDataCompareColumns, Me.ToolStripSeparator47, Me.mnuOptionsByContextCheckDataOneVariableSummarise, Me.mnuOptionsByContextCheckDataOneVariableGraph, Me.mnuOptionsByContextCheckDataOneVariableFrequencies}) Me.mnuOptionsByContextCheckData.Name = "mnuOptionsByContextCheckData" - Me.mnuOptionsByContextCheckData.Size = New System.Drawing.Size(250, 22) + Me.mnuOptionsByContextCheckData.Size = New System.Drawing.Size(180, 22) Me.mnuOptionsByContextCheckData.Text = "Check Data" ' 'mnuOptionsByContextCheckDataDuplicates @@ -4708,17 +4702,11 @@ Partial Class frmMain Me.mnuOptionsByContextCheckDataOneVariableFrequencies.Size = New System.Drawing.Size(215, 22) Me.mnuOptionsByContextCheckDataOneVariableFrequencies.Text = "One Variable Frequencies..." ' - 'mnuOptionsByContextDefineOptionsByContexts - ' - Me.mnuOptionsByContextDefineOptionsByContexts.Name = "mnuOptionsByContextDefineOptionsByContexts" - Me.mnuOptionsByContextDefineOptionsByContexts.Size = New System.Drawing.Size(250, 22) - Me.mnuOptionsByContextDefineOptionsByContexts.Text = "Define Options by Context Data..." - ' 'mnuOptionsByContextPrepare ' Me.mnuOptionsByContextPrepare.DropDownItems.AddRange(New System.Windows.Forms.ToolStripItem() {Me.mnuOptionsByContextPrepareCalculateDIfferenceBetweenOptions, Me.ToolStripSeparator48, Me.mnuOptionsByContextMergeAdditionalData, Me.mnuOptionsByContextPrepareStack, Me.mnuOptionsByContextPrepareUnstack}) Me.mnuOptionsByContextPrepare.Name = "mnuOptionsByContextPrepare" - Me.mnuOptionsByContextPrepare.Size = New System.Drawing.Size(250, 22) + Me.mnuOptionsByContextPrepare.Size = New System.Drawing.Size(180, 22) Me.mnuOptionsByContextPrepare.Text = "Prepare" ' 'mnuOptionsByContextPrepareCalculateDIfferenceBetweenOptions @@ -4754,7 +4742,7 @@ Partial Class frmMain ' Me.mnuOptionsByContextDescribe.DropDownItems.AddRange(New System.Windows.Forms.ToolStripItem() {Me.mnuOptionsByContextDescribeCompareTwoTreatments, Me.mnuOptionsByContextDescribeCompareMultipleTreatments, Me.mnuOptionsByContextDescribeBoxplot}) Me.mnuOptionsByContextDescribe.Name = "mnuOptionsByContextDescribe" - Me.mnuOptionsByContextDescribe.Size = New System.Drawing.Size(250, 22) + Me.mnuOptionsByContextDescribe.Size = New System.Drawing.Size(180, 22) Me.mnuOptionsByContextDescribe.Text = "Describe" ' 'mnuOptionsByContextDescribeCompareTwoTreatments @@ -4780,7 +4768,7 @@ Partial Class frmMain ' Me.mnuOptionsByContextModel.DropDownItems.AddRange(New System.Windows.Forms.ToolStripItem() {Me.mnuOptionsByContextModelFitModel, Me.mnuOptionsByContextGeneralFitModel}) Me.mnuOptionsByContextModel.Name = "mnuOptionsByContextModel" - Me.mnuOptionsByContextModel.Size = New System.Drawing.Size(250, 22) + Me.mnuOptionsByContextModel.Size = New System.Drawing.Size(180, 22) Me.mnuOptionsByContextModel.Text = "Model" ' 'mnuOptionsByContextModelFitModel @@ -5091,6 +5079,25 @@ Partial Class frmMain Me.mnuLogFile.Text = "Log Window..." Me.mnuLogFile.ToolTipText = "Log Window" ' + 'mnuOptionsByContextDefine + ' + Me.mnuOptionsByContextDefine.DropDownItems.AddRange(New System.Windows.Forms.ToolStripItem() {Me.mnuOptionsByContextDefineOnStation, Me.mnuOptionsByContextDefineOnFarm}) + Me.mnuOptionsByContextDefine.Name = "mnuOptionsByContextDefine" + Me.mnuOptionsByContextDefine.Size = New System.Drawing.Size(180, 22) + Me.mnuOptionsByContextDefine.Text = "Define" + ' + 'mnuOptionsByContextDefineOnStation + ' + Me.mnuOptionsByContextDefineOnStation.Name = "mnuOptionsByContextDefineOnStation" + Me.mnuOptionsByContextDefineOnStation.Size = New System.Drawing.Size(180, 22) + Me.mnuOptionsByContextDefineOnStation.Text = "On - Station..." + ' + 'mnuOptionsByContextDefineOnFarm + ' + Me.mnuOptionsByContextDefineOnFarm.Name = "mnuOptionsByContextDefineOnFarm" + Me.mnuOptionsByContextDefineOnFarm.Size = New System.Drawing.Size(180, 22) + Me.mnuOptionsByContextDefineOnFarm.Text = "On - Farm..." + ' 'frmMain ' Me.AutoScaleDimensions = New System.Drawing.SizeF(96.0!, 96.0!) @@ -5262,7 +5269,6 @@ Partial Class frmMain Friend WithEvents ToolStripSeparator1 As ToolStripSeparator Friend WithEvents mnuPrepareDataFrameReplaceValues As ToolStripMenuItem Friend WithEvents ToolStripSeparator2 As ToolStripSeparator - Friend WithEvents mnuPrepareDataFrameColumnStructure As ToolStripMenuItem Friend WithEvents mnuPrepareDataFrameReorderColumns As ToolStripMenuItem Friend WithEvents mnuPrepareDataFrameInsertColumnsRows As ToolStripMenuItem Friend WithEvents mnuPrepareDataFrameDeleteColumnsRows As ToolStripMenuItem @@ -5575,7 +5581,6 @@ Partial Class frmMain Friend WithEvents mnuClimaticPrepareEvapotranspiration As ToolStripMenuItem Friend WithEvents mnuPrepareCheckDataCompareColumns As ToolStripMenuItem Friend WithEvents mnuOptionsByContext As ToolStripMenuItem - Friend WithEvents mnuOptionsByContextDefineOptionsByContexts As ToolStripMenuItem Friend WithEvents mnuOptionsByContextPrepare As ToolStripMenuItem Friend WithEvents mnuOptionsByContextMergeAdditionalData As ToolStripMenuItem Friend WithEvents mnuOptionsByContextCheckData As ToolStripMenuItem @@ -5783,4 +5788,7 @@ Partial Class frmMain Friend WithEvents ToolStripSeparator72 As ToolStripSeparator Friend WithEvents mnuModelFitModelMachineLearning As ToolStripMenuItem Friend WithEvents mnuDescribeMultivariateClusterAnalysis As ToolStripMenuItem + Friend WithEvents mnuOptionsByContextDefine As ToolStripMenuItem + Friend WithEvents mnuOptionsByContextDefineOnStation As ToolStripMenuItem + Friend WithEvents mnuOptionsByContextDefineOnFarm As ToolStripMenuItem End Class diff --git a/instat/frmMain.vb b/instat/frmMain.vb index 3e099b26ff8..bc81ce1a85f 100644 --- a/instat/frmMain.vb +++ b/instat/frmMain.vb @@ -1030,10 +1030,6 @@ Public Class frmMain End Using End Sub - Private Sub mnuOrganiseDataFrameColumnStructure_Click(sender As Object, e As EventArgs) Handles mnuPrepareDataFrameColumnStructure.Click - dlgColumnStructure.ShowDialog() - End Sub - Private Sub mnuDescribeTwoVariablesGraph_Click(sender As Object, e As EventArgs) Handles mnuDescribeTwoVariablesGraph.Click dlgDescribeTwoVarGraph.ShowDialog() End Sub @@ -1838,10 +1834,6 @@ Public Class frmMain dlgCompareColumns.ShowDialog() End Sub - Private Sub mnuDefineOptionsByContexts_Click(sender As Object, e As EventArgs) Handles mnuOptionsByContextDefineOptionsByContexts.Click - dlgDefineOptionsByContext.ShowDialog() - End Sub - Private Sub MergeAdditionalDataToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles mnuOptionsByContextMergeAdditionalData.Click dlgMergeAdditionalData.ShowDialog() End Sub @@ -2389,7 +2381,7 @@ Public Class frmMain End Sub Private Sub mnuPasteSpecial_Click(sender As Object, e As EventArgs) Handles mnuPasteSpecial.Click, mnuSubTbPasteSpecial.Click - dlgPasteSpecial.ShowDialog() + dlgPasteNewColumns.ShowDialog() End Sub Private Sub mnuDescribeTwoVariablesPivotTable_Click(sender As Object, e As EventArgs) Handles mnuDescribeTwoVariablesPivotTable.Click @@ -2431,4 +2423,12 @@ Public Class frmMain Private Sub mnuDescribeMultivariateClusterAnalysis_Click(sender As Object, e As EventArgs) Handles mnuDescribeMultivariateClusterAnalysis.Click dlgClusterAnalysis.ShowDialog() End Sub + + Private Sub mnuOptionsByContextDefineOnStation_Click(sender As Object, e As EventArgs) Handles mnuOptionsByContextDefineOnStation.Click + dlgColumnStructure.ShowDialog() + End Sub + + Private Sub mnuOptionsByContextDefineOnFarm_Click(sender As Object, e As EventArgs) Handles mnuOptionsByContextDefineOnFarm.Click + dlgDefineOptionsByContext.ShowDialog() + End Sub End Class diff --git a/instat/sdgDataOptions.vb b/instat/sdgDataOptions.vb index c7e45302f7c..831681b7a87 100644 --- a/instat/sdgDataOptions.vb +++ b/instat/sdgDataOptions.vb @@ -108,7 +108,7 @@ Public Class sdgDataOptions clsSetCurrentColumnSelection.SetRCommand(frmMain.clsRLink.strInstatDataObject & "$set_current_column_selection") clsSetCurrentColumnSelection.AddParameter("data_name", Chr(34) & ucrSelectorForSelectColumns.ucrAvailableDataFrames.cboAvailableDataFrames.Text & Chr(34)) clsSetCurrentColumnSelection.AddParameter("name", ucrReceiverSelect.GetVariableNames()) - frmMain.clsRLink.RunScript(clsSetCurrentColumnSelection.ToScript(), strComment:="Data Options subdialog: Set the current column selection") + frmMain.clsRLink.RunScript(clsSetCurrentColumnSelection.ToScript(), strComment:="Data Options subdialog: Set the current column selection", iCallType:=2) Else 'TODO: Set Local column selection End If @@ -148,8 +148,8 @@ Public Class sdgDataOptions End Sub Private Sub cmdDefineNewSelect_Click(sender As Object, e As EventArgs) Handles cmdDefineNewSelect.Click + dlgSelectColumns.SetDefaultDataFrame(strCurrentDataFrame) dlgSelectColumns.ShowDialog() - ucrReceiverSelect.Add(dlgSelectColumns.ucrInputSelectName.GetText) ucrSelectorForSelectColumns.LoadList() End Sub diff --git a/instat/static/InstatObject/R/Rsetup.R b/instat/static/InstatObject/R/Rsetup.R index 6b04500753b..0d7aa91f633 100644 --- a/instat/static/InstatObject/R/Rsetup.R +++ b/instat/static/InstatObject/R/Rsetup.R @@ -226,7 +226,8 @@ load_R_Instat_packages <- function() { # texmex loaded because of extreme value distributions # tidyr loaded because unite() function is required by mmtable() function from mmtable2 package # purrr loaded because map_int() is required by function(s) such as header_top_left() from mmtable2 package - packs_to_load <- c("purrr", "plyr", "tidyr", "dplyr", "ggplot2", "ggthemes", "svglite", "ggfortify", "PCICt", "sp", "ggmosaic", "wakefield", "circular", "latticeExtra", "texmex") + # mc2d loaded because of triangular and continuous empirical distributions + packs_to_load <- c("purrr", "plyr", "tidyr", "dplyr", "ggplot2", "ggthemes", "svglite", "ggfortify", "PCICt", "sp", "ggmosaic", "wakefield", "circular", "latticeExtra", "texmex", "mc2d") for(pack in packs_to_load) { try(library(pack, character.only = TRUE)) } diff --git a/instat/static/InstatObject/R/data_object_R6.R b/instat/static/InstatObject/R/data_object_R6.R index 2b022b0c310..f851b64b654 100644 --- a/instat/static/InstatObject/R/data_object_R6.R +++ b/instat/static/InstatObject/R/data_object_R6.R @@ -1883,10 +1883,13 @@ DataSheet$set("public", "get_current_column_selection", function() { ) DataSheet$set("public", "set_current_column_selection", function(name = "") { - if(!name %in% names(private$column_selections)) stop(name, " not found as a column selection.") - self$current_column_selection <- private$column_selections[[name]] -} -) + if (!name %in% names(private$column_selections)) stop(name, " not found as a column selection.") + if (length(self$get_column_selection_column_names(name)) == 0) { + cat(name, " has no columns selected.") + } else { + self$current_column_selection <- private$column_selections[[name]] + } +}) DataSheet$set("public", "get_column_selection_names", function(as_list = FALSE, include = list(), exclude = list(), excluded_items = c()) { out <- names(private$column_selections) @@ -1931,11 +1934,21 @@ DataSheet$set("public", "get_column_selection_column_names", function(name) { "tidyselect::matches" = tidyselect::matches, "tidyselect::num_range" = tidyselect::num_range, "tidyselect::last_col" = tidyselect::last_col, + "tidyselect::where" = NULL, NULL ) - if (op == "base::match") args$table <- all_column_names - else args$vars <- all_column_names - res[[i]] <- do.call(fn, args) + if (op == "base::match") { + args$table <- all_column_names + res[[i]] <- do.call(fn, args) + }else if (op == "tidyselect::where"){ + selected_columns <- private$data |> + dplyr::select(where(args$fn)) |> + colnames() + res[[i]] <- which(all_column_names %in% selected_columns) + }else{ + args$vars <- all_column_names + res[[i]] <- do.call(fn, args) + } if (neg) res[[i]] <- setdiff(1:length(all_column_names), res[[i]]) i <- i + 1 } @@ -2044,7 +2057,7 @@ DataSheet$set("public", "get_last_graph", function() { ) DataSheet$set("public", "rename_object", function(object_name, new_name, object_type = "object") { - if(!object_type %in% c("object", "filter", "calculation", "graph", "table","model")) stop(object_type, " must be either object (graph, table or model), filter or a calculation.") + if(!object_type %in% c("object", "filter", "calculation", "graph", "table","model", "column_selection")) stop(object_type, " must be either object (graph, table or model), filter, column_selection or a calculation.") #Temp fix:: added graph, table and model so as to distinguish this when implementing it in the dialog. Otherwise they remain as objects if (object_type %in% c("object", "graph", "table","model")){ if(!object_name %in% names(private$objects)) stop(object_name, " not found in objects list") @@ -2063,12 +2076,19 @@ DataSheet$set("public", "rename_object", function(object_name, new_name, object_ if(new_name %in% names(private$calculations)) stop(new_name, " is already a calculation name. Cannot rename ", object_name, " to ", new_name) names(private$calculations)[names(private$calculations) == object_name] <- new_name } + else if (object_type == "column_selection"){ + if(!object_name %in% names(private$column_selections)) stop(object_name, " not found in column selections list") + if(new_name %in% names(private$column_selections)) stop(new_name, " is already a column selection name. Cannot rename ", object_name, " to ", new_name) + if(".everything" == object_name) stop("Renaming .everything is not allowed.") + names(private$column_selections)[names(private$column_selections) == object_name] <- new_name + if(private$.current_column_selection$name == object_name){private$.current_column_selection$name <- new_name} + } } ) DataSheet$set("public", "delete_objects", function(data_name, object_names, object_type = "object") { - if(!object_type %in% c("object", "graph", "table","model","filter", "calculation")) stop(object_type, " must be either object (graph, table or model), filter or a calculation.") - if(any(object_type == c("object", "graph", "table","model"))){ + if(!object_type %in% c("object", "graph", "table","model","filter", "calculation", "column_selection")) stop(object_type, " must be either object (graph, table or model), filter, column selection or a calculation.") + if(any(object_type %in% c("object", "graph", "table","model"))){ if(!all(object_names %in% names(private$objects))) stop("Not all object_names found in overall objects list.") private$objects[names(private$objects) %in% object_names] <- NULL }else if(object_type == "filter"){ @@ -2079,6 +2099,11 @@ DataSheet$set("public", "delete_objects", function(data_name, object_names, obje }else if(object_type == "calculation"){ if(!object_names %in% names(private$calculations)) stop(object_names, " not found in calculations list.") private$calculations[names(private$calculations) %in% object_names] <- NULL + }else if(object_type == "column_selection"){ + if(!all(object_names %in% names(private$column_selections))) stop(object_names, " not found in column selections list.") + if(".everything" %in% object_names) stop(".everything cannot be deleted.") + if(any(private$.current_column_selection$name %in% object_names))stop(private$.current_column_selection$name, " is currently in use and cannot be deleted.") + private$column_selections[names(private$column_selections) %in% object_names] <- NULL } if(!is.null(private$.last_graph) && length(private$.last_graph) == 2 && private$.last_graph[1] == data_name && private$.last_graph[2] %in% object_names) { private$.last_graph <- NULL @@ -4248,3 +4273,42 @@ DataSheet$set("public", "add_flag_fields", function(col_names) { self$add_columns_to_data(col_data = col_data, col_name = paste0(i, "_fl")) } }) + +DataSheet$set("public", "remove_empty", function(which = c("rows", "cols")) { + curr_data <- self$get_data_frame() + old_metadata <- attributes(curr_data) + new_df <- curr_data |> + janitor::remove_empty(which = which) + row_message <- paste(nrow(curr_data) - nrow(new_df), "empty rows deleted") + cols_message <- paste(ncol(curr_data) - ncol(new_df), "empty variables deleted") + if (all(which %in% "rows")) cat(row_message, "\n") + if (all(which %in% "cols")) cat(cols_message) + if (all(c("rows", "cols") %in% which)) { + cat(row_message, "\n") + cat(cols_message) + } + for (name in names(old_metadata)) { + if (!(name %in% c("names", "class", "row.names"))) { + attr(new_df, name) <- old_metadata[[name]] + } + } + for (col_name in names(new_df)) { + for (attr_name in names(attributes(private$data[[col_name]]))) { + if (!attr_name %in% c("class", "levels")) { + attr(new_df[[col_name]], attr_name) <- attr(private$data[[col_name]], attr_name) + } + } + } + self$set_data(new_df) + self$data_changed <- TRUE + private$.variables_metadata_changed <- TRUE +}) + +DataSheet$set("public", "replace_values_with_NA", function(row_index, column_index) { + curr_data <- self$get_data_frame(use_current_filter = FALSE) + if(!all(row_index %in% seq_len(nrow(curr_data)))) stop("All row indexes must be within the dataframe") + if(!all(column_index %in% seq_len(ncol(curr_data)))) stop("All column indexes must be within the dataframe") + curr_data[row_index, column_index] <- NA + self$set_data(curr_data) +} +) diff --git a/instat/static/InstatObject/R/install_packages.R b/instat/static/InstatObject/R/install_packages.R index 30435fd43e9..dd215285200 100644 --- a/instat/static/InstatObject/R/install_packages.R +++ b/instat/static/InstatObject/R/install_packages.R @@ -114,8 +114,16 @@ pkgs <- "tidytext", "janitor", "ggwordcloud", + # Has many useful datasets, described in the R-Instat help.They include prime numbers, Fibonacci numbers, names of dinosaurs, and the chemical elements. + "rcorpora", + # Includes a set of interesting data sets, designed particularly for machine learning. + "mlbench", # For producing periodic and natural splines in Climatic > Compare > Seasonal Plot "splines2", + # For density, distribution function and random generation for triangular and continuous empirical distributions + # Model > Probability Distributions > Show Model + # Model > Probability Distributions > Random Samples + "mc2d" # For fast creation of dummy (binary) variables from categories variables in Prepare > Column:Factor > Dummy Variables "fastDummies" # also install mmtable2 from GitHub devtools::install_github("ianmoran11/mmtable2") diff --git a/instat/static/InstatObject/R/instat_object_R6.R b/instat/static/InstatObject/R/instat_object_R6.R index a80f6ffbc5b..3e1b8b07376 100644 --- a/instat/static/InstatObject/R/instat_object_R6.R +++ b/instat/static/InstatObject/R/instat_object_R6.R @@ -2714,3 +2714,11 @@ DataBook$set("public", "add_flag_fields", function(data_name, col_names, key_col self$get_data_objects(data_name)$add_flag_fields(col_names = col_names) } ) + +DataBook$set("public", "remove_empty", function(data_name, which = c("rows","cols")) { + self$get_data_objects(data_name)$remove_empty(which = which) +}) + +DataBook$set("public", "replace_values_with_NA", function(data_name, row_index, column_index) { + self$get_data_objects(data_name)$replace_values_with_NA(row_index = row_index, column_index = column_index) +}) diff --git a/instat/static/InstatObject/R/labels_and_defaults.R b/instat/static/InstatObject/R/labels_and_defaults.R index b44bfe75882..ed6338aac03 100644 --- a/instat/static/InstatObject/R/labels_and_defaults.R +++ b/instat/static/InstatObject/R/labels_and_defaults.R @@ -69,4 +69,4 @@ keyed_link_label="keyed_link" max_labels_display=4 # Column Selection Operations -column_selection_operations <- c("base::match", "tidyselect::starts_with", "tidyselect::ends_with", "tidyselect::contains", "tidyselect::matches", "tidyselect::num_range", "tidyselect::last_col") +column_selection_operations <- c("base::match", "tidyselect::starts_with", "tidyselect::ends_with", "tidyselect::contains", "tidyselect::matches", "tidyselect::num_range", "tidyselect::last_col", "tidyselect::where") diff --git a/instat/static/InstatObject/R/stand_alone_functions.R b/instat/static/InstatObject/R/stand_alone_functions.R index ca8290f9b76..a49ee46a453 100644 --- a/instat/static/InstatObject/R/stand_alone_functions.R +++ b/instat/static/InstatObject/R/stand_alone_functions.R @@ -2518,3 +2518,19 @@ get_quarter_label <- function(quarter, start_month){ paste(mabb[start_pos:(start_pos+2)], collapse = "")}) return(factor(x = qtr, levels = unique(qtr))) } + +is.containlabel <- function(x){ + return(isTRUE(sjlabelled::get_label(x) != "")) +} + +is.emptyvariable <- function(x){ + return(isTRUE(length(x) == sum(x == ""))) +} + +is.NAvariable <- function(x){ + return(isTRUE(length(x) == sum(is.na(x)))) +} + +is.levelscount <- function(x, n){ + return(isTRUE(sum(levels(x)) == n)) +} diff --git a/instat/translations/rInstatTranslations.db b/instat/translations/rInstatTranslations.db index cf0ef3283a4..a6c12710d0a 100644 Binary files a/instat/translations/rInstatTranslations.db and b/instat/translations/rInstatTranslations.db differ diff --git a/instat/ucrColumnMetadata.vb b/instat/ucrColumnMetadata.vb index 299aa21bf0b..77f18c86993 100644 --- a/instat/ucrColumnMetadata.vb +++ b/instat/ucrColumnMetadata.vb @@ -352,8 +352,8 @@ Public Class ucrColumnMetadata mnuInsertColsBefore.Text = "Insert " & _grid.GetSelectedColumns.Count & " Columns Before" mnuInsertColsAfter.Text = "Insert " & _grid.GetSelectedColumns.Count & " Columns After" End If - mnuClearColumnFilter.Enabled = GetCurrentDataFrameFocus().clsFilter.bFilterApplied - mnuColumnContextRemoveCurrentColumnSelection.Enabled = GetCurrentDataFrameFocus().clsFilter.bColumnSelectionApplied + mnuClearColumnFilter.Enabled = GetCurrentDataFrameFocus().clsFilterOrColumnSelection.bFilterApplied + mnuColumnContextRemoveCurrentColumnSelection.Enabled = GetCurrentDataFrameFocus().clsFilterOrColumnSelection.bColumnSelectionApplied End Sub Private Sub mnuReorderColumns_Click(sender As Object, e As EventArgs) Handles mnuReorderColumns.Click diff --git a/instat/ucrDataView.Designer.vb b/instat/ucrDataView.Designer.vb index 5f8e794edff..bbef3688b50 100644 --- a/instat/ucrDataView.Designer.vb +++ b/instat/ucrDataView.Designer.vb @@ -67,6 +67,7 @@ Partial Class ucrDataView Me.mnuRenameColumn = New System.Windows.Forms.ToolStripMenuItem() Me.mnuDuplColumn = New System.Windows.Forms.ToolStripMenuItem() Me.mnuReorderColumn = New System.Windows.Forms.ToolStripMenuItem() + Me.mnuDeleteCells = New System.Windows.Forms.ToolStripMenuItem() Me.mnuCellPasteRange = New System.Windows.Forms.ToolStripMenuItem() Me.ToolStripSeparator5 = New System.Windows.Forms.ToolStripSeparator() Me.mnuConvertToFact = New System.Windows.Forms.ToolStripMenuItem() @@ -284,9 +285,15 @@ Partial Class ucrDataView 'cellContextMenuStrip ' Me.cellContextMenuStrip.ImageScalingSize = New System.Drawing.Size(20, 20) + + Me.cellContextMenuStrip.Items.AddRange(New System.Windows.Forms.ToolStripItem() {Me.ToolStripSeparator3, Me.mnuRenameColumn, Me.mnuDuplColumn, Me.mnuReorderColumn, Me.mnuDeleteCells, Me.mnuCellPasteRange, Me.ToolStripSeparator5, Me.mnuConvertToFact, Me.mnuConvertToOrderedFactor, Me.mnuConvertToCharacter, Me.mnuConvertToLogic, Me.mnuConvertToNumeric, Me.ToolStripSeparator6, Me.mnuLabelsLevel, Me.ToolStripSeparator7, Me.mnuSorts, Me.mnuComment, Me.mnuFilters, Me.mnuRemoveCurrentFilters}) + Me.cellContextMenuStrip.Name = "cellContextMenuStrip" + Me.cellContextMenuStrip.Size = New System.Drawing.Size(213, 380) + Me.cellContextMenuStrip.Items.AddRange(New System.Windows.Forms.ToolStripItem() {Me.ToolStripSeparator3, Me.mnuRenameColumn, Me.mnuDuplColumn, Me.mnuReorderColumn, Me.mnuCellPasteRange, Me.ToolStripSeparator5, Me.mnuConvertToFact, Me.mnuConvertToOrderedFactor, Me.mnuConvertToCharacter, Me.mnuConvertToLogic, Me.mnuConvertToNumeric, Me.ToolStripSeparator6, Me.mnuLabelsLevel, Me.ToolStripSeparator7, Me.mnuSorts, Me.mnuComment, Me.mnuFilters, Me.mnuCellContextColumnSelection, Me.mnuCellContextRemoveCurrentColumnSelection, Me.mnuRemoveCurrentFilters}) Me.cellContextMenuStrip.Name = "cellContextMenuStrip" Me.cellContextMenuStrip.Size = New System.Drawing.Size(215, 380) + ' 'ToolStripSeparator3 ' @@ -311,6 +318,12 @@ Partial Class ucrDataView Me.mnuReorderColumn.Size = New System.Drawing.Size(214, 22) Me.mnuReorderColumn.Text = "Reorder Column(s)..." ' + 'mnuDeleteCells + ' + Me.mnuDeleteCells.Name = "mnuDeleteCells" + Me.mnuDeleteCells.Size = New System.Drawing.Size(212, 22) + Me.mnuDeleteCells.Text = "Delete Cell(s)" + ' 'mnuCellPasteRange ' Me.mnuCellPasteRange.Name = "mnuCellPasteRange" @@ -1026,10 +1039,15 @@ Partial Class ucrDataView Friend WithEvents linkStartOpenLibrary As LinkLabel Friend WithEvents ucrReoGrid As ucrDataViewReoGrid Friend WithEvents ucrLinuxGrid As ucrDataViewLinuxGrid + + Private WithEvents mnuDeleteCell As ToolStripMenuItem + Friend WithEvents mnuDeleteCells As ToolStripMenuItem + Friend WithEvents mnuColumnContextColumnSelection As ToolStripMenuItem Friend WithEvents mnuColumnContextRemoveCurrentColumnSelection As ToolStripMenuItem Friend WithEvents mnuCellContextColumnSelection As ToolStripMenuItem Friend WithEvents mnuCellContextRemoveCurrentColumnSelection As ToolStripMenuItem Friend WithEvents mnuRowContextColumnSelection As ToolStripMenuItem Friend WithEvents mnuRowContextRemoveCurrentColumnSelection As ToolStripMenuItem + End Class diff --git a/instat/ucrDataView.vb b/instat/ucrDataView.vb index 24825936138..441c37035d3 100644 --- a/instat/ucrDataView.vb +++ b/instat/ucrDataView.vb @@ -90,6 +90,7 @@ Public Class ucrDataView AddHandler _grid.ReplaceValueInData, AddressOf ReplaceValueInData AddHandler _grid.PasteValuesToDataframe, AddressOf PasteValuesToDataFrame AddHandler _grid.CellDataChanged, AddressOf CellDataChanged + AddHandler _grid.DeleteValuesToDataframe, AddressOf DeleteCell_Click End Sub Private Sub RefreshWorksheet(fillWorkSheet As clsWorksheetAdapter, dataFrame As clsDataFrame) @@ -283,9 +284,9 @@ Public Class ucrDataView Private Sub SetDisplayLabels() lblRowDisplay.Text = "Showing rows " & GetCurrentDataFrameFocus().clsVisiblePage.intStartRow & " to " & GetCurrentDataFrameFocus().clsVisiblePage.intEndRow & " of " - If GetCurrentDataFrameFocus().clsFilter.bFilterApplied Then - lblRowDisplay.Text &= GetCurrentDataFrameFocus().clsFilter.iFilteredRowCount & - " (" & GetCurrentDataFrameFocus().iTotalRowCount & ")" & " | Active filter: " & GetCurrentDataFrameFocus().clsFilter.strName + If GetCurrentDataFrameFocus().clsFilterOrColumnSelection.bFilterApplied Then + lblRowDisplay.Text &= GetCurrentDataFrameFocus().clsFilterOrColumnSelection.iFilteredRowCount & + " (" & GetCurrentDataFrameFocus().iTotalRowCount & ")" & " | Active filter: " & GetCurrentDataFrameFocus().clsFilterOrColumnSelection.strName Else lblRowDisplay.Text &= GetCurrentDataFrameFocus().iTotalRowCount End If @@ -358,6 +359,10 @@ Public Class ucrDataView Return _grid.GetSelectedColumns() End Function + Private Function GetSelectedColumnIndexes() As List(Of String) + Return _grid.GetSelectedColumnIndexes() + End Function + Private Function GetSelectedColumnNames() As List(Of String) Return GetSelectedColumns().Select(Function(x) x.strName).ToList() End Function @@ -510,8 +515,8 @@ Public Class ucrDataView mnuInsertColsBefore.Text = "Insert " & GetSelectedColumns.Count & " Columns Before" mnuInsertColsAfter.Text = "Insert " & GetSelectedColumns.Count & " Columns After" End If - mnuClearColumnFilter.Enabled = GetCurrentDataFrameFocus().clsFilter.bFilterApplied - mnuColumnContextRemoveCurrentColumnSelection.Enabled = GetCurrentDataFrameFocus().clsFilter.bColumnSelectionApplied + mnuClearColumnFilter.Enabled = GetCurrentDataFrameFocus().clsFilterOrColumnSelection.bFilterApplied + mnuColumnContextRemoveCurrentColumnSelection.Enabled = GetCurrentDataFrameFocus().clsFilterOrColumnSelection.bColumnSelectionApplied End Sub Private Sub HideSheet_Click(sender As Object, e As EventArgs) Handles HideSheet.Click @@ -707,14 +712,14 @@ Public Class ucrDataView End Sub Private Sub rowContextMenuStrip_Opening(sender As Object, e As CancelEventArgs) Handles rowContextMenuStrip.Opening - mnuRemoveCurrentFilter.Enabled = GetCurrentDataFrameFocus().clsFilter.bFilterApplied - mnuRowContextRemoveCurrentColumnSelection.Enabled = GetCurrentDataFrameFocus().clsFilter.bColumnSelectionApplied + mnuRemoveCurrentFilter.Enabled = GetCurrentDataFrameFocus().clsFilterOrColumnSelection.bFilterApplied + mnuRowContextRemoveCurrentColumnSelection.Enabled = GetCurrentDataFrameFocus().clsFilterOrColumnSelection.bColumnSelectionApplied End Sub Private Sub cellContextMenuStrip_Opening(sender As Object, e As CancelEventArgs) Handles cellContextMenuStrip.Opening mnuLabelsLevel.Enabled = IsOnlyOneColumnSelected() AndAlso IsOnlyOneColumnSelected() - mnuRemoveCurrentFilters.Enabled = GetCurrentDataFrameFocus().clsFilter.bFilterApplied - mnuCellContextRemoveCurrentColumnSelection.Enabled = GetCurrentDataFrameFocus().clsFilter.bColumnSelectionApplied + mnuRemoveCurrentFilters.Enabled = GetCurrentDataFrameFocus().clsFilterOrColumnSelection.bFilterApplied + mnuCellContextRemoveCurrentColumnSelection.Enabled = GetCurrentDataFrameFocus().clsFilterOrColumnSelection.bColumnSelectionApplied End Sub Private Sub mnuColumnAddComment_Click(sender As Object, e As EventArgs) Handles mnuColumnAddComment.Click @@ -833,9 +838,24 @@ Public Class ucrDataView StartWait() GetCurrentDataFrameFocus().clsPrepareFunctions.RemoveCurrentColumnSelection() EndWait() - End Sub - + End Sub + Private Sub ucrDataView_Resize(sender As Object, e As EventArgs) Handles TblPanPageDisplay.Resize ResizeLabels() End Sub + + Private Sub DeleteCell_Click() + Dim deleteCell = MsgBox("This will replace the selected cells with missing values (NA)." & + Environment.NewLine & "Continue?", + MessageBoxButtons.YesNo, "Delete Cells") + If deleteCell = DialogResult.Yes Then + StartWait() + GetCurrentDataFrameFocus().clsPrepareFunctions.DeleteCells(GetSelectedRows(), GetSelectedColumnIndexes()) + EndWait() + End If + End Sub + + Private Sub mnuDeleteCells_Click(sender As Object, e As EventArgs) Handles mnuDeleteCells.Click + DeleteCell_Click() + End Sub End Class \ No newline at end of file diff --git a/instat/ucrDistributions.vb b/instat/ucrDistributions.vb index 44ca2002c35..4d41331cf6b 100644 --- a/instat/ucrDistributions.vb +++ b/instat/ucrDistributions.vb @@ -89,7 +89,6 @@ Public Class ucrDistributions Else clsCurrRFunction.AddParameter(strArgumentName, strArgumentValue) End If - End Sub Public Sub SetRDistributions() @@ -221,12 +220,14 @@ Public Class ucrDistributions Dim clsCauchyDist As New Distribution Dim clsChiSqDist As New Distribution Dim clsFDist As New Distribution - 'Dim clsHyperGeoDist As New Distribution + Dim clsHyperGeoDist As New Distribution Dim clsLogNormDist As New Distribution Dim clsExtremeValueDist As New Distribution Dim clsGeneralizedParetoDist As New Distribution Dim clsGumbelDist As New Distribution Dim clsNoDist As New Distribution + Dim clsEmpiricalDist As New Distribution + Dim clsTriangularDist As New Distribution ' Normal distribution clsNormalDist.strNameTag = "Normal" @@ -292,7 +293,7 @@ Public Class ucrDistributions lstAllDistributions.Add(clsUniformDist) 'Bernouli Distribution - clsBernouliDist.strNameTag = "Bernouli" + clsBernouliDist.strNameTag = "Bernoulli" clsBernouliDist.strRName = "binom" clsBernouliDist.strRFunctionName = "rbinom" clsBernouliDist.strPFunctionName = "pbinom" @@ -304,6 +305,7 @@ Public Class ucrDistributions clsBernouliDist.strExactName = "binom" clsBernouliDist.lstExact = {"prob", "Probability:", 0.5, 0.1, 2, 0, 1} clsBernouliDist.AddParameter("prob", "Probability", 0.5) + clsBernouliDist.AddParameter("size", "Number", 1) lstAllDistributions.Add(clsBernouliDist) 'Binomial Distribution @@ -368,6 +370,7 @@ Public Class ucrDistributions clsStudentsTDist.strQFunctionName = "qt" clsStudentsTDist.strDFunctionName = "dt" clsStudentsTDist.AddParameter("df", "DF", 1) + clsStudentsTDist.AddParameter("ncp", "Non-Centrality", 0) lstAllDistributions.Add(clsStudentsTDist) ' von mises distribution @@ -404,6 +407,7 @@ Public Class ucrDistributions clsChiSqDist.strDFunctionName = "dchisq" clsChiSqDist.bIsContinuous = True clsChiSqDist.AddParameter("df", "DF", 1) + clsChiSqDist.AddParameter("ncp", "Non-Centrality", 0) lstAllDistributions.Add(clsChiSqDist) ' F Distribution @@ -419,17 +423,42 @@ Public Class ucrDistributions 'Hypergeometric Distribution ' For rhyper, the parameters are nn = size, whereas for the other parameters this is n. - 'clsHyperGeoDist.strNameTag = "Hypergeometric" - 'clsHyperGeoDist.strRName = "hyper" - 'clsHyperGeoDist.strRFunctionName = "rhyper" - 'clsHyperGeoDist.strPFunctionName = "phyper" - 'clsHyperGeoDist.strQFunctionName = "qhyper" - 'clsHyperGeoDist.strDFunctionName = "dhyper" - 'clsHyperGeoDist.bIsContinuous = False - 'clsHyperGeoDist.AddParameter("m", "Population_Successes", 10) - 'clsHyperGeoDist.AddParameter("n", "Population_Failures", 10) - 'clsHyperGeoDist.AddParameter("k", "Sample_Size", 10) - 'lstAllDistributions.Add(clsHyperGeoDist) + clsHyperGeoDist.strNameTag = "Hypergeometric" + clsHyperGeoDist.strRName = "hyper" + clsHyperGeoDist.strRFunctionName = "rhyper" + clsHyperGeoDist.strPFunctionName = "phyper" + clsHyperGeoDist.strQFunctionName = "qhyper" + clsHyperGeoDist.strDFunctionName = "dhyper" + clsHyperGeoDist.bIsContinuous = False + clsHyperGeoDist.AddParameter("m", "Population_Successes", 10) + clsHyperGeoDist.AddParameter("n", "Population_Failures", 10) + clsHyperGeoDist.AddParameter("k", "Sample_Size", 10) + lstAllDistributions.Add(clsHyperGeoDist) + + 'Discrete Empirical distribution + clsEmpiricalDist.strNameTag = "Discrete_Empirical" + clsEmpiricalDist.strRName = "empiricalD" + clsEmpiricalDist.strDFunctionName = "dempiricalD" + clsEmpiricalDist.strPFunctionName = "pempiricalD" + clsEmpiricalDist.strQFunctionName = "qempiricalD" + clsEmpiricalDist.strRFunctionName = "rempiricalD" + clsEmpiricalDist.SetPackageName("mc2d") + clsEmpiricalDist.AddParameter("values", "Values", "1:5") + clsEmpiricalDist.AddParameter("prob", "Probability", "10, 10, 10, 0, 10") + lstAllDistributions.Add(clsEmpiricalDist) + + 'Triangular distribution + clsTriangularDist.strNameTag = "Triangular" + clsTriangularDist.strRName = "triang" + clsTriangularDist.strRFunctionName = "rtriang" + clsTriangularDist.strPFunctionName = "ptriang" + clsTriangularDist.strQFunctionName = "qtriang" + clsTriangularDist.strDFunctionName = "dtriang" + clsTriangularDist.strPackagName = "mc2d" + clsTriangularDist.AddParameter("min ", "Minimum", -1) + clsTriangularDist.AddParameter("mode ", "Mode", 0) + clsTriangularDist.AddParameter("max ", "Maximum", 1) + lstAllDistributions.Add(clsTriangularDist) ' Lognormal Distribution clsLogNormDist.strNameTag = "Lognormal" @@ -439,7 +468,6 @@ Public Class ucrDistributions clsLogNormDist.strQFunctionName = "qlnorm" clsLogNormDist.strDFunctionName = "dlnorm" clsLogNormDist.AddParameter("meanlog", "Meanlog", 0) - clsLogNormDist.AddParameter("sdlog", "SDlog", 1) lstAllDistributions.Add(clsLogNormDist) 'TODO Categorical distribution diff --git a/instat/ucrDistributionsWithParameters.Designer.vb b/instat/ucrDistributionsWithParameters.Designer.vb index 06d8974f943..111d87234ca 100644 --- a/instat/ucrDistributionsWithParameters.Designer.vb +++ b/instat/ucrDistributionsWithParameters.Designer.vb @@ -38,6 +38,7 @@ Partial Class ucrDistributionsWithParameters 'Do not modify it using the code editor. _ Private Sub InitializeComponent() + Me.components = New System.ComponentModel.Container() Me.lblDistributionParameters = New System.Windows.Forms.Label() Me.lblParameter1 = New System.Windows.Forms.Label() Me.lblParameter2 = New System.Windows.Forms.Label() @@ -47,6 +48,7 @@ Partial Class ucrDistributionsWithParameters Me.ucrInputParameter2 = New instat.ucrInputTextBox() Me.ucrInputParameter3 = New instat.ucrInputTextBox() Me.ucrInputParameter4 = New instat.ucrInputTextBox() + Me.ttEmpirical = New System.Windows.Forms.ToolTip(Me.components) Me.SuspendLayout() ' 'lblDistributionParameters @@ -173,4 +175,5 @@ Partial Class ucrDistributionsWithParameters Friend WithEvents ucrInputParameter2 As ucrInputTextBox Friend WithEvents ucrInputParameter3 As ucrInputTextBox Friend WithEvents ucrInputParameter4 As ucrInputTextBox + Friend WithEvents ttEmpirical As ToolTip End Class diff --git a/instat/ucrDistributionsWithParameters.resx b/instat/ucrDistributionsWithParameters.resx index 29dcb1b3a35..5d8d07c2185 100644 --- a/instat/ucrDistributionsWithParameters.resx +++ b/instat/ucrDistributionsWithParameters.resx @@ -117,4 +117,7 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + 17, 17 + \ No newline at end of file diff --git a/instat/ucrDistributionsWithParameters.vb b/instat/ucrDistributionsWithParameters.vb index 009a6113461..78897d48862 100644 --- a/instat/ucrDistributionsWithParameters.vb +++ b/instat/ucrDistributionsWithParameters.vb @@ -25,7 +25,7 @@ Public Class ucrDistributionsWithParameters Private Sub ucrDistributionsWithParameters_Load(sender As Object, e As EventArgs) Handles MyBase.Load 'temp disabled ucrInputParameter4.Visible = False - lblParameter4.Visible = False + lblParameter4.Visible = False End Sub Public Sub SetParameters() @@ -74,15 +74,20 @@ Public Class ucrDistributionsWithParameters For i = 0 To clsCurrDistribution.clsParameters.Count - 1 lstParameterLabels(i).Text = GetTranslation(clsCurrDistribution.clsParameters(i).strNameTag) lstCurrArguments.Add(clsCurrDistribution.clsParameters(i).strArgumentName) - If clsCurrDistribution.clsParameters(i).bHasDefault Then - lstParameterInputTextBoxes(i).SetName(clsCurrDistribution.clsParameters(i).strDefaultValue) - AddParameter(clsCurrDistribution.clsParameters(i).strArgumentName, clsCurrDistribution.clsParameters(i).strDefaultValue) + If clsCurrDistribution.clsParameters(i).bHasDefault Then + lstParameterInputTextBoxes(i).SetName(clsCurrDistribution.clsParameters(i).strDefaultValue) + If clsCurrDistribution.strNameTag = "Discrete_Empirical" Then + AddParameter(clsCurrDistribution.clsParameters(i).strArgumentName, "c(" & clsCurrDistribution.clsParameters(i).strDefaultValue & ")") + ttEmpirical.SetToolTip(ucrInputParameter2.txtInput, "Input relative values separated by commas, For example 3,2,1.") + Else + AddParameter(clsCurrDistribution.clsParameters(i).strArgumentName, clsCurrDistribution.clsParameters(i).strDefaultValue) + End If Else lstParameterInputTextBoxes(i).Reset() End If OnControlValueChanged() Next - If clsCurrDistribution.strNameTag = "Bernouli" Then + If clsCurrDistribution.strNameTag = "Bernoulli" Then AddParameter("size", 1) End If bParametersFilled = False @@ -110,12 +115,19 @@ Public Class ucrDistributionsWithParameters OnControlValueChanged() End Sub - Private Sub ucrInputParameter2_ControlValueChanged() Handles ucrInputParameter2.ControlValueChanged + Private Sub ucrInputParameter2_ContentsChanged() Handles ucrInputParameter2.ContentsChanged If lstCurrArguments IsNot Nothing AndAlso lstCurrArguments.Count > 1 Then - AddParameter(lstCurrArguments(1), ucrInputParameter2.GetText) + If clsCurrDistribution.strNameTag = "Discrete_Empirical" Then + AddParameter(lstCurrArguments(1), "c(" & ucrInputParameter2.GetText & ")") + ucrInputParameter1.SetName("1:" & ucrInputParameter2.GetText.Split(",").Length) + ucrInputParameter1.IsReadOnly = True + Else + AddParameter(lstCurrArguments(1), ucrInputParameter2.GetText) + ucrInputParameter1.IsReadOnly = False + End If CheckParametersFilled() End If - OnControlValueChanged() + OnControlContentsChanged() End Sub Private Sub ucrInputParameter3_ControlValueChanged() Handles ucrInputParameter3.ControlValueChanged diff --git a/instat/ucrSave.vb b/instat/ucrSave.vb index bf4a8b20c77..2e584e1d0ab 100644 --- a/instat/ucrSave.vb +++ b/instat/ucrSave.vb @@ -111,9 +111,7 @@ Public Class ucrSave ''' Only used when this control is saving a column. Private ucrLinkedReceiver As ucrReceiver ''' If true then set the R "before" parameter to TRUE, else set it to FALSE. - - ''' Only used when this control is saving a column. - ''' + ''' Only used when this control is saving a column. Private bInsertColumnBefore As Boolean = False Private strAdjacentColumn As String = "" 'todo. not used yet.