diff --git a/.gitignore b/.gitignore index 1701868a867..a183fb43274 100644 --- a/.gitignore +++ b/.gitignore @@ -235,3 +235,7 @@ ModelManifest.xml /instat/static/InstatObject/R/examples.R /instat/static/Library/ installer/Output/ +/instat/dlgFrequency.vb +/instat/dlgFrequency.sw-KE.resx +/instat/dlgFrequency.resx +/instat/dlgFrequency.Designer.vb diff --git a/docs/Download.html b/docs/Download.html index 77f4413aeb7..c7ac1751d7a 100644 --- a/docs/Download.html +++ b/docs/Download.html @@ -78,11 +78,11 @@

Download R-Instat

-

In response to the recent review of R-Instat by Bob Muenchen we have released a new version of R-Instat, version 0.7.4, which includes some new features and initial improvements from the review. Many thanks to Bob for reviewing R-Instat.

+

In response to the recent review of R-Instat by Bob Muenchen we have released a new version of R-Instat, version 0.7.5, which includes some new features and initial improvements from the review. Many thanks to Bob for reviewing R-Instat.


-

R-Instat 0.7.4 Installer 32 Bit (.exe 734MB)

+

R-Instat 0.7.5 Installer 32 Bit (.exe 734MB)

If you know that you have a 64 bit computer, we suggest you download the 64 Bit version

- R-Instat 0.7.4 Installer 64 Bit (.exe 736MB) + R-Instat 0.7.5 Installer 64 Bit (.exe 736MB)

R-Instat is currently a Windows only application. However, it can be accessed on Mac or Linux through use of a Virtual Windows Machine.

Installation & Documentation

diff --git a/instat/Interface/IColumnMetaDataGrid.vb b/instat/Interface/IColumnMetaDataGrid.vb index f4dd9915105..ed9694b3a6c 100644 --- a/instat/Interface/IColumnMetaDataGrid.vb +++ b/instat/Interface/IColumnMetaDataGrid.vb @@ -19,6 +19,8 @@ Public Interface IColumnMetaDataGrid Event EditValue(iRow As Integer, strColumnName As String, strPreviousValue As String, newValue As Object) + Event DeleteLabels(strColumnName As String) + Sub AddColumns(columnMetaData As clsColumnMetaData) Sub AddRowData(columnMetaData As clsColumnMetaData) diff --git a/instat/Interface/IDataframeMetaDataGrid.vb b/instat/Interface/IDataframeMetaDataGrid.vb index 222625a565f..1b3d6888353 100644 --- a/instat/Interface/IDataframeMetaDataGrid.vb +++ b/instat/Interface/IDataframeMetaDataGrid.vb @@ -19,6 +19,8 @@ Public Interface IDataframeMetaDataGrid Event EditValue(iRow As Integer, strColumnName As String, strPreviousValue As String, newValue As Object) + Event DeleteLabels(strColumnName As String) + Sub AddColumns() Sub AddRowData() diff --git a/instat/Model/DataFrame/clsColumnMetaData.vb b/instat/Model/DataFrame/clsColumnMetaData.vb index 4fd23b5b752..79ffc92cae3 100644 --- a/instat/Model/DataFrame/clsColumnMetaData.vb +++ b/instat/Model/DataFrame/clsColumnMetaData.vb @@ -15,24 +15,30 @@ ' along with this program. If not, see . Imports RDotNet + ''' ''' Holds Column Meta Data for a single dataframe ''' Public Class clsColumnMetaData - Private _strName As String + Private _strDataFrameName As String Private _RLink As RLink - Private _clsDataFrame As DataFrame + Private Property _clsColsMetadataDataFrame As DataFrame Private _hasChanged As Boolean + ''' + ''' holds the metadata change audit id + ''' + Public Property MetadataChangeAuditId As Integer + ''' ''' Returns data for a given cell within the Column Meta data table ''' - ''' - ''' + ''' + ''' ''' - Public ReadOnly Property Data(row As Integer, column As Integer) As Object + Public ReadOnly Property Data(iRowIndex As Integer, iColumnIndex As Integer) As Object Get - Return _clsDataFrame(row, column) + Return _clsColsMetadataDataFrame.Item(iRowIndex, iColumnIndex) End Get End Property @@ -43,7 +49,7 @@ Public Class clsColumnMetaData ''' Public ReadOnly Property strRowName(row As Integer) As String Get - Return _clsDataFrame.RowNames(row) + Return _clsColsMetadataDataFrame.RowNames(row) End Get End Property @@ -53,7 +59,7 @@ Public Class clsColumnMetaData ''' Public ReadOnly Property iRowCount As Integer Get - Return _clsDataFrame.RowCount + Return _clsColsMetadataDataFrame.RowCount End Get End Property @@ -64,7 +70,7 @@ Public Class clsColumnMetaData ''' Public ReadOnly Property strColumnName(column As Integer) As String Get - Return _clsDataFrame.ColumnNames(column) + Return _clsColsMetadataDataFrame.ColumnNames(column) End Get End Property @@ -74,7 +80,7 @@ Public Class clsColumnMetaData ''' Public ReadOnly Property iColumnCount As Integer Get - Return _clsDataFrame.ColumnCount + Return _clsColsMetadataDataFrame.ColumnCount End Get End Property @@ -87,7 +93,7 @@ Public Class clsColumnMetaData Get Return _hasChanged End Get - Set(ByVal value As Boolean) + Set(value As Boolean) _hasChanged = value End Set End Property @@ -99,7 +105,7 @@ Public Class clsColumnMetaData ''' Public Sub New(rLink As RLink, strName As String) _RLink = rLink - _strName = strName + _strDataFrameName = strName _hasChanged = True End Sub @@ -107,7 +113,7 @@ Public Class clsColumnMetaData Dim clsVariablesMetadataChanged As New RFunction Dim expTemp As SymbolicExpression clsVariablesMetadataChanged.SetRCommand(frmMain.clsRLink.strInstatDataObject & "$get_variables_metadata_changed") - clsVariablesMetadataChanged.AddParameter("data_name", Chr(34) & _strName & Chr(34)) + clsVariablesMetadataChanged.AddParameter("data_name", Chr(34) & _strDataFrameName & Chr(34)) expTemp = _RLink.RunInternalScriptGetValue(clsVariablesMetadataChanged.ToScript()) If expTemp IsNot Nothing AndAlso expTemp.Type <> Internals.SymbolicExpressionType.Null Then Return expTemp.AsLogical(0) @@ -121,19 +127,26 @@ Public Class clsColumnMetaData ''' Public Sub RefreshData() 'Need to check to see if dataframe exists due to the column meta data not changing when sheets are un-hidden - If _clsDataFrame Is Nothing Or HasDataChanged() Then - _clsDataFrame = GetDataFrameFromRCommand() - ResetDataFramesChanged() + If _clsColsMetadataDataFrame Is Nothing OrElse HasDataChanged() Then + _clsColsMetadataDataFrame = GetColsMetadataFromRCommand() + SetColsMetadataToNotChangedInR() + + 'this change number should eventually come from R + 'once that is done; + 'HasDataChanged() should be re-implemeted + 'HasChanged property can be deleted + 'SetColsMetadataToNotChangedInR() can be deleted + MetadataChangeAuditId += 1 End If End Sub - Private Function GetDataFrameFromRCommand() As DataFrame + Private Function GetColsMetadataFromRCommand() As DataFrame Dim clsGetVariablesMetadata As New RFunction Dim expTemp As SymbolicExpression _hasChanged = True clsGetVariablesMetadata.SetRCommand(_RLink.strInstatDataObject & "$get_variables_metadata") clsGetVariablesMetadata.AddParameter("convert_to_character", "TRUE") - clsGetVariablesMetadata.AddParameter("data_name", Chr(34) & _strName & Chr(34)) + clsGetVariablesMetadata.AddParameter("data_name", Chr(34) & _strDataFrameName & Chr(34)) expTemp = _RLink.RunInternalScriptGetValue(clsGetVariablesMetadata.ToScript(), bSilent:=True) If expTemp IsNot Nothing AndAlso expTemp.Type <> Internals.SymbolicExpressionType.Null Then Return expTemp.AsDataFrame @@ -142,10 +155,10 @@ Public Class clsColumnMetaData End If End Function - Private Sub ResetDataFramesChanged() + Private Sub SetColsMetadataToNotChangedInR() Dim clsSetVariablesMetadataChanged As New RFunction clsSetVariablesMetadataChanged.SetRCommand(_RLink.strInstatDataObject & "$set_variables_metadata_changed") - clsSetVariablesMetadataChanged.AddParameter("data_name", Chr(34) & _strName & Chr(34)) + clsSetVariablesMetadataChanged.AddParameter("data_name", Chr(34) & _strDataFrameName & Chr(34)) clsSetVariablesMetadataChanged.AddParameter("new_val", "FALSE") _RLink.RunInternalScript(clsSetVariablesMetadataChanged.ToScript(), bSilent:=True) End Sub diff --git a/instat/Model/DataFrame/clsDataBook.vb b/instat/Model/DataFrame/clsDataBook.vb index b48dcf39f41..d36df450c78 100644 --- a/instat/Model/DataFrame/clsDataBook.vb +++ b/instat/Model/DataFrame/clsDataBook.vb @@ -21,7 +21,7 @@ Imports RDotNet ''' Public Class clsDataBook Private _RLink As RLink - Private _dataFrames As List(Of clsDataFrame) + Private _lstDataFrames As List(Of clsDataFrame) Private _clsDataFrameMetaData As clsDataFrameMetaData ''' @@ -30,10 +30,10 @@ Public Class clsDataBook ''' Public Property DataFrames() As List(Of clsDataFrame) Get - Return _dataFrames + Return _lstDataFrames End Get Set(value As List(Of clsDataFrame)) - _dataFrames = value + _lstDataFrames = value End Set End Property ''' @@ -53,7 +53,7 @@ Public Class clsDataBook ''' Public Sub New(rLink As RLink) _RLink = rLink - _dataFrames = New List(Of clsDataFrame) + _lstDataFrames = New List(Of clsDataFrame) _clsDataFrameMetaData = New clsDataFrameMetaData(rLink) End Sub @@ -86,74 +86,80 @@ Public Class clsDataBook _RLink.RunScript(clsHideDataFrame.ToScript(), strComment:="Right click menu: Hide Data Frame") End Sub - Private Function CreateNewGridTab(strDataFrameName As String) As clsDataFrame - Dim dataframe As New clsDataFrame(_RLink, strDataFrameName) - _dataFrames.Add(dataframe) - Return dataframe - End Function - ''' ''' Gets the dataframe within the databook corresponding to the given name ''' ''' ''' Public Function GetDataFrame(strName As String) As clsDataFrame - Return _dataFrames.Where(Function(x) x.strName = strName).FirstOrDefault + Return _lstDataFrames.Where(Function(x) x.strName = strName).FirstOrDefault End Function + ''' ''' Gets the Column Metadata for the dataframe name given ''' ''' ''' Public Function GetColumnMetaData(strName As String) As clsColumnMetaData - Return _dataFrames.Where(Function(x) x.strName = strName).FirstOrDefault().clsColumnMetaData + Return _lstDataFrames.Where(Function(x) x.strName = strName).FirstOrDefault().clsColumnMetaData End Function ''' ''' Updates all the dataframes and metadata where the data has changed ''' Public Sub RefreshData() + 'if no R Instat object exists then just clear all data frames in the databook + 'and refresh the data frame metadata from R If Not _RLink.bInstatObjectExists Then - DeleteAllDataFrames() + _lstDataFrames.Clear() _clsDataFrameMetaData = New clsDataFrameMetaData(_RLink) Exit Sub End If + + 'else if the R Instat object data has changed + 'refresh data frames data and metadata If HasDataChanged() Then - Dim listOfDataFrames As List(Of String) = GetDataFrameNames() - DeleteOldDataFrames(listOfDataFrames) - For Each strDataFrameName In listOfDataFrames - Dim dataFrame As clsDataFrame = GetOrCreateDataFrame(strDataFrameName) - dataFrame.RefreshData() - Next + RefreshDataFrames() _clsDataFrameMetaData.RefreshData() End If End Sub - Private Sub DeleteAllDataFrames() - Dim listOfDataFrames As New List(Of String) - DeleteOldDataFrames(listOfDataFrames) - End Sub + ''' + ''' refreshes data book with recent R data frames and the data frames with their recent R data + ''' + Private Sub RefreshDataFrames() + 'get the recent list of data frame names from R Instant + Dim lstOfCurrentRDataFrameNames As List(Of String) = GetDataFrameNamesFromR() - Private Function GetOrCreateDataFrame(strDataFrameName As String) As clsDataFrame - Dim dataFrame As clsDataFrame - dataFrame = _dataFrames.Where(Function(x) x.strName = strDataFrameName).SingleOrDefault - If dataFrame Is Nothing Then - dataFrame = CreateNewGridTab(strDataFrameName) - End If - Return dataFrame - End Function + 'remove any data frames from this data book that are not in the R Instat object + _lstDataFrames.RemoveAll(Function(x) Not lstOfCurrentRDataFrameNames.Contains(x.strName)) - Private Sub DeleteOldDataFrames(currentDataFrames As List(Of String)) - Dim gridTab As clsDataFrame - For i = _dataFrames.Count - 1 To 0 Step -1 - gridTab = _dataFrames(i) - If Not currentDataFrames.Contains(gridTab.strName) Then - _dataFrames.RemoveAt(i) + 'add any R Instat object data frames missing in the data book + 'and also refresh data of the data book data frames + Dim dataFrame As clsDataFrame + For Each strDataFrameName In lstOfCurrentRDataFrameNames + dataFrame = _lstDataFrames.Where(Function(x) x.strName = strDataFrameName).SingleOrDefault + If dataFrame Is Nothing Then + dataFrame = New clsDataFrame(_RLink, strDataFrameName) + _lstDataFrames.Add(dataFrame) + End If + 'if data not refreshed successfully, remove the data frame from the data book + If Not dataFrame.RefreshData() Then + MessageBox.Show("Error: Could not retrieve data frame:" & strDataFrameName & " from R" & + Environment.NewLine & "Data displayed in spreadsheet may not be up to date." & + Environment.NewLine & "We strongly suggest restarting R-Instat before continuing.", + "Cannot retrieve data", MessageBoxButtons.OK, MessageBoxIcon.Warning) + _lstDataFrames.Remove(dataFrame) End If Next End Sub - Private Function GetDataFrameNames() As List(Of String) + + ''' + ''' Gets current data frame names from R (the R Instant object). + ''' + ''' list of data frame names. If no data frame names found, an empty list is returned + Private Function GetDataFrameNamesFromR() As List(Of String) Dim clsGetDataFrameNames As New RFunction Dim expTemp As SymbolicExpression Dim listOfDataFrames As New List(Of String) diff --git a/instat/Model/DataFrame/clsDataFrame.vb b/instat/Model/DataFrame/clsDataFrame.vb index cbc133de0be..c51d6d523f5 100644 --- a/instat/Model/DataFrame/clsDataFrame.vb +++ b/instat/Model/DataFrame/clsDataFrame.vb @@ -22,10 +22,10 @@ Imports RDotNet ''' Public Class clsDataFrame Private _clsPrepareFunctions As clsPrepareFunctionsForGrids - Private _clsVisiblePage As clsDataFramePage + Private _clsVisibleDataFramePage As clsDataFramePage Private _clsColumnMetaData As clsColumnMetaData Private _clsFilterOrColumnSelection As clsDataFrameFilterOrColumnSelection - Private _strName As String + Private _strDataFrameName As String Private _RLink As RLink Private _iTotalRowCount As Integer Private _iTotalColumnCount As Integer @@ -66,29 +66,29 @@ Public Class clsDataFrame ''' Public ReadOnly Property strName() As String Get - Return _strName + Return _strDataFrameName End Get End Property ''' ''' Returns the data in a specific cell as an object ''' - ''' - ''' + ''' Row index. Should be within the range of the visible data frame subset + ''' Column index. Should be within the range of the visible data frame subset ''' - Public ReadOnly Property Data(iRow As Integer, iColumn As Integer) As Object + Public ReadOnly Property DisplayedData(iRow As Integer, iColumn As Integer) As Object Get - Return _clsVisiblePage.Data(iRow, iColumn) + Return _clsVisibleDataFramePage.Data(iRow, iColumn) End Get End Property ''' - ''' Returns the row names + ''' Returns an array of row names of the visible data frame subset ''' ''' - Public ReadOnly Property strRowNames() As String() + Public ReadOnly Property DisplayedRowNames() As String() Get - Return _clsVisiblePage.RowNames() + Return _clsVisibleDataFramePage.RowNames() End Get End Property @@ -98,12 +98,12 @@ Public Class clsDataFrame ''' Public ReadOnly Property iDisplayedRowCount As Integer Get - Return _clsVisiblePage.DisplayedRowCount + Return _clsVisibleDataFramePage.DisplayedRowCount End Get End Property ''' - ''' Returns the total rows for the dataframe + ''' Returns the total rows for the entire dataframe ''' ''' Public ReadOnly Property iTotalRowCount() As Integer @@ -113,7 +113,7 @@ Public Class clsDataFrame End Property ''' - ''' Returns the total column count for the dataframe + ''' Returns the total column count for entire the dataframe ''' ''' Public ReadOnly Property iTotalColumnCount() As Integer @@ -126,9 +126,9 @@ Public Class clsDataFrame ''' Returns a subset of the dataframe ''' ''' - Public ReadOnly Property clsVisiblePage() As clsDataFramePage + Public ReadOnly Property clsVisibleDataFramePage() As clsDataFramePage Get - Return _clsVisiblePage + Return _clsVisibleDataFramePage End Get End Property @@ -136,14 +136,14 @@ Public Class clsDataFrame ''' Creates a new dataframe from the given name ''' ''' - ''' - Public Sub New(rLink As RLink, strName As String) + ''' + Public Sub New(rLink As RLink, strDataFrameName As String) _RLink = rLink - _strName = strName - _clsPrepareFunctions = New clsPrepareFunctionsForGrids(rLink, strName) - _clsVisiblePage = New clsDataFramePage(rLink, strName) - _clsFilterOrColumnSelection = New clsDataFrameFilterOrColumnSelection(rLink, strName) - _clsColumnMetaData = New clsColumnMetaData(rLink, strName) + _strDataFrameName = strDataFrameName + _clsPrepareFunctions = New clsPrepareFunctionsForGrids(rLink, strDataFrameName) + _clsVisibleDataFramePage = New clsDataFramePage(rLink, strDataFrameName) + _clsFilterOrColumnSelection = New clsDataFrameFilterOrColumnSelection(rLink, strDataFrameName) + _clsColumnMetaData = New clsColumnMetaData(rLink, strDataFrameName) End Sub Private Function HasDataChanged() As Boolean @@ -151,7 +151,7 @@ Public Class clsDataFrame Dim expTemp As SymbolicExpression clsDataChanged.SetRCommand(_RLink.strInstatDataObject & "$get_data_changed") - clsDataChanged.AddParameter("data_name", Chr(34) & _strName & Chr(34)) + clsDataChanged.AddParameter("data_name", Chr(34) & _strDataFrameName & Chr(34)) expTemp = _RLink.RunInternalScriptGetValue(clsDataChanged.ToScript()) If expTemp IsNot Nothing AndAlso expTemp.Type <> Internals.SymbolicExpressionType.Null Then Return expTemp.AsLogical(0) @@ -163,27 +163,33 @@ Public Class clsDataFrame ''' ''' Updates dataframe where data has changed ''' - Public Sub RefreshData() + ''' Returns true if data frame is succesfully refeshed from R, false if otherwise + Public Function RefreshData() As Boolean + Dim bRefreshed As Boolean = True If HasDataChanged() Then - If _clsVisiblePage.RefreshData() Then - _iTotalRowCount = _RLink.GetDataFrameLength(_strName, False) - _iTotalColumnCount = _RLink.GetDataFrameColumnCount(_strName) + 'check if succesfully 'refreshed', that is, data frame was successfully set up from R + If _clsVisibleDataFramePage.RefreshData() Then + _iTotalRowCount = _RLink.GetDataFrameLength(_strDataFrameName, False) + _iTotalColumnCount = _RLink.GetDataFrameColumnCount(_strDataFrameName) _clsFilterOrColumnSelection.RefreshData() If _clsFilterOrColumnSelection.bFilterApplied Then - _clsVisiblePage.SetTotalRowAndColumnCounts(_iTotalColumnCount, _clsFilterOrColumnSelection.iFilteredRowCount) + _clsVisibleDataFramePage.SetTotalRowAndColumnCounts(_iTotalColumnCount, _clsFilterOrColumnSelection.iFilteredRowCount) Else - _clsVisiblePage.SetTotalRowAndColumnCounts(_iTotalColumnCount, _iTotalRowCount) + _clsVisibleDataFramePage.SetTotalRowAndColumnCounts(_iTotalColumnCount, _iTotalRowCount) End If ResetDataFramesChanged() + Else + bRefreshed = False End If End If _clsColumnMetaData.RefreshData() - End Sub + Return bRefreshed + End Function Private Sub ResetDataFramesChanged() Dim clsSetDataFramesChanged As New RFunction clsSetDataFramesChanged.SetRCommand(_RLink.strInstatDataObject & "$set_data_frames_changed") - clsSetDataFramesChanged.AddParameter("data_name", Chr(34) & _strName & Chr(34)) + clsSetDataFramesChanged.AddParameter("data_name", Chr(34) & _strDataFrameName & Chr(34)) clsSetDataFramesChanged.AddParameter("new_val", "FALSE") _RLink.RunInternalScript(clsSetDataFramesChanged.ToScript(), bSilent:=True) End Sub diff --git a/instat/Model/DataFrame/clsDataFrameFilter.vb b/instat/Model/DataFrame/clsDataFrameFilter.vb index 999b059c04d..ea96bdb6804 100644 --- a/instat/Model/DataFrame/clsDataFrameFilter.vb +++ b/instat/Model/DataFrame/clsDataFrameFilter.vb @@ -26,7 +26,9 @@ Public Class clsDataFrameFilterOrColumnSelection Protected _bFilterApplied As Boolean Protected _bColumnSelectionApplied As Boolean Protected _iFilteredRowCount As Integer + Protected _iSelectedColumnCount As Integer Protected _strFilterName As String + Protected _strSelectionName As String Public ReadOnly Property iFilteredRowCount As Integer Get @@ -34,12 +36,24 @@ Public Class clsDataFrameFilterOrColumnSelection End Get End Property + Public ReadOnly Property iSelectedColumnCount As Integer + Get + Return _iSelectedColumnCount + End Get + End Property + Public ReadOnly Property strName As String Get Return _strFilterName End Get End Property + Public ReadOnly Property strSelectionName As String + Get + Return _strSelectionName + End Get + End Property + Public ReadOnly Property bFilterApplied() As Boolean Get Return _bFilterApplied @@ -64,6 +78,13 @@ Public Class clsDataFrameFilterOrColumnSelection Return _RLink.RunInternalScriptGetValue(clsGetCurrentFilterName.ToScript(), bSilent:=True).AsCharacter(0) End Function + Private Function GetSelectionNameFromRCommand() As String + Dim clsGetCurrentFilterName As New RFunction + clsGetCurrentFilterName.SetRCommand(_RLink.strInstatDataObject & "$get_current_column_selection") + clsGetCurrentFilterName.AddParameter("data_name", Chr(34) & _strDataFrameName & Chr(34), iPosition:=0) + Return _RLink.RunInternalScriptGetValue(clsGetCurrentFilterName.ToScript(), bSilent:=True).AsCharacter(0) + End Function + Private Function GetFilterAppliedFromRCommand() As Boolean Dim clsFilterApplied As New RFunction clsFilterApplied.SetRCommand(_RLink.strInstatDataObject & "$filter_applied") @@ -80,9 +101,11 @@ Public Class clsDataFrameFilterOrColumnSelection Public Sub RefreshData() _iFilteredRowCount = _RLink.GetDataFrameLength(_strDataFrameName, True) + _iSelectedColumnCount = _RLink.GetDataFrameColumnCount(_strDataFrameName) _bFilterApplied = GetFilterAppliedFromRCommand() _bColumnSelectionApplied = GetColumnSelectionAppliedFromRCommand() _strFilterName = GetFilterNameFromRCommand() + _strSelectionName = GetSelectionNameFromRCommand() End Sub End Class diff --git a/instat/Model/DataFrame/clsDataFramePage.vb b/instat/Model/DataFrame/clsDataFramePage.vb index a56a593dc9a..b4a6a621210 100644 --- a/instat/Model/DataFrame/clsDataFramePage.vb +++ b/instat/Model/DataFrame/clsDataFramePage.vb @@ -17,7 +17,8 @@ Imports RDotNet ''' -''' Holds a subset dataset for the dataframe +''' Holds a subset dataset of an R dataframe. +''' The subset is determined by the rows and columns indexes and count ''' Public Class clsDataFramePage Private _iRowStart As Integer @@ -26,7 +27,7 @@ Public Class clsDataFramePage Private _iTotalColumnCount As Integer Private _strDataFrameName As String Private _clsRLink As RLink - Private _clsDataFrame As DataFrame + Private _clsRDotNetDataFrame As DataFrame Private _lstColumns As List(Of clsColumnHeaderDisplay) Private _hasChanged As Boolean @@ -58,7 +59,7 @@ Public Class clsDataFramePage ''' Public ReadOnly Property RowNames() As String() Get - Return _clsDataFrame.RowNames() + Return _clsRDotNetDataFrame.RowNames() End Get End Property @@ -78,7 +79,7 @@ Public Class clsDataFramePage ''' Public ReadOnly Property intEndRow As Integer Get - Return _iRowStart + _clsDataFrame.RowCount - 1 + Return _iRowStart + _clsRDotNetDataFrame.RowCount - 1 End Get End Property @@ -98,7 +99,7 @@ Public Class clsDataFramePage ''' Public ReadOnly Property intEndColumn As Integer Get - Return _iColumnStart + _clsDataFrame.ColumnCount - 1 + Return _iColumnStart + _clsRDotNetDataFrame.ColumnCount - 1 End Get End Property @@ -110,7 +111,7 @@ Public Class clsDataFramePage ''' Public ReadOnly Property Data(iRow As Integer, iColumn As Integer) As Object Get - Return _clsDataFrame(iRow, iColumn) + Return _clsRDotNetDataFrame(iRow, iColumn) 'ToDo Need better error handling if out of range End Get End Property @@ -121,7 +122,7 @@ Public Class clsDataFramePage ''' Public ReadOnly Property DisplayedRowCount As Integer Get - Return _clsDataFrame.RowCount + Return _clsRDotNetDataFrame.RowCount End Get End Property @@ -153,15 +154,18 @@ Public Class clsDataFramePage End Sub ''' - ''' Refreshes data. Note: always refreshes regardless whether dataset has changed. + ''' Refreshes data. + ''' When called, a new R.Net data frame will be set. + ''' If data frame set is not successful, a null object will be set. + ''' Note: always refreshes regardless whether dataset has changed. ''' - ''' + ''' Returns true if R.Net data frame is set, false if not set Public Function RefreshData() - _clsDataFrame = GetDataFrameFromRCommand() - If _clsDataFrame IsNot Nothing Then + _clsRDotNetDataFrame = GetDataFrameFromRCommand() + If _clsRDotNetDataFrame IsNot Nothing Then SetHeaders() End If - Return _clsDataFrame IsNot Nothing 'Returns a success value + Return _clsRDotNetDataFrame IsNot Nothing 'Returns a success value End Function ''' @@ -215,7 +219,7 @@ Public Class clsDataFramePage Dim clsRFunction As New RFunction clsRFunction.SetRCommand(_clsRLink.strInstatDataObject & "$get_column_data_types") clsRFunction.AddParameter("data_name", Chr(34) & _strDataFrameName & Chr(34)) - clsRFunction.AddParameter("columns", _clsRLink.GetListAsRString(_clsDataFrame.ColumnNames.ToList)) + clsRFunction.AddParameter("columns", _clsRLink.GetListAsRString(_clsRDotNetDataFrame.ColumnNames.ToList)) Return _clsRLink.RunInternalScriptGetValue(clsRFunction.ToScript()).AsCharacter End Function @@ -224,7 +228,7 @@ Public Class clsDataFramePage clsRFunction.SetRCommand(_clsRLink.strInstatDataObject & "$get_variables_metadata") clsRFunction.AddParameter("data_name", Chr(34) & _strDataFrameName & Chr(34)) clsRFunction.AddParameter("property", "colour_label") - clsRFunction.AddParameter("column", _clsRLink.GetListAsRString(_clsDataFrame.ColumnNames.ToList)) + clsRFunction.AddParameter("column", _clsRLink.GetListAsRString(_clsRDotNetDataFrame.ColumnNames.ToList)) Return _clsRLink.RunInternalScriptGetValue(clsRFunction.ToScript()).AsNumeric End Function @@ -233,7 +237,7 @@ Public Class clsDataFramePage clsRFunction.ClearParameters() clsRFunction.SetRCommand(_clsRLink.strInstatDataObject & "$has_colours") clsRFunction.AddParameter("data_name", Chr(34) & _strDataFrameName & Chr(34)) - clsRFunction.AddParameter("columns", _clsRLink.GetListAsRString(_clsDataFrame.ColumnNames.ToList)) + clsRFunction.AddParameter("columns", _clsRLink.GetListAsRString(_clsRDotNetDataFrame.ColumnNames.ToList)) Return _clsRLink.RunInternalScriptGetValue(clsRFunction.ToScript()).AsLogical(0) End Function @@ -289,9 +293,10 @@ Public Class clsDataFramePage End If _lstColumns.Clear() - For i = 0 To _clsDataFrame.ColumnNames.ToList.Count - 1 - columnHeader = GetColumnDispayDetails(_clsDataFrame.ColumnNames.ToList(i), vecColumnDataTypes(i)) - If bApplyBackGroundColumnColours AndAlso vecColumnColours IsNot Nothing Then + + For i = 0 To _clsRDotNetDataFrame.ColumnNames.ToList.Count - 1 + columnHeader = GetColumnDispayDetails(_clsRDotNetDataFrame.ColumnNames.ToList(i), vecColumnDataTypes(i)) + If bApplyBackGroundColumnColours AndAlso Not Double.IsNaN(vecColumnColours(i)) Then columnHeader.clsBackGroundColour = GetColumnBackGroundColor(i, vecColumnColours(i).ToString()) End If _lstColumns.Add(columnHeader) @@ -320,7 +325,7 @@ Public Class clsDataFramePage Public Sub LoadNextRowPage() If CanLoadNextRowPage() Then _iRowStart += intRowIncrements - _clsDataFrame = GetDataFrameFromRCommand() + _clsRDotNetDataFrame = GetDataFrameFromRCommand() End If End Sub @@ -338,7 +343,7 @@ Public Class clsDataFramePage Public Sub LoadPreviousRowPage() If CanLoadPreviousRowPage() Then _iRowStart -= intRowIncrements - _clsDataFrame = GetDataFrameFromRCommand() + _clsRDotNetDataFrame = GetDataFrameFromRCommand() End If End Sub @@ -347,7 +352,7 @@ Public Class clsDataFramePage ''' Public Sub LoadLastRowPage() _iRowStart = (intRowIncrements * (GetNoOfRowPages() - 1)) + 1 - _clsDataFrame = GetDataFrameFromRCommand() + _clsRDotNetDataFrame = GetDataFrameFromRCommand() End Sub ''' @@ -355,7 +360,7 @@ Public Class clsDataFramePage ''' Public Sub LoadFirstRowPage() _iRowStart = 1 - _clsDataFrame = GetDataFrameFromRCommand() + _clsRDotNetDataFrame = GetDataFrameFromRCommand() End Sub ''' @@ -372,7 +377,7 @@ Public Class clsDataFramePage Public Sub LoadNextColumnPage() If CanLoadNextColumnPage() Then _iColumnStart += iColumnIncrements - _clsDataFrame = GetDataFrameFromRCommand() + _clsRDotNetDataFrame = GetDataFrameFromRCommand() SetHeaders() End If End Sub @@ -391,7 +396,7 @@ Public Class clsDataFramePage Public Sub LoadPreviousColumnPage() If _iColumnStart - iColumnIncrements >= 0 Then _iColumnStart -= iColumnIncrements - _clsDataFrame = GetDataFrameFromRCommand() + _clsRDotNetDataFrame = GetDataFrameFromRCommand() SetHeaders() End If End Sub @@ -401,7 +406,7 @@ Public Class clsDataFramePage ''' Public Sub LoadLastColumnPage() _iColumnStart = (iColumnIncrements * (GetNoOfColumnPages() - 1)) + 1 - _clsDataFrame = GetDataFrameFromRCommand() + _clsRDotNetDataFrame = GetDataFrameFromRCommand() SetHeaders() End Sub @@ -410,7 +415,7 @@ Public Class clsDataFramePage ''' Public Sub LoadFirstColumnPage() _iColumnStart = 1 - _clsDataFrame = GetDataFrameFromRCommand() + _clsRDotNetDataFrame = GetDataFrameFromRCommand() SetHeaders() End Sub diff --git a/instat/Model/Output/clsOutputElement.vb b/instat/Model/Output/clsOutputElement.vb index d897eb65dc8..098f881d24f 100644 --- a/instat/Model/Output/clsOutputElement.vb +++ b/instat/Model/Output/clsOutputElement.vb @@ -108,21 +108,27 @@ Public Class clsOutputElement ''' ''' Public Sub AddScript(strScript As String) - Dim rScript As New clsRScript(strScript) - Dim lstTokens As List(Of clsRToken) = rScript.GetLstTokens(rScript.GetLstLexemes(strScript)) 'rScript.lstTokens + Try + Dim rScript As New clsRScript(strScript) + Dim lstTokens As List(Of clsRToken) = rScript.GetLstTokens(rScript.GetLstLexemes(strScript)) 'rScript.lstTokens - If lstTokens Is Nothing Then - Exit Sub - End If - - For Each rToken In lstTokens - _formattedRScript.Add(New clsRScriptElement With - { - .Text = rToken.strTxt, - .Type = rToken.enuToken - }) - Next - _outputType = OutputType.Script + If lstTokens IsNot Nothing Then + For Each rToken In lstTokens + _formattedRScript.Add(New clsRScriptElement With + { + .Text = rToken.strTxt, + .Type = rToken.enuToken + }) + Next + _outputType = OutputType.Script + End If + Catch ex As Exception + MessageBox.Show("Unable to parse the following R Script: '" & strScript & "'." & + Environment.NewLine & ex.Message, + "Developer Error", + MessageBoxButtons.OK, + MessageBoxIcon.Error) + End Try End Sub ''' diff --git a/instat/Model/RCommand/clsPrepareFunctionsForGrids.vb b/instat/Model/RCommand/clsPrepareFunctionsForGrids.vb index 3b34230761e..a95bc38377b 100644 --- a/instat/Model/RCommand/clsPrepareFunctionsForGrids.vb +++ b/instat/Model/RCommand/clsPrepareFunctionsForGrids.vb @@ -150,6 +150,26 @@ Public Class clsPrepareFunctionsForGrids End If _RLink.RunScript(clsConvertToNumeric.ToScript(), strComment:="Right click menu: Convert Column(s) To Numeric") End Sub + + ''' + ''' Check if the column factor contains labels. + ''' + Public Function CheckHasLabels(strColumnName As String) As Boolean + Dim clsColmnLabelsRFunction = New RFunction + Dim clsGetColumnsFromData As New RFunction + + clsGetColumnsFromData.SetRCommand(frmMain.clsRLink.strInstatDataObject & "$get_columns_from_data") + clsGetColumnsFromData.AddParameter("data_name", Chr(34) & _strDataFrame & Chr(34), iPosition:=0) + clsGetColumnsFromData.AddParameter("col_names", Chr(34) & strColumnName & Chr(34), iPosition:=1) + clsGetColumnsFromData.AddParameter("use_current_filter", "FALSE", iPosition:=2) + + clsColmnLabelsRFunction.SetRCommand(frmMain.clsRLink.strInstatDataObject & "$has_labels") + clsColmnLabelsRFunction.AddParameter("data_name", Chr(34) & _strDataFrame & Chr(34), iPosition:=0) + clsColmnLabelsRFunction.AddParameter("col_names", clsRFunctionParameter:=clsGetColumnsFromData, iPosition:=1) + + Return frmMain.clsRLink.RunInternalScriptGetValue(clsColmnLabelsRFunction.ToScript(), bSilent:=True).AsLogical(0) + End Function + ''' ''' View dataframe the whole dataframe within a pop up ''' diff --git a/instat/Resources/upward-arrow1.png b/instat/Resources/upward-arrow1.png new file mode 100644 index 00000000000..a24a40d4837 Binary files /dev/null and b/instat/Resources/upward-arrow1.png differ diff --git a/instat/UcrGeomListWithAes.designer.vb b/instat/UcrGeomListWithAes.designer.vb index 9909213b043..7c2dac642c3 100644 --- a/instat/UcrGeomListWithAes.designer.vb +++ b/instat/UcrGeomListWithAes.designer.vb @@ -91,7 +91,6 @@ Partial Class ucrGeomListWithParameters ' 'ucrReceiverParam1 ' - Me.ucrReceiverParam1.AutoSize = True Me.ucrReceiverParam1.frmParent = Nothing Me.ucrReceiverParam1.Location = New System.Drawing.Point(97, 25) Me.ucrReceiverParam1.Margin = New System.Windows.Forms.Padding(0) @@ -104,7 +103,6 @@ Partial Class ucrGeomListWithParameters ' 'ucrReceiverParam2 ' - Me.ucrReceiverParam2.AutoSize = True Me.ucrReceiverParam2.frmParent = Nothing Me.ucrReceiverParam2.Location = New System.Drawing.Point(97, 51) Me.ucrReceiverParam2.Margin = New System.Windows.Forms.Padding(0) @@ -117,7 +115,6 @@ Partial Class ucrGeomListWithParameters ' 'ucrReceiverParam3 ' - Me.ucrReceiverParam3.AutoSize = True Me.ucrReceiverParam3.frmParent = Nothing Me.ucrReceiverParam3.Location = New System.Drawing.Point(97, 77) Me.ucrReceiverParam3.Margin = New System.Windows.Forms.Padding(0) @@ -130,7 +127,6 @@ Partial Class ucrGeomListWithParameters ' 'ucrReceiverParam4 ' - Me.ucrReceiverParam4.AutoSize = True Me.ucrReceiverParam4.frmParent = Nothing Me.ucrReceiverParam4.Location = New System.Drawing.Point(97, 103) Me.ucrReceiverParam4.Margin = New System.Windows.Forms.Padding(0) @@ -143,7 +139,6 @@ Partial Class ucrGeomListWithParameters ' 'ucrReceiverParam5 ' - Me.ucrReceiverParam5.AutoSize = True Me.ucrReceiverParam5.frmParent = Nothing Me.ucrReceiverParam5.Location = New System.Drawing.Point(97, 129) Me.ucrReceiverParam5.Margin = New System.Windows.Forms.Padding(0) @@ -200,7 +195,6 @@ Partial Class ucrGeomListWithParameters ' 'ucrReceiverParam13 ' - Me.ucrReceiverParam13.AutoSize = True Me.ucrReceiverParam13.frmParent = Nothing Me.ucrReceiverParam13.Location = New System.Drawing.Point(97, 337) Me.ucrReceiverParam13.Margin = New System.Windows.Forms.Padding(0) @@ -222,7 +216,6 @@ Partial Class ucrGeomListWithParameters ' 'ucrReceiverParam12 ' - Me.ucrReceiverParam12.AutoSize = True Me.ucrReceiverParam12.frmParent = Nothing Me.ucrReceiverParam12.Location = New System.Drawing.Point(97, 311) Me.ucrReceiverParam12.Margin = New System.Windows.Forms.Padding(0) @@ -244,7 +237,6 @@ Partial Class ucrGeomListWithParameters ' 'ucrReceiverParam11 ' - Me.ucrReceiverParam11.AutoSize = True Me.ucrReceiverParam11.frmParent = Nothing Me.ucrReceiverParam11.Location = New System.Drawing.Point(97, 285) Me.ucrReceiverParam11.Margin = New System.Windows.Forms.Padding(0) @@ -347,7 +339,6 @@ Partial Class ucrGeomListWithParameters ' 'ucrReceiverParam10 ' - Me.ucrReceiverParam10.AutoSize = True Me.ucrReceiverParam10.frmParent = Nothing Me.ucrReceiverParam10.Location = New System.Drawing.Point(97, 259) Me.ucrReceiverParam10.Margin = New System.Windows.Forms.Padding(0) @@ -360,7 +351,6 @@ Partial Class ucrGeomListWithParameters ' 'ucrReceiverParam9 ' - Me.ucrReceiverParam9.AutoSize = True Me.ucrReceiverParam9.frmParent = Nothing Me.ucrReceiverParam9.Location = New System.Drawing.Point(97, 233) Me.ucrReceiverParam9.Margin = New System.Windows.Forms.Padding(0) @@ -373,7 +363,6 @@ Partial Class ucrGeomListWithParameters ' 'ucrReceiverParam8 ' - Me.ucrReceiverParam8.AutoSize = True Me.ucrReceiverParam8.frmParent = Nothing Me.ucrReceiverParam8.Location = New System.Drawing.Point(97, 207) Me.ucrReceiverParam8.Margin = New System.Windows.Forms.Padding(0) @@ -386,7 +375,6 @@ Partial Class ucrGeomListWithParameters ' 'ucrReceiverParam7 ' - Me.ucrReceiverParam7.AutoSize = True Me.ucrReceiverParam7.frmParent = Nothing Me.ucrReceiverParam7.Location = New System.Drawing.Point(97, 181) Me.ucrReceiverParam7.Margin = New System.Windows.Forms.Padding(0) @@ -399,7 +387,6 @@ Partial Class ucrGeomListWithParameters ' 'ucrReceiverParam6 ' - Me.ucrReceiverParam6.AutoSize = True Me.ucrReceiverParam6.frmParent = Nothing Me.ucrReceiverParam6.Location = New System.Drawing.Point(97, 155) Me.ucrReceiverParam6.Margin = New System.Windows.Forms.Padding(0) @@ -432,6 +419,7 @@ Partial Class ucrGeomListWithParameters ' Me.AutoScaleDimensions = New System.Drawing.SizeF(96.0!, 96.0!) Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi + Me.AutoSize = False Me.Controls.Add(Me.ucrChkApplyOnAllLayers) Me.Controls.Add(Me.ucrChkIgnoreGlobalAes) Me.Controls.Add(Me.grpAesList) diff --git a/instat/UserControls/DataGrid/Linux/ucrColumnMetadataLinuxGrid.vb b/instat/UserControls/DataGrid/Linux/ucrColumnMetadataLinuxGrid.vb index 8921c6e6985..aa3e1157723 100644 --- a/instat/UserControls/DataGrid/Linux/ucrColumnMetadataLinuxGrid.vb +++ b/instat/UserControls/DataGrid/Linux/ucrColumnMetadataLinuxGrid.vb @@ -19,6 +19,8 @@ Public Class ucrColumnMetadataLinuxGrid Private _lstNonEditableColumns As New List(Of String) + Event DeleteLabels(strColumnName As String) Implements IColumnMetaDataGrid.DeleteLabels + Public Event EditValue(iRow As Integer, strColumnName As String, strPreviousValue As String, newValue As Object) Implements IColumnMetaDataGrid.EditValue Public Sub AddColumns(columnMetaData As clsColumnMetaData) Implements IColumnMetaDataGrid.AddColumns diff --git a/instat/UserControls/DataGrid/Linux/ucrDataViewLinuxGrid.vb b/instat/UserControls/DataGrid/Linux/ucrDataViewLinuxGrid.vb index 1ef9b871f22..16518003511 100644 --- a/instat/UserControls/DataGrid/Linux/ucrDataViewLinuxGrid.vb +++ b/instat/UserControls/DataGrid/Linux/ucrDataViewLinuxGrid.vb @@ -54,13 +54,13 @@ Public Class ucrDataViewLinuxGrid dataGrid.RowHeadersDefaultCellStyle.ForeColor = Color.DarkBlue End If - Dim strRowNames = dataFrame.strRowNames() + Dim strRowNames = dataFrame.DisplayedRowNames() dataGrid.Rows.Clear() For i = 0 To dataFrame.iDisplayedRowCount - 1 dataGrid.Rows.Add() dataGrid.Rows(i).HeaderCell.Value = strRowNames(i) For j = 0 To dataGrid.ColumnCount - 1 - dataGrid.Rows(i).Cells(j).Value = dataFrame.Data(i, j) + dataGrid.Rows(i).Cells(j).Value = dataFrame.DisplayedData(i, j) Next Next End Sub @@ -99,8 +99,8 @@ Public Class ucrDataViewLinuxGrid Private Sub DataGridView_CellEndEdit(sender As Object, e As DataGridViewCellEventArgs) Dim dataGrid = GetDataGridFromSelectedTab() RaiseEvent IDataViewGrid_ReplaceValueInData(dataGrid.CurrentCell.Value.ToString(), - GetCurrentDataFrameFocus().clsVisiblePage.lstColumns(dataGrid.CurrentCell.ColumnIndex).strName, - GetCurrentDataFrameFocus().clsVisiblePage.RowNames()(dataGrid.CurrentCell.RowIndex)) + GetCurrentDataFrameFocus().clsVisibleDataFramePage.lstColumns(dataGrid.CurrentCell.ColumnIndex).strName, + GetCurrentDataFrameFocus().clsVisibleDataFramePage.RowNames()(dataGrid.CurrentCell.RowIndex)) End Sub 'ToDo allow editing @@ -138,7 +138,7 @@ Public Class ucrDataViewLinuxGrid End If Next For Each columnIndex In selectedColumns - lstColumns.Add(GetCurrentDataFrameFocus().clsVisiblePage.lstColumns(columnIndex)) + lstColumns.Add(GetCurrentDataFrameFocus().clsVisibleDataFramePage.lstColumns(columnIndex)) Next Return lstColumns End Function diff --git a/instat/UserControls/DataGrid/Linux/ucrDataframeMetadataLinuxGrid.vb b/instat/UserControls/DataGrid/Linux/ucrDataframeMetadataLinuxGrid.vb index 413530f292c..0f900cd1eff 100644 --- a/instat/UserControls/DataGrid/Linux/ucrDataframeMetadataLinuxGrid.vb +++ b/instat/UserControls/DataGrid/Linux/ucrDataframeMetadataLinuxGrid.vb @@ -17,6 +17,8 @@ Public Class ucrDataframeMetadataLinuxGrid Implements IDataframeMetaDataGrid + Event DeleteLabels(strColumnName As String) Implements IDataframeMetaDataGrid.DeleteLabels + Public Event EditValue(iRow As Integer, strColumnName As String, strPreviousValue As String, newValue As Object) Implements IDataframeMetaDataGrid.EditValue Public Sub AddColumns() Implements IDataframeMetaDataGrid.AddColumns diff --git a/instat/UserControls/DataGrid/Linux/ucrLinuxGrid.vb b/instat/UserControls/DataGrid/Linux/ucrLinuxGrid.vb index c25addeedfa..0471871ddb2 100644 --- a/instat/UserControls/DataGrid/Linux/ucrLinuxGrid.vb +++ b/instat/UserControls/DataGrid/Linux/ucrLinuxGrid.vb @@ -25,9 +25,13 @@ Public MustInherit Class ucrLinuxGrid Private _rowContextMenuStrip As ContextMenuStrip Private _tabContextMenuStrip As ContextMenuStrip + ''' + ''' Gets current worksheet adapter + ''' + ''' Worksheet adapter if a tab is selected, else nothing Public Property CurrentWorksheet As clsWorksheetAdapter Implements IGrid.CurrentWorksheet Get - Return New clsWorksheetAdapter(tcTabs.SelectedTab) + Return If(tcTabs.SelectedTab Is Nothing, Nothing, New clsWorksheetAdapter(tcTabs.SelectedTab)) End Get Set(value As clsWorksheetAdapter) For Each tabPage As TabPage In tcTabs.TabPages diff --git a/instat/UserControls/DataGrid/ReoGrid/ucrColumnMetadataReoGrid.vb b/instat/UserControls/DataGrid/ReoGrid/ucrColumnMetadataReoGrid.vb index da422d2e9ef..1258beaaec4 100644 --- a/instat/UserControls/DataGrid/ReoGrid/ucrColumnMetadataReoGrid.vb +++ b/instat/UserControls/DataGrid/ReoGrid/ucrColumnMetadataReoGrid.vb @@ -23,6 +23,7 @@ Public Class ucrColumnMetadataReoGrid Private _lstNonEditableColumns As New List(Of String) Private strPreviousCellText As String + Public Event DeleteLabels(strColumnName As String) Implements IColumnMetaDataGrid.DeleteLabels Public Event EditValue(iRow As Integer, strColumnName As String, strPreviousValue As String, newValue As Object) Implements IColumnMetaDataGrid.EditValue Public Sub AddColumns(columnMetaData As clsColumnMetaData) Implements IColumnMetaDataGrid.AddColumns @@ -66,7 +67,7 @@ Public Class ucrColumnMetadataReoGrid 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_BeforeCellKeyDownColumnMetadata End Sub Private Sub Worksheet_AfterCellEdit(sender As Object, e As CellAfterEditEventArgs) @@ -91,4 +92,11 @@ Public Class ucrColumnMetadataReoGrid e.IsCancelled = True End Sub + Protected Sub Worksheet_BeforeCellKeyDownColumnMetadata(sender As Object, e As BeforeCellKeyDownEventArgs) + If e.KeyCode = unvell.ReoGrid.Interaction.KeyCode.Delete OrElse e.KeyCode = unvell.ReoGrid.Interaction.KeyCode.Back Then + RaiseEvent DeleteLabels(grdData.CurrentWorksheet.ColumnHeaders(e.Cell.Column).Text) + e.IsCancelled = True + End If + End Sub + End Class \ No newline at end of file diff --git a/instat/UserControls/DataGrid/ReoGrid/ucrDataViewReoGrid.vb b/instat/UserControls/DataGrid/ReoGrid/ucrDataViewReoGrid.vb index 8458b084c2f..7aba4e96df9 100644 --- a/instat/UserControls/DataGrid/ReoGrid/ucrDataViewReoGrid.vb +++ b/instat/UserControls/DataGrid/ReoGrid/ucrDataViewReoGrid.vb @@ -68,10 +68,10 @@ Public Class ucrDataViewReoGrid textColour = Color.DarkBlue End If - strRowNames = dataFrame.strRowNames() + strRowNames = dataFrame.DisplayedRowNames() For i = 0 To grdData.CurrentWorksheet.Rows - 1 For j = 0 To grdData.CurrentWorksheet.Columns - 1 - grdData.CurrentWorksheet(row:=i, col:=j) = dataFrame.Data(i, j) + grdData.CurrentWorksheet(row:=i, col:=j) = dataFrame.DisplayedData(i, j) Next grdData.CurrentWorksheet.RowHeaders.Item(i).Text = strRowNames(i) grdData.CurrentWorksheet.RowHeaders(i).TextColor = textColour @@ -81,7 +81,7 @@ Public Class ucrDataViewReoGrid Public Function GetSelectedColumns() As List(Of clsColumnHeaderDisplay) Implements IDataViewGrid.GetSelectedColumns Dim lstColumns As New List(Of clsColumnHeaderDisplay) For i As Integer = grdData.CurrentWorksheet.SelectionRange.Col To grdData.CurrentWorksheet.SelectionRange.Col + grdData.CurrentWorksheet.SelectionRange.Cols - 1 - lstColumns.Add(GetCurrentDataFrameFocus().clsVisiblePage.lstColumns(i)) + lstColumns.Add(GetCurrentDataFrameFocus().clsVisibleDataFramePage.lstColumns(i)) Next Return lstColumns End Function @@ -138,8 +138,8 @@ Public Class ucrDataViewReoGrid Private Sub Worksheet_AfterCellEdit(sender As Object, e As CellAfterEditEventArgs) RaiseEvent ReplaceValueInData(e.NewData.ToString(), - GetCurrentDataFrameFocus().clsVisiblePage.lstColumns(e.Cell.Column).strName, - GetCurrentDataFrameFocus().clsVisiblePage.RowNames()(e.Cell.Row)) + GetCurrentDataFrameFocus().clsVisibleDataFramePage.lstColumns(e.Cell.Column).strName, + GetCurrentDataFrameFocus().clsVisibleDataFramePage.RowNames()(e.Cell.Row)) e.EndReason = unvell.ReoGrid.EndEditReason.Cancel End Sub @@ -147,7 +147,7 @@ Public Class ucrDataViewReoGrid Private Sub Worksheet_BeforePaste(sender As Object, e As BeforeRangeOperationEventArgs) e.IsCancelled = True 'prevents pasted data from being added directly into the data view 'validate columns - If e.Range.EndCol >= GetCurrentDataFrameFocus().clsVisiblePage.lstColumns.Count Then + If e.Range.EndCol >= GetCurrentDataFrameFocus().clsVisibleDataFramePage.lstColumns.Count Then 'this happens when Ctrl + V is pressed and the data to be pasted has more columns 'than columns between start and end column MsgBox("Columns copied are more than the current data frame columns.", MsgBoxStyle.Critical, "Excess Columns") diff --git a/instat/UserControls/DataGrid/ReoGrid/ucrDataframeMetadataReoGrid.vb b/instat/UserControls/DataGrid/ReoGrid/ucrDataframeMetadataReoGrid.vb index 6a4fa963db1..ba68e880f55 100644 --- a/instat/UserControls/DataGrid/ReoGrid/ucrDataframeMetadataReoGrid.vb +++ b/instat/UserControls/DataGrid/ReoGrid/ucrDataframeMetadataReoGrid.vb @@ -22,6 +22,7 @@ Public Class ucrDataframeMetadataReoGrid Private lstNonEditableColumns As New List(Of String) Private strPreviousCellText As String + Event DeleteLabels(strColumnName As String) Implements IDataframeMetaDataGrid.DeleteLabels Public Event EditValue(iRow As Integer, strColumnName As String, strPreviousValue As String, newValue As Object) Implements IDataframeMetaDataGrid.EditValue Public Sub AddColumns() Implements IDataframeMetaDataGrid.AddColumns @@ -53,6 +54,7 @@ Public Class ucrDataframeMetadataReoGrid grdData.Worksheets(0).SetSettings(unvell.ReoGrid.WorksheetSettings.Edit_DragSelectionToMoveCells, False) grdData.Worksheets(0).SetSettings(unvell.ReoGrid.WorksheetSettings.Edit_DragSelectionToMoveCells, False) grdData.Worksheets(0).SetSettings(unvell.ReoGrid.WorksheetSettings.Edit_DragSelectionToFillSerial, False) + grdData.Worksheets(0).SetSettings(unvell.ReoGrid.WorksheetSettings.View_AllowCellTextOverflow, False) grdData.Worksheets(0).SelectionForwardDirection = unvell.ReoGrid.SelectionForwardDirection.Down grdData.SheetTabNewButtonVisible = False AttachEventsToWorksheet(grdData.Worksheets(0)) diff --git a/instat/UserControls/DataGrid/ReoGrid/ucrReoGrid.vb b/instat/UserControls/DataGrid/ReoGrid/ucrReoGrid.vb index fe1758caa35..af92f346d21 100644 --- a/instat/UserControls/DataGrid/ReoGrid/ucrReoGrid.vb +++ b/instat/UserControls/DataGrid/ReoGrid/ucrReoGrid.vb @@ -22,9 +22,13 @@ Public MustInherit Class ucrReoGrid Protected _clsDataBook As clsDataBook + ''' + ''' Gets current worksheet adapter + ''' + ''' Worksheet adapter if a worksheet is selected, else nothing Public Property CurrentWorksheet As clsWorksheetAdapter Implements IGrid.CurrentWorksheet Get - Return New clsWorksheetAdapter(grdData.CurrentWorksheet) + Return If(grdData.CurrentWorksheet Is Nothing, Nothing, New clsWorksheetAdapter(grdData.CurrentWorksheet)) End Get Set(value As clsWorksheetAdapter) grdData.CurrentWorksheet = grdData.Worksheets.Where(Function(x) x.Name = value.Name).FirstOrDefault @@ -186,15 +190,24 @@ Public MustInherit Class ucrReoGrid End Function Private Sub UpdateWorksheetStyle(workSheet As Worksheet) + 'issue with reo grid that means if RangePosition.EntireRange is used then the back color + 'changes. This would then override the back color set in R If frmMain.clsInstatOptions IsNot Nothing Then - workSheet.SetRangeStyles(RangePosition.EntireRange, New WorksheetRangeStyle() With { + 'Set enitre range apart from top row + workSheet.SetRangeStyles(New RangePosition(1, 0, workSheet.RowCount, workSheet.ColumnCount), New WorksheetRangeStyle() With { + .Flag = PlainStyleFlag.TextColor Or PlainStyleFlag.FontSize Or PlainStyleFlag.FontName, + .TextColor = frmMain.clsInstatOptions.clrEditor, + .FontSize = frmMain.clsInstatOptions.fntEditor.Size, + .FontName = frmMain.clsInstatOptions.fntEditor.Name + }) + 'Set top row + workSheet.SetRangeStyles(New RangePosition(0, 0, 1, workSheet.ColumnCount), New WorksheetRangeStyle() With { .Flag = PlainStyleFlag.TextColor Or PlainStyleFlag.FontSize Or PlainStyleFlag.FontName, .TextColor = frmMain.clsInstatOptions.clrEditor, .FontSize = frmMain.clsInstatOptions.fntEditor.Size, .FontName = frmMain.clsInstatOptions.fntEditor.Name }) End If - End Sub Private Sub ucrReoGrid_Load(sender As Object, e As EventArgs) Handles MyBase.Load diff --git a/instat/clsRLink.vb b/instat/clsRLink.vb index b2bec21c4e6..6f9ecb8c3f4 100644 --- a/instat/clsRLink.vb +++ b/instat/clsRLink.vb @@ -635,80 +635,6 @@ Public Class RLink Return lstCurrColumns End Function - '''-------------------------------------------------------------------------------------------- - ''' Fills the data frame control combo box with the specified data frame names and - ''' sets the combo box index. - ''' The data frames to include, and the source of the index are set by the - ''' parameters below. - ''' - ''' [in,out] The combobox data frames control. - ''' (Optional) If true then sets the combo box - ''' index to the index of the current worksheet. - ''' If false then sets the index to the index of - ''' the current data frame. - ''' (Optional) If true then adds an extra item - ''' in the combo box for '[Overall]' i.e. items - ''' not at data frame level. - ''' (Optional) The current data frame. - ''' (Optional) If true then only fill the - ''' combo box with data frame names linked to - ''' . - ''' (Optional) The primary data frame. - ''' (Optional) If true then also include the - ''' in - ''' the list of data frames. - ''' This parameter is only used if - ''' - ''' is true. - '''-------------------------------------------------------------------------------------------- - Public Sub FillComboDataFrames(ByRef cboDataFrames As ComboBox, Optional bSetDefault As Boolean = True, Optional bIncludeOverall As Boolean = False, Optional strCurrentDataFrame As String = "", Optional bOnlyLinkedToPrimaryDataFrames As Boolean = False, Optional strPrimaryDataFrame As String = "", Optional bIncludePrimaryDataFrameAsLinked As Boolean = True) - If bInstatObjectExists Then - If bIncludeOverall Then - cboDataFrames.Items.Add("[Overall]") 'TODO legacy - Task/question: explain this. - End If - If bOnlyLinkedToPrimaryDataFrames Then - cboDataFrames.Items.AddRange(GetLinkedToDataFrameNames(strPrimaryDataFrame, bIncludePrimaryDataFrameAsLinked).ToArray) - Else - cboDataFrames.Items.AddRange(GetDataFrameNames().ToArray) - End If - AdjustComboBoxWidth(cboDataFrames) - 'TODO Legacy - Task/Question: From what I understood, if bSetDefault is true or if the strCurrentDataFrame (given as an argument) is actually not in cboDataFrames (is this case generic or should it never happen ?), then the selected Index should be the current worksheet. - If (bSetDefault OrElse cboDataFrames.Items.IndexOf(strCurrentDataFrame) = -1) AndAlso (grdDataView IsNot Nothing) AndAlso (grdDataView.CurrentWorksheet IsNot Nothing) Then - cboDataFrames.SelectedIndex = cboDataFrames.Items.IndexOf(grdDataView.CurrentWorksheet.Name) - ElseIf cboDataFrames.Items.IndexOf(strCurrentDataFrame) <> -1 Then - cboDataFrames.SelectedIndex = cboDataFrames.Items.IndexOf(strCurrentDataFrame) - End If - End If - End Sub - - '''-------------------------------------------------------------------------------------------- - ''' Adjust combo box width. - ''' - ''' The combo box to adjust. - '''-------------------------------------------------------------------------------------------- - Public Shared Sub AdjustComboBoxWidth(cboCurrent As ComboBox) - 'TODO Legacy - This is used above but will not be once ucrDataFrame uses proper controls - ' Then this can be removed - ' TODO SJL 20/04/20 This is only used by the function above. Make private? - Dim iWidth As Integer = cboCurrent.DropDownWidth - Dim graTemp As System.Drawing.Graphics = cboCurrent.CreateGraphics() - Dim font As Font = cboCurrent.Font - Dim iScrollBarWidth As Integer - Dim iNewWidth As Integer - - If cboCurrent.Items.Count > cboCurrent.MaxDropDownItems Then - iScrollBarWidth = SystemInformation.VerticalScrollBarWidth - Else - iScrollBarWidth = 0 - End If - - For Each strItem As String In cboCurrent.Items - iNewWidth = CInt(graTemp.MeasureString(strItem, font).Width) + iScrollBarWidth - iWidth = Math.Max(iWidth, iNewWidth) - Next - cboCurrent.DropDownWidth = iWidth - End Sub - '''-------------------------------------------------------------------------------------------- ''' Fills the combo box with the ''' data frame's column names. diff --git a/instat/dlgAddComment.vb b/instat/dlgAddComment.vb index 28a6e7c61a6..8dfb0ca3536 100644 --- a/instat/dlgAddComment.vb +++ b/instat/dlgAddComment.vb @@ -22,7 +22,7 @@ Public Class dlgAddComment Private strSelectedColumn As String = "" Public bFirstLoad As Boolean = True Private bReset As Boolean = True - Private clsAddComment As RFunction + Private clsAddComment As New RFunction Private Sub dlgAddComment_Load(sender As Object, e As EventArgs) Handles MyBase.Load If bFirstLoad Then diff --git a/instat/dlgAddLink.vb b/instat/dlgAddLink.vb index 436336a607c..673889f4981 100644 --- a/instat/dlgAddLink.vb +++ b/instat/dlgAddLink.vb @@ -20,7 +20,7 @@ Imports RDotNet Public Class dlgAddLink Private bFirstLoad As Boolean = True Private bReset As Boolean = True - Private clsAddLink As RFunction + Private clsAddLink As New RFunction Private Sub dlgAddLink_Load(sender As Object, e As EventArgs) Handles MyBase.Load If bFirstLoad Then diff --git a/instat/dlgBarAndPieChart.Designer.vb b/instat/dlgBarAndPieChart.Designer.vb index ff085d15809..8ea11695b1a 100644 --- a/instat/dlgBarAndPieChart.Designer.vb +++ b/instat/dlgBarAndPieChart.Designer.vb @@ -55,7 +55,6 @@ Partial Class dlgBarAndPieChart Me.lblLollipopColour = New System.Windows.Forms.Label() Me.lblReorder = New System.Windows.Forms.Label() Me.lblReorderX = New System.Windows.Forms.Label() - Me.lblReorderValue = New System.Windows.Forms.Label() Me.rdoTreeMap = New System.Windows.Forms.RadioButton() Me.lblFill = New System.Windows.Forms.Label() Me.lblArea = New System.Windows.Forms.Label() @@ -68,6 +67,7 @@ Partial Class dlgBarAndPieChart Me.lblWordcloudSize = New System.Windows.Forms.Label() Me.lblWordcloudColor = New System.Windows.Forms.Label() Me.lblWordcloudAngle = New System.Windows.Forms.Label() + Me.ucrChkReorderValue = New instat.ucrCheck() Me.ucrInputPlace = New instat.ucrInputComboBox() Me.ucrInputLayout = New instat.ucrInputComboBox() Me.ucrReceiverLabel = New instat.ucrReceiverSingle() @@ -111,7 +111,7 @@ Partial Class dlgBarAndPieChart ' Me.lblByFactor.AutoSize = True Me.lblByFactor.ImeMode = System.Windows.Forms.ImeMode.NoControl - Me.lblByFactor.Location = New System.Drawing.Point(255, 277) + Me.lblByFactor.Location = New System.Drawing.Point(251, 286) Me.lblByFactor.Name = "lblByFactor" Me.lblByFactor.Size = New System.Drawing.Size(76, 13) Me.lblByFactor.TabIndex = 24 @@ -163,7 +163,7 @@ Partial Class dlgBarAndPieChart ' Me.lblPosition.AutoSize = True Me.lblPosition.ImeMode = System.Windows.Forms.ImeMode.NoControl - Me.lblPosition.Location = New System.Drawing.Point(254, 357) + Me.lblPosition.Location = New System.Drawing.Point(251, 364) Me.lblPosition.Name = "lblPosition" Me.lblPosition.Size = New System.Drawing.Size(47, 13) Me.lblPosition.TabIndex = 39 @@ -192,7 +192,7 @@ Partial Class dlgBarAndPieChart ' Me.lblXvariable.AutoSize = True Me.lblXvariable.ImeMode = System.Windows.Forms.ImeMode.NoControl - Me.lblXvariable.Location = New System.Drawing.Point(255, 196) + Me.lblXvariable.Location = New System.Drawing.Point(251, 196) Me.lblXvariable.Name = "lblXvariable" Me.lblXvariable.Size = New System.Drawing.Size(58, 13) Me.lblXvariable.TabIndex = 5 @@ -276,7 +276,7 @@ Partial Class dlgBarAndPieChart ' Me.lblReorder.AutoSize = True Me.lblReorder.ImeMode = System.Windows.Forms.ImeMode.NoControl - Me.lblReorder.Location = New System.Drawing.Point(254, 316) + Me.lblReorder.Location = New System.Drawing.Point(251, 323) Me.lblReorder.Name = "lblReorder" Me.lblReorder.Size = New System.Drawing.Size(48, 13) Me.lblReorder.TabIndex = 36 @@ -292,16 +292,6 @@ Partial Class dlgBarAndPieChart Me.lblReorderX.TabIndex = 11 Me.lblReorderX.Text = "Reorder:" ' - 'lblReorderValue - ' - Me.lblReorderValue.AutoSize = True - Me.lblReorderValue.ImeMode = System.Windows.Forms.ImeMode.NoControl - Me.lblReorderValue.Location = New System.Drawing.Point(255, 236) - Me.lblReorderValue.Name = "lblReorderValue" - Me.lblReorderValue.Size = New System.Drawing.Size(48, 13) - Me.lblReorderValue.TabIndex = 34 - Me.lblReorderValue.Text = "Reorder:" - ' 'rdoTreeMap ' Me.rdoTreeMap.Appearance = System.Windows.Forms.Appearance.Button @@ -394,7 +384,7 @@ Partial Class dlgBarAndPieChart ' Me.lblWordcloudSize.AutoSize = True Me.lblWordcloudSize.ImeMode = System.Windows.Forms.ImeMode.NoControl - Me.lblWordcloudSize.Location = New System.Drawing.Point(255, 95) + Me.lblWordcloudSize.Location = New System.Drawing.Point(251, 95) Me.lblWordcloudSize.Name = "lblWordcloudSize" Me.lblWordcloudSize.Size = New System.Drawing.Size(30, 13) Me.lblWordcloudSize.TabIndex = 13 @@ -404,7 +394,7 @@ Partial Class dlgBarAndPieChart ' Me.lblWordcloudColor.AutoSize = True Me.lblWordcloudColor.ImeMode = System.Windows.Forms.ImeMode.NoControl - Me.lblWordcloudColor.Location = New System.Drawing.Point(255, 135) + Me.lblWordcloudColor.Location = New System.Drawing.Point(251, 135) Me.lblWordcloudColor.Name = "lblWordcloudColor" Me.lblWordcloudColor.Size = New System.Drawing.Size(34, 13) Me.lblWordcloudColor.TabIndex = 17 @@ -414,12 +404,21 @@ Partial Class dlgBarAndPieChart ' Me.lblWordcloudAngle.AutoSize = True Me.lblWordcloudAngle.ImeMode = System.Windows.Forms.ImeMode.NoControl - Me.lblWordcloudAngle.Location = New System.Drawing.Point(255, 175) + Me.lblWordcloudAngle.Location = New System.Drawing.Point(251, 175) Me.lblWordcloudAngle.Name = "lblWordcloudAngle" Me.lblWordcloudAngle.Size = New System.Drawing.Size(37, 13) Me.lblWordcloudAngle.TabIndex = 21 Me.lblWordcloudAngle.Text = "Angle:" ' + 'ucrChkReorderValue + ' + Me.ucrChkReorderValue.AutoSize = True + Me.ucrChkReorderValue.Checked = False + Me.ucrChkReorderValue.Location = New System.Drawing.Point(253, 236) + Me.ucrChkReorderValue.Name = "ucrChkReorderValue" + Me.ucrChkReorderValue.Size = New System.Drawing.Size(93, 23) + Me.ucrChkReorderValue.TabIndex = 65 + ' 'ucrInputPlace ' Me.ucrInputPlace.AddQuotesIfUnrecognised = True @@ -529,7 +528,7 @@ Partial Class dlgBarAndPieChart Me.ucrInputBarChartPositions.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink Me.ucrInputBarChartPositions.GetSetSelectedIndex = -1 Me.ucrInputBarChartPositions.IsReadOnly = False - Me.ucrInputBarChartPositions.Location = New System.Drawing.Point(252, 372) + Me.ucrInputBarChartPositions.Location = New System.Drawing.Point(252, 379) Me.ucrInputBarChartPositions.Name = "ucrInputBarChartPositions" Me.ucrInputBarChartPositions.Size = New System.Drawing.Size(120, 21) Me.ucrInputBarChartPositions.TabIndex = 40 @@ -547,7 +546,7 @@ Partial Class dlgBarAndPieChart ' Me.ucrReceiverByFactor.AutoSize = True Me.ucrReceiverByFactor.frmParent = Me - Me.ucrReceiverByFactor.Location = New System.Drawing.Point(252, 292) + Me.ucrReceiverByFactor.Location = New System.Drawing.Point(252, 301) Me.ucrReceiverByFactor.Margin = New System.Windows.Forms.Padding(0) Me.ucrReceiverByFactor.Name = "ucrReceiverByFactor" Me.ucrReceiverByFactor.Selector = Nothing @@ -617,9 +616,9 @@ Partial Class dlgBarAndPieChart Me.ucrInputReorderValue.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink Me.ucrInputReorderValue.GetSetSelectedIndex = -1 Me.ucrInputReorderValue.IsReadOnly = False - Me.ucrInputReorderValue.Location = New System.Drawing.Point(252, 252) + Me.ucrInputReorderValue.Location = New System.Drawing.Point(252, 261) Me.ucrInputReorderValue.Name = "ucrInputReorderValue" - Me.ucrInputReorderValue.Size = New System.Drawing.Size(93, 21) + Me.ucrInputReorderValue.Size = New System.Drawing.Size(120, 21) Me.ucrInputReorderValue.TabIndex = 22 ' 'ucrReceiverWordcloudSize @@ -713,9 +712,9 @@ Partial Class dlgBarAndPieChart Me.ucrInputAddReorder.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink Me.ucrInputAddReorder.GetSetSelectedIndex = -1 Me.ucrInputAddReorder.IsReadOnly = False - Me.ucrInputAddReorder.Location = New System.Drawing.Point(252, 332) + Me.ucrInputAddReorder.Location = New System.Drawing.Point(252, 339) Me.ucrInputAddReorder.Name = "ucrInputAddReorder" - Me.ucrInputAddReorder.Size = New System.Drawing.Size(93, 21) + Me.ucrInputAddReorder.Size = New System.Drawing.Size(120, 21) Me.ucrInputAddReorder.TabIndex = 37 ' 'ucrChkAddLabelsText @@ -830,6 +829,7 @@ Partial Class dlgBarAndPieChart Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi Me.AutoSize = True Me.ClientSize = New System.Drawing.Size(415, 547) + Me.Controls.Add(Me.ucrChkReorderValue) Me.Controls.Add(Me.ucrInputPlace) Me.Controls.Add(Me.lblPlace) Me.Controls.Add(Me.ucrInputLayout) @@ -841,7 +841,6 @@ Partial Class dlgBarAndPieChart Me.Controls.Add(Me.rdoWordCloud) Me.Controls.Add(Me.lblLabel) Me.Controls.Add(Me.rdoTreeMap) - Me.Controls.Add(Me.lblReorderValue) Me.Controls.Add(Me.ucrInputLollipopColour) Me.Controls.Add(Me.lblLollipopColour) Me.Controls.Add(Me.lblLollipopSize) @@ -944,7 +943,6 @@ Partial Class dlgBarAndPieChart Friend WithEvents lblReorderX As Label Friend WithEvents ucrInputReorderX As ucrInputComboBox Friend WithEvents ucrInputReorderValue As ucrInputComboBox - Friend WithEvents lblReorderValue As Label Friend WithEvents rdoTreeMap As RadioButton Friend WithEvents lblArea As Label Friend WithEvents lblFill As Label @@ -972,4 +970,5 @@ Partial Class dlgBarAndPieChart Friend WithEvents ucrChkAddLabelsTreemap As ucrCheck Friend WithEvents ucrChkIncreaseSize As ucrCheck Friend WithEvents ucrNudMaxSize As ucrNud + Friend WithEvents ucrChkReorderValue As ucrCheck End Class \ No newline at end of file diff --git a/instat/dlgBarAndPieChart.vb b/instat/dlgBarAndPieChart.vb index f9115d256f3..3a172a1cf1a 100644 --- a/instat/dlgBarAndPieChart.vb +++ b/instat/dlgBarAndPieChart.vb @@ -119,12 +119,12 @@ Public Class dlgBarAndPieChart ucrPnlOptions.AddRadioButton(rdoWordCloud) ucrPnlOptions.AddFunctionNamesCondition(rdoFrequency, {"coordpolar", "geom_bar", "geom_text"}) - ucrPnlOptions.AddFunctionNamesCondition(rdoValue, {"coordpolar", "geom_bar", "geom_text"}) + ucrPnlOptions.AddFunctionNamesCondition(rdoValue, {"coordpolar", "geom_bar", "geom_text", "geom_lollipop"}) ucrPnlOptions.AddFunctionNamesCondition(rdoTreeMap, {"geom_treemap", "geom_treemap_text"}) ucrPnlOptions.AddFunctionNamesCondition(rdoWordCloud, {"geom_text_wordcloud", "scale_size_area"}) - ucrPnlOptions.AddToLinkedControls({ucrChkFlipCoordinates, ucrChkPolarCoordinates, ucrInputBarChartPositions, ucrReceiverByFactor, ucrInputAddReorder, ucrChkAddLabelsText, ucrVariablesAsFactorForBarChart, ucrChkBacktoback}, {rdoFrequency, rdoValue}, bNewLinkedAddRemoveParameter:=True, bNewLinkedHideIfParameterMissing:=True) - ucrPnlOptions.AddToLinkedControls({ucrReceiverX, ucrInputReorderValue, ucrChkLollipop}, {rdoValue}, bNewLinkedAddRemoveParameter:=True, bNewLinkedHideIfParameterMissing:=True) + ucrPnlOptions.AddToLinkedControls({ucrChkFlipCoordinates, ucrChkPolarCoordinates, ucrReceiverByFactor, ucrInputBarChartPositions, ucrChkAddLabelsText, ucrVariablesAsFactorForBarChart, ucrChkBacktoback}, {rdoFrequency, rdoValue}, bNewLinkedAddRemoveParameter:=True, bNewLinkedHideIfParameterMissing:=True) + ucrPnlOptions.AddToLinkedControls({ucrReceiverX, ucrChkReorderValue, ucrChkLollipop}, {rdoValue}, bNewLinkedAddRemoveParameter:=True, bNewLinkedHideIfParameterMissing:=True) ucrPnlOptions.AddToLinkedControls(ucrInputReorderX, {rdoFrequency}, bNewLinkedAddRemoveParameter:=True, bNewLinkedHideIfParameterMissing:=True) ucrPnlOptions.AddToLinkedControls({ucrReceiverArea, ucrReceiverFill, ucrChkLayout, ucrChkStart, ucrChkAddLabelsTreemap}, {rdoTreeMap}, bNewLinkedAddRemoveParameter:=True, bNewLinkedHideIfParameterMissing:=True) ucrPnlOptions.AddToLinkedControls({ucrReceiverWordcloudAngle, ucrReceiverWordcloudColor, ucrReceiverWordcloudLabel, ucrReceiverWordcloudSize, ucrChkIncreaseSize}, {rdoWordCloud}, bNewLinkedAddRemoveParameter:=True, bNewLinkedHideIfParameterMissing:=True) @@ -221,7 +221,7 @@ Public Class dlgBarAndPieChart ucrChkPolarCoordinates.SetParameter(New RParameter("theta")) ucrChkPolarCoordinates.SetValueIfChecked(Chr(34) & "y" & Chr(34)) ucrChkPolarCoordinates.AddToLinkedControls({ucrPnlPolar}, {True}, bNewLinkedAddRemoveParameter:=True, bNewLinkedHideIfParameterMissing:=True) - + ucrPnlPolar.AddRadioButton(rdoPie) ucrPnlPolar.AddRadioButton(rdoDonut) @@ -309,7 +309,10 @@ Public Class dlgBarAndPieChart ucrInputReorderValue.SetItems({strAscending, strDescending, strReverse, strNone}) ucrInputReorderValue.SetDropDownStyleAsNonEditable() - ucrInputReorderValue.SetLinkedDisplayControl(lblReorderValue) + ucrChkReorderValue.SetText("Reorder") + ucrChkReorderValue.AddFunctionNamesCondition(True, "reorder", True) + ucrChkReorderValue.AddFunctionNamesCondition(False, "reorder", False) + ucrChkReorderValue.AddToLinkedControls(ucrInputReorderValue, {True}, bNewLinkedHideIfParameterMissing:=True) ucrInputLayout.SetParameter(New RParameter("layout", 2)) dctLayout.Add("Squarified", Chr(34) & "squarified" & Chr(34)) @@ -397,13 +400,11 @@ Public Class dlgBarAndPieChart bResetBarLayerSubdialog = True ucrInputAddReorder.SetText(strNone) - ucrInputAddReorder.bUpdateRCodeFromControl = True ucrInputReorderX.SetText(strNone) ucrInputReorderX.bUpdateRCodeFromControl = True ucrInputReorderValue.SetText(strNone) - ucrInputReorderValue.bUpdateRCodeFromControl = True 'Temp fix: Set panel conditions properly! rdoPie.Checked = True rdoFrequency.Checked = True @@ -455,10 +456,8 @@ Public Class dlgBarAndPieChart clsForecatsInfreqValue.SetPackageName("forcats") clsForecatsInfreqValue.SetRCommand("fct_infreq") - clsReorderFunctionValue.SetRCommand("reorder") clsReorderFunctionValue.SetRCommand("reorder") - clsReorderFunction.SetRCommand("reorder") clsReorderFunction.SetRCommand("reorder") clsAesFunction1.SetRCommand("aes") @@ -587,6 +586,7 @@ Public Class dlgBarAndPieChart ucrChkPolarCoordinates.SetRCode(clsPolarCoordFunction, bReset) ucrChkFlipCoordinates.SetRCode(clsBaseOperator, bReset) ucrChkBacktoback.SetRCode(clsScaleYSymmetricFunction, bReset) + ucrChkReorderValue.SetRCode(clsReorderFunctionValue, bReset) ucrInputBarChartPositions.SetRCode(clsRgeomBarFunction, bReset) ucrInputLabelColour.SetRCode(clsGeomTextFunction, bReset) ucrChkAddLabelsText.SetRCode(clsBaseOperator, bReset) @@ -660,7 +660,11 @@ Public Class dlgBarAndPieChart Private Sub cmdBarChartOptions_Click(sender As Object, e As EventArgs) Handles cmdBarChartOptions.Click 'What should global and local aes be? If rdoValue.Checked Or rdoFrequency.Checked Then - sdgLayerOptions.SetupLayer(clsNewGgPlot:=clsRggplotFunction, clsNewGeomFunc:=clsRgeomBarFunction, clsNewGlobalAesFunc:=clsBarAesFunction, clsNewLocalAes:=clsLocalRaesFunction, bFixGeom:=True, ucrNewBaseSelector:=ucrBarChartSelector, bApplyAesGlobally:=True, bReset:=bResetBarLayerSubdialog) + If ucrChkLollipop.Checked Then + sdgLayerOptions.SetupLayer(clsNewGgPlot:=clsRggplotFunction, clsNewGeomFunc:=clsGeomLollipopFunction, clsNewGlobalAesFunc:=clsBarAesFunction, clsNewLocalAes:=clsLocalRaesFunction, bFixGeom:=True, ucrNewBaseSelector:=ucrBarChartSelector, bApplyAesGlobally:=True, bReset:=bResetBarLayerSubdialog) + Else + sdgLayerOptions.SetupLayer(clsNewGgPlot:=clsRggplotFunction, clsNewGeomFunc:=clsRgeomBarFunction, clsNewGlobalAesFunc:=clsBarAesFunction, clsNewLocalAes:=clsLocalRaesFunction, bFixGeom:=True, ucrNewBaseSelector:=ucrBarChartSelector, bApplyAesGlobally:=True, bReset:=bResetBarLayerSubdialog) + End If sdgLayerOptions.ShowDialog() bResetBarLayerSubdialog = False If clsBarAesFunction.ContainsParameter("x") Then @@ -673,6 +677,7 @@ Public Class dlgBarAndPieChart Else ucrReceiverByFactor.Clear() End If + 'Allows for sync with the layer parameters ucrInputBarChartPositions.SetRCode(clsRgeomBarFunction, bReset) TestOkEnabled() @@ -694,7 +699,6 @@ Public Class dlgBarAndPieChart Private Sub SetDialogOptions() If rdoValue.Checked Or rdoFrequency.Checked Then clsRggplotFunction.AddParameter("mapping", clsRFunctionParameter:=clsBarAesFunction, iPosition:=1) - cmdBarChartOptions.Visible = True clsRgeomBarFunction.RemoveParameterByName("width") clsBaseOperator.RemoveParameterByName("geom_col") If Not ucrSaveBar.bUserTyped Then @@ -702,6 +706,9 @@ Public Class dlgBarAndPieChart End If ucrVariablesAsFactorForBarChart.RemoveIncludedMetadataProperty("class") ucrVariablesAsFactorForBarChart.strSelectorHeading = "Variables" + + ucrInputBarChartPositions.Visible = Not ucrReceiverByFactor.IsEmpty() + ElseIf rdoTreeMap.Checked Then clsRggplotFunction.AddParameter("mapping", clsRFunctionParameter:=clsGeomTreemapAesFunction, iPosition:=1) Else @@ -710,25 +717,25 @@ Public Class dlgBarAndPieChart ucrChkLollipop.Enabled = If(rdoValue.Checked, True, False) If rdoFrequency.Checked Then - ucrChkLollipop.Checked = False If ucrVariablesAsFactorForBarChart.bSingleVariable Then ucrInputReorderX.Visible = True - ucrInputAddReorder.Visible = True + ucrInputAddReorder.Visible = Not ucrReceiverByFactor.IsEmpty() + If Not ucrInputAddReorder.Visible Then + ucrInputAddReorder.SetText(strNone) + End If Else ucrInputReorderX.Visible = False ucrInputReorderX.SetText(strNone) - ucrInputAddReorder.Visible = False - ucrInputAddReorder.SetText(strNone) End If ElseIf rdoValue.Checked Then If ucrVariablesAsFactorForBarChart.bSingleVariable Then - ucrInputReorderValue.Visible = True - ucrInputAddReorder.Visible = True + ucrChkReorderValue.Visible = True + ucrInputAddReorder.Visible = Not ucrReceiverByFactor.IsEmpty() + If Not ucrInputAddReorder.Visible Then + ucrInputAddReorder.SetText(strNone) + End If Else - ucrInputReorderValue.Visible = False - ucrInputReorderValue.SetText(strNone) - ucrInputAddReorder.Visible = False - ucrInputAddReorder.SetText(strNone) + ucrChkReorderValue.Visible = False End If End If End Sub @@ -836,6 +843,7 @@ Public Class dlgBarAndPieChart End If If ucrChkLollipop.Checked Then clsBaseOperator.AddParameter("geom_lollipop", clsRFunctionParameter:=clsGeomLollipopFunction, iPosition:=2) + clsBaseOperator.RemoveParameterByName("geom_bar") Else clsBaseOperator.AddParameter("geom_bar", clsRFunctionParameter:=clsRgeomBarFunction, iPosition:=2) End If @@ -877,8 +885,11 @@ Public Class dlgBarAndPieChart ChangeButtonsText() End Sub - Private Sub ucrPnlOptions_ControlValueChanged() Handles ucrPnlOptions.ControlValueChanged, ucrVariablesAsFactorForBarChart.ControlValueChanged, ucrReceiverX.ControlValueChanged, ucrReceiverByFactor.ControlValueChanged, ucrReceiverLabel.ControlValueChanged, ucrChkAddLabelsText.ControlValueChanged, - ucrInputReorderX.ControlValueChanged, ucrInputAddReorder.ControlValueChanged, ucrInputReorderValue.ControlValueChanged, ucrNudMaxSize.ControlValueChanged, ucrChkIncreaseSize.ControlValueChanged + Private Sub ucrPnlOptions_ControlValueChanged() Handles ucrPnlOptions.ControlValueChanged, ucrVariablesAsFactorForBarChart.ControlValueChanged, + ucrReceiverX.ControlValueChanged, ucrReceiverByFactor.ControlValueChanged, ucrReceiverLabel.ControlValueChanged, + ucrChkAddLabelsText.ControlValueChanged, ucrChkReorderValue.ControlValueChanged, ucrInputReorderX.ControlValueChanged, + ucrInputAddReorder.ControlValueChanged, ucrInputReorderValue.ControlValueChanged, ucrNudMaxSize.ControlValueChanged, + ucrChkIncreaseSize.ControlValueChanged, ucrChkLollipop.ControlValueChanged SetDialogOptions() ChangeParameterName() If rdoTreeMap.Checked Then @@ -887,7 +898,6 @@ Public Class dlgBarAndPieChart If rdoWordCloud.Checked Then ucrReceiverWordcloudLabel.SetMeAsReceiver() End If - ucrChkLollipop.Enabled = If(rdoValue.Checked, True, False) End Sub Private Sub ucrReceiverByFactor_ControlContentsChanged() Handles ucrReceiverByFactor.ControlContentsChanged, ucrPnlOptions.ControlContentsChanged @@ -900,7 +910,8 @@ Public Class dlgBarAndPieChart End If End Sub - Private Sub ucrChkBacktoback_ControlValueChanged(ucrChangedControl As ucrCore) Handles ucrChkBacktoback.ControlValueChanged, ucrChkLollipop.ControlValueChanged, ucrVariablesAsFactorForBarChart.ControlValueChanged, ucrReceiverByFactor.ControlValueChanged, ucrReceiverX.ControlValueChanged, ucrPnlOptions.ControlValueChanged + Private Sub ucrChkBacktoback_ControlValueChanged(ucrChangedControl As ucrCore) Handles ucrChkBacktoback.ControlValueChanged, + ucrVariablesAsFactorForBarChart.ControlValueChanged, ucrReceiverX.ControlValueChanged If rdoFrequency.Checked OrElse rdoValue.Checked Then clsBaseOperator.RemoveParameterByName("geom_bar1") clsBaseOperator.RemoveParameterByName("geom_bar2") @@ -991,8 +1002,13 @@ Public Class dlgBarAndPieChart SetGeomTextOptions() End Sub - Private Sub ucrSaveBar_ControlContentsChanged(ucrChangedControl As ucrCore) Handles ucrVariablesAsFactorForBarChart.ControlContentsChanged, ucrReceiverByFactor.ControlContentsChanged, ucrSaveBar.ControlContentsChanged, ucrReceiverX.ControlContentsChanged, ucrPnlOptions.ControlContentsChanged, ucrChkBacktoback.ControlContentsChanged, ucrChkPolarCoordinates.ControlContentsChanged, ucrReceiverArea.ControlContentsChanged, - ucrReceiverFill.ControlContentsChanged, ucrReceiverLabel.ControlContentsChanged, ucrChkAddLabelsText.ControlContentsChanged, ucrChkAddLabelsTreemap.ControlContentsChanged, ucrReceiverWordcloudLabel.ControlContentsChanged, ucrReceiverWordcloudSize.ControlContentsChanged, ucrReceiverWordcloudColor.ControlContentsChanged, ucrReceiverWordcloudAngle.ControlContentsChanged, ucrChkIncreaseSize.ControlContentsChanged + Private Sub ucrSaveBar_ControlContentsChanged(ucrChangedControl As ucrCore) Handles ucrVariablesAsFactorForBarChart.ControlContentsChanged, + ucrReceiverByFactor.ControlContentsChanged, ucrSaveBar.ControlContentsChanged, ucrReceiverX.ControlContentsChanged, + ucrPnlOptions.ControlContentsChanged, ucrChkBacktoback.ControlContentsChanged, ucrChkPolarCoordinates.ControlContentsChanged, + ucrReceiverArea.ControlContentsChanged, ucrReceiverFill.ControlContentsChanged, ucrReceiverLabel.ControlContentsChanged, + ucrChkAddLabelsText.ControlContentsChanged, ucrChkAddLabelsTreemap.ControlContentsChanged, ucrReceiverWordcloudLabel.ControlContentsChanged, + ucrReceiverWordcloudSize.ControlContentsChanged, ucrReceiverWordcloudColor.ControlContentsChanged, ucrReceiverWordcloudAngle.ControlContentsChanged, + ucrChkIncreaseSize.ControlContentsChanged TestOkEnabled() End Sub diff --git a/instat/dlgCalculateTreatmentDifferences.Designer.vb b/instat/dlgCalculateTreatmentDifferences.Designer.vb index e9b94f74fa7..f0e7118ecd4 100644 --- a/instat/dlgCalculateTreatmentDifferences.Designer.vb +++ b/instat/dlgCalculateTreatmentDifferences.Designer.vb @@ -82,25 +82,23 @@ Partial Class dlgCalculateTreatmentDifferences 'ucrInputFactorOption2 ' Me.ucrInputFactorOption2.AddQuotesIfUnrecognised = True - Me.ucrInputFactorOption2.AutoSize = True Me.ucrInputFactorOption2.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink Me.ucrInputFactorOption2.GetSetSelectedIndex = -1 Me.ucrInputFactorOption2.IsReadOnly = False Me.ucrInputFactorOption2.Location = New System.Drawing.Point(272, 164) Me.ucrInputFactorOption2.Name = "ucrInputFactorOption2" - Me.ucrInputFactorOption2.Size = New System.Drawing.Size(0, 0) + Me.ucrInputFactorOption2.Size = New System.Drawing.Size(120, 24) Me.ucrInputFactorOption2.TabIndex = 24 ' 'ucrInputFactorOption1 ' Me.ucrInputFactorOption1.AddQuotesIfUnrecognised = True - Me.ucrInputFactorOption1.AutoSize = True Me.ucrInputFactorOption1.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink Me.ucrInputFactorOption1.GetSetSelectedIndex = -1 Me.ucrInputFactorOption1.IsReadOnly = False Me.ucrInputFactorOption1.Location = New System.Drawing.Point(272, 122) Me.ucrInputFactorOption1.Name = "ucrInputFactorOption1" - Me.ucrInputFactorOption1.Size = New System.Drawing.Size(0, 0) + Me.ucrInputFactorOption1.Size = New System.Drawing.Size(120, 24) Me.ucrInputFactorOption1.TabIndex = 22 ' 'ucrReceiverID diff --git a/instat/dlgCalculator.vb b/instat/dlgCalculator.vb index fe275fa2e96..91211e450f8 100644 --- a/instat/dlgCalculator.vb +++ b/instat/dlgCalculator.vb @@ -18,8 +18,9 @@ Imports System.ComponentModel Imports instat.Translations Public Class dlgCalculator - Dim clsAttach As New RFunction - Dim clsDetach As New RFunction + Private clsAttachFunction As New RFunction + Private clsDetachFunction As New RFunction + Private clsRemoveLabelsFunction As New RFunction Public bFirstLoad As Boolean = True Public iHelpCalcID As Integer 'holds the original width of the form @@ -47,7 +48,6 @@ Public Class dlgCalculator End Sub Private Sub SetDefaults() - ucrCalc.ucrInputCalOptions.SetName("Basic") ucrCalc.Reset() @@ -71,13 +71,18 @@ Public Class dlgCalculator ucrCalc.ucrReceiverForCalculation.SetMeAsReceiver() ucrCalc.ucrTryCalculator.SetIsCommand() ucrCalc.ucrTryCalculator.SetReceiver(ucrCalc.ucrReceiverForCalculation) - clsAttach.SetRCommand("attach") - clsDetach.SetRCommand("detach") - clsAttach.AddParameter("what", clsRFunctionParameter:=ucrCalc.ucrSelectorForCalculations.ucrAvailableDataFrames.clsCurrDataFrame) - clsDetach.AddParameter("name", clsRFunctionParameter:=ucrCalc.ucrSelectorForCalculations.ucrAvailableDataFrames.clsCurrDataFrame) - clsDetach.AddParameter("unload", "TRUE") - ucrBase.clsRsyntax.AddToBeforeCodes(clsAttach) - ucrBase.clsRsyntax.AddToAfterCodes(clsDetach) + + clsRemoveLabelsFunction.SetRCommand(frmMain.clsRLink.strInstatDataObject & "$append_to_variables_metadata") + clsRemoveLabelsFunction.AddParameter("property", Chr(34) & "labels" & Chr(34), iPosition:=2) + clsRemoveLabelsFunction.AddParameter("new_val", Chr(34) & Chr(34), iPosition:=3) + + clsAttachFunction.SetRCommand("attach") + clsDetachFunction.SetRCommand("detach") + clsAttachFunction.AddParameter("what", clsRFunctionParameter:=ucrCalc.ucrSelectorForCalculations.ucrAvailableDataFrames.clsCurrDataFrame) + clsDetachFunction.AddParameter("name", clsRFunctionParameter:=ucrCalc.ucrSelectorForCalculations.ucrAvailableDataFrames.clsCurrDataFrame) + clsDetachFunction.AddParameter("unload", "TRUE") + ucrBase.clsRsyntax.AddToBeforeCodes(clsAttachFunction, 0) + ucrBase.clsRsyntax.AddToAfterCodes(clsDetachFunction, 0) ucrBase.clsRsyntax.SetCommandString("") ucrCalc.ucrSaveResultInto.SetPrefix("calc") @@ -110,14 +115,18 @@ Public Class dlgCalculator ''' Private Sub SaveResults() If ucrCalc.ucrSaveResultInto.ucrChkSave.Checked AndAlso ucrCalc.ucrSaveResultInto.IsComplete Then + clsRemoveLabelsFunction.AddParameter("col_names", Chr(34) & ucrCalc.ucrSaveResultInto.GetText() & Chr(34), iPosition:=1) ucrBase.clsRsyntax.SetAssignTo(ucrCalc.ucrSaveResultInto.GetText(), strTempColumn:=ucrCalc.ucrSaveResultInto.GetText(), strTempDataframe:=ucrCalc.ucrSelectorForCalculations.ucrAvailableDataFrames.cboAvailableDataFrames.Text, bAssignToIsPrefix:=ucrBase.clsRsyntax.clsBaseCommandString.bAssignToIsPrefix, bAssignToColumnWithoutNames:=ucrBase.clsRsyntax.clsBaseCommandString.bAssignToColumnWithoutNames, bInsertColumnBefore:=ucrBase.clsRsyntax.clsBaseCommandString.bInsertColumnBefore, bRequireCorrectLength:=ucrBase.clsRsyntax.clsBaseCommandString.bRequireCorrectLength) + ucrBase.clsRsyntax.AddToAfterCodes(clsRemoveLabelsFunction, 1) ucrBase.clsRsyntax.bExcludeAssignedFunctionOutput = True ucrBase.clsRsyntax.iCallType = 0 Else + ucrBase.clsRsyntax.RemoveFromAfterCodes(clsRemoveLabelsFunction) ucrBase.clsRsyntax.RemoveAssignTo() ucrBase.clsRsyntax.iCallType = 1 ucrBase.clsRsyntax.bExcludeAssignedFunctionOutput = False End If + End Sub Private Sub ucrBase_ClickOk(sender As Object, e As EventArgs) Handles ucrBase.ClickOk @@ -130,6 +139,10 @@ Public Class dlgCalculator TestOKEnabled() End Sub + Private Sub ucrSelectorForCalculation_DataframeChanged() Handles ucrCalc.DataFrameChanged + clsRemoveLabelsFunction.AddParameter("data_name", Chr(34) & ucrCalc.ucrSelectorForCalculations.strCurrentDataFrame & Chr(34), iPosition:=0) + End Sub + Private Sub ucrBase_ClickReset(sender As Object, e As EventArgs) Handles ucrBase.ClickReset SetDefaults() TestOKEnabled() diff --git a/instat/dlgCircularDensityPlot.vb b/instat/dlgCircularDensityPlot.vb index 602e0ef1ff7..a6f05c3fafe 100644 --- a/instat/dlgCircularDensityPlot.vb +++ b/instat/dlgCircularDensityPlot.vb @@ -19,9 +19,9 @@ Imports instat.Translations Public Class dlgCircularDensityPlot Private bFirstLoad As Boolean = True Private bReset As Boolean = True - Private clsDensityFunction As RFunction - Private clsRecordGraphFunction As RFunction - Private clsDensityPlotFunction, clsRosePlotFunction, clsScatterPlotFunction As RFunction + Private clsDensityFunction As New RFunction + Private clsRecordGraphFunction As New RFunction + Private clsDensityPlotFunction, clsRosePlotFunction, clsScatterPlotFunction As New RFunction Private Sub dlgCircularDensityPlot_Load(sender As Object, e As EventArgs) Handles MyBase.Load If bFirstLoad Then InitialiseDialog() diff --git a/instat/dlgClimaticCheckDataTemperature.Designer.vb b/instat/dlgClimaticCheckDataTemperature.Designer.vb index 09a71c40a61..ec0019cf27f 100644 --- a/instat/dlgClimaticCheckDataTemperature.Designer.vb +++ b/instat/dlgClimaticCheckDataTemperature.Designer.vb @@ -35,12 +35,6 @@ Partial Class dlgClimaticCheckDataTemperature Me.rdoIndividual = New System.Windows.Forms.RadioButton() Me.rdoMultiple = New System.Windows.Forms.RadioButton() Me.lblNudSame = New System.Windows.Forms.Label() - Me.lblNudJump = New System.Windows.Forms.Label() - Me.lblNudDiff = New System.Windows.Forms.Label() - Me.lblNudRangeElement1Min = New System.Windows.Forms.Label() - Me.lblNudRangeElement2Min = New System.Windows.Forms.Label() - Me.lblNudRangeElement1Max = New System.Windows.Forms.Label() - Me.lblNudRangeElement2Max = New System.Windows.Forms.Label() Me.ttOutliers = New System.Windows.Forms.ToolTip(Me.components) Me.lblCoeff = New System.Windows.Forms.Label() Me.grpLogicalCalculatedColumns = New System.Windows.Forms.GroupBox() @@ -54,12 +48,8 @@ Partial Class dlgClimaticCheckDataTemperature Me.ucrChkRangeElement1 = New instat.ucrCheck() Me.ucrNudSame = New instat.ucrNud() Me.ucrNudDifference = New instat.ucrNud() - Me.ucrNudRangeElement2Max = New instat.ucrNud() Me.ucrChkOutlier = New instat.ucrCheck() - Me.ucrNudRangeElement2Min = New instat.ucrNud() - Me.ucrNudRangeElement1Max = New instat.ucrNud() Me.ucrChkSame = New instat.ucrCheck() - Me.ucrNudRangeElement1Min = New instat.ucrNud() Me.ucrChkJump = New instat.ucrCheck() Me.ucrChkDifference = New instat.ucrCheck() Me.ucrReceiverElement1 = New instat.ucrReceiverSingle() @@ -71,6 +61,12 @@ Partial Class dlgClimaticCheckDataTemperature Me.ucrSelectorTemperature = New instat.ucrSelectorByDataFrameAddRemove() Me.ucrBase = New instat.ucrButtons() Me.ucrPnlType = New instat.UcrPanel() + Me.ucrInputRangeElement1Min = New instat.ucrInputTextBox() + Me.ucrInputRangeElement1Max = New instat.ucrInputTextBox() + Me.ucrInputRangeElement2Min = New instat.ucrInputTextBox() + Me.ucrInputRangeElement2Max = New instat.ucrInputTextBox() + Me.lblRangeElement1From = New System.Windows.Forms.Label() + Me.lblRangeElement2From = New System.Windows.Forms.Label() Me.grpLogicalCalculatedColumns.SuspendLayout() Me.SuspendLayout() ' @@ -138,21 +134,21 @@ Partial Class dlgClimaticCheckDataTemperature ' Me.lblRangeElement1to.AutoSize = True Me.lblRangeElement1to.ImeMode = System.Windows.Forms.ImeMode.NoControl - Me.lblRangeElement1to.Location = New System.Drawing.Point(254, 268) + Me.lblRangeElement1to.Location = New System.Drawing.Point(272, 268) Me.lblRangeElement1to.Name = "lblRangeElement1to" - Me.lblRangeElement1to.Size = New System.Drawing.Size(16, 13) + Me.lblRangeElement1to.Size = New System.Drawing.Size(23, 13) Me.lblRangeElement1to.TabIndex = 23 - Me.lblRangeElement1to.Text = "to" + Me.lblRangeElement1to.Text = "To:" ' 'lblRangeElement2to ' Me.lblRangeElement2to.AutoSize = True Me.lblRangeElement2to.ImeMode = System.Windows.Forms.ImeMode.NoControl - Me.lblRangeElement2to.Location = New System.Drawing.Point(254, 297) + Me.lblRangeElement2to.Location = New System.Drawing.Point(273, 297) Me.lblRangeElement2to.Name = "lblRangeElement2to" - Me.lblRangeElement2to.Size = New System.Drawing.Size(16, 13) + Me.lblRangeElement2to.Size = New System.Drawing.Size(23, 13) Me.lblRangeElement2to.TabIndex = 29 - Me.lblRangeElement2to.Text = "to" + Me.lblRangeElement2to.Text = "To:" ' 'lblElement2 ' @@ -211,66 +207,6 @@ Partial Class dlgClimaticCheckDataTemperature Me.lblNudSame.TabIndex = 34 Me.lblNudSame.Text = "days" ' - 'lblNudJump - ' - Me.lblNudJump.AutoSize = True - Me.lblNudJump.ImeMode = System.Windows.Forms.ImeMode.NoControl - Me.lblNudJump.Location = New System.Drawing.Point(236, 360) - Me.lblNudJump.Name = "lblNudJump" - Me.lblNudJump.Size = New System.Drawing.Size(18, 13) - Me.lblNudJump.TabIndex = 37 - Me.lblNudJump.Text = "°C" - ' - 'lblNudDiff - ' - Me.lblNudDiff.AutoSize = True - Me.lblNudDiff.ImeMode = System.Windows.Forms.ImeMode.NoControl - Me.lblNudDiff.Location = New System.Drawing.Point(236, 393) - Me.lblNudDiff.Name = "lblNudDiff" - Me.lblNudDiff.Size = New System.Drawing.Size(18, 13) - Me.lblNudDiff.TabIndex = 40 - Me.lblNudDiff.Text = "°C" - ' - 'lblNudRangeElement1Min - ' - Me.lblNudRangeElement1Min.AutoSize = True - Me.lblNudRangeElement1Min.ImeMode = System.Windows.Forms.ImeMode.NoControl - Me.lblNudRangeElement1Min.Location = New System.Drawing.Point(236, 268) - Me.lblNudRangeElement1Min.Name = "lblNudRangeElement1Min" - Me.lblNudRangeElement1Min.Size = New System.Drawing.Size(18, 13) - Me.lblNudRangeElement1Min.TabIndex = 22 - Me.lblNudRangeElement1Min.Text = "°C" - ' - 'lblNudRangeElement2Min - ' - Me.lblNudRangeElement2Min.AutoSize = True - Me.lblNudRangeElement2Min.ImeMode = System.Windows.Forms.ImeMode.NoControl - Me.lblNudRangeElement2Min.Location = New System.Drawing.Point(236, 297) - Me.lblNudRangeElement2Min.Name = "lblNudRangeElement2Min" - Me.lblNudRangeElement2Min.Size = New System.Drawing.Size(18, 13) - Me.lblNudRangeElement2Min.TabIndex = 28 - Me.lblNudRangeElement2Min.Text = "°C" - ' - 'lblNudRangeElement1Max - ' - Me.lblNudRangeElement1Max.AutoSize = True - Me.lblNudRangeElement1Max.ImeMode = System.Windows.Forms.ImeMode.NoControl - Me.lblNudRangeElement1Max.Location = New System.Drawing.Point(324, 268) - Me.lblNudRangeElement1Max.Name = "lblNudRangeElement1Max" - Me.lblNudRangeElement1Max.Size = New System.Drawing.Size(18, 13) - Me.lblNudRangeElement1Max.TabIndex = 25 - Me.lblNudRangeElement1Max.Text = "°C" - ' - 'lblNudRangeElement2Max - ' - Me.lblNudRangeElement2Max.AutoSize = True - Me.lblNudRangeElement2Max.ImeMode = System.Windows.Forms.ImeMode.NoControl - Me.lblNudRangeElement2Max.Location = New System.Drawing.Point(325, 297) - Me.lblNudRangeElement2Max.Name = "lblNudRangeElement2Max" - Me.lblNudRangeElement2Max.Size = New System.Drawing.Size(18, 13) - Me.lblNudRangeElement2Max.TabIndex = 31 - Me.lblNudRangeElement2Max.Text = "°C" - ' 'lblCoeff ' Me.lblCoeff.AutoSize = True @@ -279,7 +215,7 @@ Partial Class dlgClimaticCheckDataTemperature Me.lblCoeff.Name = "lblCoeff" Me.lblCoeff.Size = New System.Drawing.Size(32, 13) Me.lblCoeff.TabIndex = 42 - Me.lblCoeff.Text = "Coeff" + Me.lblCoeff.Text = "Coef:" ' 'grpLogicalCalculatedColumns ' @@ -334,7 +270,7 @@ Partial Class dlgClimaticCheckDataTemperature Me.ucrChkRangeElement2.Checked = False Me.ucrChkRangeElement2.Location = New System.Drawing.Point(10, 293) Me.ucrChkRangeElement2.Name = "ucrChkRangeElement2" - Me.ucrChkRangeElement2.Size = New System.Drawing.Size(172, 23) + Me.ucrChkRangeElement2.Size = New System.Drawing.Size(165, 23) Me.ucrChkRangeElement2.TabIndex = 26 ' 'ucrReceiverElement2 @@ -369,7 +305,7 @@ Partial Class dlgClimaticCheckDataTemperature Me.ucrChkRangeElement1.Checked = False Me.ucrChkRangeElement1.Location = New System.Drawing.Point(10, 264) Me.ucrChkRangeElement1.Name = "ucrChkRangeElement1" - Me.ucrChkRangeElement1.Size = New System.Drawing.Size(172, 23) + Me.ucrChkRangeElement1.Size = New System.Drawing.Size(165, 23) Me.ucrChkRangeElement1.TabIndex = 20 ' 'ucrNudSame @@ -398,19 +334,6 @@ Partial Class dlgClimaticCheckDataTemperature Me.ucrNudDifference.TabIndex = 39 Me.ucrNudDifference.Value = New Decimal(New Integer() {0, 0, 0, 0}) ' - 'ucrNudRangeElement2Max - ' - Me.ucrNudRangeElement2Max.AutoSize = True - Me.ucrNudRangeElement2Max.DecimalPlaces = New Decimal(New Integer() {0, 0, 0, 0}) - Me.ucrNudRangeElement2Max.Increment = New Decimal(New Integer() {1, 0, 0, 0}) - Me.ucrNudRangeElement2Max.Location = New System.Drawing.Point(274, 293) - Me.ucrNudRangeElement2Max.Maximum = New Decimal(New Integer() {100, 0, 0, 0}) - Me.ucrNudRangeElement2Max.Minimum = New Decimal(New Integer() {0, 0, 0, 0}) - Me.ucrNudRangeElement2Max.Name = "ucrNudRangeElement2Max" - Me.ucrNudRangeElement2Max.Size = New System.Drawing.Size(50, 20) - Me.ucrNudRangeElement2Max.TabIndex = 30 - Me.ucrNudRangeElement2Max.Value = New Decimal(New Integer() {0, 0, 0, 0}) - ' 'ucrChkOutlier ' Me.ucrChkOutlier.AutoSize = True @@ -420,32 +343,6 @@ Partial Class dlgClimaticCheckDataTemperature Me.ucrChkOutlier.Size = New System.Drawing.Size(100, 23) Me.ucrChkOutlier.TabIndex = 41 ' - 'ucrNudRangeElement2Min - ' - Me.ucrNudRangeElement2Min.AutoSize = True - Me.ucrNudRangeElement2Min.DecimalPlaces = New Decimal(New Integer() {0, 0, 0, 0}) - Me.ucrNudRangeElement2Min.Increment = New Decimal(New Integer() {1, 0, 0, 0}) - Me.ucrNudRangeElement2Min.Location = New System.Drawing.Point(184, 293) - Me.ucrNudRangeElement2Min.Maximum = New Decimal(New Integer() {100, 0, 0, 0}) - Me.ucrNudRangeElement2Min.Minimum = New Decimal(New Integer() {0, 0, 0, 0}) - Me.ucrNudRangeElement2Min.Name = "ucrNudRangeElement2Min" - Me.ucrNudRangeElement2Min.Size = New System.Drawing.Size(50, 20) - Me.ucrNudRangeElement2Min.TabIndex = 27 - Me.ucrNudRangeElement2Min.Value = New Decimal(New Integer() {0, 0, 0, 0}) - ' - 'ucrNudRangeElement1Max - ' - Me.ucrNudRangeElement1Max.AutoSize = True - Me.ucrNudRangeElement1Max.DecimalPlaces = New Decimal(New Integer() {0, 0, 0, 0}) - Me.ucrNudRangeElement1Max.Increment = New Decimal(New Integer() {1, 0, 0, 0}) - Me.ucrNudRangeElement1Max.Location = New System.Drawing.Point(274, 264) - Me.ucrNudRangeElement1Max.Maximum = New Decimal(New Integer() {100, 0, 0, 0}) - Me.ucrNudRangeElement1Max.Minimum = New Decimal(New Integer() {0, 0, 0, 0}) - Me.ucrNudRangeElement1Max.Name = "ucrNudRangeElement1Max" - Me.ucrNudRangeElement1Max.Size = New System.Drawing.Size(50, 20) - Me.ucrNudRangeElement1Max.TabIndex = 24 - Me.ucrNudRangeElement1Max.Value = New Decimal(New Integer() {0, 0, 0, 0}) - ' 'ucrChkSame ' Me.ucrChkSame.AutoSize = True @@ -455,19 +352,6 @@ Partial Class dlgClimaticCheckDataTemperature Me.ucrChkSame.Size = New System.Drawing.Size(100, 23) Me.ucrChkSame.TabIndex = 32 ' - 'ucrNudRangeElement1Min - ' - Me.ucrNudRangeElement1Min.AutoSize = True - Me.ucrNudRangeElement1Min.DecimalPlaces = New Decimal(New Integer() {0, 0, 0, 0}) - Me.ucrNudRangeElement1Min.Increment = New Decimal(New Integer() {1, 0, 0, 0}) - Me.ucrNudRangeElement1Min.Location = New System.Drawing.Point(184, 264) - Me.ucrNudRangeElement1Min.Maximum = New Decimal(New Integer() {100, 0, 0, 0}) - Me.ucrNudRangeElement1Min.Minimum = New Decimal(New Integer() {0, 0, 0, 0}) - Me.ucrNudRangeElement1Min.Name = "ucrNudRangeElement1Min" - Me.ucrNudRangeElement1Min.Size = New System.Drawing.Size(50, 20) - Me.ucrNudRangeElement1Min.TabIndex = 21 - Me.ucrNudRangeElement1Min.Value = New Decimal(New Integer() {0, 0, 0, 0}) - ' 'ucrChkJump ' Me.ucrChkJump.AutoSize = True @@ -593,22 +477,86 @@ Partial Class dlgClimaticCheckDataTemperature Me.ucrPnlType.Size = New System.Drawing.Size(212, 60) Me.ucrPnlType.TabIndex = 0 ' + 'ucrInputRangeElement1Min + ' + Me.ucrInputRangeElement1Min.AddQuotesIfUnrecognised = True + Me.ucrInputRangeElement1Min.AutoSize = True + Me.ucrInputRangeElement1Min.IsMultiline = False + Me.ucrInputRangeElement1Min.IsReadOnly = False + Me.ucrInputRangeElement1Min.Location = New System.Drawing.Point(221, 264) + Me.ucrInputRangeElement1Min.Name = "ucrInputRangeElement1Min" + Me.ucrInputRangeElement1Min.Size = New System.Drawing.Size(44, 21) + Me.ucrInputRangeElement1Min.TabIndex = 48 + ' + 'ucrInputRangeElement1Max + ' + Me.ucrInputRangeElement1Max.AddQuotesIfUnrecognised = True + Me.ucrInputRangeElement1Max.AutoSize = True + Me.ucrInputRangeElement1Max.IsMultiline = False + Me.ucrInputRangeElement1Max.IsReadOnly = False + Me.ucrInputRangeElement1Max.Location = New System.Drawing.Point(297, 264) + Me.ucrInputRangeElement1Max.Name = "ucrInputRangeElement1Max" + Me.ucrInputRangeElement1Max.Size = New System.Drawing.Size(44, 21) + Me.ucrInputRangeElement1Max.TabIndex = 49 + ' + 'ucrInputRangeElement2Min + ' + Me.ucrInputRangeElement2Min.AddQuotesIfUnrecognised = True + Me.ucrInputRangeElement2Min.AutoSize = True + Me.ucrInputRangeElement2Min.IsMultiline = False + Me.ucrInputRangeElement2Min.IsReadOnly = False + Me.ucrInputRangeElement2Min.Location = New System.Drawing.Point(221, 293) + Me.ucrInputRangeElement2Min.Name = "ucrInputRangeElement2Min" + Me.ucrInputRangeElement2Min.Size = New System.Drawing.Size(44, 21) + Me.ucrInputRangeElement2Min.TabIndex = 50 + ' + 'ucrInputRangeElement2Max + ' + Me.ucrInputRangeElement2Max.AddQuotesIfUnrecognised = True + Me.ucrInputRangeElement2Max.AutoSize = True + Me.ucrInputRangeElement2Max.IsMultiline = False + Me.ucrInputRangeElement2Max.IsReadOnly = False + Me.ucrInputRangeElement2Max.Location = New System.Drawing.Point(297, 293) + Me.ucrInputRangeElement2Max.Name = "ucrInputRangeElement2Max" + Me.ucrInputRangeElement2Max.Size = New System.Drawing.Size(44, 21) + Me.ucrInputRangeElement2Max.TabIndex = 51 + ' + 'lblRangeElement1From + ' + Me.lblRangeElement1From.AutoSize = True + Me.lblRangeElement1From.ImeMode = System.Windows.Forms.ImeMode.NoControl + Me.lblRangeElement1From.Location = New System.Drawing.Point(185, 268) + Me.lblRangeElement1From.Name = "lblRangeElement1From" + Me.lblRangeElement1From.Size = New System.Drawing.Size(33, 13) + Me.lblRangeElement1From.TabIndex = 52 + Me.lblRangeElement1From.Text = "From:" + ' + 'lblRangeElement2From + ' + Me.lblRangeElement2From.AutoSize = True + Me.lblRangeElement2From.ImeMode = System.Windows.Forms.ImeMode.NoControl + Me.lblRangeElement2From.Location = New System.Drawing.Point(185, 297) + Me.lblRangeElement2From.Name = "lblRangeElement2From" + Me.lblRangeElement2From.Size = New System.Drawing.Size(33, 13) + Me.lblRangeElement2From.TabIndex = 53 + Me.lblRangeElement2From.Text = "From:" + ' 'dlgClimaticCheckDataTemperature ' 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(478, 561) + Me.Controls.Add(Me.lblRangeElement2From) + Me.Controls.Add(Me.lblRangeElement1From) + Me.Controls.Add(Me.ucrInputRangeElement2Max) + Me.Controls.Add(Me.ucrInputRangeElement2Min) + Me.Controls.Add(Me.ucrInputRangeElement1Max) + Me.Controls.Add(Me.ucrInputRangeElement1Min) Me.Controls.Add(Me.lblCoeff) Me.Controls.Add(Me.ucrNudCoeff) Me.Controls.Add(Me.ucrChkIncludeLogicalColumns) Me.Controls.Add(Me.ucrChkRangeElement2) - Me.Controls.Add(Me.lblNudRangeElement2Max) - Me.Controls.Add(Me.lblNudRangeElement1Max) - Me.Controls.Add(Me.lblNudRangeElement2Min) - Me.Controls.Add(Me.lblNudRangeElement1Min) - Me.Controls.Add(Me.lblNudDiff) - Me.Controls.Add(Me.lblNudJump) Me.Controls.Add(Me.lblNudSame) Me.Controls.Add(Me.rdoIndividual) Me.Controls.Add(Me.rdoMultiple) @@ -620,12 +568,8 @@ Partial Class dlgClimaticCheckDataTemperature Me.Controls.Add(Me.ucrNudSame) Me.Controls.Add(Me.lblRangeElement2to) Me.Controls.Add(Me.ucrNudDifference) - Me.Controls.Add(Me.ucrNudRangeElement2Max) Me.Controls.Add(Me.ucrChkOutlier) - Me.Controls.Add(Me.ucrNudRangeElement2Min) - Me.Controls.Add(Me.ucrNudRangeElement1Max) Me.Controls.Add(Me.ucrChkSame) - Me.Controls.Add(Me.ucrNudRangeElement1Min) Me.Controls.Add(Me.ucrChkJump) Me.Controls.Add(Me.ucrChkDifference) Me.Controls.Add(Me.lblElement1) @@ -677,10 +621,6 @@ Partial Class dlgClimaticCheckDataTemperature Friend WithEvents ucrChkDifference As ucrCheck Friend WithEvents ucrNudSame As ucrNud Friend WithEvents ucrNudDifference As ucrNud - Friend WithEvents ucrNudRangeElement1Max As ucrNud - Friend WithEvents ucrNudRangeElement1Min As ucrNud - Friend WithEvents ucrNudRangeElement2Max As ucrNud - Friend WithEvents ucrNudRangeElement2Min As ucrNud Friend WithEvents lblRangeElement1to As Label Friend WithEvents lblRangeElement2to As Label Friend WithEvents ucrChkRangeElement1 As ucrCheck @@ -690,13 +630,7 @@ Partial Class dlgClimaticCheckDataTemperature Friend WithEvents rdoIndividual As RadioButton Friend WithEvents rdoMultiple As RadioButton Friend WithEvents ucrPnlType As UcrPanel - Friend WithEvents lblNudDiff As Label - Friend WithEvents lblNudJump As Label Friend WithEvents lblNudSame As Label - Friend WithEvents lblNudRangeElement2Max As Label - Friend WithEvents lblNudRangeElement1Max As Label - Friend WithEvents lblNudRangeElement2Min As Label - Friend WithEvents lblNudRangeElement1Min As Label Friend WithEvents ucrChkRangeElement2 As ucrCheck Friend WithEvents ttOutliers As ToolTip Friend WithEvents ucrChkIncludeCalculatedColumns As ucrCheck @@ -705,4 +639,10 @@ Partial Class dlgClimaticCheckDataTemperature Friend WithEvents lblCoeff As Label Friend WithEvents grpLogicalCalculatedColumns As GroupBox Friend WithEvents ttMultiple As ToolTip + Friend WithEvents ucrInputRangeElement1Min As ucrInputTextBox + Friend WithEvents ucrInputRangeElement1Max As ucrInputTextBox + Friend WithEvents ucrInputRangeElement2Max As ucrInputTextBox + Friend WithEvents ucrInputRangeElement2Min As ucrInputTextBox + Friend WithEvents lblRangeElement2From As Label + Friend WithEvents lblRangeElement1From As Label End Class diff --git a/instat/dlgClimaticCheckDataTemperature.vb b/instat/dlgClimaticCheckDataTemperature.vb index 38aa4ea08be..cbe577815ba 100644 --- a/instat/dlgClimaticCheckDataTemperature.vb +++ b/instat/dlgClimaticCheckDataTemperature.vb @@ -21,7 +21,7 @@ Public Class dlgClimaticCheckDataTemperature Private strCurrDataFrame As String Private clsGroupByFunc, clsGroupingListFunc, clsCalcFilterFunc, clsRunCalcFunc As New RFunction 'logical columns - Private clsFilterListFunc, clsFilterFunc As New RFunction + Private clsFilterListFunc As New RFunction 'Jump Private clsJumpCodeElement1, clsJumpCodeElement2 As New clsQCJumpRCode Private clsJumpOp, clsJumpListSubCalc As New ROperator @@ -63,10 +63,10 @@ Public Class dlgClimaticCheckDataTemperature rdoIndividual.Checked = True Dim lstLabels As New List(Of Control) - lstLabels.AddRange({lblRangeElement1to, lblNudRangeElement1Min, lblNudRangeElement1Max}) + lstLabels.AddRange({lblRangeElement1to, lblRangeElement1From}) Dim lstLabels2 As New List(Of Control) - lstLabels2.AddRange({lblNudRangeElement2Min, lblRangeElement2to, lblNudRangeElement2Max}) + lstLabels2.AddRange({lblRangeElement2to, lblRangeElement2From}) 'Station Receiver ucrReceiverStation.Selector = ucrSelectorTemperature @@ -119,38 +119,36 @@ Public Class dlgClimaticCheckDataTemperature 'Checkboxes for options ucrChkRangeElement1.SetParameter(New RParameter("range1", clsRangeOrOp, 1), bNewChangeParameterValue:=False) - ucrChkRangeElement1.SetText("Acceptable Range (Element1)") + ucrChkRangeElement1.SetText("Acceptable Range Element1:") ucrChkRangeElement2.SetParameter(New RParameter("range2", clsRange2OrOp, 1), bNewChangeParameterValue:=False) - ucrChkRangeElement2.SetText("Acceptable Range (Element2)") + ucrChkRangeElement2.SetText("Acceptable Range Element2:") 'Linking controls - ucrChkRangeElement1.AddToLinkedControls(ucrNudRangeElement1Min, {True}, bNewLinkedAddRemoveParameter:=True, bNewLinkedHideIfParameterMissing:=True, bNewLinkedChangeToDefaultState:=True, objNewDefaultState:=10) - ucrChkRangeElement1.AddToLinkedControls(ucrNudRangeElement1Max, {True}, bNewLinkedAddRemoveParameter:=True, bNewLinkedHideIfParameterMissing:=True, bNewLinkedChangeToDefaultState:=True, objNewDefaultState:=50) - ucrChkRangeElement2.AddToLinkedControls(ucrNudRangeElement2Min, {True}, bNewLinkedAddRemoveParameter:=True, bNewLinkedHideIfParameterMissing:=True, bNewLinkedChangeToDefaultState:=True, objNewDefaultState:=1) - ucrChkRangeElement2.AddToLinkedControls(ucrNudRangeElement2Max, {True}, bNewLinkedAddRemoveParameter:=True, bNewLinkedHideIfParameterMissing:=True, bNewLinkedChangeToDefaultState:=True, objNewDefaultState:=30) + ucrChkRangeElement1.AddToLinkedControls(ucrInputRangeElement1Min, {True}, bNewLinkedAddRemoveParameter:=True, bNewLinkedHideIfParameterMissing:=True, bNewLinkedChangeToDefaultState:=True, objNewDefaultState:=10) + ucrChkRangeElement1.AddToLinkedControls(ucrInputRangeElement1Max, {True}, bNewLinkedAddRemoveParameter:=True, bNewLinkedHideIfParameterMissing:=True, bNewLinkedChangeToDefaultState:=True, objNewDefaultState:=50) + ucrChkRangeElement2.AddToLinkedControls(ucrInputRangeElement2Min, {True}, bNewLinkedAddRemoveParameter:=True, bNewLinkedHideIfParameterMissing:=True, bNewLinkedChangeToDefaultState:=True, objNewDefaultState:=1) + ucrChkRangeElement2.AddToLinkedControls(ucrInputRangeElement2Max, {True}, bNewLinkedAddRemoveParameter:=True, bNewLinkedHideIfParameterMissing:=True, bNewLinkedChangeToDefaultState:=True, objNewDefaultState:=30) ucrChkOutlier.AddToLinkedControls(ucrNudCoeff, {True}, bNewLinkedAddRemoveParameter:=True, bNewLinkedHideIfParameterMissing:=True, bNewLinkedChangeToDefaultState:=True, objNewDefaultState:=1.5) - ucrNudRangeElement2Min.SetLinkedDisplayControl(lstLabels2) - ucrNudRangeElement1Min.SetLinkedDisplayControl(lstLabels) - ucrNudJump.SetLinkedDisplayControl(lblNudJump) + ucrInputRangeElement2Min.SetLinkedDisplayControl(lstLabels2) + ucrInputRangeElement1Min.SetLinkedDisplayControl(lstLabels) ucrNudSame.SetLinkedDisplayControl(lblNudSame) - ucrNudDifference.SetLinkedDisplayControl(lblNudDiff) ucrReceiverElement2.SetLinkedDisplayControl(lblElement2) ucrNudCoeff.SetLinkedDisplayControl(lblCoeff) ucrChkSame.SetParameter(New RParameter("same", clsSameOp, 1), bNewChangeParameterValue:=False) - ucrChkSame.SetText("Same (Element1)") + ucrChkSame.SetText("Days: (Element1)") ucrChkSame.AddToLinkedControls(ucrNudSame, {True}, bNewLinkedAddRemoveParameter:=True, bNewLinkedHideIfParameterMissing:=True, bNewLinkedChangeToDefaultState:=True, objNewDefaultState:=4) ucrChkJump.SetParameter(New RParameter("jump", clsJumpOp, 1), bNewChangeParameterValue:=False) - ucrChkJump.SetText("Jump (Element1)") + ucrChkJump.SetText("Jump: (Element1)") ucrChkJump.AddToLinkedControls(ucrNudJump, {True}, bNewLinkedAddRemoveParameter:=True, bNewLinkedHideIfParameterMissing:=True, bNewLinkedChangeToDefaultState:=True, objNewDefaultState:=10) ucrChkDifference.SetParameter(New RParameter("diff", clsDiffOp, 1), bNewChangeParameterValue:=False) - ucrChkDifference.SetText("Difference") + ucrChkDifference.SetText("Difference:") ucrChkOutlier.SetParameter(New RParameter("Combined_outlier", clsOutlierCombinedOperator, 1), bNewChangeParameterValue:=False) - ucrChkOutlier.SetText("Outlier") + ucrChkOutlier.SetText("Outlier:") ucrNudCoeff.SetParameter(New RParameter("coef")) ucrNudCoeff.DecimalPlaces = 1 @@ -158,25 +156,21 @@ Public Class dlgClimaticCheckDataTemperature 'Nuds for the respective options 'Range Option - ucrNudRangeElement1Min.SetParameter(New RParameter("from", 1, bNewIncludeArgumentName:=False)) - ucrNudRangeElement1Min.SetMinMax(-35, 65) - ucrNudRangeElement1Min.DecimalPlaces = 1 - ucrNudRangeElement1Min.Increment = 0.1 - - ucrNudRangeElement1Max.SetParameter(New RParameter("To", 1, bNewIncludeArgumentName:=False)) - ucrNudRangeElement1Max.SetMinMax(-35, 65) - ucrNudRangeElement1Max.DecimalPlaces = 1 - ucrNudRangeElement1Max.Increment = 0.1 - - ucrNudRangeElement2Min.SetParameter(New RParameter("from", 1, bNewIncludeArgumentName:=False)) - ucrNudRangeElement2Min.SetMinMax(-50, 40) - ucrNudRangeElement2Min.DecimalPlaces = 1 - ucrNudRangeElement2Min.Increment = 0.1 - - ucrNudRangeElement2Max.SetParameter(New RParameter("To", 1, bNewIncludeArgumentName:=False)) - ucrNudRangeElement2Max.SetMinMax(-50, 40) - ucrNudRangeElement2Max.DecimalPlaces = 1 - ucrNudRangeElement2Max.Increment = 0.1 + ucrInputRangeElement1Min.SetParameter(New RParameter("from", 1, bNewIncludeArgumentName:=False)) + ucrInputRangeElement1Min.SetValidationTypeAsNumeric(dcmMin:=-35.0, dcmMax:=65.0) + ucrInputRangeElement1Min.AddQuotesIfUnrecognised = False + + ucrInputRangeElement1Max.SetParameter(New RParameter("To", 1, bNewIncludeArgumentName:=False)) + ucrInputRangeElement1Max.SetValidationTypeAsNumeric(dcmMin:=-35.0, dcmMax:=65.0) + ucrInputRangeElement1Max.AddQuotesIfUnrecognised = False + + ucrInputRangeElement2Min.SetParameter(New RParameter("from", 1, bNewIncludeArgumentName:=False)) + ucrInputRangeElement2Min.SetValidationTypeAsNumeric(dcmMin:=-50.0, dcmMax:=40.0) + ucrInputRangeElement2Min.AddQuotesIfUnrecognised = False + + ucrInputRangeElement2Max.SetParameter(New RParameter("To", 1, bNewIncludeArgumentName:=False)) + ucrInputRangeElement2Max.SetValidationTypeAsNumeric(dcmMin:=-50.0, dcmMax:=40.0) + ucrInputRangeElement2Max.AddQuotesIfUnrecognised = False 'Same Option ucrNudSame.SetParameter(New RParameter("n", 1, bNewIncludeArgumentName:=False)) @@ -203,7 +197,6 @@ Public Class dlgClimaticCheckDataTemperature ucrChkIncludeLogicalColumns.SetParameter(New RParameter("save", 4)) ucrChkIncludeLogicalColumns.SetValuesCheckedAndUnchecked("2", "0") - ttOutliers.SetToolTip(ucrChkOutlier, "Values that are further than this number of IQRs from the corresponding quartile.") ttMultiple.Show("Not yet implemented.", rdoMultiple) End Sub @@ -212,10 +205,8 @@ Public Class dlgClimaticCheckDataTemperature clsGroupByFunc = New RFunction clsGroupingListFunc = New RFunction clsCalcFilterFunc = New RFunction - clsFilterFunc = New RFunction clsFilterListFunc = New RFunction clsRunCalcFunc = New RFunction - clsOrOperator = New ROperator ucrSelectorTemperature.Reset() @@ -229,21 +220,21 @@ Public Class dlgClimaticCheckDataTemperature clsGroupingListFunc.AddParameter("list", bIncludeArgumentName:=False, clsRFunctionParameter:=clsGroupByFunc, iPosition:=0) 'Range - clsQCAcceptableRangeElement1.SetDefaults("_tmax") - clsQCAcceptableRangeElement2.SetDefaults("_tmin") + clsQCAcceptableRangeElement1.SetDefaults("_e1") + clsQCAcceptableRangeElement2.SetDefaults("_e2") clsRangeOrOp.SetOperation("|") clsRange2OrOp.SetOperation("|") 'Same - clsSameCodeElement1.SetDefaults("_tmax") - clsSameCodeElement2.SetDefaults("_tmin") + clsSameCodeElement1.SetDefaults("_e1") + clsSameCodeElement2.SetDefaults("_e2") clsSameOp.SetOperation("|") 'Jump - clsJumpCodeElement1.SetDefaults("_tmax") - clsJumpCodeElement2.SetDefaults("_tmin") + clsJumpCodeElement1.SetDefaults("_e1") + clsJumpCodeElement2.SetDefaults("_e2") clsJumpOp.SetOperation("|") @@ -261,8 +252,8 @@ Public Class dlgClimaticCheckDataTemperature clsListForOutlierManipulations.AddParameter("sub1", clsRFunctionParameter:=clsGroupByMonth, bIncludeArgumentName:=False, iPosition:=0) 'Outliers - clsOutliersElement1.SetDefaults("_tmax") - clsOutliersElement2.SetDefaults("_tmin") + clsOutliersElement1.SetDefaults("_e1") + clsOutliersElement2.SetDefaults("_e2") clsOutlierCombinedOperator.SetOperation("|") clsOutlierCombinedOperator.bBrackets = False @@ -275,24 +266,16 @@ Public Class dlgClimaticCheckDataTemperature clsSameListSubCalc.SetOperation(",") clsDiffListSubCalc.SetOperation(",") - 'Main calculation filter clsCalcFilterFunc.SetRCommand("instat_calculation$new") - clsCalcFilterFunc.AddParameter("type", Chr(34) & "calculation" & Chr(34), iPosition:=0) - clsCalcFilterFunc.AddParameter("result_name", Chr(34) & "QC" & Chr(34)) + clsCalcFilterFunc.AddParameter("type", Chr(34) & "filter" & Chr(34), iPosition:=0) clsCalcFilterFunc.AddParameter("function_exp", clsROperatorParameter:=clsOrOperator, iPosition:=1) - clsCalcFilterFunc.AddParameter("sub_calculations", clsRFunctionParameter:=clsListSubCalc, iPosition:=3) + clsCalcFilterFunc.AddParameter("sub_calculations", clsRFunctionParameter:=clsFilterListFunc, iPosition:=2) + clsCalcFilterFunc.AddParameter("save", "2", iPosition:=3) + clsCalcFilterFunc.AddParameter("sub_calculations", clsRFunctionParameter:=clsListSubCalc, iPosition:=4) + clsCalcFilterFunc.AddParameter("result_data_frame", Chr(34) & "qcTemp" & Chr(34), iPosition:=5) clsCalcFilterFunc.SetAssignTo("filter_calculation") - 'Logical columns - clsFilterFunc.SetRCommand("instat_calculation$new") - clsFilterFunc.AddParameter("type", Chr(34) & "filter" & Chr(34), iPosition:=0) - clsFilterFunc.AddParameter("function_exp", strParameterValue:=Chr(34) & "QC" & Chr(34), iPosition:=1) - clsFilterFunc.AddParameter("sub_calculations", clsRFunctionParameter:=clsFilterListFunc, iPosition:=2) - clsFilterFunc.AddParameter("save", "2", iPosition:=3) - clsFilterFunc.AddParameter("result_data_frame", Chr(34) & "qcTemp" & Chr(34), iPosition:=4) - clsFilterFunc.SetAssignTo("filtered_data") - clsFilterListFunc.SetRCommand("list") clsFilterListFunc.AddParameter("sub", clsRFunctionParameter:=clsCalcFilterFunc, bIncludeArgumentName:=False) @@ -302,7 +285,7 @@ Public Class dlgClimaticCheckDataTemperature clsOrOperator.bToScriptAsRString = True clsRunCalcFunc.SetRCommand(frmMain.clsRLink.strInstatDataObject & "$run_instat_calculation") - clsRunCalcFunc.AddParameter("calc", clsRFunctionParameter:=clsFilterFunc, iPosition:=0) + clsRunCalcFunc.AddParameter("calc", clsRFunctionParameter:=clsCalcFilterFunc, iPosition:=0) clsRunCalcFunc.AddParameter("display", "FALSE") ucrBase.clsRsyntax.SetBaseRFunction(clsRunCalcFunc) End Sub @@ -336,22 +319,21 @@ Public Class dlgClimaticCheckDataTemperature ucrNudCoeff.AddAdditionalCodeParameterPair(clsOutliersElement1.clsOutlierUpperLimitFunc, New RParameter("coef"), iAdditionalPairNo:=3) ucrNudCoeff.AddAdditionalCodeParameterPair(clsOutliersElement2.clsOutlierUpperLimitFunc, New RParameter("coef"), iAdditionalPairNo:=3) - ucrChkIncludeLogicalColumns.AddAdditionalCodeParameterPair(clsJumpCodeElement1.clsJumpTestFunction, New RParameter("save"), iAdditionalPairNo:=1) - ucrChkIncludeLogicalColumns.AddAdditionalCodeParameterPair(clsJumpCodeElement2.clsJumpTestFunction, New RParameter("save"), iAdditionalPairNo:=2) + ucrChkIncludeLogicalColumns.AddAdditionalCodeParameterPair(clsJumpCodeElement2.clsJumpTestFunction, New RParameter("save"), iAdditionalPairNo:=1) - ucrChkIncludeLogicalColumns.AddAdditionalCodeParameterPair(clsSameCodeElement1.clsSameTestFunction, New RParameter("save"), iAdditionalPairNo:=3) - ucrChkIncludeLogicalColumns.AddAdditionalCodeParameterPair(clsSameCodeElement2.clsSameTestFunction, New RParameter("save"), iAdditionalPairNo:=4) + ucrChkIncludeLogicalColumns.AddAdditionalCodeParameterPair(clsSameCodeElement1.clsSameTestFunction, New RParameter("save"), iAdditionalPairNo:=2) + ucrChkIncludeLogicalColumns.AddAdditionalCodeParameterPair(clsSameCodeElement2.clsSameTestFunction, New RParameter("save"), iAdditionalPairNo:=3) - ucrChkIncludeLogicalColumns.AddAdditionalCodeParameterPair(clsQCDifferenceRCode.clsDiffTestFunction, New RParameter("save"), iAdditionalPairNo:=5) + ucrChkIncludeLogicalColumns.AddAdditionalCodeParameterPair(clsQCDifferenceRCode.clsDiffTestFunction, New RParameter("save"), iAdditionalPairNo:=4) - ucrChkIncludeLogicalColumns.AddAdditionalCodeParameterPair(clsQCAcceptableRangeElement1.clsAcceptableRangeTestFunc, New RParameter("save"), iAdditionalPairNo:=6) - ucrChkIncludeLogicalColumns.AddAdditionalCodeParameterPair(clsQCAcceptableRangeElement2.clsAcceptableRangeTestFunc, New RParameter("save"), iAdditionalPairNo:=7) + ucrChkIncludeLogicalColumns.AddAdditionalCodeParameterPair(clsQCAcceptableRangeElement1.clsAcceptableRangeTestFunc, New RParameter("save"), iAdditionalPairNo:=5) + ucrChkIncludeLogicalColumns.AddAdditionalCodeParameterPair(clsQCAcceptableRangeElement2.clsAcceptableRangeTestFunc, New RParameter("save"), iAdditionalPairNo:=6) - ucrChkIncludeLogicalColumns.AddAdditionalCodeParameterPair(clsOutliersElement1.clsOutlierUpperLimitTestCalc, New RParameter("save"), iAdditionalPairNo:=8) - ucrChkIncludeLogicalColumns.AddAdditionalCodeParameterPair(clsOutliersElement1.clsOutlierLowerLimitTestCalc, New RParameter("save"), iAdditionalPairNo:=9) + ucrChkIncludeLogicalColumns.AddAdditionalCodeParameterPair(clsOutliersElement1.clsOutlierUpperLimitTestCalc, New RParameter("save"), iAdditionalPairNo:=7) + ucrChkIncludeLogicalColumns.AddAdditionalCodeParameterPair(clsOutliersElement1.clsOutlierLowerLimitTestCalc, New RParameter("save"), iAdditionalPairNo:=8) - ucrChkIncludeLogicalColumns.AddAdditionalCodeParameterPair(clsOutliersElement2.clsOutlierUpperLimitTestCalc, New RParameter("save"), iAdditionalPairNo:=10) - ucrChkIncludeLogicalColumns.AddAdditionalCodeParameterPair(clsOutliersElement2.clsOutlierLowerLimitTestCalc, New RParameter("save"), iAdditionalPairNo:=11) + ucrChkIncludeLogicalColumns.AddAdditionalCodeParameterPair(clsOutliersElement2.clsOutlierUpperLimitTestCalc, New RParameter("save"), iAdditionalPairNo:=9) + ucrChkIncludeLogicalColumns.AddAdditionalCodeParameterPair(clsOutliersElement2.clsOutlierLowerLimitTestCalc, New RParameter("save"), iAdditionalPairNo:=10) ucrChkIncludeCalculatedColumns.AddAdditionalCodeParameterPair(clsJumpCodeElement2.clsJumpCalcFunction, New RParameter("save"), iAdditionalPairNo:=1) @@ -369,11 +351,11 @@ Public Class dlgClimaticCheckDataTemperature ucrNudJump.AddAdditionalCodeParameterPair(clsJumpCodeElement2.clsGreaterJumpOperator, (New RParameter("n", 1, bNewIncludeArgumentName:=False))) ucrNudSame.AddAdditionalCodeParameterPair(clsSameCodeElement2.clsSameGreaterOperator, (New RParameter("n", 1, bNewIncludeArgumentName:=False))) - ucrNudRangeElement2Max.SetRCode(clsQCAcceptableRangeElement2.clsGreaterEqualToOperator, bReset) - ucrNudRangeElement2Min.SetRCode(clsQCAcceptableRangeElement2.clsLessEqualToOperator, bReset) + ucrInputRangeElement2Max.SetRCode(clsQCAcceptableRangeElement2.clsGreaterEqualToOperator, bReset) + ucrInputRangeElement2Min.SetRCode(clsQCAcceptableRangeElement2.clsLessEqualToOperator, bReset) ucrReceiverElement1.SetRCode(clsQCAcceptableRangeElement1.clsLessEqualToOperator, bReset) - ucrNudRangeElement1Min.SetRCode(clsQCAcceptableRangeElement1.clsLessEqualToOperator, bReset) - ucrNudRangeElement1Max.SetRCode(clsQCAcceptableRangeElement1.clsGreaterEqualToOperator, bReset) + ucrInputRangeElement1Min.SetRCode(clsQCAcceptableRangeElement1.clsLessEqualToOperator, bReset) + ucrInputRangeElement1Max.SetRCode(clsQCAcceptableRangeElement1.clsGreaterEqualToOperator, bReset) ucrNudJump.SetRCode(clsJumpCodeElement1.clsGreaterJumpOperator, bReset) ucrReceiverElement2.SetRCode(clsQCDifferenceRCode.clsDiffOperator, bReset) ucrNudDifference.SetRCode(clsQCDifferenceRCode.clsLessDiffOperator, bReset) @@ -383,7 +365,7 @@ Public Class dlgClimaticCheckDataTemperature ucrChkRangeElement2.SetRCode(clsOrOperator, bReset) ucrChkSame.SetRCode(clsOrOperator, bReset) ucrChkJump.SetRCode(clsOrOperator, bReset) - ucrChkIncludeLogicalColumns.SetRCode(clsCalcFilterFunc, bReset) + ucrChkIncludeLogicalColumns.SetRCode(clsJumpCodeElement1.clsJumpTestFunction, bReset) ucrChkIncludeCalculatedColumns.SetRCode(clsJumpCodeElement1.clsJumpCalcFunction, bReset) ucrChkOutlier.SetRCode(clsOrOperator, bReset) ucrNudCoeff.SetRCode(clsOutliersElement1.clsOutlierUpperLimitFunc) @@ -408,7 +390,7 @@ Public Class dlgClimaticCheckDataTemperature End If If ucrChkRangeElement1.Checked Then - If ucrNudRangeElement1Min.GetText <> "" AndAlso ucrNudRangeElement1Max.GetText <> "" Then + If ucrInputRangeElement1Min.GetText <> "" AndAlso ucrInputRangeElement1Max.GetText <> "" Then bEnable = True Else ucrBase.OKEnabled(False) @@ -416,7 +398,7 @@ Public Class dlgClimaticCheckDataTemperature End If End If If ucrChkRangeElement2.Checked Then - If ucrNudRangeElement2Min.GetText <> "" AndAlso ucrNudRangeElement2Max.GetText <> "" Then + If ucrInputRangeElement2Min.GetText <> "" AndAlso ucrInputRangeElement2Max.GetText <> "" Then bEnable = True Else ucrBase.OKEnabled(False) @@ -456,7 +438,6 @@ Public Class dlgClimaticCheckDataTemperature Exit Sub End If End If - ucrBase.OKEnabled(bEnable) End Sub @@ -471,10 +452,8 @@ Public Class dlgClimaticCheckDataTemperature If Not ucrReceiverStation.IsEmpty Then clsGroupByFunc.AddParameter("calculated_from", "list(" & strCurrDataFrame & "=" & ucrReceiverStation.GetVariableNames & ")", iPosition:=1) clsCalcFilterFunc.AddParameter("manipulations", clsRFunctionParameter:=clsGroupingListFunc, iPosition:=2) - clsFilterFunc.AddParameter("manipulations", clsRFunctionParameter:=clsGroupingListFunc, iPosition:=3) Else clsCalcFilterFunc.RemoveParameterByName("manipulations") - clsFilterFunc.RemoveParameterByName("manipulations") End If End Sub @@ -583,7 +562,6 @@ Public Class dlgClimaticCheckDataTemperature If Not ucrReceiverElement1.IsEmpty AndAlso Not ucrReceiverElement2.IsEmpty Then clsCalcFilterFunc.AddParameter("calculated_from", "list(" & strCurrDataFrame & "=" & ucrReceiverElement1.GetVariableNames & "," & strCurrDataFrame & "=" & ucrReceiverElement2.GetVariableNames & ")", iPosition:=2) - clsFilterFunc.AddParameter("calculated_from", "list(" & strCurrDataFrame & "=" & ucrReceiverElement1.GetVariableNames & "," & strCurrDataFrame & "=" & ucrReceiverElement2.GetVariableNames & ")", iPosition:=2) clsQCDifferenceRCode.clsDiffCalcFunction.AddParameter("calculated_from", "list(" & strCurrDataFrame & "=" & ucrReceiverElement1.GetVariableNames & "," & strCurrDataFrame & "=" & ucrReceiverElement2.GetVariableNames & ")", iPosition:=2) clsDiffOp.AddParameter("diff", strParameterValue:=clsQCDifferenceRCode.strTestName, bIncludeArgumentName:=False) clsJumpCodeElement1.clsJumpCalcFunction.AddParameter("calculated_from", "list(" & strCurrDataFrame & "=" & ucrReceiverElement1.GetVariableNames & "," & strCurrDataFrame & "=" & ucrReceiverElement2.GetVariableNames & ")", iPosition:=2) @@ -594,7 +572,6 @@ Public Class dlgClimaticCheckDataTemperature clsQCAcceptableRangeElement2.clsAcceptableRangeTestFunc.AddParameter("calculated_from", "list(" & strCurrDataFrame & "=" & ucrReceiverElement1.GetVariableNames & "," & strCurrDataFrame & "=" & ucrReceiverElement2.GetVariableNames & ")", iPosition:=2) ElseIf Not ucrReceiverElement1.IsEmpty Then clsCalcFilterFunc.AddParameter("calculated_from", "list(" & strCurrDataFrame & "=" & ucrReceiverElement1.GetVariableNames & ")", iPosition:=2) - clsFilterFunc.AddParameter("calculated_from", "list(" & strCurrDataFrame & "=" & ucrReceiverElement1.GetVariableNames & ")", iPosition:=2) clsJumpCodeElement1.clsJumpCalcFunction.AddParameter("calculated_from", "list(" & strCurrDataFrame & "=" & ucrReceiverElement1.GetVariableNames & ")", iPosition:=2) clsJumpCodeElement2.clsJumpCalcFunction.AddParameter("calculated_from", "list(" & strCurrDataFrame & "=" & ucrReceiverElement1.GetVariableNames & ")", iPosition:=2) clsSameCodeElement1.clsSameCalcFunction.AddParameter("calculated_from", "list(" & strCurrDataFrame & "=" & ucrReceiverElement1.GetVariableNames & ")", iPosition:=2) @@ -605,7 +582,6 @@ Public Class dlgClimaticCheckDataTemperature clsOutliersElement1.clsOutlierLowerLimitCalc.AddParameter("calculated_from", "list(" & strCurrDataFrame & "=" & ucrReceiverElement1.GetVariableNames & ")", iPosition:=2) ElseIf Not ucrReceiverElement2.IsEmpty Then clsCalcFilterFunc.AddParameter("calculated_from", "list(" & strCurrDataFrame & "=" & ucrReceiverElement2.GetVariableNames & ")", iPosition:=2) - clsFilterFunc.AddParameter("calculated_from", "list(" & strCurrDataFrame & "=" & ucrReceiverElement2.GetVariableNames & ")", iPosition:=2) clsJumpCodeElement1.clsJumpCalcFunction.AddParameter("calculated_from", "list(" & strCurrDataFrame & "=" & ucrReceiverElement2.GetVariableNames & ")", iPosition:=2) clsJumpCodeElement2.clsJumpCalcFunction.AddParameter("calculated_from", "list(" & strCurrDataFrame & "=" & ucrReceiverElement2.GetVariableNames & ")", iPosition:=2) clsSameCodeElement1.clsSameCalcFunction.AddParameter("calculated_from", "list(" & strCurrDataFrame & "=" & ucrReceiverElement2.GetVariableNames & ")", iPosition:=2) @@ -647,7 +623,7 @@ Public Class dlgClimaticCheckDataTemperature EnableOrDisableDifferenceControls() End Sub - Private Sub CoreControls_ControlContentsChanged(ucrChangedControl As ucrCore) Handles ucrReceiverElement1.ControlContentsChanged, ucrReceiverElement2.ControlContentsChanged, ucrNudSame.ControlContentsChanged, ucrNudRangeElement1Min.ControlContentsChanged, ucrNudRangeElement1Max.ControlContentsChanged, ucrNudRangeElement2Min.ControlContentsChanged, ucrNudRangeElement2Max.ControlContentsChanged, ucrNudJump.ControlContentsChanged, ucrNudRangeElement2Min.ControlContentsChanged, ucrNudRangeElement2Max.ControlContentsChanged, ucrNudDifference.ControlContentsChanged, ucrChkRangeElement1.ControlContentsChanged, ucrChkRangeElement2.ControlContentsChanged, ucrChkJump.ControlContentsChanged, ucrChkDifference.ControlContentsChanged, ucrChkSame.ControlContentsChanged, ucrChkOutlier.ControlContentsChanged + Private Sub CoreControls_ControlContentsChanged(ucrChangedControl As ucrCore) Handles ucrReceiverElement1.ControlContentsChanged, ucrReceiverElement2.ControlContentsChanged, ucrNudSame.ControlContentsChanged, ucrNudJump.ControlContentsChanged, ucrInputRangeElement2Min.ControlContentsChanged, ucrInputRangeElement2Max.ControlContentsChanged, ucrNudDifference.ControlContentsChanged, ucrChkRangeElement1.ControlContentsChanged, ucrChkRangeElement2.ControlContentsChanged, ucrChkJump.ControlContentsChanged, ucrChkDifference.ControlContentsChanged, ucrChkSame.ControlContentsChanged, ucrChkOutlier.ControlContentsChanged TestOkEnabled() End Sub End Class diff --git a/instat/dlgClimaticDataEntry.Designer.vb b/instat/dlgClimaticDataEntry.Designer.vb index 4e9a21803d1..7e4fa2dc70b 100644 --- a/instat/dlgClimaticDataEntry.Designer.vb +++ b/instat/dlgClimaticDataEntry.Designer.vb @@ -37,6 +37,11 @@ Partial Class dlgClimaticDataEntry Me.cmdCheckData = New System.Windows.Forms.Button() Me.ttCmdCheckData = New System.Windows.Forms.ToolTip(Me.components) Me.ttucrChkDefaultValue = New System.Windows.Forms.ToolTip(Me.components) + Me.lblNbRowsChanged = New System.Windows.Forms.Label() + Me.cmdOptions = New System.Windows.Forms.Button() + Me.lblNbRowsChanged1 = New System.Windows.Forms.Label() + Me.lblNbCommentEntered = New System.Windows.Forms.Label() + Me.ucrInputSelectStation = New instat.ucrInputFactorLevels() Me.ucrEndDate = New instat.ucrDateTimePicker() Me.ucrStartDate = New instat.ucrDateTimePicker() Me.ucrInputType = New instat.ucrInputComboBox() @@ -47,11 +52,6 @@ Partial Class dlgClimaticDataEntry Me.ucrReceiverElements = New instat.ucrReceiverMultiple() Me.ucrBase = New instat.ucrButtons() Me.ucrPnlOptions = New instat.UcrPanel() - Me.lblNbRowsChanged = New System.Windows.Forms.Label() - Me.cmdOptions = New System.Windows.Forms.Button() - Me.lblNbRowsChanged1 = New System.Windows.Forms.Label() - Me.ucrInputSelectStation = New instat.ucrInputFactorLevels() - Me.lblNbCommentEntered = New System.Windows.Forms.Label() Me.SuspendLayout() ' 'rdoAdd @@ -205,6 +205,54 @@ Partial Class dlgClimaticDataEntry Me.ttucrChkDefaultValue.InitialDelay = 500 Me.ttucrChkDefaultValue.ReshowDelay = 100 ' + 'lblNbRowsChanged + ' + Me.lblNbRowsChanged.AutoSize = True + Me.lblNbRowsChanged.Location = New System.Drawing.Point(253, -57) + Me.lblNbRowsChanged.Name = "lblNbRowsChanged" + Me.lblNbRowsChanged.Size = New System.Drawing.Size(39, 13) + Me.lblNbRowsChanged.TabIndex = 88 + Me.lblNbRowsChanged.Text = "Label3" + ' + 'cmdOptions + ' + Me.cmdOptions.ImeMode = System.Windows.Forms.ImeMode.NoControl + Me.cmdOptions.Location = New System.Drawing.Point(7, 337) + Me.cmdOptions.Name = "cmdOptions" + Me.cmdOptions.Size = New System.Drawing.Size(106, 24) + Me.cmdOptions.TabIndex = 89 + Me.cmdOptions.Text = "Options" + Me.cmdOptions.UseVisualStyleBackColor = True + ' + 'lblNbRowsChanged1 + ' + Me.lblNbRowsChanged1.AutoSize = True + Me.lblNbRowsChanged1.Location = New System.Drawing.Point(7, 405) + Me.lblNbRowsChanged1.Name = "lblNbRowsChanged1" + Me.lblNbRowsChanged1.Size = New System.Drawing.Size(39, 13) + Me.lblNbRowsChanged1.TabIndex = 90 + Me.lblNbRowsChanged1.Text = "Label3" + ' + 'lblNbCommentEntered + ' + Me.lblNbCommentEntered.AutoSize = True + Me.lblNbCommentEntered.Location = New System.Drawing.Point(7, 429) + Me.lblNbCommentEntered.Name = "lblNbCommentEntered" + Me.lblNbCommentEntered.Size = New System.Drawing.Size(39, 13) + Me.lblNbCommentEntered.TabIndex = 92 + Me.lblNbCommentEntered.Text = "Label4" + ' + 'ucrInputSelectStation + ' + Me.ucrInputSelectStation.AddQuotesIfUnrecognised = True + Me.ucrInputSelectStation.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink + Me.ucrInputSelectStation.GetSetSelectedIndex = -1 + Me.ucrInputSelectStation.IsReadOnly = False + Me.ucrInputSelectStation.Location = New System.Drawing.Point(273, 127) + Me.ucrInputSelectStation.Name = "ucrInputSelectStation" + Me.ucrInputSelectStation.Size = New System.Drawing.Size(120, 23) + Me.ucrInputSelectStation.TabIndex = 91 + ' 'ucrEndDate ' Me.ucrEndDate.AutoSize = True @@ -321,55 +369,6 @@ Partial Class dlgClimaticDataEntry Me.ucrPnlOptions.Size = New System.Drawing.Size(278, 35) Me.ucrPnlOptions.TabIndex = 26 ' - 'lblNbRowsChanged - ' - Me.lblNbRowsChanged.AutoSize = True - Me.lblNbRowsChanged.Location = New System.Drawing.Point(253, -57) - Me.lblNbRowsChanged.Name = "lblNbRowsChanged" - Me.lblNbRowsChanged.Size = New System.Drawing.Size(39, 13) - Me.lblNbRowsChanged.TabIndex = 88 - Me.lblNbRowsChanged.Text = "Label3" - ' - 'cmdOptions - ' - Me.cmdOptions.ImeMode = System.Windows.Forms.ImeMode.NoControl - Me.cmdOptions.Location = New System.Drawing.Point(7, 337) - Me.cmdOptions.Name = "cmdOptions" - Me.cmdOptions.Size = New System.Drawing.Size(106, 24) - Me.cmdOptions.TabIndex = 89 - Me.cmdOptions.Text = "Options" - Me.cmdOptions.UseVisualStyleBackColor = True - ' - 'lblNbRowsChanged1 - ' - Me.lblNbRowsChanged1.AutoSize = True - Me.lblNbRowsChanged1.Location = New System.Drawing.Point(7, 405) - Me.lblNbRowsChanged1.Name = "lblNbRowsChanged1" - Me.lblNbRowsChanged1.Size = New System.Drawing.Size(39, 13) - Me.lblNbRowsChanged1.TabIndex = 90 - Me.lblNbRowsChanged1.Text = "Label3" - ' - 'ucrInputSelectStation - ' - Me.ucrInputSelectStation.AddQuotesIfUnrecognised = True - Me.ucrInputSelectStation.AutoSize = True - Me.ucrInputSelectStation.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink - Me.ucrInputSelectStation.GetSetSelectedIndex = -1 - Me.ucrInputSelectStation.IsReadOnly = False - Me.ucrInputSelectStation.Location = New System.Drawing.Point(273, 127) - Me.ucrInputSelectStation.Name = "ucrInputSelectStation" - Me.ucrInputSelectStation.Size = New System.Drawing.Size(0, 0) - Me.ucrInputSelectStation.TabIndex = 91 - ' - 'lblNbCommentEntered - ' - Me.lblNbCommentEntered.AutoSize = True - Me.lblNbCommentEntered.Location = New System.Drawing.Point(7, 429) - Me.lblNbCommentEntered.Name = "lblNbCommentEntered" - Me.lblNbCommentEntered.Size = New System.Drawing.Size(39, 13) - Me.lblNbCommentEntered.TabIndex = 92 - Me.lblNbCommentEntered.Text = "Label4" - ' 'dlgClimaticDataEntry ' Me.AutoScaleDimensions = New System.Drawing.SizeF(96.0!, 96.0!) @@ -406,7 +405,7 @@ Partial Class dlgClimaticDataEntry Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow Me.Name = "dlgClimaticDataEntry" Me.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent - Me.Text = "Daily Data Entry" + Me.Text = "Daily Data Editing/Entry" Me.ResumeLayout(False) Me.PerformLayout() diff --git a/instat/dlgClimaticDataEntry.vb b/instat/dlgClimaticDataEntry.vb index c8516a0e376..7be9fe670dd 100644 --- a/instat/dlgClimaticDataEntry.vb +++ b/instat/dlgClimaticDataEntry.vb @@ -31,7 +31,7 @@ Public Class dlgClimaticDataEntry Private ReadOnly strMonth As String = "Month" Private ReadOnly strRange As String = "Range" Private bChange As Boolean = False - Private bSubdialogFirstLoad As Boolean = True + Private bSubdialogFirstLoad As Boolean Private bState As Boolean = False Private bResetSubdialogs As Boolean @@ -321,7 +321,7 @@ Public Class dlgClimaticDataEntry Private Sub ucrBase_ClickOk(sender As Object, e As EventArgs) Handles ucrBase.ClickOk bChange = True - bSubdialogFirstLoad = True + bSubdialogFirstLoad = Not lblNbRowsChanged1.Visible clsListFunction.ClearParameters() sdgCommentForDataEntry.GetSetNumberOfCommentsEntered = 0 SetNumberRowsChangedText(0) @@ -353,4 +353,8 @@ Public Class dlgClimaticDataEntry SetDateOptions() bChange = True End Sub + + Private Sub ucrBase_ClickClose(sender As Object, e As EventArgs) Handles ucrBase.ClickClose, Me.Closed + bSubdialogFirstLoad = Not lblNbRowsChanged1.Visible + End Sub End Class \ No newline at end of file diff --git a/instat/dlgClimaticStationMaps.vb b/instat/dlgClimaticStationMaps.vb index a3bc51e92ae..55676169864 100644 --- a/instat/dlgClimaticStationMaps.vb +++ b/instat/dlgClimaticStationMaps.vb @@ -20,7 +20,7 @@ Imports RDotNet Public Class dlgClimaticStationMaps Private bFirstLoad As Boolean = True Private bReset As Boolean = True - Private clsGgplotFunction, clsGeomSfFunction, clsGeomPointFunction, clsSfAesFunction, clsGeomPointAesFunction, clsScaleShapeFunction, clsLabelRepelFunction As RFunction + Private clsGgplotFunction, clsGeomSfFunction, clsGeomPointFunction, clsSfAesFunction, clsGeomPointAesFunction, clsScaleShapeFunction, clsLabelRepelFunction As New RFunction Private clsGGplotOperator, clsFacetOp As New ROperator Private clsLabsFunction As New RFunction @@ -36,14 +36,14 @@ Public Class dlgClimaticStationMaps Private bResetSubdialog As Boolean = True Private bResetSFLayerSubdialog As Boolean = True Private clsLabelRepelAesFunction As New RFunction - Private clsCoordPolarFunction As RFunction - Private clsCoordPolarStartOperator As ROperator + 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 clsAnnotateFunction As New RFunction - Private clsGetDataFrame As RFunction + Private clsGetDataFrame As New RFunction Private clsRemoveFunc As New RFunction Private clsParamOperator As New ROperator @@ -224,7 +224,8 @@ Public Class dlgClimaticStationMaps clsScaleColourViridisFunction = GgplotDefaults.clsScaleColorViridisFunction clsAnnotateFunction = GgplotDefaults.clsAnnotateFunction - clsRFacetFunction.AddParameter("facet", clsROperatorParameter:=clsFacetOp, bIncludeArgumentName:=False) + clsRFacetFunction.RemoveParameterByName("facets") + clsRFacetFunction.AddParameter("facets", clsROperatorParameter:=clsFacetOp) clsXlimFunction.SetRCommand("xlim") clsYlimFunction.SetRCommand("ylim") diff --git a/instat/dlgClimsoftWizard.vb b/instat/dlgClimsoftWizard.vb index 47c0677caec..8db3fb77dbd 100644 --- a/instat/dlgClimsoftWizard.vb +++ b/instat/dlgClimsoftWizard.vb @@ -21,7 +21,7 @@ Public Class dlgClimsoftWizard 'used as the R command by the 2 wizard steps. import stations and import elements data 'this is also be used as the base function - Private clsRImportFromClimsoft As RFunction + Private clsRImportFromClimsoft As New RFunction 'holds all the wizard steps objects, used in going from step to step Private lstWizardSteps As New List(Of IWizStep) diff --git a/instat/dlgColourbyProperty.Designer.vb b/instat/dlgColourbyProperty.Designer.vb index f3331584896..be061243ae1 100644 --- a/instat/dlgColourbyProperty.Designer.vb +++ b/instat/dlgColourbyProperty.Designer.vb @@ -49,7 +49,7 @@ Partial Class dlgColourbyProperty ' Me.lblMetadataProp.AutoSize = True Me.lblMetadataProp.ImeMode = System.Windows.Forms.ImeMode.NoControl - Me.lblMetadataProp.Location = New System.Drawing.Point(263, 45) + Me.lblMetadataProp.Location = New System.Drawing.Point(263, 36) Me.lblMetadataProp.Name = "lblMetadataProp" Me.lblMetadataProp.Size = New System.Drawing.Size(97, 13) Me.lblMetadataProp.TabIndex = 3 @@ -59,7 +59,7 @@ Partial Class dlgColourbyProperty ' Me.ucrChkRemoveColours.AutoSize = True Me.ucrChkRemoveColours.Checked = False - Me.ucrChkRemoveColours.Location = New System.Drawing.Point(263, 84) + Me.ucrChkRemoveColours.Location = New System.Drawing.Point(263, 82) Me.ucrChkRemoveColours.Name = "ucrChkRemoveColours" Me.ucrChkRemoveColours.Size = New System.Drawing.Size(147, 23) Me.ucrChkRemoveColours.TabIndex = 4 @@ -68,7 +68,7 @@ Partial Class dlgColourbyProperty ' Me.ucrReceiverMetadataProperty.AutoSize = True Me.ucrReceiverMetadataProperty.frmParent = Me - Me.ucrReceiverMetadataProperty.Location = New System.Drawing.Point(263, 60) + Me.ucrReceiverMetadataProperty.Location = New System.Drawing.Point(263, 51) Me.ucrReceiverMetadataProperty.Margin = New System.Windows.Forms.Padding(0) Me.ucrReceiverMetadataProperty.Name = "ucrReceiverMetadataProperty" Me.ucrReceiverMetadataProperty.Selector = Nothing diff --git a/instat/dlgColourbyProperty.vb b/instat/dlgColourbyProperty.vb index 73ecaf870fb..ccf731c407a 100644 --- a/instat/dlgColourbyProperty.vb +++ b/instat/dlgColourbyProperty.vb @@ -15,11 +15,13 @@ ' along with this program. If not, see . Imports instat.Translations +Imports RDotNet Public Class dlgColourbyProperty Public bFirstLoad As Boolean = True Private clsColourByMetadata As New RFunction Private clsRemoveColour As New RFunction Private bReset As Boolean = True + Private bApplyColumnColours As Boolean Private Sub dlgColourbyProperty_Load(sender As Object, e As EventArgs) Handles MyBase.Load If bFirstLoad Then @@ -32,6 +34,8 @@ Public Class dlgColourbyProperty SetRCodeForControls(bReset) bReset = False TestOKEnabled() + AutoFill() + SetBaseFunction() autoTranslate(Me) End Sub @@ -61,7 +65,6 @@ Public Class dlgColourbyProperty clsColourByMetadata.SetRCommand(frmMain.clsRLink.strInstatDataObject & "$set_column_colours_by_metadata") clsRemoveColour.SetRCommand(frmMain.clsRLink.strInstatDataObject & "$remove_column_colours") - ucrBase.clsRsyntax.SetBaseRFunction(clsColourByMetadata) End Sub @@ -73,7 +76,7 @@ Public Class dlgColourbyProperty End Sub Private Sub TestOKEnabled() - If Not ucrReceiverMetadataProperty.IsEmpty Then + If Not ucrReceiverMetadataProperty.IsEmpty OrElse ucrChkRemoveColours.Checked Then ucrBase.OKEnabled(True) Else ucrBase.OKEnabled(False) @@ -86,14 +89,41 @@ Public Class dlgColourbyProperty TestOKEnabled() End Sub - Private Sub ucrChkRemoveColours_ControlValueChanged(ucrChangedControl As ucrCore) Handles ucrChkRemoveColours.ControlValueChanged - If ucrChkRemoveColours.Checked Then + + Private Sub AutoFill() + If ucrSelectorColourByMetadata.lstAvailableVariable.Items.Count > 0 Then + Dim clsHasColoursFunc As New RFunction + clsHasColoursFunc.SetRCommand(frmMain.clsRLink.strInstatDataObject & "$has_colours") + clsHasColoursFunc.AddParameter("data_name", Chr(34) & ucrSelectorColourByMetadata.ucrAvailableDataFrames.strCurrDataFrame & Chr(34)) + bApplyColumnColours = frmMain.clsRLink.RunInternalScriptGetValue(clsHasColoursFunc.ToScript()).AsLogical(0) + If Not bApplyColumnColours Then + For Each lviItem As ListViewItem In ucrSelectorColourByMetadata.lstAvailableVariable.Items + If lviItem.Text = "class" Then + ucrReceiverMetadataProperty.Add(lviItem.Text, ucrSelectorColourByMetadata.ucrAvailableDataFrames.strCurrDataFrame) + Exit For + End If + Next + End If + ucrChkRemoveColours.Visible = bApplyColumnColours + End If + End Sub + + Private Sub SetBaseFunction() + If ucrChkRemoveColours.Checked AndAlso bApplyColumnColours Then ucrBase.clsRsyntax.SetBaseRFunction(clsRemoveColour) Else ucrBase.clsRsyntax.SetBaseRFunction(clsColourByMetadata) End If End Sub + Private Sub ucrChkRemoveColours_ControlValueChanged(ucrChangedControl As ucrCore) Handles ucrChkRemoveColours.ControlValueChanged + SetBaseFunction() + End Sub + + Private Sub ucrSelectorColourByMetadata_ControlValueChanged(ucrChangedControl As ucrCore) Handles ucrSelectorColourByMetadata.ControlValueChanged + AutoFill() + End Sub + Private Sub Controls_ControContententsChanged(ucrChangedControl As ucrCore) Handles ucrSelectorColourByMetadata.ControlContentsChanged, ucrReceiverMetadataProperty.ControlContentsChanged, ucrChkRemoveColours.ControlContentsChanged TestOKEnabled() End Sub diff --git a/instat/dlgCompareTreatmentLines.Designer.vb b/instat/dlgCompareTreatmentLines.Designer.vb index 8d66b3d98e1..253b226f677 100644 --- a/instat/dlgCompareTreatmentLines.Designer.vb +++ b/instat/dlgCompareTreatmentLines.Designer.vb @@ -393,25 +393,23 @@ Partial Class dlgCompareTreatmentLines 'ucrInputFactorOption2 ' Me.ucrInputFactorOption2.AddQuotesIfUnrecognised = True - Me.ucrInputFactorOption2.AutoSize = True Me.ucrInputFactorOption2.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink Me.ucrInputFactorOption2.GetSetSelectedIndex = -1 Me.ucrInputFactorOption2.IsReadOnly = False - Me.ucrInputFactorOption2.Location = New System.Drawing.Point(267, 219) + Me.ucrInputFactorOption2.Location = New System.Drawing.Point(267, 220) Me.ucrInputFactorOption2.Name = "ucrInputFactorOption2" - Me.ucrInputFactorOption2.Size = New System.Drawing.Size(0, 0) + Me.ucrInputFactorOption2.Size = New System.Drawing.Size(124, 23) Me.ucrInputFactorOption2.TabIndex = 11 ' 'ucrInputFactorOption1 ' Me.ucrInputFactorOption1.AddQuotesIfUnrecognised = True - Me.ucrInputFactorOption1.AutoSize = True Me.ucrInputFactorOption1.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink Me.ucrInputFactorOption1.GetSetSelectedIndex = -1 Me.ucrInputFactorOption1.IsReadOnly = False - Me.ucrInputFactorOption1.Location = New System.Drawing.Point(267, 177) + Me.ucrInputFactorOption1.Location = New System.Drawing.Point(267, 178) Me.ucrInputFactorOption1.Name = "ucrInputFactorOption1" - Me.ucrInputFactorOption1.Size = New System.Drawing.Size(0, 0) + Me.ucrInputFactorOption1.Size = New System.Drawing.Size(124, 22) Me.ucrInputFactorOption1.TabIndex = 9 ' 'ucrReceiverID diff --git a/instat/dlgContrasts.Designer.vb b/instat/dlgContrasts.Designer.vb index 937e1100da1..b984e453007 100644 --- a/instat/dlgContrasts.Designer.vb +++ b/instat/dlgContrasts.Designer.vb @@ -19,7 +19,7 @@ Partial Class dlgContrasts 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 dlgContrasts '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.lblFactorReceiver = New System.Windows.Forms.Label() Me.lblSelectContrastName = New System.Windows.Forms.Label() @@ -71,9 +71,9 @@ Partial Class dlgContrasts Me.lblDefineContrast.AutoSize = True Me.lblDefineContrast.Location = New System.Drawing.Point(445, 20) Me.lblDefineContrast.Name = "lblDefineContrast" - Me.lblDefineContrast.Size = New System.Drawing.Size(92, 13) + Me.lblDefineContrast.Size = New System.Drawing.Size(88, 13) Me.lblDefineContrast.TabIndex = 5 - Me.lblDefineContrast.Text = "Define a Contrast:" + Me.lblDefineContrast.Text = "Define Contrasts:" ' 'grdLayoutForContrasts ' @@ -91,6 +91,7 @@ Partial Class dlgContrasts Me.grdLayoutForContrasts.ShowScrollEndSpacing = True Me.grdLayoutForContrasts.Size = New System.Drawing.Size(333, 207) Me.grdLayoutForContrasts.TabIndex = 6 + Me.grdLayoutForContrasts.Text = "Define Contrasts:" ' 'ucrInputContrastName ' diff --git a/instat/dlgContrasts.vb b/instat/dlgContrasts.vb index c4c5f9fa345..2193c9f0b4e 100644 --- a/instat/dlgContrasts.vb +++ b/instat/dlgContrasts.vb @@ -33,10 +33,10 @@ Public Class dlgContrasts ' Add any initialization after the InitializeComponent() call. grdLayoutForContrasts.SetSettings(WorkbookSettings.View_ShowSheetTabControl, False) - grdLayoutForContrasts.SetSettings(WorkbookSettings.View_ShowHorScroll, False) grdLayoutForContrasts.SheetTabNewButtonVisible = False grdCurrSheet = grdLayoutForContrasts.CurrentWorksheet grdCurrSheet.SetSettings(WorksheetSettings.Edit_DragSelectionToMoveCells, False) + grdCurrSheet.SetSettings(WorksheetSettings.Edit_DragSelectionToFillSerial, False) grdCurrSheet.SelectionForwardDirection = SelectionForwardDirection.Down iFullWidth = Me.Width End Sub @@ -55,19 +55,6 @@ Public Class dlgContrasts TestOKEnabled() End Sub - Private Sub SetRCodeforControls(bReset As Boolean) - ucrSelectorForContrast.SetRCode(clsSetContrast, bReset) - ucrReceiverForContrasts.SetRCode(clsSetContrast, bReset) - ucrInputContrastName.SetRCode(clsSetContrast, bReset) - End Sub - - Private Sub TestOKEnabled() - If ucrReceiverForContrasts.IsEmpty OrElse (ucrInputContrastName.GetText = "User Defined" AndAlso IsEmptyCells()) Then - ucrBase.OKEnabled(False) - Else - ucrBase.OKEnabled(True) - End If - End Sub Private Sub InitialiseDialog() ucrReceiverForContrasts.Selector = ucrSelectorForContrast @@ -75,6 +62,7 @@ Public Class dlgContrasts ucrReceiverForContrasts.SetIncludedDataTypes({"factor"}, bStrict:=True) ucrReceiverForContrasts.strSelectorHeading = "Factors" ucrBase.iHelpTopicID = 353 + ucrBase.clsRsyntax.iCallType = 2 Dim dctContrastTypes As New Dictionary(Of String, String) ucrInputContrastName.SetParameter(New RParameter("new_contrasts", 2)) @@ -91,7 +79,6 @@ Public Class dlgContrasts ucrReceiverForContrasts.SetParameter(New RParameter("col_name", 1)) ucrReceiverForContrasts.SetParameterIsString() - End Sub Private Sub SetDefaults() @@ -115,6 +102,18 @@ Public Class dlgContrasts ucrBase.clsRsyntax.SetBaseRFunction(clsSetContrast) End Sub + Private Sub SetRCodeforControls(bReset As Boolean) + SetRCode(Me, ucrBase.clsRsyntax.clsBaseFunction, bReset) + End Sub + + Private Sub TestOKEnabled() + If ucrReceiverForContrasts.IsEmpty OrElse (ucrInputContrastName.GetText = "User Defined" AndAlso IsEmptyCells()) Then + ucrBase.OKEnabled(False) + Else + ucrBase.OKEnabled(True) + End If + End Sub + Private Sub ucrBase_ClickReset(sender As Object, e As EventArgs) Handles ucrBase.ClickReset SetDefaults() SetRCodeforControls(True) @@ -151,6 +150,8 @@ Public Class dlgContrasts Private Sub SetGridDimensions() If Not ucrReceiverForContrasts.IsEmpty AndAlso ucrInputContrastName.GetText = "User Defined" Then + lblDefineContrast.Visible = True + grdLayoutForContrasts.Visible = True Me.Size = New Size(iFullWidth, Me.Height) clsFactorColumn.AddParameter("col_name", ucrReceiverForContrasts.GetVariableNames()) clsFactorColumn.AddParameter("data_name", Chr(34) & ucrSelectorForContrast.ucrAvailableDataFrames.cboAvailableDataFrames.SelectedItem & Chr(34)) @@ -160,11 +161,13 @@ Public Class dlgContrasts grdCurrSheet.Columns = grdCurrSheet.Rows - 1 grdLayoutForContrasts.Enabled = True End If + GetContrast() Else Me.Size = New Size(iFullWidth / 1.86, Me.Height) clsFactorColumn.RemoveParameterByName("col_name") clsNlevels.RemoveParameterByName("x") - grdLayoutForContrasts.Enabled = False + grdLayoutForContrasts.Visible = False + lblDefineContrast.Visible = False End If SetMatrixFunction() End Sub @@ -194,9 +197,32 @@ Public Class dlgContrasts Return False End Function - Private Sub grdLayoutForContrasts_AfterCellKeyDown(sender As Object, e As EventArgs) Handles grdCurrSheet.AfterCellKeyDown - SetMatrixFunction() - TestOKEnabled() + Private Sub grdLayoutForContrasts_AfterCellKeyDown(sender As Object, e As AfterCellKeyDownEventArgs) Handles grdCurrSheet.AfterCellKeyDown + If e.KeyCode = Keys.Control + Keys.C Then + SetMatrixFunction() + TestOKEnabled() + End If + End Sub + + Private Sub GetContrast() + Dim clsGetColumnFunction As RFunction = ucrReceiverForContrasts.GetVariables() + clsGetColumnFunction.RemoveAssignTo() + Dim clsGetContrastFunction As New RFunction + Dim expContrasts As SymbolicExpression + Dim vecColums As NumericMatrix + Dim strTopItemText As String = "" + + clsGetContrastFunction.SetRCommand("contrasts") + clsGetContrastFunction.AddParameter("x", clsRFunctionParameter:=clsGetColumnFunction, iPosition:=0) + expContrasts = frmMain.clsRLink.RunInternalScriptGetValue(clsGetContrastFunction.ToScript(), bSilent:=True) + If expContrasts IsNot Nothing AndAlso Not expContrasts.Type = Internals.SymbolicExpressionType.Null Then + vecColums = expContrasts.AsNumericMatrix() + For j = 0 To vecColums.ColumnCount - 1 + For i = 0 To vecColums.RowCount - 1 + grdCurrSheet.Item(row:=i, col:=j) = vecColums(i, j).ToString("0.###") + Next + Next + End If End Sub Private Sub grdLayoutForContrasts_Leave(sender As Object, e As EventArgs) Handles grdLayoutForContrasts.Leave @@ -211,11 +237,6 @@ Public Class dlgContrasts End Sub Private Sub ucrReceiverForContrasts_ControlContentsChanged(ucrChangedControl As ucrCore) Handles ucrReceiverForContrasts.ControlContentsChanged - If Not ucrReceiverForContrasts.IsEmpty Then - grdLayoutForContrasts.Enabled = True - Else - grdLayoutForContrasts.Enabled = False - End If SetGridDimensions() TestOKEnabled() End Sub diff --git a/instat/dlgConversions.Designer.vb b/instat/dlgConversions.Designer.vb index da41686d7ed..8bf3a1d9f87 100644 --- a/instat/dlgConversions.Designer.vb +++ b/instat/dlgConversions.Designer.vb @@ -51,23 +51,28 @@ Partial Class dlgConversions Me.lblMinutes = New System.Windows.Forms.Label() Me.lblSeconds = New System.Windows.Forms.Label() Me.lblDegrees = New System.Windows.Forms.Label() - Me.ucrReceiverLetters = New instat.ucrReceiverSingle() + Me.lblDirection = New System.Windows.Forms.Label() + Me.ucrSaveColumn = New instat.ucrSave() + Me.ucrInputDirection = New instat.ucrInputComboBox() Me.ucrChkVariable = New instat.ucrCheck() Me.ucrInputSecond = New instat.ucrInputTextBox() - Me.ucrInputMinute = New instat.ucrInputTextBox() Me.ucrInputDegree = New instat.ucrInputTextBox() + Me.ucrReceiverLetters = New instat.ucrReceiverSingle() Me.ucrSaveConversions = New instat.ucrSave() Me.ucrReceiverDegrees = New instat.ucrReceiverSingle() - Me.ucrReceiverMinutes = New instat.ucrReceiverSingle() Me.ucrReceiverSeconds = New instat.ucrReceiverSingle() Me.ucrReceiverDate = New instat.ucrReceiverSingle() Me.ucrReceiverElement = New instat.ucrReceiverSingle() Me.ucrPnlConversions = New instat.UcrPanel() Me.ucrSelectorConversions = New instat.ucrSelectorByDataFrameAddRemove() Me.ucrBase = New instat.ucrButtons() - Me.ucrInputDirection = New instat.ucrInputComboBox() - Me.lblDirection = New System.Windows.Forms.Label() - Me.ucrSaveColumn = New instat.ucrSave() + Me.ucrInputMinute = New instat.ucrInputTextBox() + Me.ucrReceiverMinutes = New instat.ucrReceiverSingle() + Me.rdoYear = New System.Windows.Forms.RadioButton() + Me.ucrReceiverYear = New instat.ucrReceiverSingle() + Me.lblYear = New System.Windows.Forms.Label() + Me.ucrNudBaseYear = New instat.ucrNud() + Me.lblBaseYear = New System.Windows.Forms.Label() Me.grpLatitude.SuspendLayout() Me.grpElements.SuspendLayout() Me.SuspendLayout() @@ -83,9 +88,9 @@ Partial Class dlgConversions Me.rdoDayLength.FlatStyle = System.Windows.Forms.FlatStyle.Flat Me.rdoDayLength.ForeColor = System.Drawing.SystemColors.ActiveCaptionText Me.rdoDayLength.ImeMode = System.Windows.Forms.ImeMode.NoControl - Me.rdoDayLength.Location = New System.Drawing.Point(166, 21) + Me.rdoDayLength.Location = New System.Drawing.Point(127, 21) Me.rdoDayLength.Name = "rdoDayLength" - Me.rdoDayLength.Size = New System.Drawing.Size(99, 28) + Me.rdoDayLength.Size = New System.Drawing.Size(90, 28) Me.rdoDayLength.TabIndex = 2 Me.rdoDayLength.Text = "Day Length" Me.rdoDayLength.TextAlign = System.Drawing.ContentAlignment.MiddleCenter @@ -101,9 +106,9 @@ Partial Class dlgConversions Me.rdoUnits.FlatStyle = System.Windows.Forms.FlatStyle.Flat Me.rdoUnits.ForeColor = System.Drawing.SystemColors.ControlText Me.rdoUnits.ImeMode = System.Windows.Forms.ImeMode.NoControl - Me.rdoUnits.Location = New System.Drawing.Point(67, 21) + Me.rdoUnits.Location = New System.Drawing.Point(39, 21) Me.rdoUnits.Name = "rdoUnits" - Me.rdoUnits.Size = New System.Drawing.Size(99, 28) + Me.rdoUnits.Size = New System.Drawing.Size(90, 28) Me.rdoUnits.TabIndex = 1 Me.rdoUnits.Text = "Units" Me.rdoUnits.TextAlign = System.Drawing.ContentAlignment.MiddleCenter @@ -410,9 +415,9 @@ Partial Class dlgConversions Me.rdoCoordinates.FlatStyle = System.Windows.Forms.FlatStyle.Flat Me.rdoCoordinates.ForeColor = System.Drawing.SystemColors.ActiveCaptionText Me.rdoCoordinates.ImeMode = System.Windows.Forms.ImeMode.NoControl - Me.rdoCoordinates.Location = New System.Drawing.Point(264, 21) + Me.rdoCoordinates.Location = New System.Drawing.Point(215, 21) Me.rdoCoordinates.Name = "rdoCoordinates" - Me.rdoCoordinates.Size = New System.Drawing.Size(99, 28) + Me.rdoCoordinates.Size = New System.Drawing.Size(90, 28) Me.rdoCoordinates.TabIndex = 3 Me.rdoCoordinates.Text = "Coordinates" Me.rdoCoordinates.TextAlign = System.Drawing.ContentAlignment.MiddleCenter @@ -448,18 +453,35 @@ Partial Class dlgConversions Me.lblDegrees.TabIndex = 7 Me.lblDegrees.Text = "Degrees:" ' - 'ucrReceiverLetters + 'lblDirection ' - Me.ucrReceiverLetters.AutoSize = True - Me.ucrReceiverLetters.frmParent = Me - Me.ucrReceiverLetters.Location = New System.Drawing.Point(353, 239) - Me.ucrReceiverLetters.Margin = New System.Windows.Forms.Padding(0) - Me.ucrReceiverLetters.Name = "ucrReceiverLetters" - Me.ucrReceiverLetters.Selector = Nothing - Me.ucrReceiverLetters.Size = New System.Drawing.Size(81, 21) - Me.ucrReceiverLetters.strNcFilePath = "" - Me.ucrReceiverLetters.TabIndex = 6 - Me.ucrReceiverLetters.ucrSelector = Nothing + Me.lblDirection.AutoSize = True + Me.lblDirection.ImeMode = System.Windows.Forms.ImeMode.NoControl + Me.lblDirection.Location = New System.Drawing.Point(265, 223) + Me.lblDirection.Name = "lblDirection" + Me.lblDirection.Size = New System.Drawing.Size(52, 13) + Me.lblDirection.TabIndex = 24 + Me.lblDirection.Text = "Direction:" + ' + 'ucrSaveColumn + ' + Me.ucrSaveColumn.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink + Me.ucrSaveColumn.Location = New System.Drawing.Point(9, 413) + Me.ucrSaveColumn.Margin = New System.Windows.Forms.Padding(4, 5, 4, 5) + Me.ucrSaveColumn.Name = "ucrSaveColumn" + Me.ucrSaveColumn.Size = New System.Drawing.Size(320, 22) + Me.ucrSaveColumn.TabIndex = 25 + ' + 'ucrInputDirection + ' + Me.ucrInputDirection.AddQuotesIfUnrecognised = True + Me.ucrInputDirection.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink + Me.ucrInputDirection.GetSetSelectedIndex = -1 + Me.ucrInputDirection.IsReadOnly = False + Me.ucrInputDirection.Location = New System.Drawing.Point(265, 239) + Me.ucrInputDirection.Name = "ucrInputDirection" + Me.ucrInputDirection.Size = New System.Drawing.Size(86, 21) + Me.ucrInputDirection.TabIndex = 23 ' 'ucrChkVariable ' @@ -481,17 +503,6 @@ Partial Class dlgConversions Me.ucrInputSecond.Size = New System.Drawing.Size(120, 20) Me.ucrInputSecond.TabIndex = 12 ' - 'ucrInputMinute - ' - Me.ucrInputMinute.AddQuotesIfUnrecognised = True - Me.ucrInputMinute.AutoSize = True - Me.ucrInputMinute.IsMultiline = False - Me.ucrInputMinute.IsReadOnly = False - Me.ucrInputMinute.Location = New System.Drawing.Point(265, 152) - Me.ucrInputMinute.Name = "ucrInputMinute" - Me.ucrInputMinute.Size = New System.Drawing.Size(120, 20) - Me.ucrInputMinute.TabIndex = 10 - ' 'ucrInputDegree ' Me.ucrInputDegree.AddQuotesIfUnrecognised = True @@ -503,6 +514,19 @@ Partial Class dlgConversions Me.ucrInputDegree.Size = New System.Drawing.Size(120, 20) Me.ucrInputDegree.TabIndex = 8 ' + 'ucrReceiverLetters + ' + Me.ucrReceiverLetters.AutoSize = True + Me.ucrReceiverLetters.frmParent = Me + Me.ucrReceiverLetters.Location = New System.Drawing.Point(353, 239) + Me.ucrReceiverLetters.Margin = New System.Windows.Forms.Padding(0) + Me.ucrReceiverLetters.Name = "ucrReceiverLetters" + Me.ucrReceiverLetters.Selector = Nothing + Me.ucrReceiverLetters.Size = New System.Drawing.Size(81, 21) + Me.ucrReceiverLetters.strNcFilePath = "" + Me.ucrReceiverLetters.TabIndex = 6 + Me.ucrReceiverLetters.ucrSelector = Nothing + ' 'ucrSaveConversions ' Me.ucrSaveConversions.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink @@ -525,19 +549,6 @@ Partial Class dlgConversions Me.ucrReceiverDegrees.TabIndex = 9 Me.ucrReceiverDegrees.ucrSelector = Nothing ' - 'ucrReceiverMinutes - ' - Me.ucrReceiverMinutes.AutoSize = True - Me.ucrReceiverMinutes.frmParent = Me - Me.ucrReceiverMinutes.Location = New System.Drawing.Point(265, 152) - Me.ucrReceiverMinutes.Margin = New System.Windows.Forms.Padding(0) - Me.ucrReceiverMinutes.Name = "ucrReceiverMinutes" - Me.ucrReceiverMinutes.Selector = Nothing - Me.ucrReceiverMinutes.Size = New System.Drawing.Size(120, 20) - Me.ucrReceiverMinutes.strNcFilePath = "" - Me.ucrReceiverMinutes.TabIndex = 10 - Me.ucrReceiverMinutes.ucrSelector = Nothing - ' 'ucrReceiverSeconds ' Me.ucrReceiverSeconds.AutoSize = True @@ -580,9 +591,9 @@ Partial Class dlgConversions 'ucrPnlConversions ' Me.ucrPnlConversions.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink - Me.ucrPnlConversions.Location = New System.Drawing.Point(62, 21) + Me.ucrPnlConversions.Location = New System.Drawing.Point(30, 21) Me.ucrPnlConversions.Name = "ucrPnlConversions" - Me.ucrPnlConversions.Size = New System.Drawing.Size(310, 28) + Me.ucrPnlConversions.Size = New System.Drawing.Size(376, 28) Me.ucrPnlConversions.TabIndex = 0 ' 'ucrSelectorConversions @@ -606,58 +617,118 @@ Partial Class dlgConversions Me.ucrBase.Size = New System.Drawing.Size(405, 52) Me.ucrBase.TabIndex = 17 ' - 'ucrInputDirection - ' - Me.ucrInputDirection.AddQuotesIfUnrecognised = True - Me.ucrInputDirection.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink - Me.ucrInputDirection.GetSetSelectedIndex = -1 - Me.ucrInputDirection.IsReadOnly = False - Me.ucrInputDirection.Location = New System.Drawing.Point(265, 239) - Me.ucrInputDirection.Name = "ucrInputDirection" - Me.ucrInputDirection.Size = New System.Drawing.Size(86, 21) - Me.ucrInputDirection.TabIndex = 23 + 'ucrInputMinute ' - 'lblDirection + Me.ucrInputMinute.AddQuotesIfUnrecognised = True + Me.ucrInputMinute.AutoSize = True + Me.ucrInputMinute.IsMultiline = False + Me.ucrInputMinute.IsReadOnly = False + Me.ucrInputMinute.Location = New System.Drawing.Point(265, 152) + Me.ucrInputMinute.Name = "ucrInputMinute" + Me.ucrInputMinute.Size = New System.Drawing.Size(120, 20) + Me.ucrInputMinute.TabIndex = 10 ' - Me.lblDirection.AutoSize = True - Me.lblDirection.ImeMode = System.Windows.Forms.ImeMode.NoControl - Me.lblDirection.Location = New System.Drawing.Point(265, 223) - Me.lblDirection.Name = "lblDirection" - Me.lblDirection.Size = New System.Drawing.Size(52, 13) - Me.lblDirection.TabIndex = 24 - Me.lblDirection.Text = "Direction:" + 'ucrReceiverMinutes ' - 'ucrSaveColumn + Me.ucrReceiverMinutes.AutoSize = True + Me.ucrReceiverMinutes.frmParent = Me + Me.ucrReceiverMinutes.Location = New System.Drawing.Point(265, 152) + Me.ucrReceiverMinutes.Margin = New System.Windows.Forms.Padding(0) + Me.ucrReceiverMinutes.Name = "ucrReceiverMinutes" + Me.ucrReceiverMinutes.Selector = Nothing + Me.ucrReceiverMinutes.Size = New System.Drawing.Size(120, 20) + Me.ucrReceiverMinutes.strNcFilePath = "" + Me.ucrReceiverMinutes.TabIndex = 10 + Me.ucrReceiverMinutes.ucrSelector = Nothing ' - Me.ucrSaveColumn.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink - Me.ucrSaveColumn.Location = New System.Drawing.Point(9, 413) - Me.ucrSaveColumn.Margin = New System.Windows.Forms.Padding(4, 5, 4, 5) - Me.ucrSaveColumn.Name = "ucrSaveColumn" - Me.ucrSaveColumn.Size = New System.Drawing.Size(320, 22) - Me.ucrSaveColumn.TabIndex = 25 + 'rdoYear + ' + Me.rdoYear.Appearance = System.Windows.Forms.Appearance.Button + Me.rdoYear.BackgroundImageLayout = System.Windows.Forms.ImageLayout.None + Me.rdoYear.CheckAlign = System.Drawing.ContentAlignment.MiddleCenter + Me.rdoYear.FlatAppearance.BorderColor = System.Drawing.SystemColors.ActiveCaption + Me.rdoYear.FlatAppearance.BorderSize = 2 + Me.rdoYear.FlatAppearance.CheckedBackColor = System.Drawing.SystemColors.ActiveCaption + Me.rdoYear.FlatStyle = System.Windows.Forms.FlatStyle.Flat + Me.rdoYear.ForeColor = System.Drawing.SystemColors.ActiveCaptionText + Me.rdoYear.ImeMode = System.Windows.Forms.ImeMode.NoControl + Me.rdoYear.Location = New System.Drawing.Point(303, 21) + Me.rdoYear.Name = "rdoYear" + Me.rdoYear.Size = New System.Drawing.Size(90, 28) + Me.rdoYear.TabIndex = 27 + Me.rdoYear.Text = "Year" + Me.rdoYear.TextAlign = System.Drawing.ContentAlignment.MiddleCenter + Me.rdoYear.UseVisualStyleBackColor = True + ' + 'ucrReceiverYear + ' + Me.ucrReceiverYear.AutoSize = True + Me.ucrReceiverYear.frmParent = Me + Me.ucrReceiverYear.Location = New System.Drawing.Point(265, 109) + Me.ucrReceiverYear.Margin = New System.Windows.Forms.Padding(0) + Me.ucrReceiverYear.Name = "ucrReceiverYear" + Me.ucrReceiverYear.Selector = Nothing + Me.ucrReceiverYear.Size = New System.Drawing.Size(120, 20) + Me.ucrReceiverYear.strNcFilePath = "" + Me.ucrReceiverYear.TabIndex = 28 + Me.ucrReceiverYear.ucrSelector = Nothing + ' + 'lblYear + ' + Me.lblYear.AutoSize = True + Me.lblYear.ImeMode = System.Windows.Forms.ImeMode.NoControl + Me.lblYear.Location = New System.Drawing.Point(265, 93) + Me.lblYear.Name = "lblYear" + Me.lblYear.Size = New System.Drawing.Size(32, 13) + Me.lblYear.TabIndex = 29 + Me.lblYear.Text = "Year:" + ' + 'ucrNudBaseYear + ' + Me.ucrNudBaseYear.AutoSize = True + Me.ucrNudBaseYear.DecimalPlaces = New Decimal(New Integer() {0, 0, 0, 0}) + Me.ucrNudBaseYear.Increment = New Decimal(New Integer() {1, 0, 0, 0}) + Me.ucrNudBaseYear.Location = New System.Drawing.Point(265, 152) + Me.ucrNudBaseYear.Maximum = New Decimal(New Integer() {100, 0, 0, 0}) + Me.ucrNudBaseYear.Minimum = New Decimal(New Integer() {0, 0, 0, 0}) + Me.ucrNudBaseYear.Name = "ucrNudBaseYear" + Me.ucrNudBaseYear.Size = New System.Drawing.Size(64, 20) + Me.ucrNudBaseYear.TabIndex = 30 + Me.ucrNudBaseYear.Value = New Decimal(New Integer() {0, 0, 0, 0}) + ' + 'lblBaseYear + ' + Me.lblBaseYear.AutoSize = True + Me.lblBaseYear.ImeMode = System.Windows.Forms.ImeMode.NoControl + Me.lblBaseYear.Location = New System.Drawing.Point(265, 136) + Me.lblBaseYear.Name = "lblBaseYear" + Me.lblBaseYear.Size = New System.Drawing.Size(59, 13) + Me.lblBaseYear.TabIndex = 31 + Me.lblBaseYear.Text = "Base Year:" ' 'dlgConversions ' Me.AutoScaleDimensions = New System.Drawing.SizeF(96.0!, 96.0!) Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi Me.ClientSize = New System.Drawing.Size(436, 503) + Me.Controls.Add(Me.lblBaseYear) + Me.Controls.Add(Me.ucrNudBaseYear) + Me.Controls.Add(Me.lblYear) + Me.Controls.Add(Me.ucrReceiverYear) + Me.Controls.Add(Me.rdoYear) Me.Controls.Add(Me.ucrSaveColumn) Me.Controls.Add(Me.lblDirection) Me.Controls.Add(Me.ucrInputDirection) Me.Controls.Add(Me.ucrChkVariable) Me.Controls.Add(Me.ucrInputSecond) - Me.Controls.Add(Me.ucrInputMinute) - Me.Controls.Add(Me.ucrInputDegree) Me.Controls.Add(Me.ucrReceiverLetters) Me.Controls.Add(Me.ucrSaveConversions) Me.Controls.Add(Me.lblDegrees) Me.Controls.Add(Me.lblSeconds) Me.Controls.Add(Me.lblMinutes) Me.Controls.Add(Me.ucrReceiverDegrees) - Me.Controls.Add(Me.ucrReceiverMinutes) Me.Controls.Add(Me.ucrReceiverSeconds) Me.Controls.Add(Me.rdoCoordinates) - Me.Controls.Add(Me.grpLatitude) Me.Controls.Add(Me.lblDate) Me.Controls.Add(Me.ucrReceiverDate) Me.Controls.Add(Me.lblElement) @@ -668,6 +739,10 @@ Partial Class dlgConversions Me.Controls.Add(Me.ucrSelectorConversions) Me.Controls.Add(Me.ucrBase) Me.Controls.Add(Me.grpElements) + Me.Controls.Add(Me.ucrInputMinute) + Me.Controls.Add(Me.ucrReceiverMinutes) + Me.Controls.Add(Me.grpLatitude) + Me.Controls.Add(Me.ucrInputDegree) Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow Me.MaximizeBox = False Me.MinimizeBox = False @@ -729,4 +804,9 @@ Partial Class dlgConversions Friend WithEvents lblDirection As Label Friend WithEvents ucrInputDirection As ucrInputComboBox Friend WithEvents ucrSaveColumn As ucrSave + Friend WithEvents lblBaseYear As Label + Friend WithEvents ucrNudBaseYear As ucrNud + Friend WithEvents lblYear As Label + Friend WithEvents ucrReceiverYear As ucrReceiverSingle + Friend WithEvents rdoYear As RadioButton End Class \ No newline at end of file diff --git a/instat/dlgConversions.vb b/instat/dlgConversions.vb index 1de8b15bd1b..8de14f90963 100644 --- a/instat/dlgConversions.vb +++ b/instat/dlgConversions.vb @@ -21,6 +21,7 @@ Public Class dlgConversions Private clsPrecipitationFunction, clsTemperatureFunction, clsWindSpeedFunction, clsConvertToDegreeFunction As New RFunction Private clsRoundFunction As New RFunction Private clsDayLengthFunction As New RFunction + Private clsYearConversionFunction As New RFunction Private clsDummyFunction As New RFunction Private Sub dlgConversions_Load(sender As Object, e As EventArgs) Handles MyBase.Load @@ -50,10 +51,12 @@ Public Class dlgConversions ucrPnlConversions.AddRadioButton(rdoUnits) ucrPnlConversions.AddRadioButton(rdoDayLength) ucrPnlConversions.AddRadioButton(rdoCoordinates) + ucrPnlConversions.AddRadioButton(rdoYear) ucrPnlConversions.AddFunctionNamesCondition(rdoUnits, {"convert_precip", "convert_temperature", "convert_wind_speed"}) ucrPnlConversions.AddFunctionNamesCondition(rdoDayLength, "daylength") ucrPnlConversions.AddFunctionNamesCondition(rdoCoordinates, "convert_to_dec_deg") + ucrPnlConversions.AddFunctionNamesCondition(rdoYear, "convert_yy_to_yyyy") ucrPnlLatitude.AddRadioButton(rdoSingleValue) ucrPnlLatitude.AddRadioButton(rdoColumn) @@ -100,6 +103,18 @@ Public Class dlgConversions ucrReceiverLetters.Selector = ucrSelectorConversions ucrReceiverLetters.bUseFilteredData = False + ucrReceiverYear.SetParameter(New RParameter("x", 0)) + ucrReceiverYear.Selector = ucrSelectorConversions + ucrReceiverYear.SetParameterIsRFunction() + ucrReceiverYear.bUseFilteredData = False + ucrReceiverYear.SetIncludedDataTypes({"numeric"}) + ucrReceiverYear.SetLinkedDisplayControl(lblYear) + + ucrNudBaseYear.SetParameter(New RParameter("base", 1)) + ucrNudBaseYear.SetMinMax(iNewMin:=2000, iNewMax:=2100) + ucrNudBaseYear.Increment = 1 + ucrNudBaseYear.SetLinkedDisplayControl(lblBaseYear) + ucrInputLatitude.SetValidationTypeAsNumeric(dcmMin:=-90, dcmMax:=90) ucrInputFromPrecipitation.SetParameter(New RParameter("old_metric", 1)) @@ -143,6 +158,8 @@ Public Class dlgConversions ucrPnlConversions.AddToLinkedControls(ucrReceiverElement, {rdoUnits}, bNewLinkedAddRemoveParameter:=True, bNewLinkedHideIfParameterMissing:=True) ucrPnlConversions.AddToLinkedControls(ucrNudDecimal, {rdoUnits}, bNewLinkedHideIfParameterMissing:=True) ucrPnlConversions.AddToLinkedControls(ucrPnlElements, {rdoUnits}, bNewLinkedAddRemoveParameter:=True, bNewLinkedHideIfParameterMissing:=True, bNewLinkedChangeToDefaultState:=True, objNewDefaultState:=rdoRain) + ucrPnlConversions.AddToLinkedControls(ucrReceiverYear, {rdoYear}, bNewLinkedAddRemoveParameter:=True, bNewLinkedHideIfParameterMissing:=True) + ucrPnlConversions.AddToLinkedControls(ucrNudBaseYear, {rdoYear}, bNewLinkedHideIfParameterMissing:=True) ucrPnlConversions.AddToLinkedControls(ucrReceiverDate, {rdoDayLength}, bNewLinkedAddRemoveParameter:=True, bNewLinkedHideIfParameterMissing:=True) ucrPnlConversions.AddToLinkedControls(ucrPnlLatitude, {rdoDayLength}, bNewLinkedAddRemoveParameter:=True, bNewLinkedHideIfParameterMissing:=True, bNewLinkedChangeToDefaultState:=True, objNewDefaultState:=rdoSingleValue) @@ -168,7 +185,7 @@ Public Class dlgConversions ucrPnlConversions.AddToLinkedControls(ucrReceiverMinutes, {rdoCoordinates}, bNewLinkedAddRemoveParameter:=True, bNewLinkedHideIfParameterMissing:=True) ucrPnlConversions.AddToLinkedControls(ucrReceiverSeconds, {rdoCoordinates}, bNewLinkedAddRemoveParameter:=True, bNewLinkedHideIfParameterMissing:=True) ucrPnlConversions.AddToLinkedControls(ucrInputDirection, {rdoCoordinates}, bNewLinkedHideIfParameterMissing:=True) - ucrPnlConversions.AddToLinkedControls(ucrSaveConversions, {rdoUnits, rdoDayLength}, bNewLinkedHideIfParameterMissing:=True) + ucrPnlConversions.AddToLinkedControls(ucrSaveConversions, {rdoUnits, rdoDayLength, rdoYear}, bNewLinkedHideIfParameterMissing:=True) ucrPnlConversions.AddToLinkedControls({ucrChkVariable}, {rdoCoordinates}, bNewLinkedHideIfParameterMissing:=True) ucrInputDirection.AddToLinkedControls(ucrReceiverLetters, {"Variable"}, bNewLinkedHideIfParameterMissing:=True) ucrChkVariable.AddToLinkedControls({ucrInputDegree, ucrInputMinute, ucrInputSecond}, {False}, bNewLinkedHideIfParameterMissing:=True) @@ -178,12 +195,12 @@ Public Class dlgConversions ucrReceiverMinutes.SetLinkedDisplayControl(lblMinutes) ucrReceiverSeconds.SetLinkedDisplayControl(lblSeconds) ucrInputDirection.SetLinkedDisplayControl(lblDirection) + ucrPnlElements.SetLinkedDisplayControl(grpElements) ucrReceiverElement.SetLinkedDisplayControl(lblElement) ucrNudDecimal.SetLinkedDisplayControl(lstLabels) ucrReceiverDate.SetLinkedDisplayControl(lblDate) ucrPnlLatitude.SetLinkedDisplayControl(grpLatitude) - ucrPnlElements.SetLinkedDisplayControl(grpElements) ucrSaveConversions.SetSaveTypeAsColumn() ucrSaveConversions.SetDataFrameSelector(ucrSelectorConversions.ucrAvailableDataFrames) @@ -206,6 +223,7 @@ Public Class dlgConversions clsConvertToDegreeFunction = New RFunction clsRoundFunction = New RFunction clsDummyFunction = New RFunction + clsYearConversionFunction = New RFunction ucrSelectorConversions.Reset() ucrSaveConversions.Reset() @@ -237,6 +255,9 @@ Public Class dlgConversions clsRoundFunction.AddParameter("x", clsRFunctionParameter:=clsConvertToDegreeFunction, iPosition:=0) clsRoundFunction.AddParameter("digits", 3, iPosition:=1) + clsYearConversionFunction.SetRCommand("convert_yy_to_yyyy") + clsYearConversionFunction.AddParameter("base", "2030", iPosition:=1) + clsPrecipitationFunction.SetAssignTo(ucrSaveConversions.GetText, strTempDataframe:=ucrSelectorConversions.ucrAvailableDataFrames.cboAvailableDataFrames.Text, strTempColumn:=ucrSaveConversions.GetText, bAssignToIsPrefix:=True) ucrBase.clsRsyntax.SetBaseRFunction(clsPrecipitationFunction) End Sub @@ -249,6 +270,7 @@ Public Class dlgConversions ucrSaveConversions.AddAdditionalRCode(clsTemperatureFunction, iAdditionalPairNo:=1) ucrSaveConversions.AddAdditionalRCode(clsWindSpeedFunction, iAdditionalPairNo:=2) ucrSaveConversions.AddAdditionalRCode(clsDayLengthFunction, iAdditionalPairNo:=3) + ucrSaveConversions.AddAdditionalRCode(clsYearConversionFunction, iAdditionalPairNo:=4) ucrReceiverElement.SetRCode(clsPrecipitationFunction, bReset) ucrInputFromPrecipitation.SetRCode(clsPrecipitationFunction, bReset) @@ -262,6 +284,8 @@ Public Class dlgConversions ucrSaveConversions.SetRCode(clsPrecipitationFunction, bReset) ucrSaveColumn.SetRCode(clsRoundFunction, bReset) ucrInputDirection.SetRCode(clsConvertToDegreeFunction, bReset) + ucrReceiverYear.SetRCode(clsYearConversionFunction, bReset) + ucrNudBaseYear.SetRCode(clsYearConversionFunction, bReset) If bReset Then ucrPnlConversions.SetRCode(clsPrecipitationFunction, bReset) @@ -271,12 +295,12 @@ Public Class dlgConversions End Sub Private Sub TestOkEnabled() - If rdoUnits.Checked AndAlso Not ucrReceiverElement.IsEmpty AndAlso ucrNudDecimal.GetText <> "" AndAlso ucrSaveConversions.IsComplete Then - If rdoRain.Checked AndAlso ucrInputFromPrecipitation.GetText <> ucrInputToPrecipitation.GetText Then + If rdoUnits.Checked AndAlso Not ucrReceiverElement.IsEmpty AndAlso ucrSaveConversions.IsComplete Then + If rdoRain.Checked AndAlso ucrNudDecimal.GetText <> "" AndAlso ucrInputFromPrecipitation.GetText <> ucrInputToPrecipitation.GetText Then ucrBase.OKEnabled(True) - ElseIf rdoTemperature.Checked AndAlso ucrInputFromTemperature.GetText <> ucrInputToTemperature.GetText Then + ElseIf rdoTemperature.Checked AndAlso ucrNudDecimal.GetText <> "" AndAlso ucrInputFromTemperature.GetText <> ucrInputToTemperature.GetText Then ucrBase.OKEnabled(True) - ElseIf rdoWindSpeed.Checked AndAlso ucrInputFromWindSpeed.GetText <> ucrInputToWindSpeed.GetText Then + ElseIf rdoWindSpeed.Checked AndAlso ucrNudDecimal.GetText <> "" AndAlso ucrInputFromWindSpeed.GetText <> ucrInputToWindSpeed.GetText Then ucrBase.OKEnabled(True) Else ucrBase.OKEnabled(False) @@ -291,6 +315,8 @@ Public Class dlgConversions Else ucrBase.OKEnabled(False) End If + ElseIf rdoYear.Checked AndAlso Not ucrReceiverYear.IsEmpty AndAlso ucrNudBaseYear.GetText <> "" AndAlso ucrSaveConversions.IsComplete Then + ucrBase.OKEnabled(True) Else ucrBase.OKEnabled(False) End If @@ -325,7 +351,6 @@ Public Class dlgConversions End Sub Private Sub ucrPnlConversions_ControlValueChanged(ucrChangedControl As ucrCore) Handles ucrPnlConversions.ControlValueChanged - If rdoDayLength.Checked Then ucrBase.clsRsyntax.SetBaseRFunction(clsDayLengthFunction) ucrBase.clsRsyntax.iCallType = 0 @@ -341,6 +366,12 @@ Public Class dlgConversions ucrBase.clsRsyntax.SetBaseRFunction(clsRoundFunction) ucrReceiverDegrees.SetMeAsReceiver() ChangeParameter() + ElseIf rdoYear.Checked Then + ucrBase.clsRsyntax.SetBaseRFunction(clsYearConversionFunction) + ucrReceiverYear.SetMeAsReceiver() + ucrSaveConversions.SetPrefix("conversion") + ucrSaveConversions.setLinkedReceiver(ucrReceiverYear) + ucrReceiverYear.strSelectorHeading = "Numerics" End If ChangeLatParameter() End Sub @@ -356,9 +387,9 @@ Public Class dlgConversions ucrReceiverLetters.SetMeAsReceiver() End If If Not ucrReceiverLetters.IsEmpty Then - clsConvertToDegreeFunction.AddParameter("dir", clsRFunctionParameter:=clsGetDirVariable, iPosition:=3) - End If + clsConvertToDegreeFunction.AddParameter("dir", clsRFunctionParameter:=clsGetDirVariable, iPosition:=3) End If + End If ChangeParameter() End Sub @@ -439,7 +470,14 @@ Public Class dlgConversions ChangeLatParameter() End Sub - Private Sub ucrPnlConversions_ControlContentsChanged(ucrChangedControl As ucrCore) Handles ucrPnlConversions.ControlContentsChanged, ucrReceiverElement.ControlContentsChanged, ucrReceiverDate.ControlContentsChanged, ucrNudDecimal.ControlContentsChanged, ucrPnlLatitude.ControlContentsChanged, ucrInputLatitude.ControlContentsChanged, ucrReceiverLatitude.ControlContentsChanged, ucrInputFromPrecipitation.ControlContentsChanged, ucrInputToPrecipitation.ControlContentsChanged, ucrInputFromTemperature.ControlContentsChanged, ucrInputToTemperature.ControlContentsChanged, ucrInputFromWindSpeed.ControlContentsChanged, ucrInputToWindSpeed.ControlContentsChanged, ucrPnlElements.ControlContentsChanged, ucrReceiverDegrees.ControlContentsChanged, ucrChkVariable.ControlContentsChanged, ucrInputDegree.ControlContentsChanged, ucrSaveConversions.ControlContentsChanged + Private Sub ucrPnlConversions_ControlContentsChanged(ucrChangedControl As ucrCore) Handles ucrPnlConversions.ControlContentsChanged, + ucrReceiverElement.ControlContentsChanged, ucrReceiverDate.ControlContentsChanged, ucrNudDecimal.ControlContentsChanged, + ucrPnlLatitude.ControlContentsChanged, ucrInputLatitude.ControlContentsChanged, ucrReceiverLatitude.ControlContentsChanged, + ucrInputFromPrecipitation.ControlContentsChanged, ucrInputToPrecipitation.ControlContentsChanged, ucrInputFromTemperature.ControlContentsChanged, + ucrInputToTemperature.ControlContentsChanged, ucrInputFromWindSpeed.ControlContentsChanged, ucrInputToWindSpeed.ControlContentsChanged, + ucrPnlElements.ControlContentsChanged, ucrReceiverDegrees.ControlContentsChanged, ucrChkVariable.ControlContentsChanged, + ucrInputDegree.ControlContentsChanged, ucrSaveConversions.ControlContentsChanged, ucrReceiverYear.ControlContentsChanged, + ucrNudBaseYear.ControlContentsChanged TestOkEnabled() End Sub End Class \ No newline at end of file diff --git a/instat/dlgCorrelation.designer.vb b/instat/dlgCorrelation.designer.vb index 004f97eb00f..b65e1af1257 100644 --- a/instat/dlgCorrelation.designer.vb +++ b/instat/dlgCorrelation.designer.vb @@ -38,56 +38,140 @@ Partial Class dlgCorrelation 'Do not modify it using the code editor. Private Sub InitializeComponent() - Me.lblFirstColumn = New System.Windows.Forms.Label() - Me.lblSecondColumn = New System.Windows.Forms.Label() + Me.rdoCompleteRowsOnly = New System.Windows.Forms.RadioButton() + Me.rdoPairwise = New System.Windows.Forms.RadioButton() + Me.lblMethod = New System.Windows.Forms.Label() + Me.lblDisplayNas = New System.Windows.Forms.Label() + Me.lblDecimalPlaces = New System.Windows.Forms.Label() + Me.rdoTwoColumns = New System.Windows.Forms.RadioButton() + Me.rdoMultipleColumns = New System.Windows.Forms.RadioButton() Me.grpMethod = New System.Windows.Forms.GroupBox() Me.rdoKendall = New System.Windows.Forms.RadioButton() Me.rdoPearson = New System.Windows.Forms.RadioButton() Me.rdoSpearman = New System.Windows.Forms.RadioButton() - Me.ucrPnlMethod = New instat.UcrPanel() - Me.cmdOptions = New System.Windows.Forms.Button() Me.grpMissing = New System.Windows.Forms.GroupBox() - Me.rdoCompleteRowsOnly = New System.Windows.Forms.RadioButton() - Me.rdoPairwise = New System.Windows.Forms.RadioButton() - Me.ucrPnlCompletePairwise = New instat.UcrPanel() + Me.cmdOptions = New System.Windows.Forms.Button() + Me.grpDisplayOptions = New System.Windows.Forms.GroupBox() Me.lblConfInterval = New System.Windows.Forms.Label() - Me.rdoTwoColumns = New System.Windows.Forms.RadioButton() - Me.rdoMultipleColumns = New System.Windows.Forms.RadioButton() + Me.lblSecondColumn = New System.Windows.Forms.Label() Me.lblSelectedVariables = New System.Windows.Forms.Label() - Me.ucrSaveModel = New instat.ucrSave() - Me.ucrNudConfidenceInterval = New instat.ucrNud() - Me.ucrChkCorrelationMatrix = New instat.ucrCheck() + Me.lblFirstColumn = New System.Windows.Forms.Label() + Me.ucrSaveFashionModel = New instat.ucrSave() + Me.ucrSaveCorrelation = New instat.ucrSave() + Me.ucrChkAbsolute = New instat.ucrCheck() + Me.ucrInputRearrange = New instat.ucrInputComboBox() + Me.ucrChkRearrange = New instat.ucrCheck() + Me.ucrInputDisplayNas = New instat.ucrInputComboBox() + Me.ucrChkLeadingZeros = New instat.ucrCheck() + Me.ucrNudDecimalPlaces = New instat.ucrNud() Me.ucrPnlColumns = New instat.UcrPanel() + Me.ucrPnlMethod = New instat.UcrPanel() + Me.ucrPnlCompletePairwise = New instat.UcrPanel() + Me.ucrSelectorCorrelation = New instat.ucrSelectorByDataFrameAddRemove() + Me.ucrBase = New instat.ucrButtons() + Me.ucrChkDisplayAsDataFrame = New instat.ucrCheck() + Me.ucrChkShave = New instat.ucrCheck() + Me.ucrSaveCorrelationTest = New instat.ucrSave() Me.ucrReceiverMultipleColumns = New instat.ucrReceiverMultiple() Me.ucrReceiverSecondColumn = New instat.ucrReceiverSingle() Me.ucrReceiverFirstColumn = New instat.ucrReceiverSingle() - Me.ucrSelectorCorrelation = New instat.ucrSelectorByDataFrameAddRemove() - Me.ucrBase = New instat.ucrButtons() + Me.ucrNudConfidenceInterval = New instat.ucrNud() + Me.ucrSaveFashionDataFrame = New instat.ucrSave() + Me.ucrChkDisplayOptions = New instat.ucrCheck() Me.grpMethod.SuspendLayout() Me.grpMissing.SuspendLayout() + Me.grpDisplayOptions.SuspendLayout() Me.SuspendLayout() ' - 'lblFirstColumn + 'rdoCompleteRowsOnly ' - Me.lblFirstColumn.AutoSize = True - Me.lblFirstColumn.ImeMode = System.Windows.Forms.ImeMode.NoControl - Me.lblFirstColumn.Location = New System.Drawing.Point(258, 75) - Me.lblFirstColumn.Name = "lblFirstColumn" - Me.lblFirstColumn.Size = New System.Drawing.Size(67, 13) - Me.lblFirstColumn.TabIndex = 5 - Me.lblFirstColumn.Tag = "First_column" - Me.lblFirstColumn.Text = "First Column:" + Me.rdoCompleteRowsOnly.AutoSize = True + Me.rdoCompleteRowsOnly.Checked = True + Me.rdoCompleteRowsOnly.ImeMode = System.Windows.Forms.ImeMode.NoControl + Me.rdoCompleteRowsOnly.Location = New System.Drawing.Point(6, 17) + Me.rdoCompleteRowsOnly.Name = "rdoCompleteRowsOnly" + Me.rdoCompleteRowsOnly.Size = New System.Drawing.Size(116, 17) + Me.rdoCompleteRowsOnly.TabIndex = 1 + Me.rdoCompleteRowsOnly.TabStop = True + Me.rdoCompleteRowsOnly.Tag = "Complete_rows_only" + Me.rdoCompleteRowsOnly.Text = "Complete rows only" + Me.rdoCompleteRowsOnly.UseVisualStyleBackColor = True ' - 'lblSecondColumn + 'rdoPairwise ' - Me.lblSecondColumn.AutoSize = True - Me.lblSecondColumn.ImeMode = System.Windows.Forms.ImeMode.NoControl - Me.lblSecondColumn.Location = New System.Drawing.Point(258, 127) - Me.lblSecondColumn.Name = "lblSecondColumn" - Me.lblSecondColumn.Size = New System.Drawing.Size(85, 13) - Me.lblSecondColumn.TabIndex = 8 - Me.lblSecondColumn.Tag = "Second_column" - Me.lblSecondColumn.Text = "Second Column:" + Me.rdoPairwise.AutoSize = True + Me.rdoPairwise.ImeMode = System.Windows.Forms.ImeMode.NoControl + Me.rdoPairwise.Location = New System.Drawing.Point(6, 43) + Me.rdoPairwise.Name = "rdoPairwise" + Me.rdoPairwise.Size = New System.Drawing.Size(64, 17) + Me.rdoPairwise.TabIndex = 2 + Me.rdoPairwise.Tag = "Pairwise" + Me.rdoPairwise.Text = "Pairwise" + Me.rdoPairwise.UseVisualStyleBackColor = True + ' + 'lblMethod + ' + Me.lblMethod.AutoSize = True + Me.lblMethod.ImeMode = System.Windows.Forms.ImeMode.NoControl + Me.lblMethod.Location = New System.Drawing.Point(125, 446) + Me.lblMethod.Name = "lblMethod" + Me.lblMethod.Size = New System.Drawing.Size(46, 13) + Me.lblMethod.TabIndex = 61 + Me.lblMethod.Text = "Method:" + ' + 'lblDisplayNas + ' + Me.lblDisplayNas.AutoSize = True + Me.lblDisplayNas.ImeMode = System.Windows.Forms.ImeMode.NoControl + Me.lblDisplayNas.Location = New System.Drawing.Point(17, 393) + Me.lblDisplayNas.Name = "lblDisplayNas" + Me.lblDisplayNas.Size = New System.Drawing.Size(106, 13) + Me.lblDisplayNas.TabIndex = 56 + Me.lblDisplayNas.Text = "Display On Diagonal:" + ' + 'lblDecimalPlaces + ' + Me.lblDecimalPlaces.AutoSize = True + Me.lblDecimalPlaces.ImeMode = System.Windows.Forms.ImeMode.NoControl + Me.lblDecimalPlaces.Location = New System.Drawing.Point(17, 369) + Me.lblDecimalPlaces.Name = "lblDecimalPlaces" + Me.lblDecimalPlaces.Size = New System.Drawing.Size(83, 13) + Me.lblDecimalPlaces.TabIndex = 53 + Me.lblDecimalPlaces.Text = "Decimal Places:" + ' + 'rdoTwoColumns + ' + Me.rdoTwoColumns.Appearance = System.Windows.Forms.Appearance.Button + Me.rdoTwoColumns.FlatAppearance.BorderColor = System.Drawing.SystemColors.ActiveCaption + Me.rdoTwoColumns.FlatAppearance.BorderSize = 2 + Me.rdoTwoColumns.FlatAppearance.CheckedBackColor = System.Drawing.SystemColors.ActiveCaption + Me.rdoTwoColumns.FlatStyle = System.Windows.Forms.FlatStyle.Flat + Me.rdoTwoColumns.ImeMode = System.Windows.Forms.ImeMode.NoControl + Me.rdoTwoColumns.Location = New System.Drawing.Point(230, 7) + Me.rdoTwoColumns.Name = "rdoTwoColumns" + Me.rdoTwoColumns.Size = New System.Drawing.Size(127, 27) + Me.rdoTwoColumns.TabIndex = 35 + Me.rdoTwoColumns.TabStop = True + Me.rdoTwoColumns.Text = "Two Variables" + Me.rdoTwoColumns.TextAlign = System.Drawing.ContentAlignment.MiddleCenter + Me.rdoTwoColumns.UseVisualStyleBackColor = True + ' + 'rdoMultipleColumns + ' + Me.rdoMultipleColumns.Appearance = System.Windows.Forms.Appearance.Button + Me.rdoMultipleColumns.FlatAppearance.BorderColor = System.Drawing.SystemColors.ActiveCaption + Me.rdoMultipleColumns.FlatAppearance.BorderSize = 2 + Me.rdoMultipleColumns.FlatAppearance.CheckedBackColor = System.Drawing.SystemColors.ActiveCaption + Me.rdoMultipleColumns.FlatStyle = System.Windows.Forms.FlatStyle.Flat + Me.rdoMultipleColumns.ImeMode = System.Windows.Forms.ImeMode.NoControl + Me.rdoMultipleColumns.Location = New System.Drawing.Point(100, 7) + Me.rdoMultipleColumns.Name = "rdoMultipleColumns" + Me.rdoMultipleColumns.Size = New System.Drawing.Size(132, 27) + Me.rdoMultipleColumns.TabIndex = 36 + Me.rdoMultipleColumns.TabStop = True + Me.rdoMultipleColumns.Text = "Multiple Variables" + Me.rdoMultipleColumns.TextAlign = System.Drawing.ContentAlignment.MiddleCenter + Me.rdoMultipleColumns.UseVisualStyleBackColor = True ' 'grpMethod ' @@ -95,10 +179,10 @@ Partial Class dlgCorrelation Me.grpMethod.Controls.Add(Me.rdoPearson) Me.grpMethod.Controls.Add(Me.rdoSpearman) Me.grpMethod.Controls.Add(Me.ucrPnlMethod) - Me.grpMethod.Location = New System.Drawing.Point(9, 232) + Me.grpMethod.Location = New System.Drawing.Point(9, 241) Me.grpMethod.Name = "grpMethod" Me.grpMethod.Size = New System.Drawing.Size(246, 45) - Me.grpMethod.TabIndex = 10 + Me.grpMethod.TabIndex = 44 Me.grpMethod.TabStop = False Me.grpMethod.Tag = "Method" Me.grpMethod.Text = "Method" @@ -107,7 +191,7 @@ Partial Class dlgCorrelation ' Me.rdoKendall.AutoSize = True Me.rdoKendall.ImeMode = System.Windows.Forms.ImeMode.NoControl - Me.rdoKendall.Location = New System.Drawing.Point(91, 18) + Me.rdoKendall.Location = New System.Drawing.Point(91, 15) Me.rdoKendall.Name = "rdoKendall" Me.rdoKendall.Size = New System.Drawing.Size(60, 17) Me.rdoKendall.TabIndex = 2 @@ -120,7 +204,7 @@ Partial Class dlgCorrelation Me.rdoPearson.AutoSize = True Me.rdoPearson.Checked = True Me.rdoPearson.ImeMode = System.Windows.Forms.ImeMode.NoControl - Me.rdoPearson.Location = New System.Drawing.Point(15, 18) + Me.rdoPearson.Location = New System.Drawing.Point(15, 15) Me.rdoPearson.Name = "rdoPearson" Me.rdoPearson.Size = New System.Drawing.Size(64, 17) Me.rdoPearson.TabIndex = 1 @@ -133,7 +217,7 @@ Partial Class dlgCorrelation ' Me.rdoSpearman.AutoSize = True Me.rdoSpearman.ImeMode = System.Windows.Forms.ImeMode.NoControl - Me.rdoSpearman.Location = New System.Drawing.Point(164, 18) + Me.rdoSpearman.Location = New System.Drawing.Point(164, 15) Me.rdoSpearman.Name = "rdoSpearman" Me.rdoSpearman.Size = New System.Drawing.Size(73, 17) Me.rdoSpearman.TabIndex = 3 @@ -141,165 +225,236 @@ Partial Class dlgCorrelation Me.rdoSpearman.Text = "Spearman" Me.rdoSpearman.UseVisualStyleBackColor = True ' - 'ucrPnlMethod - ' - Me.ucrPnlMethod.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink - Me.ucrPnlMethod.Location = New System.Drawing.Point(8, 16) - Me.ucrPnlMethod.Name = "ucrPnlMethod" - Me.ucrPnlMethod.Size = New System.Drawing.Size(229, 24) - Me.ucrPnlMethod.TabIndex = 0 - ' - 'cmdOptions - ' - Me.cmdOptions.ImeMode = System.Windows.Forms.ImeMode.NoControl - Me.cmdOptions.Location = New System.Drawing.Point(299, 334) - Me.cmdOptions.Name = "cmdOptions" - Me.cmdOptions.Size = New System.Drawing.Size(114, 25) - Me.cmdOptions.TabIndex = 16 - Me.cmdOptions.Tag = "Options" - Me.cmdOptions.Text = "Options" - Me.cmdOptions.UseVisualStyleBackColor = True - ' 'grpMissing ' Me.grpMissing.Controls.Add(Me.rdoCompleteRowsOnly) Me.grpMissing.Controls.Add(Me.rdoPairwise) Me.grpMissing.Controls.Add(Me.ucrPnlCompletePairwise) - Me.grpMissing.Location = New System.Drawing.Point(261, 232) + Me.grpMissing.Location = New System.Drawing.Point(261, 241) Me.grpMissing.Name = "grpMissing" - Me.grpMissing.Size = New System.Drawing.Size(167, 71) - Me.grpMissing.TabIndex = 11 + Me.grpMissing.Size = New System.Drawing.Size(158, 71) + Me.grpMissing.TabIndex = 45 Me.grpMissing.TabStop = False Me.grpMissing.Tag = "Missing" Me.grpMissing.Text = "Missing" ' - 'rdoCompleteRowsOnly - ' - Me.rdoCompleteRowsOnly.AutoSize = True - Me.rdoCompleteRowsOnly.Checked = True - Me.rdoCompleteRowsOnly.ImeMode = System.Windows.Forms.ImeMode.NoControl - Me.rdoCompleteRowsOnly.Location = New System.Drawing.Point(6, 23) - Me.rdoCompleteRowsOnly.Name = "rdoCompleteRowsOnly" - Me.rdoCompleteRowsOnly.Size = New System.Drawing.Size(116, 17) - Me.rdoCompleteRowsOnly.TabIndex = 1 - Me.rdoCompleteRowsOnly.TabStop = True - Me.rdoCompleteRowsOnly.Tag = "Complete_rows_only" - Me.rdoCompleteRowsOnly.Text = "Complete rows only" - Me.rdoCompleteRowsOnly.UseVisualStyleBackColor = True - ' - 'rdoPairwise + 'cmdOptions ' - Me.rdoPairwise.AutoSize = True - Me.rdoPairwise.ImeMode = System.Windows.Forms.ImeMode.NoControl - Me.rdoPairwise.Location = New System.Drawing.Point(6, 46) - Me.rdoPairwise.Name = "rdoPairwise" - Me.rdoPairwise.Size = New System.Drawing.Size(64, 17) - Me.rdoPairwise.TabIndex = 2 - Me.rdoPairwise.Tag = "Pairwise" - Me.rdoPairwise.Text = "Pairwise" - Me.rdoPairwise.UseVisualStyleBackColor = True + Me.cmdOptions.ImeMode = System.Windows.Forms.ImeMode.NoControl + Me.cmdOptions.Location = New System.Drawing.Point(301, 514) + Me.cmdOptions.Name = "cmdOptions" + Me.cmdOptions.Size = New System.Drawing.Size(114, 25) + Me.cmdOptions.TabIndex = 49 + Me.cmdOptions.Tag = "Options" + Me.cmdOptions.Text = "Options" + Me.cmdOptions.UseVisualStyleBackColor = True ' - 'ucrPnlCompletePairwise + 'grpDisplayOptions ' - Me.ucrPnlCompletePairwise.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink - Me.ucrPnlCompletePairwise.Location = New System.Drawing.Point(6, 16) - Me.ucrPnlCompletePairwise.Name = "ucrPnlCompletePairwise" - Me.ucrPnlCompletePairwise.Size = New System.Drawing.Size(152, 49) - Me.ucrPnlCompletePairwise.TabIndex = 0 + Me.grpDisplayOptions.Controls.Add(Me.ucrChkDisplayAsDataFrame) + Me.grpDisplayOptions.Controls.Add(Me.ucrChkShave) + Me.grpDisplayOptions.Location = New System.Drawing.Point(9, 346) + Me.grpDisplayOptions.Name = "grpDisplayOptions" + Me.grpDisplayOptions.Size = New System.Drawing.Size(410, 156) + Me.grpDisplayOptions.TabIndex = 63 + Me.grpDisplayOptions.TabStop = False + Me.grpDisplayOptions.Tag = "Display Options" + Me.grpDisplayOptions.Text = "Display Options" ' 'lblConfInterval ' Me.lblConfInterval.AutoSize = True Me.lblConfInterval.ImeMode = System.Windows.Forms.ImeMode.NoControl - Me.lblConfInterval.Location = New System.Drawing.Point(15, 286) + Me.lblConfInterval.Location = New System.Drawing.Point(9, 313) Me.lblConfInterval.Name = "lblConfInterval" Me.lblConfInterval.Size = New System.Drawing.Size(102, 13) - Me.lblConfInterval.TabIndex = 12 + Me.lblConfInterval.TabIndex = 46 Me.lblConfInterval.Text = "Confidence Interval:" ' - 'rdoTwoColumns - ' - Me.rdoTwoColumns.Appearance = System.Windows.Forms.Appearance.Button - Me.rdoTwoColumns.FlatAppearance.BorderColor = System.Drawing.SystemColors.ActiveCaption - Me.rdoTwoColumns.FlatAppearance.BorderSize = 2 - Me.rdoTwoColumns.FlatAppearance.CheckedBackColor = System.Drawing.SystemColors.ActiveCaption - Me.rdoTwoColumns.FlatStyle = System.Windows.Forms.FlatStyle.Flat - Me.rdoTwoColumns.ImeMode = System.Windows.Forms.ImeMode.NoControl - Me.rdoTwoColumns.Location = New System.Drawing.Point(119, 10) - Me.rdoTwoColumns.Name = "rdoTwoColumns" - Me.rdoTwoColumns.Size = New System.Drawing.Size(127, 27) - Me.rdoTwoColumns.TabIndex = 1 - Me.rdoTwoColumns.TabStop = True - Me.rdoTwoColumns.Text = "Two Columns" - Me.rdoTwoColumns.TextAlign = System.Drawing.ContentAlignment.MiddleCenter - Me.rdoTwoColumns.UseVisualStyleBackColor = True - ' - 'rdoMultipleColumns + 'lblSecondColumn ' - Me.rdoMultipleColumns.Appearance = System.Windows.Forms.Appearance.Button - Me.rdoMultipleColumns.FlatAppearance.BorderColor = System.Drawing.SystemColors.ActiveCaption - Me.rdoMultipleColumns.FlatAppearance.BorderSize = 2 - Me.rdoMultipleColumns.FlatAppearance.CheckedBackColor = System.Drawing.SystemColors.ActiveCaption - Me.rdoMultipleColumns.FlatStyle = System.Windows.Forms.FlatStyle.Flat - Me.rdoMultipleColumns.ImeMode = System.Windows.Forms.ImeMode.NoControl - Me.rdoMultipleColumns.Location = New System.Drawing.Point(243, 10) - Me.rdoMultipleColumns.Name = "rdoMultipleColumns" - Me.rdoMultipleColumns.Size = New System.Drawing.Size(127, 27) - Me.rdoMultipleColumns.TabIndex = 2 - Me.rdoMultipleColumns.TabStop = True - Me.rdoMultipleColumns.Text = "Multiple Columns" - Me.rdoMultipleColumns.TextAlign = System.Drawing.ContentAlignment.MiddleCenter - Me.rdoMultipleColumns.UseVisualStyleBackColor = True + Me.lblSecondColumn.AutoSize = True + Me.lblSecondColumn.ImeMode = System.Windows.Forms.ImeMode.NoControl + Me.lblSecondColumn.Location = New System.Drawing.Point(260, 122) + Me.lblSecondColumn.Name = "lblSecondColumn" + Me.lblSecondColumn.Size = New System.Drawing.Size(88, 13) + Me.lblSecondColumn.TabIndex = 42 + Me.lblSecondColumn.Tag = "Second_column" + Me.lblSecondColumn.Text = "Second Variable:" ' 'lblSelectedVariables ' Me.lblSelectedVariables.AutoSize = True Me.lblSelectedVariables.ImeMode = System.Windows.Forms.ImeMode.NoControl - Me.lblSelectedVariables.Location = New System.Drawing.Point(255, 75) + Me.lblSelectedVariables.Location = New System.Drawing.Point(260, 73) Me.lblSelectedVariables.Name = "lblSelectedVariables" Me.lblSelectedVariables.Size = New System.Drawing.Size(53, 13) - Me.lblSelectedVariables.TabIndex = 4 + Me.lblSelectedVariables.TabIndex = 38 Me.lblSelectedVariables.Tag = "" Me.lblSelectedVariables.Text = "Variables:" ' - 'ucrSaveModel + 'lblFirstColumn ' - Me.ucrSaveModel.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink - Me.ucrSaveModel.Location = New System.Drawing.Point(14, 335) - Me.ucrSaveModel.Margin = New System.Windows.Forms.Padding(4, 5, 4, 5) - Me.ucrSaveModel.Name = "ucrSaveModel" - Me.ucrSaveModel.Size = New System.Drawing.Size(266, 24) - Me.ucrSaveModel.TabIndex = 15 + Me.lblFirstColumn.AutoSize = True + Me.lblFirstColumn.ImeMode = System.Windows.Forms.ImeMode.NoControl + Me.lblFirstColumn.Location = New System.Drawing.Point(260, 73) + Me.lblFirstColumn.Name = "lblFirstColumn" + Me.lblFirstColumn.Size = New System.Drawing.Size(70, 13) + Me.lblFirstColumn.TabIndex = 39 + Me.lblFirstColumn.Tag = "First_column" + Me.lblFirstColumn.Text = "First Variable:" + ' + 'ucrSaveFashionModel + ' + Me.ucrSaveFashionModel.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink + Me.ucrSaveFashionModel.Location = New System.Drawing.Point(9, 512) + Me.ucrSaveFashionModel.Margin = New System.Windows.Forms.Padding(4, 5, 4, 5) + Me.ucrSaveFashionModel.Name = "ucrSaveFashionModel" + Me.ucrSaveFashionModel.Size = New System.Drawing.Size(266, 24) + Me.ucrSaveFashionModel.TabIndex = 66 + ' + 'ucrSaveCorrelation + ' + Me.ucrSaveCorrelation.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink + Me.ucrSaveCorrelation.Location = New System.Drawing.Point(9, 512) + Me.ucrSaveCorrelation.Margin = New System.Windows.Forms.Padding(4, 5, 4, 5) + Me.ucrSaveCorrelation.Name = "ucrSaveCorrelation" + Me.ucrSaveCorrelation.Size = New System.Drawing.Size(266, 24) + Me.ucrSaveCorrelation.TabIndex = 65 + ' + 'ucrChkAbsolute + ' + Me.ucrChkAbsolute.AutoSize = True + Me.ucrChkAbsolute.Checked = False + Me.ucrChkAbsolute.Location = New System.Drawing.Point(266, 444) + Me.ucrChkAbsolute.Name = "ucrChkAbsolute" + Me.ucrChkAbsolute.Size = New System.Drawing.Size(117, 23) + Me.ucrChkAbsolute.TabIndex = 62 + ' + 'ucrInputRearrange + ' + Me.ucrInputRearrange.AddQuotesIfUnrecognised = True + Me.ucrInputRearrange.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink + Me.ucrInputRearrange.GetSetSelectedIndex = -1 + Me.ucrInputRearrange.IsReadOnly = False + Me.ucrInputRearrange.Location = New System.Drawing.Point(175, 443) + Me.ucrInputRearrange.Name = "ucrInputRearrange" + Me.ucrInputRearrange.Size = New System.Drawing.Size(79, 21) + Me.ucrInputRearrange.TabIndex = 60 + ' + 'ucrChkRearrange + ' + Me.ucrChkRearrange.AutoSize = True + Me.ucrChkRearrange.Checked = False + Me.ucrChkRearrange.Location = New System.Drawing.Point(17, 445) + Me.ucrChkRearrange.Name = "ucrChkRearrange" + Me.ucrChkRearrange.Size = New System.Drawing.Size(96, 23) + Me.ucrChkRearrange.TabIndex = 59 + ' + 'ucrInputDisplayNas + ' + Me.ucrInputDisplayNas.AddQuotesIfUnrecognised = True + Me.ucrInputDisplayNas.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink + Me.ucrInputDisplayNas.GetSetSelectedIndex = -1 + Me.ucrInputDisplayNas.IsReadOnly = False + Me.ucrInputDisplayNas.Location = New System.Drawing.Point(127, 390) + Me.ucrInputDisplayNas.Name = "ucrInputDisplayNas" + Me.ucrInputDisplayNas.Size = New System.Drawing.Size(51, 21) + Me.ucrInputDisplayNas.TabIndex = 57 + ' + 'ucrChkLeadingZeros + ' + Me.ucrChkLeadingZeros.AutoSize = True + Me.ucrChkLeadingZeros.Checked = False + Me.ucrChkLeadingZeros.Location = New System.Drawing.Point(17, 417) + Me.ucrChkLeadingZeros.Name = "ucrChkLeadingZeros" + Me.ucrChkLeadingZeros.Size = New System.Drawing.Size(115, 23) + Me.ucrChkLeadingZeros.TabIndex = 55 + ' + 'ucrNudDecimalPlaces + ' + Me.ucrNudDecimalPlaces.AutoSize = True + Me.ucrNudDecimalPlaces.DecimalPlaces = New Decimal(New Integer() {0, 0, 0, 0}) + Me.ucrNudDecimalPlaces.Increment = New Decimal(New Integer() {1, 0, 0, 0}) + Me.ucrNudDecimalPlaces.Location = New System.Drawing.Point(127, 365) + Me.ucrNudDecimalPlaces.Maximum = New Decimal(New Integer() {100, 0, 0, 0}) + Me.ucrNudDecimalPlaces.Minimum = New Decimal(New Integer() {0, 0, 0, 0}) + Me.ucrNudDecimalPlaces.Name = "ucrNudDecimalPlaces" + Me.ucrNudDecimalPlaces.Size = New System.Drawing.Size(50, 20) + Me.ucrNudDecimalPlaces.TabIndex = 52 + Me.ucrNudDecimalPlaces.Value = New Decimal(New Integer() {0, 0, 0, 0}) ' - 'ucrNudConfidenceInterval + 'ucrPnlColumns ' - Me.ucrNudConfidenceInterval.AutoSize = True - Me.ucrNudConfidenceInterval.DecimalPlaces = New Decimal(New Integer() {0, 0, 0, 0}) - Me.ucrNudConfidenceInterval.Increment = New Decimal(New Integer() {1, 0, 0, 0}) - Me.ucrNudConfidenceInterval.Location = New System.Drawing.Point(130, 283) - Me.ucrNudConfidenceInterval.Maximum = New Decimal(New Integer() {100, 0, 0, 0}) - Me.ucrNudConfidenceInterval.Minimum = New Decimal(New Integer() {0, 0, 0, 0}) - Me.ucrNudConfidenceInterval.Name = "ucrNudConfidenceInterval" - Me.ucrNudConfidenceInterval.Size = New System.Drawing.Size(50, 20) - Me.ucrNudConfidenceInterval.TabIndex = 13 - Me.ucrNudConfidenceInterval.Value = New Decimal(New Integer() {0, 0, 0, 0}) + Me.ucrPnlColumns.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink + Me.ucrPnlColumns.Location = New System.Drawing.Point(88, 4) + Me.ucrPnlColumns.Name = "ucrPnlColumns" + Me.ucrPnlColumns.Size = New System.Drawing.Size(280, 36) + Me.ucrPnlColumns.TabIndex = 34 ' - 'ucrChkCorrelationMatrix + 'ucrPnlMethod ' - Me.ucrChkCorrelationMatrix.AutoSize = True - Me.ucrChkCorrelationMatrix.Checked = False - Me.ucrChkCorrelationMatrix.Location = New System.Drawing.Point(14, 309) - Me.ucrChkCorrelationMatrix.Name = "ucrChkCorrelationMatrix" - Me.ucrChkCorrelationMatrix.Size = New System.Drawing.Size(283, 23) - Me.ucrChkCorrelationMatrix.TabIndex = 14 + Me.ucrPnlMethod.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink + Me.ucrPnlMethod.Location = New System.Drawing.Point(8, 13) + Me.ucrPnlMethod.Name = "ucrPnlMethod" + Me.ucrPnlMethod.Size = New System.Drawing.Size(229, 24) + Me.ucrPnlMethod.TabIndex = 0 ' - 'ucrPnlColumns + 'ucrPnlCompletePairwise ' - Me.ucrPnlColumns.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink - Me.ucrPnlColumns.Location = New System.Drawing.Point(86, 6) - Me.ucrPnlColumns.Name = "ucrPnlColumns" - Me.ucrPnlColumns.Size = New System.Drawing.Size(284, 36) - Me.ucrPnlColumns.TabIndex = 0 + Me.ucrPnlCompletePairwise.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink + Me.ucrPnlCompletePairwise.Location = New System.Drawing.Point(6, 13) + Me.ucrPnlCompletePairwise.Name = "ucrPnlCompletePairwise" + Me.ucrPnlCompletePairwise.Size = New System.Drawing.Size(146, 49) + Me.ucrPnlCompletePairwise.TabIndex = 0 + ' + 'ucrSelectorCorrelation + ' + Me.ucrSelectorCorrelation.AutoSize = True + Me.ucrSelectorCorrelation.bDropUnusedFilterLevels = False + Me.ucrSelectorCorrelation.bShowHiddenColumns = False + Me.ucrSelectorCorrelation.bUseCurrentFilter = True + Me.ucrSelectorCorrelation.Location = New System.Drawing.Point(9, 52) + Me.ucrSelectorCorrelation.Margin = New System.Windows.Forms.Padding(0) + Me.ucrSelectorCorrelation.Name = "ucrSelectorCorrelation" + Me.ucrSelectorCorrelation.Size = New System.Drawing.Size(213, 183) + Me.ucrSelectorCorrelation.TabIndex = 37 + ' + 'ucrBase + ' + Me.ucrBase.AutoSize = True + Me.ucrBase.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink + Me.ucrBase.Location = New System.Drawing.Point(11, 540) + Me.ucrBase.Name = "ucrBase" + Me.ucrBase.Size = New System.Drawing.Size(405, 52) + Me.ucrBase.TabIndex = 50 + ' + 'ucrChkDisplayAsDataFrame + ' + Me.ucrChkDisplayAsDataFrame.AutoSize = True + Me.ucrChkDisplayAsDataFrame.Checked = False + Me.ucrChkDisplayAsDataFrame.Location = New System.Drawing.Point(168, 128) + Me.ucrChkDisplayAsDataFrame.Name = "ucrChkDisplayAsDataFrame" + Me.ucrChkDisplayAsDataFrame.Size = New System.Drawing.Size(162, 23) + Me.ucrChkDisplayAsDataFrame.TabIndex = 63 + ' + 'ucrChkShave + ' + Me.ucrChkShave.AutoSize = True + Me.ucrChkShave.Checked = False + Me.ucrChkShave.Location = New System.Drawing.Point(8, 128) + Me.ucrChkShave.Name = "ucrChkShave" + Me.ucrChkShave.Size = New System.Drawing.Size(154, 23) + Me.ucrChkShave.TabIndex = 26 + ' + 'ucrSaveCorrelationTest + ' + Me.ucrSaveCorrelationTest.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink + Me.ucrSaveCorrelationTest.Location = New System.Drawing.Point(9, 512) + Me.ucrSaveCorrelationTest.Margin = New System.Windows.Forms.Padding(4, 5, 4, 5) + Me.ucrSaveCorrelationTest.Name = "ucrSaveCorrelationTest" + Me.ucrSaveCorrelationTest.Size = New System.Drawing.Size(266, 24) + Me.ucrSaveCorrelationTest.TabIndex = 48 ' 'ucrReceiverMultipleColumns ' @@ -311,20 +466,20 @@ Partial Class dlgCorrelation Me.ucrReceiverMultipleColumns.Selector = Nothing Me.ucrReceiverMultipleColumns.Size = New System.Drawing.Size(120, 100) Me.ucrReceiverMultipleColumns.strNcFilePath = "" - Me.ucrReceiverMultipleColumns.TabIndex = 7 + Me.ucrReceiverMultipleColumns.TabIndex = 41 Me.ucrReceiverMultipleColumns.ucrSelector = Nothing ' 'ucrReceiverSecondColumn ' Me.ucrReceiverSecondColumn.AutoSize = True Me.ucrReceiverSecondColumn.frmParent = Me - Me.ucrReceiverSecondColumn.Location = New System.Drawing.Point(258, 142) + Me.ucrReceiverSecondColumn.Location = New System.Drawing.Point(258, 137) Me.ucrReceiverSecondColumn.Margin = New System.Windows.Forms.Padding(0) Me.ucrReceiverSecondColumn.Name = "ucrReceiverSecondColumn" Me.ucrReceiverSecondColumn.Selector = Nothing Me.ucrReceiverSecondColumn.Size = New System.Drawing.Size(120, 20) Me.ucrReceiverSecondColumn.strNcFilePath = "" - Me.ucrReceiverSecondColumn.TabIndex = 9 + Me.ucrReceiverSecondColumn.TabIndex = 43 Me.ucrReceiverSecondColumn.ucrSelector = Nothing ' 'ucrReceiverFirstColumn @@ -337,54 +492,77 @@ Partial Class dlgCorrelation Me.ucrReceiverFirstColumn.Selector = Nothing Me.ucrReceiverFirstColumn.Size = New System.Drawing.Size(120, 20) Me.ucrReceiverFirstColumn.strNcFilePath = "" - Me.ucrReceiverFirstColumn.TabIndex = 6 + Me.ucrReceiverFirstColumn.TabIndex = 40 Me.ucrReceiverFirstColumn.ucrSelector = Nothing ' - 'ucrSelectorCorrelation + 'ucrNudConfidenceInterval ' - Me.ucrSelectorCorrelation.AutoSize = True - Me.ucrSelectorCorrelation.bDropUnusedFilterLevels = False - Me.ucrSelectorCorrelation.bShowHiddenColumns = False - Me.ucrSelectorCorrelation.bUseCurrentFilter = True - Me.ucrSelectorCorrelation.Location = New System.Drawing.Point(10, 40) - Me.ucrSelectorCorrelation.Margin = New System.Windows.Forms.Padding(0) - Me.ucrSelectorCorrelation.Name = "ucrSelectorCorrelation" - Me.ucrSelectorCorrelation.Size = New System.Drawing.Size(213, 183) - Me.ucrSelectorCorrelation.TabIndex = 3 + Me.ucrNudConfidenceInterval.AutoSize = True + Me.ucrNudConfidenceInterval.DecimalPlaces = New Decimal(New Integer() {0, 0, 0, 0}) + Me.ucrNudConfidenceInterval.Increment = New Decimal(New Integer() {1, 0, 0, 0}) + Me.ucrNudConfidenceInterval.Location = New System.Drawing.Point(127, 309) + Me.ucrNudConfidenceInterval.Maximum = New Decimal(New Integer() {100, 0, 0, 0}) + Me.ucrNudConfidenceInterval.Minimum = New Decimal(New Integer() {0, 0, 0, 0}) + Me.ucrNudConfidenceInterval.Name = "ucrNudConfidenceInterval" + Me.ucrNudConfidenceInterval.Size = New System.Drawing.Size(50, 20) + Me.ucrNudConfidenceInterval.TabIndex = 47 + Me.ucrNudConfidenceInterval.Value = New Decimal(New Integer() {0, 0, 0, 0}) ' - 'ucrBase + 'ucrSaveFashionDataFrame ' - Me.ucrBase.AutoSize = True - Me.ucrBase.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink - Me.ucrBase.Location = New System.Drawing.Point(14, 361) - Me.ucrBase.Name = "ucrBase" - Me.ucrBase.Size = New System.Drawing.Size(405, 52) - Me.ucrBase.TabIndex = 17 + Me.ucrSaveFashionDataFrame.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink + Me.ucrSaveFashionDataFrame.Location = New System.Drawing.Point(9, 512) + Me.ucrSaveFashionDataFrame.Margin = New System.Windows.Forms.Padding(4, 5, 4, 5) + Me.ucrSaveFashionDataFrame.Name = "ucrSaveFashionDataFrame" + Me.ucrSaveFashionDataFrame.Size = New System.Drawing.Size(266, 24) + Me.ucrSaveFashionDataFrame.TabIndex = 67 + ' + 'ucrChkDisplayOptions + ' + Me.ucrChkDisplayOptions.AutoSize = True + Me.ucrChkDisplayOptions.Checked = False + Me.ucrChkDisplayOptions.Location = New System.Drawing.Point(9, 311) + Me.ucrChkDisplayOptions.Name = "ucrChkDisplayOptions" + Me.ucrChkDisplayOptions.Size = New System.Drawing.Size(192, 23) + Me.ucrChkDisplayOptions.TabIndex = 64 ' 'dlgCorrelation ' 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(436, 416) - Me.Controls.Add(Me.lblSelectedVariables) - Me.Controls.Add(Me.ucrNudConfidenceInterval) - Me.Controls.Add(Me.ucrChkCorrelationMatrix) + Me.ClientSize = New System.Drawing.Size(438, 596) + Me.Controls.Add(Me.ucrSaveFashionModel) + Me.Controls.Add(Me.ucrSaveCorrelation) + Me.Controls.Add(Me.ucrChkAbsolute) + Me.Controls.Add(Me.lblMethod) + Me.Controls.Add(Me.ucrInputRearrange) + Me.Controls.Add(Me.ucrChkRearrange) + Me.Controls.Add(Me.ucrInputDisplayNas) + Me.Controls.Add(Me.lblDisplayNas) + Me.Controls.Add(Me.ucrChkLeadingZeros) + Me.Controls.Add(Me.lblDecimalPlaces) + Me.Controls.Add(Me.ucrNudDecimalPlaces) Me.Controls.Add(Me.rdoTwoColumns) Me.Controls.Add(Me.rdoMultipleColumns) Me.Controls.Add(Me.ucrPnlColumns) Me.Controls.Add(Me.grpMethod) - Me.Controls.Add(Me.ucrReceiverMultipleColumns) - Me.Controls.Add(Me.lblConfInterval) Me.Controls.Add(Me.grpMissing) Me.Controls.Add(Me.cmdOptions) - Me.Controls.Add(Me.lblSecondColumn) + Me.Controls.Add(Me.ucrSelectorCorrelation) + Me.Controls.Add(Me.ucrBase) + Me.Controls.Add(Me.grpDisplayOptions) + Me.Controls.Add(Me.ucrSaveCorrelationTest) + Me.Controls.Add(Me.lblSelectedVariables) Me.Controls.Add(Me.lblFirstColumn) + Me.Controls.Add(Me.ucrReceiverMultipleColumns) Me.Controls.Add(Me.ucrReceiverSecondColumn) Me.Controls.Add(Me.ucrReceiverFirstColumn) - Me.Controls.Add(Me.ucrSelectorCorrelation) - Me.Controls.Add(Me.ucrBase) - Me.Controls.Add(Me.ucrSaveModel) + Me.Controls.Add(Me.lblSecondColumn) + Me.Controls.Add(Me.ucrSaveFashionDataFrame) + Me.Controls.Add(Me.ucrChkDisplayOptions) + Me.Controls.Add(Me.lblConfInterval) + Me.Controls.Add(Me.ucrNudConfidenceInterval) Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow Me.MaximizeBox = False Me.MinimizeBox = False @@ -396,33 +574,51 @@ Partial Class dlgCorrelation Me.grpMethod.PerformLayout() Me.grpMissing.ResumeLayout(False) Me.grpMissing.PerformLayout() + Me.grpDisplayOptions.ResumeLayout(False) + Me.grpDisplayOptions.PerformLayout() Me.ResumeLayout(False) Me.PerformLayout() End Sub - Friend WithEvents ucrBase As ucrButtons - Friend WithEvents ucrSelectorCorrelation As ucrSelectorByDataFrameAddRemove - Friend WithEvents ucrReceiverFirstColumn As ucrReceiverSingle - Friend WithEvents ucrReceiverSecondColumn As ucrReceiverSingle - Friend WithEvents lblFirstColumn As Label - Friend WithEvents lblSecondColumn As Label - Friend WithEvents grpMethod As GroupBox - Friend WithEvents rdoSpearman As RadioButton - Friend WithEvents rdoKendall As RadioButton - Friend WithEvents rdoPearson As RadioButton - Friend WithEvents cmdOptions As Button - Friend WithEvents grpMissing As GroupBox - Friend WithEvents rdoPairwise As RadioButton + + Friend WithEvents ucrChkDisplayOptions As ucrCheck + Friend WithEvents ucrChkAbsolute As ucrCheck + Friend WithEvents ucrChkShave As ucrCheck Friend WithEvents rdoCompleteRowsOnly As RadioButton - Friend WithEvents lblConfInterval As Label - Friend WithEvents ucrReceiverMultipleColumns As ucrReceiverMultiple + Friend WithEvents rdoPairwise As RadioButton + Friend WithEvents ucrPnlCompletePairwise As UcrPanel + Friend WithEvents lblMethod As Label + Friend WithEvents ucrInputRearrange As ucrInputComboBox + Friend WithEvents ucrChkRearrange As ucrCheck + Friend WithEvents ucrInputDisplayNas As ucrInputComboBox + Friend WithEvents lblDisplayNas As Label + Friend WithEvents ucrChkLeadingZeros As ucrCheck + Friend WithEvents lblDecimalPlaces As Label + Friend WithEvents ucrNudDecimalPlaces As ucrNud Friend WithEvents rdoTwoColumns As RadioButton Friend WithEvents rdoMultipleColumns As RadioButton Friend WithEvents ucrPnlColumns As UcrPanel - Friend WithEvents ucrChkCorrelationMatrix As ucrCheck + Friend WithEvents grpMethod As GroupBox + Friend WithEvents rdoKendall As RadioButton + Friend WithEvents rdoPearson As RadioButton + Friend WithEvents rdoSpearman As RadioButton Friend WithEvents ucrPnlMethod As UcrPanel - Friend WithEvents ucrPnlCompletePairwise As UcrPanel + Friend WithEvents grpMissing As GroupBox + Friend WithEvents cmdOptions As Button + Friend WithEvents ucrSelectorCorrelation As ucrSelectorByDataFrameAddRemove + Friend WithEvents ucrBase As ucrButtons + Friend WithEvents grpDisplayOptions As GroupBox + Friend WithEvents ucrSaveCorrelationTest As ucrSave Friend WithEvents ucrNudConfidenceInterval As ucrNud - Friend WithEvents ucrSaveModel As ucrSave + Friend WithEvents lblConfInterval As Label + Friend WithEvents ucrReceiverMultipleColumns As ucrReceiverMultiple + Friend WithEvents ucrReceiverSecondColumn As ucrReceiverSingle + Friend WithEvents lblSecondColumn As Label Friend WithEvents lblSelectedVariables As Label + Friend WithEvents ucrReceiverFirstColumn As ucrReceiverSingle + Friend WithEvents lblFirstColumn As Label + Friend WithEvents ucrChkDisplayAsDataFrame As ucrCheck + Friend WithEvents ucrSaveCorrelation As ucrSave + Friend WithEvents ucrSaveFashionDataFrame As ucrSave + Friend WithEvents ucrSaveFashionModel As ucrSave End Class \ No newline at end of file diff --git a/instat/dlgCorrelation.vb b/instat/dlgCorrelation.vb index 7e63813ce77..4547f648313 100644 --- a/instat/dlgCorrelation.vb +++ b/instat/dlgCorrelation.vb @@ -18,10 +18,13 @@ Imports instat.Translations Public Class dlgCorrelation Private bFirstload As Boolean = True Private bReset As Boolean = True + Private bRcodeSet As Boolean = True Private clsCorrelationTestFunction, clsRGGcorrGraphicsFunction, clsRGGscatMatrixFunction, clsCorrelationFunction, clsCurrentDataFrameFunction, - clsGuidesFunction, clsGuideLegendFunction, clsDummyFunction As New RFunction + clsGuidesFunction, clsGuideLegendFunction, clsDummyFunction, clsFashionModelFunction, + clsFashionDataFrameFunction, clsShaveFunction, clsRearrangeFunction As New RFunction Private clsRGraphicsFuction, clsListFunction, clsWrapFunction As New RFunction + Private clsDummyShave As New RFunction Private clsRGGscatMatricReverseOperator As New ROperator Private strColFunction As String Private bResetSubdialog As Boolean = False @@ -44,8 +47,12 @@ Public Class dlgCorrelation End Sub Private Sub InitialiseDialog() + Dim dctNaPrint As New Dictionary(Of String, String) + Dim dctDiagonal As New Dictionary(Of String, String) + Dim dctMethod As New Dictionary(Of String, String) + ucrBase.iHelpTopicID = 421 - ucrBase.clsRsyntax.iCallType = 2 + ucrBase.clsRsyntax.bExcludeAssignedFunctionOutput = False ucrReceiverFirstColumn.SetParameter(New RParameter("x", 0)) ucrReceiverFirstColumn.SetParameterIsRFunction() @@ -65,7 +72,6 @@ Public Class dlgCorrelation ucrReceiverMultipleColumns.Selector = ucrSelectorCorrelation ucrReceiverMultipleColumns.strSelectorHeading = "Numerics" ucrReceiverMultipleColumns.SetParameterIsRFunction() - ' cor accepts numeric and logical columns ucrReceiverMultipleColumns.SetIncludedDataTypes({"numeric", "logical"}) ucrBase.clsRsyntax.bExcludeAssignedFunctionOutput = False @@ -76,10 +82,30 @@ Public Class dlgCorrelation ucrNudConfidenceInterval.Increment = 0.05 ucrNudConfidenceInterval.SetRDefault(0.95) + ucrNudDecimalPlaces.SetParameter(New RParameter("decimals", 1)) + ucrNudDecimalPlaces.SetMinMax(0, 5) + ucrNudDecimalPlaces.Increment = 1 + ucrNudDecimalPlaces.SetRDefault(2) + + ucrChkLeadingZeros.SetParameter(New RParameter("leading_zeros", 2)) + ucrChkLeadingZeros.SetText("Leading Zeros") + ucrChkLeadingZeros.SetValuesCheckedAndUnchecked("TRUE", "FALSE") + + ucrChkShave.SetText("Shave") + ucrChkShave.SetParameter(New RParameter("checked", 0)) + ucrChkShave.SetValuesCheckedAndUnchecked("TRUE", "FALSE") + + ucrInputDisplayNas.SetParameter(New RParameter("na_print", 3)) + dctNaPrint.Add("blank", Chr(34) & " " & Chr(34)) + dctNaPrint.Add("NA", "NA") + dctNaPrint.Add("1", Chr(34) & 1 & Chr(34)) + ucrInputDisplayNas.SetItems(dctNaPrint) + ucrInputDisplayNas.AddQuotesIfUnrecognised = False + ucrPnlColumns.AddRadioButton(rdoTwoColumns) ucrPnlColumns.AddRadioButton(rdoMultipleColumns) ucrPnlColumns.AddFunctionNamesCondition(rdoTwoColumns, "cor.test") - ucrPnlColumns.AddFunctionNamesCondition(rdoMultipleColumns, "cor") + ucrPnlColumns.AddFunctionNamesCondition(rdoMultipleColumns, {"fashion", "shave", "rearrange", "correlate"}) ucrPnlMethod.SetParameter(New RParameter("method", 4)) ucrPnlMethod.AddRadioButton(rdoPearson, Chr(34) & "pearson" & Chr(34)) @@ -92,26 +118,87 @@ Public Class dlgCorrelation ucrPnlCompletePairwise.AddParameterValuesCondition(rdoCompleteRowsOnly, "use", Chr(34) & "complete.obs" & Chr(34)) ucrPnlCompletePairwise.AddParameterValuesCondition(rdoPairwise, "use", Chr(34) & "pairwise.complete.obs" & Chr(34)) - 'ucrChk - ucrChkCorrelationMatrix.SetText("Correlation Matrix") - ucrChkCorrelationMatrix.Enabled = False - - ucrPnlColumns.AddToLinkedControls({ucrReceiverFirstColumn, ucrNudConfidenceInterval, ucrReceiverSecondColumn}, {rdoTwoColumns}, bNewLinkedAddRemoveParameter:=True, bNewLinkedHideIfParameterMissing:=True) + ucrChkRearrange.SetText("Rearrange") + ucrChkRearrange.SetParameter(New RParameter("check", 0)) + ucrChkRearrange.SetValuesCheckedAndUnchecked("TRUE", "FALSE") + ucrChkRearrange.AddToLinkedControls(ucrInputRearrange, {True}, bNewLinkedAddRemoveParameter:=True, bNewLinkedHideIfParameterMissing:=True, bNewLinkedChangeToDefaultState:=True, objNewDefaultState:="PCA") + ucrChkRearrange.AddToLinkedControls(ucrChkAbsolute, {True}, bNewLinkedAddRemoveParameter:=True, bNewLinkedHideIfParameterMissing:=True) + + ucrChkDisplayOptions.SetText("Display Options") + ucrChkDisplayOptions.SetParameter(New RParameter("display", 0)) + ucrChkDisplayOptions.SetValuesCheckedAndUnchecked("TRUE", "FALSE") + ucrChkDisplayOptions.AddToLinkedControls({ucrChkLeadingZeros, ucrChkRearrange, ucrChkShave, ucrNudDecimalPlaces}, {True}, bNewLinkedHideIfParameterMissing:=True) + ucrChkDisplayOptions.AddToLinkedControls(ucrInputDisplayNas, {True}, bNewLinkedAddRemoveParameter:=True, bNewLinkedHideIfParameterMissing:=True, bNewLinkedChangeToDefaultState:=True, objNewDefaultState:="blank") + ucrChkDisplayOptions.AddToLinkedControls(ucrSaveCorrelation, {False}, bNewLinkedAddRemoveParameter:=True, bNewLinkedHideIfParameterMissing:=True) + ucrChkDisplayOptions.AddToLinkedControls(ucrChkDisplayAsDataFrame, {True}, bNewLinkedHideIfParameterMissing:=True, bNewLinkedAddRemoveParameter:=True) + ucrChkDisplayOptions.AddToLinkedControls(ucrSaveFashionModel, {True}, bNewLinkedAddRemoveParameter:=True, bNewLinkedHideIfParameterMissing:=True) + ucrChkShave.SetLinkedDisplayControl(grpDisplayOptions) + + ucrInputRearrange.SetParameter(New RParameter("method", 1)) + dctMethod.Add("PCA", Chr(34) & "PCA" & Chr(34)) + dctMethod.Add("HC", Chr(34) & "HC" & Chr(34)) + dctMethod.Add("Identity", Chr(34) & "Identity" & Chr(34)) + dctMethod.Add("Random", Chr(34) & "Random" & Chr(34)) + dctMethod.Add("MDS", Chr(34) & "MDS" & Chr(34)) + dctMethod.Add("R2E", Chr(34) & "R2E" & Chr(34)) + dctMethod.Add("Spectral", Chr(34) & "Spectral" & Chr(34)) + ucrInputRearrange.SetItems(dctMethod) + ucrInputRearrange.SetDropDownStyleAsNonEditable() + + ucrChkAbsolute.SetText("Absolute") + ucrChkAbsolute.SetParameter(New RParameter("absolute", 2)) + ucrChkAbsolute.SetValuesCheckedAndUnchecked("TRUE", "FALSE") + + ucrChkDisplayAsDataFrame.SetText("Display As DataFrame") + ucrChkDisplayAsDataFrame.AddParameterValuesCondition(False, "display_as_dataframe", "False") + ucrChkDisplayAsDataFrame.AddParameterValuesCondition(True, "display_as_dataframe", "True") + ucrChkDisplayAsDataFrame.AddToLinkedControls(ucrSaveFashionDataFrame, {True}, bNewLinkedAddRemoveParameter:=True, bNewLinkedHideIfParameterMissing:=True) + ucrChkDisplayAsDataFrame.AddToLinkedControls(ucrSaveFashionModel, {False}, bNewLinkedAddRemoveParameter:=True, bNewLinkedHideIfParameterMissing:=True) + + ucrPnlColumns.AddToLinkedControls({ucrReceiverFirstColumn, ucrNudConfidenceInterval, ucrSaveCorrelationTest, ucrReceiverSecondColumn}, {rdoTwoColumns}, bNewLinkedAddRemoveParameter:=True, bNewLinkedHideIfParameterMissing:=True) ucrReceiverFirstColumn.SetLinkedDisplayControl(lblFirstColumn) ucrReceiverSecondColumn.SetLinkedDisplayControl(lblSecondColumn) ucrPnlColumns.AddToLinkedControls({ucrReceiverMultipleColumns}, {rdoMultipleColumns}, bNewLinkedAddRemoveParameter:=True, bNewLinkedHideIfParameterMissing:=True) ucrReceiverMultipleColumns.SetLinkedDisplayControl(lblSelectedVariables) ucrNudConfidenceInterval.SetLinkedDisplayControl(lblConfInterval) + ucrInputDisplayNas.SetLinkedDisplayControl(lblDisplayNas) + ucrInputRearrange.SetLinkedDisplayControl(lblMethod) + ucrNudDecimalPlaces.SetLinkedDisplayControl(lblDecimalPlaces) ucrPnlColumns.AddToLinkedControls(ucrPnlCompletePairwise, {rdoMultipleColumns}, bNewLinkedAddRemoveParameter:=True, bNewLinkedHideIfParameterMissing:=True, bNewLinkedChangeToDefaultState:=True, objNewDefaultState:=rdoCompleteRowsOnly) + ucrPnlColumns.AddToLinkedControls(ucrNudDecimalPlaces, {rdoMultipleColumns}, bNewLinkedHideIfParameterMissing:=True) + ucrPnlColumns.AddToLinkedControls({ucrSaveCorrelation}, {rdoMultipleColumns}, bNewLinkedHideIfParameterMissing:=True) + ucrPnlColumns.AddToLinkedControls({ucrChkDisplayOptions}, {rdoMultipleColumns}, bNewLinkedHideIfParameterMissing:=True) + ucrPnlCompletePairwise.SetLinkedDisplayControl(grpMissing) - ucrSaveModel.SetPrefix("cor") - ucrSaveModel.SetSaveTypeAsModel() - ucrSaveModel.SetDataFrameSelector(ucrSelectorCorrelation.ucrAvailableDataFrames) - ucrSaveModel.SetCheckBoxText("Result Name") - ucrSaveModel.SetIsComboBox() - ucrSaveModel.SetAssignToIfUncheckedValue("last_model") - ucrSaveModel.Reset() + ucrSaveCorrelationTest.SetPrefix("model") + ucrSaveCorrelationTest.SetSaveTypeAsModel() + ucrSaveCorrelationTest.SetDataFrameSelector(ucrSelectorCorrelation.ucrAvailableDataFrames) + ucrSaveCorrelationTest.SetCheckBoxText("Model Name") + ucrSaveCorrelationTest.SetIsComboBox() + ucrSaveCorrelationTest.SetAssignToIfUncheckedValue("last_correlation") + + ucrSaveCorrelation.SetPrefix("my_corr") + ucrSaveCorrelation.SetSaveTypeAsModel() + ucrSaveCorrelation.SetDataFrameSelector(ucrSelectorCorrelation.ucrAvailableDataFrames) + ucrSaveCorrelation.SetCheckBoxText("Result Name") + ucrSaveCorrelation.SetIsComboBox() + ucrSaveCorrelation.SetAssignToIfUncheckedValue("last_correlation") + + ucrSaveFashionModel.SetPrefix("my_corr") + ucrSaveFashionModel.SetSaveTypeAsModel() + ucrSaveFashionModel.SetDataFrameSelector(ucrSelectorCorrelation.ucrAvailableDataFrames) + ucrSaveFashionModel.SetCheckBoxText("Result Name") + ucrSaveFashionModel.SetIsComboBox() + ucrSaveFashionModel.SetAssignToIfUncheckedValue("last_correlation") + + ucrSaveFashionDataFrame.SetPrefix("my_corr") + ucrSaveFashionDataFrame.SetSaveTypeAsDataFrame() + ucrSaveFashionDataFrame.SetDataFrameSelector(ucrSelectorCorrelation.ucrAvailableDataFrames) + ucrSaveFashionDataFrame.SetCheckBoxText("Data Name") + ucrSaveFashionDataFrame.SetIsComboBox() + ucrSaveFashionDataFrame.SetAssignToIfUncheckedValue("last_correlation") + End Sub Private Sub SetDefaults() @@ -127,13 +214,23 @@ Public Class dlgCorrelation clsGuideLegendFunction = New RFunction clsDummyFunction = New RFunction clsCurrentDataFrameFunction = New RFunction + clsFashionModelFunction = New RFunction + clsFashionDataFrameFunction = New RFunction + clsShaveFunction = New RFunction + clsDummyShave = New RFunction + clsRearrangeFunction = New RFunction bResetSubdialog = True ucrSelectorCorrelation.Reset() - ucrSaveModel.Reset() + ucrSaveCorrelationTest.Reset() + ucrSaveCorrelation.Reset() + ucrSaveFashionModel.Reset() + ucrSaveFashionDataFrame.Reset() ucrReceiverFirstColumn.SetMeAsReceiver() + ucrReceiverMultipleColumns.SetMeAsReceiver() clsDummyFunction.AddParameter("checked", "none", iPosition:=0) + clsDummyFunction.AddParameter("display_as_dataframe", "False", iPosition:=1) clsRGGscatMatricReverseOperator.SetOperation("+") clsRGGscatMatricReverseOperator.AddParameter("matrix", clsRFunctionParameter:=clsRGGscatMatrixFunction, iPosition:=0) @@ -169,16 +266,39 @@ Public Class dlgCorrelation clsRGGscatMatrixFunction.AddParameter("data", clsRFunctionParameter:=clsCurrentDataFrameFunction, iPosition:=0) clsCorrelationTestFunction.SetRCommand("cor.test") - clsCorrelationTestFunction.iCallType = 2 clsCorrelationTestFunction.AddParameter("alternative", Chr(34) & "two.sided" & Chr(34)) clsCorrelationTestFunction.AddParameter("exact", "NULL") clsCorrelationTestFunction.AddParameter("conf.level", "0.95") clsCorrelationTestFunction.AddParameter("method", Chr(34) & "pearson" & Chr(34)) - clsCorrelationFunction.SetRCommand("cor") - clsCorrelationFunction.iCallType = 2 + clsCorrelationFunction.SetPackageName("corrr") + clsCorrelationFunction.SetRCommand("correlate") clsCorrelationFunction.AddParameter("use", Chr(34) & "complete.obs" & Chr(34)) + clsRearrangeFunction.SetPackageName("corrr") + clsRearrangeFunction.SetRCommand("rearrange") + clsRearrangeFunction.AddParameter("x", clsRFunctionParameter:=clsCorrelationFunction, iPosition:=0) + clsRearrangeFunction.AddParameter("method", "PCA", iPosition:=1) + clsRearrangeFunction.AddParameter("absolute", "FALSE", iPosition:=3) + + clsFashionModelFunction.SetPackageName("corrr") + clsFashionModelFunction.SetRCommand("fashion") + clsFashionModelFunction.AddParameter("x", clsRFunctionParameter:=clsCorrelationFunction, iPosition:=0) + clsFashionModelFunction.AddParameter("decimals", "2", iPosition:=1) + clsFashionModelFunction.AddParameter("leading_zeros", "FALSE", iPosition:=2) + clsFashionModelFunction.AddParameter("na_print", Chr(34) & " " & Chr(34), iPosition:=3) + + clsFashionDataFrameFunction.SetPackageName("corrr") + clsFashionDataFrameFunction.SetRCommand("fashion") + clsFashionDataFrameFunction.AddParameter("x", clsRFunctionParameter:=clsCorrelationFunction, iPosition:=0) + clsFashionDataFrameFunction.AddParameter("decimals", "2", iPosition:=1) + clsFashionDataFrameFunction.AddParameter("leading_zeros", "FALSE", iPosition:=2) + clsFashionDataFrameFunction.AddParameter("na_print", Chr(34) & " " & Chr(34), iPosition:=3) + + clsShaveFunction.SetPackageName("corrr") + clsShaveFunction.SetRCommand("shave") + clsShaveFunction.AddParameter("x", clsRFunctionParameter:=clsCorrelationFunction, iPosition:=0) + clsRGGcorrGraphicsFunction.SetPackageName("GGally") clsRGGcorrGraphicsFunction.SetRCommand("ggcorr") clsRGGcorrGraphicsFunction.iCallType = 3 @@ -186,30 +306,49 @@ Public Class dlgCorrelation clsRGGcorrGraphicsFunction.AddParameter("cor_matrix", clsRFunctionParameter:=clsCorrelationFunction) clsRGGcorrGraphicsFunction.AddParameter("data", "NULL") - clsCorrelationTestFunction.SetAssignTo("last_model", strTempDataframe:=ucrSelectorCorrelation.ucrAvailableDataFrames.cboAvailableDataFrames.Text, strTempModel:="last_model") - clsCorrelationFunction.SetAssignTo("last_model", strTempDataframe:=ucrSelectorCorrelation.ucrAvailableDataFrames.cboAvailableDataFrames.Text, strTempModel:="last_model") + clsCorrelationTestFunction.SetAssignTo("last_correlation", strTempDataframe:=ucrSelectorCorrelation.ucrAvailableDataFrames.cboAvailableDataFrames.Text, strTempModel:="last_correlation") + clsCorrelationFunction.SetAssignTo("last_correlation", strTempDataframe:=ucrSelectorCorrelation.ucrAvailableDataFrames.cboAvailableDataFrames.Text, strTempModel:="last_correlation") clsRGGcorrGraphicsFunction.SetAssignTo("last_graph", strTempDataframe:=ucrSelectorCorrelation.ucrAvailableDataFrames.cboAvailableDataFrames.Text, strTempGraph:="last_graph") clsRGraphicsFuction.SetAssignTo("last_graph", strTempDataframe:=ucrSelectorCorrelation.ucrAvailableDataFrames.cboAvailableDataFrames.Text, strTempGraph:="last_graph") + ucrBase.clsRsyntax.ClearCodes() ucrBase.clsRsyntax.SetBaseRFunction(clsCorrelationTestFunction) End Sub Private Sub SetRCodeForControls(bReset As Boolean) + bRcodeSet = False ucrPnlMethod.AddAdditionalCodeParameterPair(clsCorrelationFunction, New RParameter("method", 4), iAdditionalPairNo:=1) ucrPnlMethod.AddAdditionalCodeParameterPair(clsWrapFunction, New RParameter("method", 2), iAdditionalPairNo:=2) ucrPnlMethod.AddAdditionalCodeParameterPair(clsRGGcorrGraphicsFunction, New RParameter("method", 2), iAdditionalPairNo:=3) ucrPnlMethod.AddAdditionalCodeParameterPair(clsRGGscatMatrixFunction, New RParameter("corMethod", 4), iAdditionalPairNo:=4) + + ucrNudDecimalPlaces.AddAdditionalCodeParameterPair(clsFashionDataFrameFunction, ucrNudDecimalPlaces.GetParameter(), iAdditionalPairNo:=1) + ucrChkLeadingZeros.AddAdditionalCodeParameterPair(clsFashionDataFrameFunction, ucrChkLeadingZeros.GetParameter(), iAdditionalPairNo:=1) + ucrInputDisplayNas.AddAdditionalCodeParameterPair(clsFashionDataFrameFunction, ucrInputDisplayNas.GetParameter(), iAdditionalPairNo:=1) + ucrReceiverMultipleColumns.SetRCode(clsCorrelationFunction, bReset) ucrNudConfidenceInterval.SetRCode(clsCorrelationTestFunction, bReset) ucrReceiverFirstColumn.SetRCode(clsCorrelationTestFunction, bReset) ucrReceiverSecondColumn.SetRCode(clsCorrelationTestFunction, bReset) + ucrNudDecimalPlaces.SetRCode(clsFashionModelFunction, bReset) + ucrChkLeadingZeros.SetRCode(clsFashionModelFunction, bReset) + ucrInputDisplayNas.SetRCode(clsFashionModelFunction, bReset) + ucrInputRearrange.SetRCode(clsRearrangeFunction, bReset) + ucrChkRearrange.SetRCode(clsDummyShave, bReset) + ucrChkAbsolute.SetRCode(clsRearrangeFunction, bReset) + ucrChkShave.SetRCode(clsDummyShave, bReset) + ucrChkDisplayOptions.SetRCode(clsDummyShave, bReset) + ucrChkDisplayAsDataFrame.SetRCode(clsDummyFunction, bReset) If bReset Then - ucrPnlColumns.SetRCode(clsCorrelationTestFunction, bReset) + ucrPnlColumns.SetRCode(clsFashionModelFunction, bReset) End If ucrPnlMethod.SetRCode(clsCorrelationTestFunction, bReset) ucrPnlCompletePairwise.SetRCode(clsCorrelationFunction, bReset) - ucrSaveModel.AddAdditionalRCode(clsCorrelationTestFunction, 1) - ucrSaveModel.SetRCode(clsCorrelationFunction, bReset) + ucrSaveFashionModel.SetRCode(clsFashionModelFunction, bReset) + ucrSaveFashionDataFrame.SetRCode(clsFashionDataFrameFunction, bReset) + ucrSaveCorrelationTest.SetRCode(clsCorrelationTestFunction, bReset) + ucrSaveCorrelation.SetRCode(clsCorrelationFunction, bReset) + bRcodeSet = True End Sub Private Sub SetDefaultColumn() @@ -228,15 +367,42 @@ Public Class dlgCorrelation Public Sub TestOKEnabled() If rdoTwoColumns.Checked Then - If (Not ucrReceiverFirstColumn.IsEmpty()) AndAlso (Not ucrReceiverSecondColumn.IsEmpty()) AndAlso (rdoPearson.Checked = True Or rdoKendall.Checked = True Or rdoSpearman.Checked = True) Then + If Not ucrReceiverFirstColumn.IsEmpty AndAlso Not ucrReceiverSecondColumn.IsEmpty AndAlso + ucrSaveCorrelationTest.IsComplete Then ucrBase.OKEnabled(True) Else ucrBase.OKEnabled(False) End If - ElseIf rdoMultipleColumns.Checked AndAlso ucrReceiverMultipleColumns.lstSelectedVariables.Items.Count > 1 AndAlso (rdoCompleteRowsOnly.Checked OrElse rdoPairwise.Checked) AndAlso (rdoPearson.Checked OrElse rdoKendall.Checked OrElse rdoSpearman.Checked) Then - ucrBase.OKEnabled(True) Else - ucrBase.OKEnabled(False) + If ucrReceiverMultipleColumns.lstSelectedVariables.Items.Count > 1 Then + If ucrChkDisplayOptions.Checked Then + If ucrNudDecimalPlaces.GetText <> "" Then + If ucrChkDisplayAsDataFrame.Checked Then + If ucrSaveFashionDataFrame.IsComplete() Then + ucrBase.OKEnabled(True) + Else + ucrBase.OKEnabled(False) + End If + Else + If ucrSaveFashionModel.IsComplete Then + ucrBase.OKEnabled(True) + Else + ucrBase.OKEnabled(False) + End If + End If + Else + ucrBase.OKEnabled(False) + End If + Else + If ucrSaveCorrelation.IsComplete Then + ucrBase.OKEnabled(True) + Else + ucrBase.OKEnabled(False) + End If + End If + Else + ucrBase.OKEnabled(False) + End If End If End Sub @@ -255,14 +421,6 @@ Public Class dlgCorrelation bResetSubdialog = False End Sub - Private Sub ucrBase_BeforeClickOk(sender As Object, e As EventArgs) Handles ucrBase.BeforeClickOk - If rdoTwoColumns.Checked Then - ucrBase.clsRsyntax.SetBaseRFunction(clsCorrelationTestFunction) - ElseIf rdoMultipleColumns.Checked Then - ucrBase.clsRsyntax.SetBaseRFunction(clsCorrelationFunction) - End If - End Sub - ' This is here because otherwise the panel cannot be set up correctly if you reopen the dialog when on the 2-variable rdo button Private Sub ucrPnlCompletePairwise_ControlValueChanged(ucrChangedControl As ucrCore) Handles ucrPnlCompletePairwise.ControlValueChanged If rdoPairwise.Checked Then @@ -280,13 +438,38 @@ Public Class dlgCorrelation ucrReceiverMultipleColumns.SetMeAsReceiver() End If ReceiverColumns() + ChangeBaseFunction() + End Sub + + Private Sub ChangeBaseFunction() + If rdoMultipleColumns.Checked Then + If ucrChkDisplayOptions.Checked Then + If ucrChkDisplayAsDataFrame.Checked Then + ucrBase.clsRsyntax.SetBaseRFunction(clsFashionDataFrameFunction) + ucrBase.clsRsyntax.iCallType = 0 + Else + ucrBase.clsRsyntax.SetBaseRFunction(clsFashionModelFunction) + ucrBase.clsRsyntax.iCallType = 2 + End If + Else + ucrBase.clsRsyntax.SetBaseRFunction(clsCorrelationFunction) + ucrBase.clsRsyntax.iCallType = 2 + End If + Else + ucrBase.clsRsyntax.SetBaseRFunction(clsCorrelationTestFunction) + ucrBase.clsRsyntax.iCallType = 2 + End If End Sub Private Sub ucrReceiverMultipleColumns_ControlValueChanged(ucrChangedControl As ucrCore) Handles ucrReceiverMultipleColumns.ControlValueChanged, ucrReceiverFirstColumn.ControlValueChanged, ucrReceiverSecondColumn.ControlValueChanged ReceiverColumns() End Sub - Private Sub ucrReceiverFirstColumn_ControlContentsChanged(ucrChangedControl As ucrCore) Handles ucrReceiverFirstColumn.ControlContentsChanged, ucrReceiverSecondColumn.ControlContentsChanged, ucrReceiverMultipleColumns.ControlContentsChanged, ucrPnlColumns.ControlContentsChanged, ucrPnlCompletePairwise.ControlContentsChanged, ucrPnlMethod.ControlContentsChanged + Private Sub ucrReceiverFirstColumn_ControlContentsChanged(ucrChangedControl As ucrCore) Handles ucrReceiverFirstColumn.ControlContentsChanged, + ucrReceiverSecondColumn.ControlContentsChanged, ucrReceiverMultipleColumns.ControlContentsChanged, ucrPnlColumns.ControlContentsChanged, + ucrPnlCompletePairwise.ControlContentsChanged, ucrPnlMethod.ControlContentsChanged, ucrChkShave.ControlContentsChanged, ucrSaveFashionModel.ControlContentsChanged, + ucrSaveCorrelation.ControlContentsChanged, ucrSaveFashionDataFrame.ControlContentsChanged, ucrSaveCorrelationTest.ControlContentsChanged, + ucrNudDecimalPlaces.ControlContentsChanged, ucrChkDisplayAsDataFrame.ControlContentsChanged TestOKEnabled() End Sub @@ -296,7 +479,6 @@ Public Class dlgCorrelation Private Sub ReceiverColumns() Dim strTwoColumns As String - If rdoTwoColumns.Checked Then strTwoColumns = "c(" & ucrReceiverFirstColumn.GetVariableNames() & ", " & ucrReceiverSecondColumn.GetVariableNames() & ")" clsRGraphicsFuction.AddParameter("columns", strTwoColumns, iPosition:=1) @@ -306,4 +488,51 @@ Public Class dlgCorrelation clsRGGscatMatrixFunction.AddParameter("columns", ucrReceiverMultipleColumns.GetVariableNames(), iPosition:=1) End If End Sub + + Private Sub DisplayOptions() + If ucrChkDisplayOptions.Checked Then + If ucrChkShave.Checked Then + clsFashionModelFunction.AddParameter("x", clsRFunctionParameter:=clsShaveFunction, iPosition:=0) + clsFashionDataFrameFunction.AddParameter("x", clsRFunctionParameter:=clsShaveFunction, iPosition:=0) + ElseIf ucrChkRearrange.Checked Then + clsRearrangeFunction.AddParameter("x", clsRFunctionParameter:=clsCorrelationFunction, iPosition:=0) + clsFashionModelFunction.AddParameter("x", clsRFunctionParameter:=clsRearrangeFunction, iPosition:=0) + clsFashionDataFrameFunction.AddParameter("x", clsRFunctionParameter:=clsRearrangeFunction, iPosition:=0) + Else + clsFashionModelFunction.AddParameter("x", clsRFunctionParameter:=clsCorrelationFunction, iPosition:=0) + clsFashionDataFrameFunction.AddParameter("x", clsRFunctionParameter:=clsCorrelationFunction, iPosition:=0) + End If + If ucrChkShave.Checked AndAlso ucrChkRearrange.Checked Then + clsShaveFunction.AddParameter("x", clsRFunctionParameter:=clsRearrangeFunction, iPosition:=0) + clsFashionModelFunction.AddParameter("x", clsRFunctionParameter:=clsShaveFunction, iPosition:=0) + clsFashionDataFrameFunction.AddParameter("x", clsRFunctionParameter:=clsShaveFunction, iPosition:=0) + Else + clsShaveFunction.AddParameter("x", clsRFunctionParameter:=clsCorrelationFunction, iPosition:=0) + End If + End If + End Sub + + Private Sub ucrChkDisplayOptions_ControlValueChanged(ucrChangedControl As ucrCore) Handles ucrChkDisplayOptions.ControlValueChanged, ucrChkRearrange.ControlValueChanged, ucrChkShave.ControlValueChanged, ucrChkAbsolute.ControlValueChanged, ucrChkLeadingZeros.ControlValueChanged, ucrSaveFashionModel.ControlValueChanged, ucrSaveCorrelation.ControlValueChanged, ucrInputRearrange.ControlValueChanged ', ucrChkDisplayAsDataFrame.ControlValueChanged, ucrSaveFashionDataFrame.ControlValueChanged + DisplayOptions() + ChangeBaseFunction() + + If ucrChangedControl Is ucrChkDisplayOptions Then + ChangeBaseAsModelOrDataframe() + End If + End Sub + + Private Sub ChangeBaseAsModelOrDataframe() + If bRcodeSet Then + If ucrChkDisplayAsDataFrame.Checked Then + clsDummyFunction.AddParameter("display_as_dataframe", "True", iPosition:=1) + Else + clsDummyFunction.AddParameter("display_as_dataframe", "False", iPosition:=1) + End If + End If + End Sub + + Private Sub ucrChkDisplayAsDataFrame_ControlValueChanged(ucrChangedControl As ucrCore) Handles ucrChkDisplayAsDataFrame.ControlValueChanged, ucrSaveFashionDataFrame.ControlValueChanged + ChangeBaseAsModelOrDataframe() + ChangeBaseFunction() + End Sub End Class \ No newline at end of file diff --git a/instat/dlgDefineCRI.Designer.vb b/instat/dlgDefineCRI.Designer.vb index 54a09c7e594..4b272435296 100644 --- a/instat/dlgDefineCRI.Designer.vb +++ b/instat/dlgDefineCRI.Designer.vb @@ -169,14 +169,11 @@ Partial Class dlgCorruptionDefineCRI ' Me.ucrGridWeights.AutoSize = True Me.ucrGridWeights.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle - Me.ucrGridWeights.clsReceiver = Nothing Me.ucrGridWeights.Location = New System.Drawing.Point(226, 121) Me.ucrGridWeights.Margin = New System.Windows.Forms.Padding(5) Me.ucrGridWeights.Name = "ucrGridWeights" - Me.ucrGridWeights.shtCurrSheet = Nothing Me.ucrGridWeights.Size = New System.Drawing.Size(263, 202) Me.ucrGridWeights.TabIndex = 5 - Me.ucrGridWeights.ucrChkLevels = Nothing ' 'ucrReceiverRedFlag ' diff --git a/instat/dlgDefineCRI.vb b/instat/dlgDefineCRI.vb index 6ce5435bc78..cf19f9a5b60 100644 --- a/instat/dlgDefineCRI.vb +++ b/instat/dlgDefineCRI.vb @@ -69,11 +69,10 @@ Public Class dlgCorruptionDefineCRI ucrChkScaleNumeric.Enabled = False 'grd - ucrGridWeights.SetReceiver(ucrReceiverRedFlag) - ucrGridWeights.SetAsViewerOnly() - ucrGridWeights.bIncludeLevels = False - ucrGridWeights.strExtraColumn = strWeightColumn - ucrGridWeights.AddEditableColumns({strWeightColumn}) + ucrGridWeights.SetAsNormalGridColumn(ucrReceiverRedFlag, + extraColNames:={strWeightColumn}, + editableColNames:={strWeightColumn}, + hiddenColNames:={ucrFactor.DefaultColumnNames.Level}) 'lstbox lstIndexComponents.Columns.Add("Component") @@ -152,18 +151,10 @@ Public Class dlgCorruptionDefineCRI Private Sub EnableAddButton() If Not ucrReceiverRedFlag.IsEmpty() Then - If (ucrReceiverRedFlag.strCurrDataType = "numeric" OrElse ucrReceiverRedFlag.strCurrDataType = "logical" OrElse ucrReceiverRedFlag.strCurrDataType = "integer") Then - If ucrNudWeights.GetText <> "" Then - cmdAddComponent.Enabled = True - Else - cmdAddComponent.Enabled = False - End If + If ucrReceiverRedFlag.strCurrDataType = "numeric" OrElse ucrReceiverRedFlag.strCurrDataType = "logical" OrElse ucrReceiverRedFlag.strCurrDataType = "integer" Then + cmdAddComponent.Enabled = ucrNudWeights.GetText <> "" Else - If ucrGridWeights.IsColumnComplete(strWeightColumn) Then - cmdAddComponent.Enabled = True - Else - cmdAddComponent.Enabled = False - End If + cmdAddComponent.Enabled = ucrGridWeights.IsColumnComplete({strWeightColumn}) End If Else cmdAddComponent.Enabled = False @@ -202,11 +193,11 @@ Public Class dlgCorruptionDefineCRI Dim clsTempOp As ROperator Dim clsTempFactorOp As ROperator Dim strList As String = "" - Dim iWeightColumn As Integer = -1 + Dim bFound As Boolean = False clsTempOp = New ROperator - iWeightColumn = ucrGridWeights.GetColumnIndex(strWeightColumn) + For j = 0 To lstIndexComponents.Items.Count - 1 If lstIndexComponents.Items(j).Text = ucrReceiverRedFlag.GetVariableNames(False) Then lviCondition = lstIndexComponents.Items(j) @@ -222,15 +213,19 @@ Public Class dlgCorruptionDefineCRI clsTempOp.SetOperation("*") clsTempOp.AddParameter("column", ucrReceiverRedFlag.GetVariableNames(False), iPosition:=0) clsTempOp.AddParameter("weight", ucrNudWeights.Value, iPosition:=1) - ElseIf ucrReceiverRedFlag.strCurrDataType = "factor" AndAlso iWeightColumn <> -1 Then - lviCondition.SubItems(1).Text = ucrGridWeights.GetColumnInFactorSheet(strWeightColumn, False) + ElseIf ucrReceiverRedFlag.strCurrDataType = "factor" Then + Dim iWeightColumn As Integer = ucrGridWeights.GetColumnIndex(strWeightColumn) + lviCondition.SubItems(1).Text = mdlCoreControl.GetRVector( + ucrGridWeights.GetCellValues(strWeightColumn, False), + bOnlyIfMultipleElement:=True) + clsTempOp.SetOperation("+") - For j As Integer = 0 To ucrGridWeights.grdFactorData.CurrentWorksheet.RowCount - 1 + For iRowIndex As Integer = 0 To ucrGridWeights.RowCount - 1 clsTempFactorOp = New ROperator clsTempFactorOp.SetOperation("*") - clsTempFactorOp.AddParameter("factor_level" & j, "(" & ucrReceiverRedFlag.GetVariableNames(False) & "==" & Chr(39) & ucrGridWeights.grdFactorData.CurrentWorksheet(j, 1) & Chr(39) & ")", iPosition:=1) - clsTempFactorOp.AddParameter("level_weight" & j, ucrGridWeights.grdFactorData.CurrentWorksheet(j, iWeightColumn), iPosition:=1) - clsTempOp.AddParameter("factor_comp" & j, clsROperatorParameter:=clsTempFactorOp, iPosition:=j) + clsTempFactorOp.AddParameter("factor_level" & iRowIndex, "(" & ucrReceiverRedFlag.GetVariableNames(False) & "==" & Chr(39) & ucrGridWeights.GridSheet(iRowIndex, 1) & Chr(39) & ")", iPosition:=1) + clsTempFactorOp.AddParameter("level_weight" & iRowIndex, ucrGridWeights.GridSheet(iRowIndex, iWeightColumn), iPosition:=1) + clsTempOp.AddParameter("factor_comp" & iRowIndex, clsROperatorParameter:=clsTempFactorOp, iPosition:=iRowIndex) Next Else lviCondition = New ListViewItem @@ -287,19 +282,17 @@ Public Class dlgCorruptionDefineCRI Private Sub EditComponent() Dim lviCondition As ListViewItem Dim strCol As String - Dim iWeightColumn As Integer Dim strIndexValues() As String If lstIndexComponents.SelectedItems.Count = 1 Then lviCondition = lstIndexComponents.SelectedItems(0) strCol = lviCondition.Text ucrReceiverRedFlag.Add(strCol, ucrSelectorCRI.ucrAvailableDataFrames.cboAvailableDataFrames.Text) - iWeightColumn = ucrGridWeights.GetColumnIndex(strWeightColumn) If ucrReceiverRedFlag.strCurrDataType = "numeric" OrElse ucrReceiverRedFlag.strCurrDataType = "integer" OrElse ucrReceiverRedFlag.strCurrDataType = "logical" Then ucrNudWeights.Value = lviCondition.SubItems(1).Text - ElseIf ucrReceiverRedFlag.strCurrDataType = "factor" AndAlso iWeightColumn <> -1 Then + ElseIf ucrReceiverRedFlag.strCurrDataType = "factor" Then strIndexValues = ExtractItemsFromRList(lviCondition.SubItems(1).Text) - ucrGridWeights.SetColumn(strIndexValues, iWeightColumn, bSilent:=False) + ucrGridWeights.SetCellValues(strWeightColumn, strIndexValues, bRaisedControlValueChangedEvent:=True) Else MsgBox("Cannot detect column or column data in the data. Editing of this component not possible", MsgBoxStyle.Exclamation, "Cannot edit component") End If @@ -342,7 +335,7 @@ Public Class dlgCorruptionDefineCRI ucrInputCRIPreview.SetName("") End Sub - Private Sub ucrGridWeights_GridContentChanged() Handles ucrGridWeights.GridContentChanged + Private Sub ucrGridWeights_ControlValueChanged() Handles ucrGridWeights.ControlValueChanged EnableAddButton() End Sub diff --git a/instat/dlgDefineOptionsByContext.vb b/instat/dlgDefineOptionsByContext.vb index 569c7737fa7..2659957c5cd 100644 --- a/instat/dlgDefineOptionsByContext.vb +++ b/instat/dlgDefineOptionsByContext.vb @@ -19,8 +19,8 @@ Imports instat.Translations Public Class dlgDefineOptionsByContext Private bFirstLoad As Boolean = True Private bReset As Boolean = True - Private clsDefineOptionsByContext As RFunction - Private clsTypes As RFunction + Private clsDefineOptionsByContext As New RFunction + Private clsTypes As New RFunction Private bDefaultsSet As Boolean = True Private Sub dlgDefineOptionsByContext_Load(sender As Object, e As EventArgs) Handles MyBase.Load diff --git a/instat/dlgDeleteRowsOrColums.Designer.vb b/instat/dlgDeleteRowsOrColums.Designer.vb index 773ed4761f3..78cded7b9ae 100644 --- a/instat/dlgDeleteRowsOrColums.Designer.vb +++ b/instat/dlgDeleteRowsOrColums.Designer.vb @@ -199,7 +199,7 @@ Partial Class dlgDeleteRowsOrColums Me.ucrDataFrameLengthForDeleteRows.Name = "ucrDataFrameLengthForDeleteRows" Me.ucrDataFrameLengthForDeleteRows.Size = New System.Drawing.Size(62, 24) Me.ucrDataFrameLengthForDeleteRows.TabIndex = 8 - Me.ucrDataFrameLengthForDeleteRows.ucrDataFrameSelector = Nothing + ' 'ucrNudFrom ' diff --git a/instat/dlgDescribeTwoVarGraph.Designer.vb b/instat/dlgDescribeTwoVarGraph.Designer.vb index 8a997b99a1e..cac687f3ed6 100644 --- a/instat/dlgDescribeTwoVarGraph.Designer.vb +++ b/instat/dlgDescribeTwoVarGraph.Designer.vb @@ -64,6 +64,24 @@ Partial Class dlgDescribeTwoVarGraph Me.rdoBy = New System.Windows.Forms.RadioButton() Me.lblColour = New System.Windows.Forms.Label() Me.grpTypeOfDispaly = New System.Windows.Forms.GroupBox() + Me.lblDiagonalNA = New System.Windows.Forms.Label() + Me.ucrInputDiagonalNA = New instat.ucrInputComboBox() + Me.lblDiagonalDiscrete = New System.Windows.Forms.Label() + Me.ucrInputDiagonalDiscrete = New instat.ucrInputComboBox() + Me.lblDiagonalContinuous = New System.Windows.Forms.Label() + Me.ucrInputDiagonalContinous = New instat.ucrInputComboBox() + 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.lblLowerNA = New System.Windows.Forms.Label() + Me.lblLowerDiscrete = New System.Windows.Forms.Label() + Me.lblLowerCombo = New System.Windows.Forms.Label() + Me.lblLowerContinous = New System.Windows.Forms.Label() Me.ucrInputLowerNA = New instat.ucrInputComboBox() Me.ucrInputLowerDiscrete = New instat.ucrInputComboBox() Me.ucrInputLowerCombo = New instat.ucrInputComboBox() @@ -78,24 +96,13 @@ Partial Class dlgDescribeTwoVarGraph 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.ucrInputLabelSize = New instat.ucrInputComboBox() + Me.lblLabelColour = New System.Windows.Forms.Label() + Me.lblLabelSize = New System.Windows.Forms.Label() + Me.ucrInputLabelPosition = New instat.ucrInputComboBox() + Me.ucrChkAddLabelsText = New instat.ucrCheck() + Me.lblLabelPosition = New System.Windows.Forms.Label() + Me.ucrInputLabelColour = New instat.ucrInputComboBox() Me.grpSummaries.SuspendLayout() Me.grpOptions.SuspendLayout() Me.grpTypeOfDispaly.SuspendLayout() @@ -116,7 +123,7 @@ Partial Class dlgDescribeTwoVarGraph ' Me.lblSecondVariable.AutoSize = True Me.lblSecondVariable.ImeMode = System.Windows.Forms.ImeMode.NoControl - Me.lblSecondVariable.Location = New System.Drawing.Point(285, 201) + Me.lblSecondVariable.Location = New System.Drawing.Point(290, 201) Me.lblSecondVariable.Name = "lblSecondVariable" Me.lblSecondVariable.Size = New System.Drawing.Size(88, 13) Me.lblSecondVariable.TabIndex = 3 @@ -381,7 +388,7 @@ Partial Class dlgDescribeTwoVarGraph ' Me.lblColour.AutoSize = True Me.lblColour.ImeMode = System.Windows.Forms.ImeMode.NoControl - Me.lblColour.Location = New System.Drawing.Point(283, 201) + Me.lblColour.Location = New System.Drawing.Point(290, 201) Me.lblColour.Name = "lblColour" Me.lblColour.Size = New System.Drawing.Size(88, 13) Me.lblColour.TabIndex = 20 @@ -414,13 +421,200 @@ Partial Class dlgDescribeTwoVarGraph 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.Location = New System.Drawing.Point(11, 255) 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" ' + '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 + ' + '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 + ' + '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 + ' + '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 + ' + '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:" + ' + '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:" + ' + '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:" + ' + '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:" + ' 'ucrInputLowerNA ' Me.ucrInputLowerNA.AddQuotesIfUnrecognised = True @@ -496,7 +690,7 @@ Partial Class dlgDescribeTwoVarGraph ' Me.ucrReceiverColour.AutoSize = True Me.ucrReceiverColour.frmParent = Me - Me.ucrReceiverColour.Location = New System.Drawing.Point(287, 216) + Me.ucrReceiverColour.Location = New System.Drawing.Point(290, 216) Me.ucrReceiverColour.Margin = New System.Windows.Forms.Padding(0) Me.ucrReceiverColour.Name = "ucrReceiverColour" Me.ucrReceiverColour.Selector = Nothing @@ -516,7 +710,7 @@ Partial Class dlgDescribeTwoVarGraph 'ucrSaveGraph ' Me.ucrSaveGraph.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink - Me.ucrSaveGraph.Location = New System.Drawing.Point(10, 405) + Me.ucrSaveGraph.Location = New System.Drawing.Point(10, 433) 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) @@ -526,7 +720,7 @@ Partial Class dlgDescribeTwoVarGraph ' Me.ucrReceiverSecondVar.AutoSize = True Me.ucrReceiverSecondVar.frmParent = Me - Me.ucrReceiverSecondVar.Location = New System.Drawing.Point(287, 216) + Me.ucrReceiverSecondVar.Location = New System.Drawing.Point(290, 216) Me.ucrReceiverSecondVar.Margin = New System.Windows.Forms.Padding(0) Me.ucrReceiverSecondVar.Name = "ucrReceiverSecondVar" Me.ucrReceiverSecondVar.Selector = Nothing @@ -551,7 +745,7 @@ Partial Class dlgDescribeTwoVarGraph ' Me.ucrBase.AutoSize = True Me.ucrBase.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink - Me.ucrBase.Location = New System.Drawing.Point(10, 431) + Me.ucrBase.Location = New System.Drawing.Point(10, 460) Me.ucrBase.Name = "ucrBase" Me.ucrBase.Size = New System.Drawing.Size(405, 52) Me.ucrBase.TabIndex = 8 @@ -569,199 +763,91 @@ 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 + 'ucrInputLabelSize + ' + Me.ucrInputLabelSize.AddQuotesIfUnrecognised = True + Me.ucrInputLabelSize.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink + Me.ucrInputLabelSize.GetSetSelectedIndex = -1 + Me.ucrInputLabelSize.IsReadOnly = False + Me.ucrInputLabelSize.Location = New System.Drawing.Point(346, 409) + Me.ucrInputLabelSize.Name = "ucrInputLabelSize" + Me.ucrInputLabelSize.Size = New System.Drawing.Size(57, 21) + Me.ucrInputLabelSize.TabIndex = 65 + ' + 'lblLabelColour + ' + Me.lblLabelColour.AutoSize = True + Me.lblLabelColour.ImeMode = System.Windows.Forms.ImeMode.NoControl + Me.lblLabelColour.Location = New System.Drawing.Point(210, 412) + Me.lblLabelColour.Name = "lblLabelColour" + Me.lblLabelColour.Size = New System.Drawing.Size(40, 13) + Me.lblLabelColour.TabIndex = 61 + Me.lblLabelColour.Text = "Colour:" + ' + 'lblLabelSize + ' + Me.lblLabelSize.AutoSize = True + Me.lblLabelSize.ImeMode = System.Windows.Forms.ImeMode.NoControl + Me.lblLabelSize.Location = New System.Drawing.Point(313, 412) + Me.lblLabelSize.Name = "lblLabelSize" + Me.lblLabelSize.Size = New System.Drawing.Size(30, 13) + Me.lblLabelSize.TabIndex = 64 + Me.lblLabelSize.Text = "Size:" + ' + 'ucrInputLabelPosition + ' + Me.ucrInputLabelPosition.AddQuotesIfUnrecognised = True + Me.ucrInputLabelPosition.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink + Me.ucrInputLabelPosition.GetSetSelectedIndex = -1 + Me.ucrInputLabelPosition.IsReadOnly = False + Me.ucrInputLabelPosition.Location = New System.Drawing.Point(151, 409) + Me.ucrInputLabelPosition.Name = "ucrInputLabelPosition" + Me.ucrInputLabelPosition.Size = New System.Drawing.Size(57, 21) + Me.ucrInputLabelPosition.TabIndex = 60 + ' + 'ucrChkAddLabelsText + ' + Me.ucrChkAddLabelsText.AutoSize = True + Me.ucrChkAddLabelsText.Checked = False + Me.ucrChkAddLabelsText.Location = New System.Drawing.Point(10, 409) + Me.ucrChkAddLabelsText.Name = "ucrChkAddLabelsText" + Me.ucrChkAddLabelsText.Size = New System.Drawing.Size(88, 23) + Me.ucrChkAddLabelsText.TabIndex = 62 + ' + 'lblLabelPosition + ' + Me.lblLabelPosition.AutoSize = True + Me.lblLabelPosition.ImeMode = System.Windows.Forms.ImeMode.NoControl + Me.lblLabelPosition.Location = New System.Drawing.Point(101, 412) + Me.lblLabelPosition.Name = "lblLabelPosition" + Me.lblLabelPosition.Size = New System.Drawing.Size(47, 13) + Me.lblLabelPosition.TabIndex = 59 + Me.lblLabelPosition.Text = "Position:" + ' + 'ucrInputLabelColour + ' + Me.ucrInputLabelColour.AddQuotesIfUnrecognised = True + Me.ucrInputLabelColour.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink + Me.ucrInputLabelColour.GetSetSelectedIndex = -1 + Me.ucrInputLabelColour.IsReadOnly = False + Me.ucrInputLabelColour.Location = New System.Drawing.Point(252, 409) + Me.ucrInputLabelColour.Name = "ucrInputLabelColour" + Me.ucrInputLabelColour.Size = New System.Drawing.Size(57, 21) + Me.ucrInputLabelColour.TabIndex = 63 ' '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(438, 491) + Me.ClientSize = New System.Drawing.Size(438, 516) + Me.Controls.Add(Me.ucrInputLabelSize) + Me.Controls.Add(Me.lblLabelColour) + Me.Controls.Add(Me.lblLabelSize) + Me.Controls.Add(Me.ucrInputLabelPosition) + Me.Controls.Add(Me.ucrChkAddLabelsText) + Me.Controls.Add(Me.lblLabelPosition) + Me.Controls.Add(Me.ucrInputLabelColour) Me.Controls.Add(Me.grpTypeOfDispaly) Me.Controls.Add(Me.lblColour) Me.Controls.Add(Me.ucrReceiverColour) @@ -783,7 +869,7 @@ Partial Class dlgDescribeTwoVarGraph Me.MinimizeBox = False Me.Name = "dlgDescribeTwoVarGraph" Me.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen - Me.Text = "Two Variable Graph" + Me.Text = "Two Plus Variable Graph" Me.grpSummaries.ResumeLayout(False) Me.grpSummaries.PerformLayout() Me.grpOptions.ResumeLayout(False) @@ -853,4 +939,11 @@ Partial Class dlgDescribeTwoVarGraph Friend WithEvents ucrInputUpperDiscrete As ucrInputComboBox Friend WithEvents ucrInputUpperCombo As ucrInputComboBox Friend WithEvents ucrInputUpperContinous As ucrInputComboBox + Friend WithEvents ucrInputLabelSize As ucrInputComboBox + Friend WithEvents lblLabelColour As Label + Friend WithEvents lblLabelSize As Label + Friend WithEvents ucrInputLabelPosition As ucrInputComboBox + Friend WithEvents ucrChkAddLabelsText As ucrCheck + Friend WithEvents lblLabelPosition As Label + Friend WithEvents ucrInputLabelColour As ucrInputComboBox End Class \ No newline at end of file diff --git a/instat/dlgDescribeTwoVarGraph.vb b/instat/dlgDescribeTwoVarGraph.vb index 01fb712e258..10b5185322d 100644 --- a/instat/dlgDescribeTwoVarGraph.vb +++ b/instat/dlgDescribeTwoVarGraph.vb @@ -18,9 +18,11 @@ Imports instat.Translations Public Class dlgDescribeTwoVarGraph Private clsBaseOperator, clsCoordPolarStartOperator As New ROperator - Private clsRGGplotFunction, clsRFacet, clsThemeFunction, clsGlobalAes, clsLabsFunction, clsXlabsFunction, - clsYlabFunction, clsXScaleContinuousFunction, clsYScaleContinuousFunction, clsCoordPolarFunction, - clsXScaleDateFunction, clsYScaleDateFunction, clsScaleFillViridisFunction, clsScaleColourViridisFunction As New RFunction + Private clsRGGplotFunction, clsMosaicGgplotFunction, 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, @@ -28,23 +30,25 @@ Public Class dlgDescribeTwoVarGraph 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 + Private clsAesNumericByNumeric As New RFunction ' Use this aes for categorical by categorical bar graphs - Private clsAesCategoricalByCategoricalBarChart As RFunction - Private clsGgmosaicProduct As RFunction + Private clsAesCategoricalByCategoricalBarChart As New RFunction + Private clsGgmosaicProduct As New RFunction ' Use this aes for categorical by categorical mosiac plots - Private clsAesCategoricalByCategoricalMosaicPlot As RFunction + Private clsAesCategoricalByCategoricalMosaicPlot As New RFunction ' Use this aes for numeric by categorical when the y axis is the numeric variable(s) e.g. boxplot, violin, point - Private clsAesNumericByCategoricalYNumeric As RFunction + Private clsAesNumericByCategoricalYNumeric As New RFunction ' Use this aes for numeric by categorical when the x axis is the numeric variable(s) e.g. histogram, density - Private clsAesNumericByCategoricalXNumeric As RFunction + Private clsAesNumericByCategoricalXNumeric As New RFunction ' Use this aes for categorical by numeric when the y axis is the numeric variable(s) e.g. boxplot, violin, point - Private clsAesCategoricalByNumericYNumeric As RFunction - ' Aes for stat_summary hline - Private clsAesStatSummaryHlineCategoricalByNumeric As RFunction - Private clsAesStatSummaryHlineNumericByCategorical As RFunction + Private clsAesCategoricalByNumericYNumeric As New RFunction + ' Aes for stat_summary hlineclsBaseOperator + Private clsAesStatSummaryHlineCategoricalByNumeric As New RFunction + Private clsAesStatSummaryHlineNumericByCategorical As New 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 + Private clsAesCategoricalByNumericXNumeric As New RFunction + Private clsLabelAesFunction As New RFunction + Private clsGeomTextFunction 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 @@ -73,6 +77,9 @@ Public Class dlgDescribeTwoVarGraph Dim clsCoordFlipParam As New RParameter Dim strNumericCategoricalPlots() As String Dim dctPositionPairs As New Dictionary(Of String, String) + Dim dctLabelColours As New Dictionary(Of String, String) + Dim dctLabelPositions As New Dictionary(Of String, String) + Dim dctLabelSizes As New Dictionary(Of String, String) ucrBase.iHelpTopicID = 416 ucrBase.clsRsyntax.iCallType = 3 @@ -83,8 +90,7 @@ Public Class dlgDescribeTwoVarGraph ucrPnlByPairs.AddParameterValuesCondition(rdoBy, "checked", "by") ucrPnlByPairs.AddParameterValuesCondition(rdoPairs, "checked", "pair") - ucrPnlByPairs.AddToLinkedControls({ucrReceiverSecondVar, ucrInputCategoricalByCategorical, - ucrChkFlipCoordinates}, {rdoBy}, bNewLinkedHideIfParameterMissing:=True) + ucrPnlByPairs.AddToLinkedControls({ucrReceiverSecondVar, ucrChkFlipCoordinates}, {rdoBy}, bNewLinkedHideIfParameterMissing:=True) ucrPnlByPairs.AddToLinkedControls({ucrChkLower, ucrReceiverColour}, {rdoPairs}, bNewLinkedHideIfParameterMissing:=True) ucrChkLower.SetLinkedDisplayControl(grpTypeOfDispaly) @@ -123,19 +129,45 @@ 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") ucrInputCategoricalByCategorical.SetDropDownStyleAsNonEditable() + ucrChkAddLabelsText.SetText("Add Labels") + ucrChkAddLabelsText.AddParameterPresentCondition(True, "text") + ucrChkAddLabelsText.AddParameterPresentCondition(False, "text", False) + ucrChkAddLabelsText.AddToLinkedControls({ucrInputLabelPosition, ucrInputLabelSize, ucrInputLabelColour}, {True}, bNewLinkedHideIfParameterMissing:=True) + ucrInputLabelColour.SetLinkedDisplayControl(lblLabelColour) + ucrInputLabelPosition.SetLinkedDisplayControl(lblLabelPosition) + ucrInputLabelSize.SetLinkedDisplayControl(lblLabelSize) + + ucrInputLabelPosition.SetParameter(New RParameter("vjust", 2)) + dctLabelPositions.Add("Out", "-0.25") + dctLabelPositions.Add("In", "5") + ucrInputLabelPosition.SetItems(dctLabelPositions) + ucrInputLabelPosition.SetDropDownStyleAsNonEditable() + + ucrInputLabelColour.SetParameter(New RParameter("colour", 4)) + dctLabelColours.Add("Black", Chr(34) & "black" & Chr(34)) + dctLabelColours.Add("White", Chr(34) & "white" & Chr(34)) + ucrInputLabelColour.SetItems(dctLabelColours) + ucrInputLabelColour.bAllowNonConditionValues = True + + ucrInputLabelSize.SetParameter(New RParameter("size", 5)) + dctLabelSizes.Add("Default", "4") + dctLabelSizes.Add("Small", "3") + dctLabelSizes.Add("Big", "7") + ucrInputLabelSize.SetItems(dctLabelSizes) + ucrInputLabelSize.SetDropDownStyleAsNonEditable() + clsCoordFlipFunc.SetPackageName("ggplot2") clsCoordFlipFunc.SetRCommand("coord_flip") clsCoordFlipParam.SetArgumentName("coord_flip") clsCoordFlipParam.SetArgument(clsCoordFlipFunc) ucrChkFlipCoordinates.SetText("Flip Coordinates") ucrChkFlipCoordinates.SetParameter(clsCoordFlipParam, bNewChangeParameterValue:=False, bNewAddRemoveParameter:=True) - ucrChkFlipCoordinates.SetLinkedDisplayControl(grpOptions) + ucrChkFlipCoordinates.SetLinkedDisplayControl(New List(Of Control)({grpSummaries, grpOptions})) ucrChkFreeScaleYAxis.SetText("Free Scale Y Axis") ucrChkFreeScaleYAxis.SetParameter(New RParameter("scales", iNewPosition:=3), bNewChangeParameterValue:=False, bNewAddRemoveParameter:=False) @@ -242,6 +274,7 @@ Public Class dlgDescribeTwoVarGraph Private Sub SetDefaults() clsGGpairsFunction = New RFunction clsRGGplotFunction = New RFunction + clsMosaicGgplotFunction = New RFunction clsDummyFunction = New RFunction clsRFacet = New RFunction clsThemeFunction = GgplotDefaults.clsDefaultThemeFunction.Clone() @@ -286,6 +319,8 @@ Public Class dlgDescribeTwoVarGraph clsUpperListFunction = New RFunction clsLowerListFunction = New RFunction clsDiagonalListFunction = New RFunction + clsGeomTextFunction = New RFunction + clsLabelAesFunction = New RFunction clsBaseOperator = New ROperator bResetSubdialog = True @@ -299,6 +334,18 @@ Public Class dlgDescribeTwoVarGraph clsDummyFunction.AddParameter("checked", "pair", iPosition:=0) + clsGeomTextFunction.SetPackageName("ggplot2") + clsGeomTextFunction.SetRCommand("geom_text") + clsGeomTextFunction.AddParameter("stat", Chr(34) & "count" & Chr(34), iPosition:=0) + clsGeomTextFunction.AddParameter("mapping", clsRFunctionParameter:=clsLabelAesFunction, iPosition:=1) + clsGeomTextFunction.AddParameter("colour", "black", iPosition:=4) + clsGeomTextFunction.AddParameter("vjust", "-0.25", iPosition:=2) + clsGeomTextFunction.AddParameter("size", "4", iPosition:=5) + + clsLabelAesFunction.SetPackageName("ggplot2") + clsLabelAesFunction.SetRCommand("aes") + clsLabelAesFunction.AddParameter("label", "..count..", 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) @@ -327,9 +374,11 @@ Public Class dlgDescribeTwoVarGraph clsRGGplotFunction.SetPackageName("ggplot2") clsRGGplotFunction.SetRCommand("ggplot") + clsMosaicGgplotFunction.SetPackageName("ggplot2") + clsMosaicGgplotFunction.SetRCommand("ggplot") + clsRFacet.SetPackageName("ggplot2") clsRFacet.SetRCommand("facet_wrap") - clsRFacet.AddParameter("facets", "~variable", iPosition:=0) clsGeomViolin.SetPackageName("ggplot2") clsGeomViolin.SetRCommand("geom_violin") @@ -392,7 +441,6 @@ Public Class dlgDescribeTwoVarGraph clsGgmosaicProduct.SetPackageName("ggmosaic") clsGgmosaicProduct.SetRCommand("product") - clsGgmosaicProduct.AddParameter("0", "value", bIncludeArgumentName:=False, iPosition:=0) clsGeomPoint.SetPackageName("ggplot2") clsGeomPoint.SetRCommand("geom_point") @@ -402,7 +450,8 @@ Public Class dlgDescribeTwoVarGraph clsGeomBar.SetPackageName("ggplot2") clsGeomBar.SetRCommand("geom_bar") - clsGeomBar.AddParameter("position", Chr(34) & "dodge" & Chr(34)) + clsGeomBar.AddParameter("position", Chr(34) & "dodge" & Chr(34), iPosition:=0) + clsGeomBar.AddParameter("stat", Chr(34) & "count" & Chr(34), iPosition:=1) clsGeomFreqPoly.SetPackageName("ggplot2") clsGeomFreqPoly.SetRCommand("geom_freqpoly") @@ -445,8 +494,7 @@ Public Class dlgDescribeTwoVarGraph ucrReceiverSecondVar.AddAdditionalCodeParameterPair(clsAesCategoricalByNumericYNumeric, New RParameter("y", 1), iAdditionalPairNo:=3) ucrReceiverSecondVar.AddAdditionalCodeParameterPair(clsAesCategoricalByNumericXNumeric, New RParameter("x", 0), iAdditionalPairNo:=4) 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) + ucrReceiverSecondVar.AddAdditionalCodeParameterPair(clsAesStatSummaryHlineCategoricalByNumeric, New RParameter("y", 1), iAdditionalPairNo:=6) ucrSaveGraph.AddAdditionalRCode(clsGGpairsFunction, bReset) ucrSelectorTwoVarGraph.SetRCode(clsRGGplotFunction, bReset) @@ -473,10 +521,14 @@ Public Class dlgDescribeTwoVarGraph ucrChkLower.SetRCode(clsGGpairsFunction, bReset) ucrChkUpper.SetRCode(clsGGpairsFunction, bReset) ucrChkDiagonal.SetRCode(clsGGpairsFunction, bReset) + ucrInputLabelPosition.SetRCode(clsGeomTextFunction, bReset) + ucrInputLabelColour.SetRCode(clsGeomTextFunction, bReset) + ucrInputLabelSize.SetRCode(clsGeomTextFunction, bReset) bRCodeSet = True Results() SetFreeYAxis() + EnableVisibleLabelControls() End Sub Private Sub TestOkEnabled() @@ -732,14 +784,30 @@ Public Class dlgDescribeTwoVarGraph End Sub Private Sub ucrReceiverFirstVars_ControlValueChanged(ucrChangedControl As ucrCore) Handles ucrReceiverFirstVars.ControlValueChanged + Dim iPosition As Integer = 0 + Dim iNumVariables As Integer = ucrReceiverFirstVars.ucrMultipleVariables.GetVariableNamesList(bWithQuotes:=False).Count Results() + EnableVisibleLabelControls() clsGGpairsFunction.AddParameter("columns", ucrReceiverFirstVars.ucrMultipleVariables.GetVariableNames(), iPosition:=1) + clsGgmosaicProduct.ClearParameters() + For Each strVariables In ucrReceiverFirstVars.ucrMultipleVariables.GetVariableNamesList(bWithQuotes:=False) + clsGgmosaicProduct.AddParameter("columns" & iPosition, strVariables, + iPosition:=iPosition, bIncludeArgumentName:=False) + iPosition = iPosition + 1 + Next + ChangeGeomToMosaicAndFacet() + + If iNumVariables > 0 Then + clsAesCategoricalByCategoricalMosaicPlot.AddParameter("fill", ucrReceiverFirstVars.ucrMultipleVariables.GetVariableNamesList(bWithQuotes:=False)(0), iPosition:=1) + End If End Sub Private Sub ucrReceiverSecondVar_ControlValueChanged(ucrChangedControl As ucrCore) Handles ucrReceiverSecondVar.ControlValueChanged clsScaleColourViridisFunction.AddParameter("discrete", "TRUE", iPosition:=5) clsScaleFillViridisFunction.AddParameter("discrete", "TRUE", iPosition:=5) Results() + EnableVisibleLabelControls() + ChangeGeomToMosaicAndFacet() End Sub Private Sub Controls_ControlContentsChanged(ucrChangedControl As ucrCore) Handles ucrReceiverSecondVar.ControlContentsChanged, ucrReceiverFirstVars.ControlContentsChanged, ucrSaveGraph.ControlContentsChanged, ucrPnlByPairs.ControlContentsChanged @@ -748,6 +816,9 @@ Public Class dlgDescribeTwoVarGraph Private Sub ucrInputCategoricalByCategorical_ControlValueChanged(ucrChangedControl As ucrCore) Handles ucrInputNumericByNumeric.ControlValueChanged, ucrInputNumericByCategorical.ControlValueChanged, ucrInputCategoricalByNumeric.ControlValueChanged, ucrInputCategoricalByCategorical.ControlValueChanged Results() + EnableVisibleLabelControls() + AddRemoveTextParameter() + ChangeGeomToMosaicAndFacet() End Sub Private Sub RemoveAllGeomsStats() @@ -879,6 +950,7 @@ Public Class dlgDescribeTwoVarGraph Private Sub ucrPnlByPairs_ControlValueChanged(ucrChangedControl As ucrCore) Handles ucrPnlByPairs.ControlValueChanged ucrReceiverFirstVars.ucrMultipleVariables.Clear() + ucrReceiverFirstVars.SetMeAsReceiver() If rdoBy.Checked Then cmdOptions.Enabled = True ucrReceiverFirstVars.ucrMultipleVariables.SetSingleTypeStatus(True, bIsCategoricalNumeric:=True) @@ -895,7 +967,9 @@ Public Class dlgDescribeTwoVarGraph clsDummyFunction.AddParameter("checked", "pair", iPosition:=0) End If End If + EnableVisibleLabelControls() AddRemoveColourParameter() + ChangeGeomToMosaicAndFacet() End Sub Private Sub ucrSelectorTwoVarGraph_ControlValueChanged(ucrChangedControl As ucrCore) Handles ucrSelectorTwoVarGraph.ControlValueChanged @@ -906,6 +980,7 @@ Public Class dlgDescribeTwoVarGraph Dim clsGetDataFrameFunction As RFunction = ucrSelectorTwoVarGraph.ucrAvailableDataFrames.clsCurrDataFrame.Clone clsGetDataFrameFunction.RemoveParameterByName("stack_data") clsGGpairsFunction.AddParameter("data", clsRFunctionParameter:=clsGetDataFrameFunction, iPosition:=0) + clsMosaicGgplotFunction.AddParameter("data", clsRFunctionParameter:=clsGetDataFrameFunction, iPosition:=0) End Sub Private Sub ucrReceiverColour_ControlValueChanged(ucrChangedControl As ucrCore) Handles ucrReceiverColour.ControlValueChanged @@ -920,6 +995,46 @@ Public Class dlgDescribeTwoVarGraph End If End Sub + Private Sub EnableVisibleLabelControls() + ucrChkAddLabelsText.Visible = False + ucrInputLabelPosition.Visible = False + ucrInputLabelColour.Visible = False + ucrInputLabelSize.Visible = False + If rdoBy.Checked AndAlso strFirstVariablesType = "categorical" AndAlso + strSecondVariableType = "categorical" AndAlso bRCodeSet AndAlso + ucrInputCategoricalByCategorical.GetText = "Bar Chart" Then + ucrChkAddLabelsText.Visible = True + ucrChkAddLabelsText.SetRCode(clsBaseOperator) + End If + End Sub + + Private Sub ucrChkAddLabelsText_ControlValueChanged(ucrChangedControl As ucrCore) Handles ucrChkAddLabelsText.ControlValueChanged + AddRemoveTextParameter() + End Sub + + Private Sub ChangeGeomToMosaicAndFacet() + If rdoBy.Checked AndAlso strFirstVariablesType = "categorical" AndAlso + strSecondVariableType = "categorical" AndAlso + ucrInputCategoricalByCategorical.GetText = "Mosaic Plot" Then + clsBaseOperator.AddParameter("ggplot", clsRFunctionParameter:=clsMosaicGgplotFunction, iPosition:=0) + clsRFacet.AddParameter("facets", "~ " & ucrReceiverSecondVar.GetVariableNames(False), iPosition:=0) + Else + clsBaseOperator.AddParameter("ggplot", clsRFunctionParameter:=clsRGGplotFunction, iPosition:=0) + clsRFacet.AddParameter("facets", "~variable", iPosition:=0) + End If + End Sub + + Private Sub AddRemoveTextParameter() + If ucrChkAddLabelsText.Checked AndAlso + ucrInputCategoricalByCategorical.GetText = "Bar Chart" AndAlso + strFirstVariablesType = "categorical" AndAlso strSecondVariableType = "categorical" AndAlso + bRCodeSet Then + clsBaseOperator.AddParameter("text", clsRFunctionParameter:=clsGeomTextFunction, iPosition:=3) + Else + clsBaseOperator.RemoveParameterByName("text") + 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 diff --git a/instat/dlgDescribeTwoVariable.Designer.vb b/instat/dlgDescribeTwoVariable.Designer.vb index 39fbce76d6d..fccec8ee931 100644 --- a/instat/dlgDescribeTwoVariable.Designer.vb +++ b/instat/dlgDescribeTwoVariable.Designer.vb @@ -42,28 +42,53 @@ Partial Class dlgDescribeTwoVariable Me.lblFirstVariable = New System.Windows.Forms.Label() Me.lbSecondVariable = New System.Windows.Forms.Label() Me.grpOptions = New System.Windows.Forms.GroupBox() - Me.ucrChkOmitMissing = New instat.ucrCheck() Me.lblSummary = New System.Windows.Forms.Label() Me.lblFirstType = New System.Windows.Forms.Label() Me.lblBy = New System.Windows.Forms.Label() Me.lblSecondType = New System.Windows.Forms.Label() Me.lblSummaryName = New System.Windows.Forms.Label() Me.grpSummaries = New System.Windows.Forms.GroupBox() + Me.rdoCustomize = New System.Windows.Forms.RadioButton() + Me.rdoSkim = New System.Windows.Forms.RadioButton() + Me.lbSecondOpt = New System.Windows.Forms.Label() + Me.lblSecondFactor = New System.Windows.Forms.Label() + Me.lblNumericVariable = New System.Windows.Forms.Label() + Me.lblMarginName = New System.Windows.Forms.Label() + Me.grpDisplay = New System.Windows.Forms.GroupBox() + Me.lblFactorsAsPercentage = New System.Windows.Forms.Label() + Me.grpFrequency = New System.Windows.Forms.GroupBox() + Me.lblColumnFactors = New System.Windows.Forms.Label() + Me.lblSigFigs = New System.Windows.Forms.Label() + Me.rdoThreeVariable = New System.Windows.Forms.RadioButton() + Me.ucrBase = New instat.ucrButtons() + Me.ucrNudColumnFactors = New instat.ucrNud() + Me.ucrNudSigFigs = New instat.ucrNud() + Me.ucrInputMarginName = New instat.ucrInputTextBox() + Me.ucrChkDisplayMargins = New instat.ucrCheck() + Me.ucrReceiverPercentages = New instat.ucrReceiverSingle() + Me.ucrChkPercentageProportion = New instat.ucrCheck() + Me.ucrChkDisplayAsPercentage = New instat.ucrCheck() + Me.ucrReceiverNumericVariable = New instat.ucrReceiverSingle() + Me.ucrReceiverSecondFactor = New instat.ucrReceiverSingle() + Me.ucrChkOmitMissing = New instat.ucrCheck() + Me.ucrReceiverSecondOpt = New instat.ucrReceiverSingle() + Me.ucrPnlDescribe = New instat.UcrPanel() Me.ucrReceiverSecondVar = New instat.ucrReceiverSingle() Me.ucrReceiverFirstVars = New instat.ucrReceiverMultiple() Me.ucrSelectorDescribeTwoVar = New instat.ucrSelectorByDataFrameAddRemove() - Me.ucrBase = New instat.ucrButtons() Me.grpOptions.SuspendLayout() Me.grpSummaries.SuspendLayout() + Me.grpDisplay.SuspendLayout() + Me.grpFrequency.SuspendLayout() Me.SuspendLayout() ' 'cmdSummaries ' Me.cmdSummaries.ImeMode = System.Windows.Forms.ImeMode.NoControl - Me.cmdSummaries.Location = New System.Drawing.Point(9, 45) + Me.cmdSummaries.Location = New System.Drawing.Point(6, 45) Me.cmdSummaries.Name = "cmdSummaries" Me.cmdSummaries.Size = New System.Drawing.Size(105, 23) - Me.cmdSummaries.TabIndex = 7 + Me.cmdSummaries.TabIndex = 1 Me.cmdSummaries.Tag = "Summaries" Me.cmdSummaries.Text = "Summaries" Me.cmdSummaries.UseVisualStyleBackColor = True @@ -72,17 +97,17 @@ Partial Class dlgDescribeTwoVariable ' Me.lblFirstVariable.AutoSize = True Me.lblFirstVariable.ImeMode = System.Windows.Forms.ImeMode.NoControl - Me.lblFirstVariable.Location = New System.Drawing.Point(268, 45) + Me.lblFirstVariable.Location = New System.Drawing.Point(268, 58) Me.lblFirstVariable.Name = "lblFirstVariable" Me.lblFirstVariable.Size = New System.Drawing.Size(75, 13) - Me.lblFirstVariable.TabIndex = 1 + Me.lblFirstVariable.TabIndex = 4 Me.lblFirstVariable.Tag = "" Me.lblFirstVariable.Text = "First Variables:" ' 'lbSecondVariable ' Me.lbSecondVariable.ImeMode = System.Windows.Forms.ImeMode.NoControl - Me.lbSecondVariable.Location = New System.Drawing.Point(268, 155) + Me.lbSecondVariable.Location = New System.Drawing.Point(268, 164) Me.lbSecondVariable.Name = "lbSecondVariable" Me.lbSecondVariable.Size = New System.Drawing.Size(100, 15) Me.lbSecondVariable.TabIndex = 3 @@ -93,22 +118,13 @@ Partial Class dlgDescribeTwoVariable ' Me.grpOptions.Controls.Add(Me.ucrChkOmitMissing) Me.grpOptions.Controls.Add(Me.cmdSummaries) - Me.grpOptions.Location = New System.Drawing.Point(236, 202) + Me.grpOptions.Location = New System.Drawing.Point(256, 250) Me.grpOptions.Name = "grpOptions" Me.grpOptions.Size = New System.Drawing.Size(155, 76) - Me.grpOptions.TabIndex = 10 + Me.grpOptions.TabIndex = 12 Me.grpOptions.TabStop = False Me.grpOptions.Text = "Options" ' - 'ucrChkOmitMissing - ' - Me.ucrChkOmitMissing.AutoSize = True - Me.ucrChkOmitMissing.Checked = False - Me.ucrChkOmitMissing.Location = New System.Drawing.Point(9, 19) - Me.ucrChkOmitMissing.Name = "ucrChkOmitMissing" - Me.ucrChkOmitMissing.Size = New System.Drawing.Size(143, 23) - Me.ucrChkOmitMissing.TabIndex = 6 - ' 'lblSummary ' Me.lblSummary.AutoSize = True @@ -116,37 +132,37 @@ Partial Class dlgDescribeTwoVariable Me.lblSummary.Location = New System.Drawing.Point(6, 43) Me.lblSummary.Name = "lblSummary" Me.lblSummary.Size = New System.Drawing.Size(53, 13) - Me.lblSummary.TabIndex = 9 + Me.lblSummary.TabIndex = 4 Me.lblSummary.Text = "Summary:" ' 'lblFirstType ' Me.lblFirstType.ForeColor = System.Drawing.SystemColors.ControlText Me.lblFirstType.ImeMode = System.Windows.Forms.ImeMode.NoControl - Me.lblFirstType.Location = New System.Drawing.Point(6, 16) + Me.lblFirstType.Location = New System.Drawing.Point(-20, 16) Me.lblFirstType.Name = "lblFirstType" - Me.lblFirstType.Size = New System.Drawing.Size(55, 13) - Me.lblFirstType.TabIndex = 10 + Me.lblFirstType.Size = New System.Drawing.Size(83, 13) + Me.lblFirstType.TabIndex = 0 Me.lblFirstType.TextAlign = System.Drawing.ContentAlignment.TopRight ' 'lblBy ' Me.lblBy.AutoSize = True Me.lblBy.ImeMode = System.Windows.Forms.ImeMode.NoControl - Me.lblBy.Location = New System.Drawing.Point(64, 16) + Me.lblBy.Location = New System.Drawing.Point(66, 16) Me.lblBy.Name = "lblBy" Me.lblBy.Size = New System.Drawing.Size(18, 13) - Me.lblBy.TabIndex = 11 + Me.lblBy.TabIndex = 1 Me.lblBy.Text = "by" ' 'lblSecondType ' Me.lblSecondType.AutoSize = True Me.lblSecondType.ImeMode = System.Windows.Forms.ImeMode.NoControl - Me.lblSecondType.Location = New System.Drawing.Point(82, 16) + Me.lblSecondType.Location = New System.Drawing.Point(85, 18) Me.lblSecondType.Name = "lblSecondType" Me.lblSecondType.Size = New System.Drawing.Size(0, 13) - Me.lblSecondType.TabIndex = 12 + Me.lblSecondType.TabIndex = 2 ' 'lblSummaryName ' @@ -155,7 +171,7 @@ Partial Class dlgDescribeTwoVariable Me.lblSummaryName.Location = New System.Drawing.Point(60, 43) Me.lblSummaryName.Name = "lblSummaryName" Me.lblSummaryName.Size = New System.Drawing.Size(0, 13) - Me.lblSummaryName.TabIndex = 13 + Me.lblSummaryName.TabIndex = 3 ' 'grpSummaries ' @@ -164,17 +180,309 @@ Partial Class dlgDescribeTwoVariable Me.grpSummaries.Controls.Add(Me.lblSummary) Me.grpSummaries.Controls.Add(Me.lblBy) Me.grpSummaries.Controls.Add(Me.lblSecondType) - Me.grpSummaries.Location = New System.Drawing.Point(10, 202) + Me.grpSummaries.Location = New System.Drawing.Point(10, 227) Me.grpSummaries.Name = "grpSummaries" Me.grpSummaries.Size = New System.Drawing.Size(210, 72) - Me.grpSummaries.TabIndex = 14 + Me.grpSummaries.TabIndex = 11 Me.grpSummaries.TabStop = False ' + 'rdoCustomize + ' + Me.rdoCustomize.Appearance = System.Windows.Forms.Appearance.Button + Me.rdoCustomize.FlatAppearance.BorderColor = System.Drawing.SystemColors.ActiveCaption + Me.rdoCustomize.FlatAppearance.BorderSize = 2 + Me.rdoCustomize.FlatAppearance.CheckedBackColor = System.Drawing.SystemColors.ActiveCaption + Me.rdoCustomize.FlatStyle = System.Windows.Forms.FlatStyle.Flat + Me.rdoCustomize.ImeMode = System.Windows.Forms.ImeMode.NoControl + Me.rdoCustomize.Location = New System.Drawing.Point(144, 12) + Me.rdoCustomize.Name = "rdoCustomize" + Me.rdoCustomize.Size = New System.Drawing.Size(100, 28) + Me.rdoCustomize.TabIndex = 2 + Me.rdoCustomize.Text = "Two Variables" + Me.rdoCustomize.TextAlign = System.Drawing.ContentAlignment.MiddleCenter + Me.rdoCustomize.UseVisualStyleBackColor = True + ' + 'rdoSkim + ' + Me.rdoSkim.Appearance = System.Windows.Forms.Appearance.Button + Me.rdoSkim.FlatAppearance.BorderColor = System.Drawing.SystemColors.ActiveCaption + Me.rdoSkim.FlatAppearance.BorderSize = 2 + Me.rdoSkim.FlatAppearance.CheckedBackColor = System.Drawing.SystemColors.ActiveCaption + Me.rdoSkim.FlatStyle = System.Windows.Forms.FlatStyle.Flat + Me.rdoSkim.ImeMode = System.Windows.Forms.ImeMode.NoControl + Me.rdoSkim.Location = New System.Drawing.Point(49, 12) + Me.rdoSkim.Name = "rdoSkim" + Me.rdoSkim.Size = New System.Drawing.Size(100, 28) + Me.rdoSkim.TabIndex = 1 + Me.rdoSkim.Text = "Skim" + Me.rdoSkim.TextAlign = System.Drawing.ContentAlignment.MiddleCenter + Me.rdoSkim.UseVisualStyleBackColor = True + ' + 'lbSecondOpt + ' + Me.lbSecondOpt.ImeMode = System.Windows.Forms.ImeMode.NoControl + Me.lbSecondOpt.Location = New System.Drawing.Point(271, 163) + Me.lbSecondOpt.Name = "lbSecondOpt" + Me.lbSecondOpt.Size = New System.Drawing.Size(100, 15) + Me.lbSecondOpt.TabIndex = 6 + Me.lbSecondOpt.Tag = "" + Me.lbSecondOpt.Text = "Factor (Optional) :" + ' + 'lblSecondFactor + ' + Me.lblSecondFactor.ImeMode = System.Windows.Forms.ImeMode.NoControl + Me.lblSecondFactor.Location = New System.Drawing.Point(270, 206) + Me.lblSecondFactor.Name = "lblSecondFactor" + Me.lblSecondFactor.Size = New System.Drawing.Size(137, 15) + Me.lblSecondFactor.TabIndex = 8 + Me.lblSecondFactor.Tag = "" + Me.lblSecondFactor.Text = "Second Factor (Optional) :" + ' + 'lblNumericVariable + ' + Me.lblNumericVariable.ImeMode = System.Windows.Forms.ImeMode.NoControl + Me.lblNumericVariable.Location = New System.Drawing.Point(270, 203) + Me.lblNumericVariable.Name = "lblNumericVariable" + Me.lblNumericVariable.Size = New System.Drawing.Size(154, 15) + Me.lblNumericVariable.TabIndex = 10 + Me.lblNumericVariable.Tag = "" + Me.lblNumericVariable.Text = "Numeric Variable (Optional):" + ' + 'lblMarginName + ' + Me.lblMarginName.AutoSize = True + Me.lblMarginName.ImeMode = System.Windows.Forms.ImeMode.NoControl + Me.lblMarginName.Location = New System.Drawing.Point(11, 101) + Me.lblMarginName.Name = "lblMarginName" + Me.lblMarginName.Size = New System.Drawing.Size(41, 13) + Me.lblMarginName.TabIndex = 19 + Me.lblMarginName.Text = "Name :" + ' + 'grpDisplay + ' + Me.grpDisplay.Controls.Add(Me.ucrReceiverPercentages) + Me.grpDisplay.Controls.Add(Me.lblFactorsAsPercentage) + Me.grpDisplay.Controls.Add(Me.ucrChkPercentageProportion) + Me.grpDisplay.Controls.Add(Me.ucrChkDisplayAsPercentage) + Me.grpDisplay.Location = New System.Drawing.Point(239, 250) + Me.grpDisplay.Name = "grpDisplay" + Me.grpDisplay.Size = New System.Drawing.Size(174, 120) + Me.grpDisplay.TabIndex = 21 + Me.grpDisplay.TabStop = False + Me.grpDisplay.Text = "Percentages" + ' + 'lblFactorsAsPercentage + ' + Me.lblFactorsAsPercentage.AutoSize = True + Me.lblFactorsAsPercentage.ImeMode = System.Windows.Forms.ImeMode.NoControl + Me.lblFactorsAsPercentage.Location = New System.Drawing.Point(18, 44) + Me.lblFactorsAsPercentage.Name = "lblFactorsAsPercentage" + Me.lblFactorsAsPercentage.Size = New System.Drawing.Size(117, 13) + Me.lblFactorsAsPercentage.TabIndex = 1 + Me.lblFactorsAsPercentage.Tag = "Factors as Percentage:" + Me.lblFactorsAsPercentage.Text = "Factors as Percentage:" + ' + 'grpFrequency + ' + Me.grpFrequency.Controls.Add(Me.ucrNudColumnFactors) + Me.grpFrequency.Controls.Add(Me.lblColumnFactors) + Me.grpFrequency.Controls.Add(Me.ucrNudSigFigs) + Me.grpFrequency.Controls.Add(Me.ucrInputMarginName) + Me.grpFrequency.Controls.Add(Me.lblMarginName) + Me.grpFrequency.Controls.Add(Me.lblSigFigs) + Me.grpFrequency.Controls.Add(Me.ucrChkDisplayMargins) + Me.grpFrequency.Location = New System.Drawing.Point(10, 302) + Me.grpFrequency.Name = "grpFrequency" + Me.grpFrequency.Size = New System.Drawing.Size(223, 127) + Me.grpFrequency.TabIndex = 22 + Me.grpFrequency.TabStop = False + Me.grpFrequency.Text = "Display" + ' + 'lblColumnFactors + ' + Me.lblColumnFactors.AutoSize = True + Me.lblColumnFactors.ImeMode = System.Windows.Forms.ImeMode.NoControl + Me.lblColumnFactors.Location = New System.Drawing.Point(8, 53) + Me.lblColumnFactors.Name = "lblColumnFactors" + Me.lblColumnFactors.Size = New System.Drawing.Size(83, 13) + Me.lblColumnFactors.TabIndex = 21 + Me.lblColumnFactors.Tag = "" + Me.lblColumnFactors.Text = "Column Factors:" + ' + 'lblSigFigs + ' + Me.lblSigFigs.AutoSize = True + Me.lblSigFigs.ImeMode = System.Windows.Forms.ImeMode.NoControl + Me.lblSigFigs.Location = New System.Drawing.Point(8, 25) + Me.lblSigFigs.Name = "lblSigFigs" + Me.lblSigFigs.Size = New System.Drawing.Size(96, 13) + Me.lblSigFigs.TabIndex = 4 + Me.lblSigFigs.Tag = "Significant_Figures:" + Me.lblSigFigs.Text = "Significant Figures:" + ' + 'rdoThreeVariable + ' + Me.rdoThreeVariable.Appearance = System.Windows.Forms.Appearance.Button + Me.rdoThreeVariable.FlatAppearance.BorderColor = System.Drawing.SystemColors.ActiveCaption + Me.rdoThreeVariable.FlatAppearance.BorderSize = 2 + Me.rdoThreeVariable.FlatAppearance.CheckedBackColor = System.Drawing.SystemColors.ActiveCaption + Me.rdoThreeVariable.FlatStyle = System.Windows.Forms.FlatStyle.Flat + Me.rdoThreeVariable.ImeMode = System.Windows.Forms.ImeMode.NoControl + Me.rdoThreeVariable.Location = New System.Drawing.Point(242, 12) + Me.rdoThreeVariable.Name = "rdoThreeVariable" + Me.rdoThreeVariable.Size = New System.Drawing.Size(100, 28) + Me.rdoThreeVariable.TabIndex = 23 + Me.rdoThreeVariable.Text = "Three Variables" + Me.rdoThreeVariable.TextAlign = System.Drawing.ContentAlignment.MiddleCenter + Me.rdoThreeVariable.UseVisualStyleBackColor = True + ' + 'ucrBase + ' + Me.ucrBase.AutoSize = True + Me.ucrBase.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink + Me.ucrBase.Location = New System.Drawing.Point(8, 435) + Me.ucrBase.Name = "ucrBase" + Me.ucrBase.Size = New System.Drawing.Size(405, 52) + Me.ucrBase.TabIndex = 13 + ' + 'ucrNudColumnFactors + ' + Me.ucrNudColumnFactors.AutoSize = True + Me.ucrNudColumnFactors.DecimalPlaces = New Decimal(New Integer() {0, 0, 0, 0}) + Me.ucrNudColumnFactors.Increment = New Decimal(New Integer() {1, 0, 0, 0}) + Me.ucrNudColumnFactors.Location = New System.Drawing.Point(129, 48) + Me.ucrNudColumnFactors.Maximum = New Decimal(New Integer() {100, 0, 0, 0}) + Me.ucrNudColumnFactors.Minimum = New Decimal(New Integer() {0, 0, 0, 0}) + Me.ucrNudColumnFactors.Name = "ucrNudColumnFactors" + Me.ucrNudColumnFactors.Size = New System.Drawing.Size(50, 20) + Me.ucrNudColumnFactors.TabIndex = 22 + Me.ucrNudColumnFactors.Value = New Decimal(New Integer() {0, 0, 0, 0}) + ' + 'ucrNudSigFigs + ' + Me.ucrNudSigFigs.AutoSize = True + Me.ucrNudSigFigs.DecimalPlaces = New Decimal(New Integer() {0, 0, 0, 0}) + Me.ucrNudSigFigs.Increment = New Decimal(New Integer() {1, 0, 0, 0}) + Me.ucrNudSigFigs.Location = New System.Drawing.Point(129, 22) + Me.ucrNudSigFigs.Maximum = New Decimal(New Integer() {100, 0, 0, 0}) + Me.ucrNudSigFigs.Minimum = New Decimal(New Integer() {0, 0, 0, 0}) + Me.ucrNudSigFigs.Name = "ucrNudSigFigs" + Me.ucrNudSigFigs.Size = New System.Drawing.Size(50, 20) + Me.ucrNudSigFigs.TabIndex = 5 + Me.ucrNudSigFigs.Value = New Decimal(New Integer() {0, 0, 0, 0}) + ' + 'ucrInputMarginName + ' + Me.ucrInputMarginName.AddQuotesIfUnrecognised = True + Me.ucrInputMarginName.AutoSize = True + Me.ucrInputMarginName.IsMultiline = False + Me.ucrInputMarginName.IsReadOnly = False + Me.ucrInputMarginName.Location = New System.Drawing.Point(53, 98) + Me.ucrInputMarginName.Name = "ucrInputMarginName" + Me.ucrInputMarginName.Size = New System.Drawing.Size(74, 21) + Me.ucrInputMarginName.TabIndex = 20 + ' + 'ucrChkDisplayMargins + ' + Me.ucrChkDisplayMargins.AutoSize = True + Me.ucrChkDisplayMargins.Checked = False + Me.ucrChkDisplayMargins.Location = New System.Drawing.Point(9, 74) + Me.ucrChkDisplayMargins.Name = "ucrChkDisplayMargins" + Me.ucrChkDisplayMargins.Size = New System.Drawing.Size(149, 23) + Me.ucrChkDisplayMargins.TabIndex = 17 + ' + 'ucrReceiverPercentages + ' + Me.ucrReceiverPercentages.AutoSize = True + Me.ucrReceiverPercentages.frmParent = Nothing + Me.ucrReceiverPercentages.Location = New System.Drawing.Point(21, 63) + Me.ucrReceiverPercentages.Margin = New System.Windows.Forms.Padding(0) + Me.ucrReceiverPercentages.Name = "ucrReceiverPercentages" + Me.ucrReceiverPercentages.Selector = Nothing + Me.ucrReceiverPercentages.Size = New System.Drawing.Size(120, 20) + Me.ucrReceiverPercentages.strNcFilePath = "" + Me.ucrReceiverPercentages.TabIndex = 8 + Me.ucrReceiverPercentages.ucrSelector = Nothing + ' + 'ucrChkPercentageProportion + ' + Me.ucrChkPercentageProportion.AutoSize = True + Me.ucrChkPercentageProportion.Checked = False + Me.ucrChkPercentageProportion.Location = New System.Drawing.Point(14, 86) + Me.ucrChkPercentageProportion.Name = "ucrChkPercentageProportion" + Me.ucrChkPercentageProportion.Size = New System.Drawing.Size(154, 23) + Me.ucrChkPercentageProportion.TabIndex = 3 + ' + 'ucrChkDisplayAsPercentage + ' + Me.ucrChkDisplayAsPercentage.AutoSize = True + Me.ucrChkDisplayAsPercentage.Checked = False + Me.ucrChkDisplayAsPercentage.Location = New System.Drawing.Point(14, 19) + Me.ucrChkDisplayAsPercentage.Name = "ucrChkDisplayAsPercentage" + Me.ucrChkDisplayAsPercentage.Size = New System.Drawing.Size(135, 23) + Me.ucrChkDisplayAsPercentage.TabIndex = 0 + ' + 'ucrReceiverNumericVariable + ' + Me.ucrReceiverNumericVariable.AutoSize = True + Me.ucrReceiverNumericVariable.frmParent = Me + Me.ucrReceiverNumericVariable.Location = New System.Drawing.Point(272, 222) + Me.ucrReceiverNumericVariable.Margin = New System.Windows.Forms.Padding(0) + Me.ucrReceiverNumericVariable.Name = "ucrReceiverNumericVariable" + Me.ucrReceiverNumericVariable.Selector = Nothing + Me.ucrReceiverNumericVariable.Size = New System.Drawing.Size(120, 20) + Me.ucrReceiverNumericVariable.strNcFilePath = "" + Me.ucrReceiverNumericVariable.TabIndex = 11 + Me.ucrReceiverNumericVariable.ucrSelector = Nothing + ' + 'ucrReceiverSecondFactor + ' + Me.ucrReceiverSecondFactor.AutoSize = True + Me.ucrReceiverSecondFactor.frmParent = Me + Me.ucrReceiverSecondFactor.Location = New System.Drawing.Point(272, 222) + Me.ucrReceiverSecondFactor.Margin = New System.Windows.Forms.Padding(0) + Me.ucrReceiverSecondFactor.Name = "ucrReceiverSecondFactor" + Me.ucrReceiverSecondFactor.Selector = Nothing + Me.ucrReceiverSecondFactor.Size = New System.Drawing.Size(120, 20) + Me.ucrReceiverSecondFactor.strNcFilePath = "" + Me.ucrReceiverSecondFactor.TabIndex = 9 + Me.ucrReceiverSecondFactor.ucrSelector = Nothing + ' + 'ucrChkOmitMissing + ' + Me.ucrChkOmitMissing.AutoSize = True + Me.ucrChkOmitMissing.Checked = False + Me.ucrChkOmitMissing.Location = New System.Drawing.Point(9, 19) + Me.ucrChkOmitMissing.Name = "ucrChkOmitMissing" + Me.ucrChkOmitMissing.Size = New System.Drawing.Size(143, 23) + Me.ucrChkOmitMissing.TabIndex = 0 + ' + 'ucrReceiverSecondOpt + ' + Me.ucrReceiverSecondOpt.AutoSize = True + Me.ucrReceiverSecondOpt.frmParent = Me + Me.ucrReceiverSecondOpt.Location = New System.Drawing.Point(271, 179) + Me.ucrReceiverSecondOpt.Margin = New System.Windows.Forms.Padding(0) + Me.ucrReceiverSecondOpt.Name = "ucrReceiverSecondOpt" + Me.ucrReceiverSecondOpt.Selector = Nothing + Me.ucrReceiverSecondOpt.Size = New System.Drawing.Size(120, 20) + Me.ucrReceiverSecondOpt.strNcFilePath = "" + Me.ucrReceiverSecondOpt.TabIndex = 7 + Me.ucrReceiverSecondOpt.ucrSelector = Nothing + ' + 'ucrPnlDescribe + ' + Me.ucrPnlDescribe.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink + Me.ucrPnlDescribe.Location = New System.Drawing.Point(39, 9) + Me.ucrPnlDescribe.Name = "ucrPnlDescribe" + Me.ucrPnlDescribe.Size = New System.Drawing.Size(317, 34) + Me.ucrPnlDescribe.TabIndex = 0 + ' 'ucrReceiverSecondVar ' Me.ucrReceiverSecondVar.AutoSize = True Me.ucrReceiverSecondVar.frmParent = Me - Me.ucrReceiverSecondVar.Location = New System.Drawing.Point(271, 170) + Me.ucrReceiverSecondVar.Location = New System.Drawing.Point(271, 179) Me.ucrReceiverSecondVar.Margin = New System.Windows.Forms.Padding(0) Me.ucrReceiverSecondVar.Name = "ucrReceiverSecondVar" Me.ucrReceiverSecondVar.Selector = Nothing @@ -187,13 +495,13 @@ Partial Class dlgDescribeTwoVariable ' Me.ucrReceiverFirstVars.AutoSize = True Me.ucrReceiverFirstVars.frmParent = Me - Me.ucrReceiverFirstVars.Location = New System.Drawing.Point(271, 63) + Me.ucrReceiverFirstVars.Location = New System.Drawing.Point(271, 76) Me.ucrReceiverFirstVars.Margin = New System.Windows.Forms.Padding(0) Me.ucrReceiverFirstVars.Name = "ucrReceiverFirstVars" Me.ucrReceiverFirstVars.Selector = Nothing - Me.ucrReceiverFirstVars.Size = New System.Drawing.Size(120, 87) + Me.ucrReceiverFirstVars.Size = New System.Drawing.Size(120, 79) Me.ucrReceiverFirstVars.strNcFilePath = "" - Me.ucrReceiverFirstVars.TabIndex = 4 + Me.ucrReceiverFirstVars.TabIndex = 5 Me.ucrReceiverFirstVars.ucrSelector = Nothing ' 'ucrSelectorDescribeTwoVar @@ -202,35 +510,38 @@ Partial Class dlgDescribeTwoVariable Me.ucrSelectorDescribeTwoVar.bDropUnusedFilterLevels = False Me.ucrSelectorDescribeTwoVar.bShowHiddenColumns = False Me.ucrSelectorDescribeTwoVar.bUseCurrentFilter = True - Me.ucrSelectorDescribeTwoVar.Location = New System.Drawing.Point(10, 10) + Me.ucrSelectorDescribeTwoVar.Location = New System.Drawing.Point(10, 39) Me.ucrSelectorDescribeTwoVar.Margin = New System.Windows.Forms.Padding(0) Me.ucrSelectorDescribeTwoVar.Name = "ucrSelectorDescribeTwoVar" Me.ucrSelectorDescribeTwoVar.Size = New System.Drawing.Size(213, 183) - Me.ucrSelectorDescribeTwoVar.TabIndex = 0 - ' - 'ucrBase - ' - Me.ucrBase.AutoSize = True - Me.ucrBase.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink - Me.ucrBase.Location = New System.Drawing.Point(10, 286) - Me.ucrBase.Name = "ucrBase" - Me.ucrBase.Size = New System.Drawing.Size(405, 52) - Me.ucrBase.TabIndex = 9 + Me.ucrSelectorDescribeTwoVar.TabIndex = 3 ' 'dlgDescribeTwoVariable ' 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, 341) - Me.Controls.Add(Me.grpSummaries) + Me.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink + Me.ClientSize = New System.Drawing.Size(419, 491) + Me.Controls.Add(Me.rdoThreeVariable) + Me.Controls.Add(Me.ucrBase) + Me.Controls.Add(Me.grpFrequency) + Me.Controls.Add(Me.grpDisplay) + Me.Controls.Add(Me.lblNumericVariable) + Me.Controls.Add(Me.ucrReceiverNumericVariable) + Me.Controls.Add(Me.lblSecondFactor) + Me.Controls.Add(Me.ucrReceiverSecondFactor) Me.Controls.Add(Me.grpOptions) + Me.Controls.Add(Me.lbSecondOpt) + Me.Controls.Add(Me.ucrReceiverSecondOpt) + Me.Controls.Add(Me.rdoSkim) + Me.Controls.Add(Me.rdoCustomize) + Me.Controls.Add(Me.ucrPnlDescribe) Me.Controls.Add(Me.lbSecondVariable) Me.Controls.Add(Me.lblFirstVariable) Me.Controls.Add(Me.ucrReceiverSecondVar) Me.Controls.Add(Me.ucrReceiverFirstVars) Me.Controls.Add(Me.ucrSelectorDescribeTwoVar) - Me.Controls.Add(Me.ucrBase) + Me.Controls.Add(Me.grpSummaries) Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow Me.MaximizeBox = False Me.MinimizeBox = False @@ -242,6 +553,10 @@ Partial Class dlgDescribeTwoVariable Me.grpOptions.PerformLayout() Me.grpSummaries.ResumeLayout(False) Me.grpSummaries.PerformLayout() + Me.grpDisplay.ResumeLayout(False) + Me.grpDisplay.PerformLayout() + Me.grpFrequency.ResumeLayout(False) + Me.grpFrequency.PerformLayout() Me.ResumeLayout(False) Me.PerformLayout() @@ -262,4 +577,27 @@ Partial Class dlgDescribeTwoVariable Friend WithEvents lblSummary As Label Friend WithEvents lblSummaryName As Label Friend WithEvents grpSummaries As GroupBox + Friend WithEvents ucrPnlDescribe As UcrPanel + Friend WithEvents ucrReceiverSecondOpt As ucrReceiverSingle + Friend WithEvents rdoSkim As RadioButton + Friend WithEvents rdoCustomize As RadioButton + Friend WithEvents lbSecondOpt As Label + Friend WithEvents lblSecondFactor As Label + Friend WithEvents ucrReceiverSecondFactor As ucrReceiverSingle + Friend WithEvents lblNumericVariable As Label + Friend WithEvents ucrReceiverNumericVariable As ucrReceiverSingle + Friend WithEvents ucrChkDisplayMargins As ucrCheck + Friend WithEvents ucrInputMarginName As ucrInputTextBox + Friend WithEvents lblMarginName As Label + Friend WithEvents grpDisplay As GroupBox + Friend WithEvents lblFactorsAsPercentage As Label + Friend WithEvents ucrChkPercentageProportion As ucrCheck + Friend WithEvents ucrChkDisplayAsPercentage As ucrCheck + Friend WithEvents grpFrequency As GroupBox + Friend WithEvents ucrNudColumnFactors As ucrNud + Friend WithEvents lblColumnFactors As Label + Friend WithEvents ucrNudSigFigs As ucrNud + Friend WithEvents lblSigFigs As Label + Friend WithEvents ucrReceiverPercentages As ucrReceiverSingle + Friend WithEvents rdoThreeVariable As RadioButton End Class diff --git a/instat/dlgDescribeTwoVariable.vb b/instat/dlgDescribeTwoVariable.vb index 888abdcdbf1..2e1557b8b7b 100644 --- a/instat/dlgDescribeTwoVariable.vb +++ b/instat/dlgDescribeTwoVariable.vb @@ -20,8 +20,19 @@ Public Class dlgDescribeTwoVariable Private bReset As Boolean = True Private bResetSubdialog As Boolean = False Public strFirstVariablesType, strSecondVariableType As String - Public clsGetDataType, clsGetSecondDataType, clsRCorrelation, clsRCustomSummary, clsConcFunction, clsRAnova, clsRFreqTables As New RFunction - Private clsSummariesList As New RFunction + Public clsGetDataTypeFunction, clsGetSecondDataTypeFunction, clsRCorrelationFunction, clsRCustomSummaryFunction, + clsCombineFunction, clsRAnovaFunction, clsFrequencyTablesFunction, clsSkimrFunction, clsSummariesListFunction, + clsGroupByFunction, clsDummyFunction, clsMmtableFunction, clsHeaderTopLeftFunction, + clsHeaderLeftTopFunction, clsHeaderLeftTopFuncion, clsCombineFrequencyParametersFunction, + clsSummaryMapFunction, clsCombineMultipleColumnsFunction, clsCombineFactorsFunction, + clsMmtableMapFunction, clsHeaderTopLeftSummaryVariableFunction, + clsCombineFrequencyFactorParameterFunction, clsSelectFunction, clsRenameCombineFunction As New RFunction + Private clsGroupByPipeOperator, clsMmtablePlusOperator, clsMapFrequencyPipeOperator, + clsMmtableTildeOperator, clsDataSelectTildeOperator, clsEmptyOperator, clsSecondEmptyOperator As New ROperator + Private lstFrequencyParameters As New List(Of String)({"percentage_type", "margin_name", + "perc_total_factors", "perc_decimal", + "signif_fig", "include_margins"}) + Private iUcrBaseXLocation, iDialogueXsize As Integer Private Sub dlgDescribeTwoVariable_Load(sender As Object, e As EventArgs) Handles MyBase.Load If bFirstLoad Then @@ -40,6 +51,11 @@ Public Class dlgDescribeTwoVariable Private Sub InitialiseDialog() ucrBase.iHelpTopicID = 414 ucrBase.clsRsyntax.iCallType = 2 + rdoThreeVariable.Enabled = False + lblNumericVariable.Visible = False + + iUcrBaseXLocation = ucrBase.Location.X + iDialogueXsize = Me.Size.Width ucrSelectorDescribeTwoVar.SetParameter(New RParameter("data_name", 0)) ucrSelectorDescribeTwoVar.SetParameterIsString() @@ -52,95 +68,285 @@ Public Class dlgDescribeTwoVariable ucrReceiverSecondVar.SetParameter(New RParameter("factors", 2)) ucrReceiverSecondVar.SetParameterIsString() ucrReceiverSecondVar.Selector = ucrSelectorDescribeTwoVar + ucrReceiverSecondVar.SetLinkedDisplayControl(lbSecondVariable) + + ucrReceiverSecondOpt.SetParameter(New RParameter("factors", 2, bNewIncludeArgumentName:=False)) + ucrReceiverSecondOpt.bWithQuotes = False + ucrReceiverSecondOpt.SetParameterIsString() + ucrReceiverSecondOpt.Selector = ucrSelectorDescribeTwoVar + ucrReceiverSecondOpt.SetLinkedDisplayControl(lbSecondOpt) + ucrReceiverSecondOpt.SetDataType("factor") + + ucrReceiverSecondFactor.SetParameter(New RParameter("second_factor", 3, bNewIncludeArgumentName:=False)) + ucrReceiverSecondFactor.bWithQuotes = False + ucrReceiverSecondFactor.SetParameterIsString() + ucrReceiverSecondFactor.Selector = ucrSelectorDescribeTwoVar + ucrReceiverSecondFactor.SetLinkedDisplayControl(lblSecondFactor) + ucrReceiverSecondFactor.SetDataType("factor") + + ucrReceiverNumericVariable.SetParameter(New RParameter("factor_two", 2, bNewIncludeArgumentName:=False)) + ucrReceiverNumericVariable.SetParameterIsString() + ucrReceiverNumericVariable.Selector = ucrSelectorDescribeTwoVar + ucrReceiverNumericVariable.SetLinkedDisplayControl(lblNumericVariable) ucrChkOmitMissing.SetParameter(New RParameter("na.rm", 6)) ucrChkOmitMissing.SetText("Omit Missing Values") ucrChkOmitMissing.SetValuesCheckedAndUnchecked("TRUE", "FALSE") ucrChkOmitMissing.bUpdateRCodeFromControl = True - clsGetDataType.SetRCommand(frmMain.clsRLink.strInstatDataObject & "$get_variables_metadata") - clsGetDataType.AddParameter("property", "data_type_label") + ucrChkDisplayMargins.SetParameter(New RParameter("include_margins", 5)) + ucrChkDisplayMargins.SetText("Display Margins") + ucrChkDisplayMargins.SetRDefault("FALSE") + + ucrInputMarginName.SetLinkedDisplayControl(lblMarginName) + + ucrPnlDescribe.AddRadioButton(rdoCustomize) + ucrPnlDescribe.AddRadioButton(rdoSkim) + ucrPnlDescribe.AddRadioButton(rdoThreeVariable) + ucrPnlDescribe.AddParameterValuesCondition(rdoCustomize, "checked", "customize") + ucrPnlDescribe.AddParameterValuesCondition(rdoSkim, "checked", "skim") + ucrPnlDescribe.AddParameterValuesCondition(rdoThreeVariable, "checked", "three_variable") + + ucrChkDisplayAsPercentage.SetParameter(New RParameter("percentage_type", 1)) + ucrChkDisplayAsPercentage.SetText("As Percentages") + ucrChkDisplayAsPercentage.SetValuesCheckedAndUnchecked(Chr(34) & "factors" & Chr(34), Chr(34) & "none" & Chr(34)) + ucrChkDisplayAsPercentage.SetRDefault(Chr(34) & "none" & Chr(34)) + + ucrChkDisplayAsPercentage.AddToLinkedControls(ucrReceiverPercentages, {True}, bNewLinkedAddRemoveParameter:=True, bNewLinkedHideIfParameterMissing:=True) + ucrChkDisplayAsPercentage.AddToLinkedControls(ucrChkPercentageProportion, {True}, bNewLinkedAddRemoveParameter:=True, bNewLinkedHideIfParameterMissing:=True) + + ucrReceiverPercentages.SetParameter(New RParameter("perc_total_factors", 2)) + ucrReceiverPercentages.SetParameterIsString() + ucrReceiverPercentages.Selector = ucrSelectorDescribeTwoVar + ucrReceiverPercentages.SetDataType("factor") + ucrReceiverPercentages.SetLinkedDisplayControl(lblFactorsAsPercentage) - clsGetSecondDataType.SetRCommand(frmMain.clsRLink.strInstatDataObject & "$get_variables_metadata") - clsGetSecondDataType.AddParameter("property", "data_type_label") + ucrChkPercentageProportion.SetParameter(New RParameter("perc_decimal", 3)) + ucrChkPercentageProportion.SetText("Display as Decimal") + ucrChkPercentageProportion.SetRDefault("FALSE") + + ucrNudSigFigs.SetParameter(New RParameter("signif_fig", 6)) + ucrNudSigFigs.SetMinMax(0, 22) + ucrNudSigFigs.SetRDefault(2) + + ucrNudColumnFactors.SetMinMax(1, 2) + + ucrPnlDescribe.AddToLinkedControls({ucrReceiverSecondOpt, ucrReceiverSecondFactor}, {rdoSkim, rdoThreeVariable}, bNewLinkedAddRemoveParameter:=True, bNewLinkedHideIfParameterMissing:=True) + ucrPnlDescribe.AddToLinkedControls({ucrReceiverNumericVariable}, {rdoThreeVariable}, bNewLinkedAddRemoveParameter:=True, bNewLinkedHideIfParameterMissing:=True) + + clsGetDataTypeFunction.SetRCommand(frmMain.clsRLink.strInstatDataObject & "$get_variables_metadata") + clsGetDataTypeFunction.AddParameter("property", "data_type_label") + + clsGetSecondDataTypeFunction.SetRCommand(frmMain.clsRLink.strInstatDataObject & "$get_variables_metadata") + clsGetSecondDataTypeFunction.AddParameter("property", "data_type_label") End Sub Private Sub SetDefaults() - clsRFreqTables = New RFunction - clsRAnova = New RFunction - clsRCorrelation = New RFunction - clsSummariesList = New RFunction - clsRCustomSummary = New RFunction - clsConcFunction = New RFunction + clsFrequencyTablesFunction = New RFunction + clsRAnovaFunction = New RFunction + clsRCorrelationFunction = New RFunction + clsSummariesListFunction = New RFunction + clsRCustomSummaryFunction = New RFunction + clsCombineFunction = New RFunction + clsSkimrFunction = New RFunction + clsGroupByPipeOperator = New ROperator + clsGroupByFunction = New RFunction + clsMmtableFunction = New RFunction + clsHeaderTopLeftFunction = New RFunction + clsHeaderLeftTopFunction = New RFunction + clsHeaderLeftTopFuncion = New RFunction + clsDummyFunction = New RFunction + clsCombineFrequencyParametersFunction = New RFunction + clsSummaryMapFunction = New RFunction + clsCombineMultipleColumnsFunction = New RFunction + clsMmtableMapFunction = New RFunction + clsHeaderTopLeftSummaryVariableFunction = New RFunction + clsCombineFactorsFunction = New RFunction + clsCombineFrequencyFactorParameterFunction = New RFunction + clsSelectFunction = New RFunction + clsRenameCombineFunction = New RFunction + clsDataSelectTildeOperator = New ROperator + clsMmtableTildeOperator = New ROperator + clsMapFrequencyPipeOperator = New ROperator + clsMmtablePlusOperator = New ROperator + clsEmptyOperator = New ROperator + clsSecondEmptyOperator = New ROperator ucrSelectorDescribeTwoVar.Reset() ucrReceiverFirstVars.SetMeAsReceiver() + ucrInputMarginName.SetText("All") + ucrNudColumnFactors.SetText("2") + ucrInputMarginName.Visible = False - clsConcFunction.SetRCommand("c") + ucrBase.clsRsyntax.ClearCodes() - clsRFreqTables.SetRCommand(frmMain.clsRLink.strInstatDataObject & "$frequency_tables") - clsRFreqTables.AddParameter("store_results", "FALSE", iPosition:=4) - clsRFreqTables.AddParameter("as_html", "FALSE", iPosition:=12) + clsCombineFrequencyParametersFunction.SetRCommand("c") - clsRAnova.AddParameter("signif.stars", "FALSE", iPosition:=2) - clsRAnova.AddParameter("sign_level", "FALSE", iPosition:=3) - clsRAnova.AddParameter("means", "FALSE", iPosition:=4) + clsCombineFactorsFunction.SetRCommand("c") - clsSummariesList.SetRCommand("c") - clsSummariesList.AddParameter("summary_count_missing", Chr(34) & "summary_count_missing" & Chr(34), bIncludeArgumentName:=False, iPosition:=0) - clsSummariesList.AddParameter("summary_min", Chr(34) & "summary_min" & Chr(34), bIncludeArgumentName:=False, iPosition:=1) - clsSummariesList.AddParameter("p25", Chr(34) & "p25" & Chr(34), bIncludeArgumentName:=False, iPosition:=2) - clsSummariesList.AddParameter("summary_median", Chr(34) & "summary_median" & Chr(34), bIncludeArgumentName:=False, iPosition:=3) - clsSummariesList.AddParameter("summary_mean", Chr(34) & "summary_mean" & Chr(34), bIncludeArgumentName:=False, iPosition:=4) - clsSummariesList.AddParameter("p75", Chr(34) & "p75" & Chr(34), bIncludeArgumentName:=False, iPosition:=5) - clsSummariesList.AddParameter("summary_max", Chr(34) & "summary_max" & Chr(34), bIncludeArgumentName:=False, iPosition:=6) + clsRenameCombineFunction.SetRCommand("c") + clsRenameCombineFunction.AddParameter("first", "1", iPosition:=0, bIncludeArgumentName:=False) + clsRenameCombineFunction.AddParameter("by_var", "2", iPosition:=1) + clsRenameCombineFunction.AddParameter("third", "3", iPosition:=2, bIncludeArgumentName:=False) + clsRenameCombineFunction.AddParameter("fourth", "4", iPosition:=3, bIncludeArgumentName:=False) - clsRCustomSummary.SetRCommand(frmMain.clsRLink.strInstatDataObject & "$summary") - clsRCustomSummary.AddParameter("summaries", clsRFunctionParameter:=clsSummariesList) + clsSelectFunction.SetPackageName("dplyr") + clsSelectFunction.SetRCommand("select") + clsSelectFunction.AddParameter(".data", clsRFunctionParameter:=clsFrequencyTablesFunction, iPosition:=0) + clsSelectFunction.AddParameter("rename_function", bIncludeArgumentName:=False, clsRFunctionParameter:=clsRenameCombineFunction, iPosition:=1) - clsRCustomSummary.AddParameter("store_results", "FALSE", iPosition:=4) - clsRCustomSummary.AddParameter("drop", "TRUE", iPosition:=5) - clsRCustomSummary.AddParameter("na.rm", "FALSE", iPosition:=6) - clsRCustomSummary.AddParameter("return_output", "TRUE", iPosition:=7) + clsCombineFrequencyFactorParameterFunction.SetRCommand("c") + clsCombineFrequencyFactorParameterFunction.AddParameter("factor_by", ".x", + iPosition:=1, bIncludeArgumentName:=False) - clsRCorrelation.SetRCommand(frmMain.clsRLink.strInstatDataObject & "$cor") + clsEmptyOperator.SetOperation("") + clsEmptyOperator.AddParameter("multiple_receiver_cols", "multiple_receiver_cols", iPosition:=0) + clsEmptyOperator.SetAssignTo("names(list_of_tables)") - clsRAnova.SetRCommand(frmMain.clsRLink.strInstatDataObject & "$anova_tables") + clsSecondEmptyOperator.SetOperation("") + clsSecondEmptyOperator.iCallType = 2 + clsSecondEmptyOperator.AddParameter("list_of_tables", "list_of_tables", iPosition:=0) - ucrBase.clsRsyntax.SetBaseRFunction(clsRCustomSummary) - bResetSubdialog = True - End Sub + clsDataSelectTildeOperator.SetOperation("~") + clsDataSelectTildeOperator.AddParameter("empty_parameter", "", iPosition:=0) + clsDataSelectTildeOperator.AddParameter("select_function", clsRFunctionParameter:=clsSelectFunction, iPosition:=1) - Private Sub SetRCodeForControls(bReset As Boolean) - ucrReceiverSecondVar.AddAdditionalCodeParameterPair(clsRAnova, New RParameter("y_col_name", 2), iAdditionalPairNo:=1) - ucrReceiverSecondVar.AddAdditionalCodeParameterPair(clsRFreqTables, New RParameter("y_col_name", 2), iAdditionalPairNo:=2) - ucrReceiverSecondVar.AddAdditionalCodeParameterPair(clsRCorrelation, New RParameter("y_col_name", 2), iAdditionalPairNo:=3) + clsMmtableTildeOperator.SetOperation("~") + clsMmtableTildeOperator.AddParameter("empty_parameter", "", iPosition:=0) + clsMmtableTildeOperator.AddParameter("mmtable", clsRFunctionParameter:=clsMmtableFunction, iPosition:=1) + + clsCombineMultipleColumnsFunction.SetRCommand("c") + clsCombineMultipleColumnsFunction.SetAssignTo("multiple_receiver_cols") + + clsSummaryMapFunction.SetPackageName("purrr") + clsSummaryMapFunction.SetRCommand("map") + clsSummaryMapFunction.AddParameter(".x", clsRFunctionParameter:=clsCombineMultipleColumnsFunction, iPosition:=0) + clsSummaryMapFunction.AddParameter(".f", clsROperatorParameter:=clsDataSelectTildeOperator, iPosition:=1) + + clsMmtableMapFunction.SetPackageName("purrr") + clsMmtableMapFunction.SetRCommand("map") + clsMmtableMapFunction.AddParameter(".x", ".", iPosition:=0) + clsMmtableMapFunction.AddParameter(".f", clsROperatorParameter:=clsMmtablePlusOperator, iPosition:=1) + + clsMapFrequencyPipeOperator.SetOperation("%>%") + clsMapFrequencyPipeOperator.AddParameter("map_summary_table", clsRFunctionParameter:=clsSummaryMapFunction, iPosition:=1) + clsMapFrequencyPipeOperator.AddParameter("map_mmtable", clsRFunctionParameter:=clsMmtableMapFunction, iPosition:=2) + clsMapFrequencyPipeOperator.AddParameter("data", clsRFunctionParameter:=ucrSelectorDescribeTwoVar.ucrAvailableDataFrames.clsCurrDataFrame, iPosition:=0) + clsMapFrequencyPipeOperator.SetAssignTo("list_of_tables ") + + clsHeaderTopLeftFunction.SetPackageName("mmtable2") + clsHeaderTopLeftFunction.SetRCommand("header_top_left") + + clsHeaderLeftTopFunction.SetPackageName("mmtable2") + clsHeaderLeftTopFunction.SetRCommand("header_left_top") + + clsHeaderTopLeftSummaryVariableFunction.SetPackageName("mmtable2") + clsHeaderTopLeftSummaryVariableFunction.SetRCommand("header_top_left") + clsHeaderTopLeftSummaryVariableFunction.AddParameter("variable", Chr(39) & "summary-variable" & Chr(39), iPosition:=0) + + clsMmtableFunction.SetPackageName("mmtable2") + clsMmtableFunction.SetRCommand("mmtable") + clsMmtableFunction.AddParameter("data", ".x", iPosition:=0) + clsMmtableFunction.AddParameter("cells", "value", iPosition:=1) + + clsDummyFunction.AddParameter("checked", "skim", iPosition:=0) + + clsMmtablePlusOperator.SetOperation("+") + clsMmtablePlusOperator.bBrackets = False + clsMmtablePlusOperator.AddParameter("mmtable2", clsROperatorParameter:=clsMmtableTildeOperator, iPosition:=0) + clsMmtablePlusOperator.AddParameter("header_top_left", clsRFunctionParameter:=clsHeaderTopLeftFunction, iPosition:=1) + clsMmtablePlusOperator.AddParameter("header_left_top", clsRFunctionParameter:=clsHeaderLeftTopFunction, iPosition:=2) - ucrReceiverFirstVars.AddAdditionalCodeParameterPair(clsRAnova, New RParameter("x_col_names", 1), iAdditionalPairNo:=1) - ucrReceiverFirstVars.AddAdditionalCodeParameterPair(clsRFreqTables, New RParameter("x_col_names", 1), iAdditionalPairNo:=2) - ucrReceiverFirstVars.AddAdditionalCodeParameterPair(clsRCorrelation, New RParameter("x_col_names", 1), iAdditionalPairNo:=3) + clsGroupByPipeOperator.SetOperation("%>%") + clsGroupByPipeOperator.AddParameter("skim", clsRFunctionParameter:=clsSkimrFunction, iPosition:=2, bIncludeArgumentName:=False) + clsGroupByPipeOperator.AddParameter("data", clsRFunctionParameter:=ucrSelectorDescribeTwoVar.ucrAvailableDataFrames.clsCurrDataFrame, iPosition:=0) - ucrSelectorDescribeTwoVar.AddAdditionalCodeParameterPair(clsRAnova, ucrSelectorDescribeTwoVar.GetParameter(), iAdditionalPairNo:=1) - ucrSelectorDescribeTwoVar.AddAdditionalCodeParameterPair(clsRCustomSummary, ucrSelectorDescribeTwoVar.GetParameter(), iAdditionalPairNo:=2) - ucrSelectorDescribeTwoVar.AddAdditionalCodeParameterPair(clsRFreqTables, ucrSelectorDescribeTwoVar.GetParameter(), iAdditionalPairNo:=3) + clsGroupByFunction.SetPackageName("dplyr") + clsGroupByFunction.SetRCommand("group_by") - ucrChkOmitMissing.SetRCode(clsRCustomSummary, bReset) - ucrReceiverFirstVars.SetRCode(clsRCustomSummary, bReset) - ucrReceiverSecondVar.SetRCode(clsRCustomSummary, bReset) - ucrSelectorDescribeTwoVar.SetRCode(clsRCorrelation, bReset) + clsSkimrFunction.SetPackageName("skimr") + clsSkimrFunction.SetRCommand("skim_without_charts") + clsCombineFunction.SetRCommand("c") + + clsFrequencyTablesFunction.SetRCommand(frmMain.clsRLink.strInstatDataObject & "$summary_table") + clsFrequencyTablesFunction.AddParameter("data_name", Chr(34) & ucrSelectorDescribeTwoVar.ucrAvailableDataFrames.cboAvailableDataFrames.Text & Chr(34), iPosition:=0) + clsFrequencyTablesFunction.AddParameter("summaries", Chr(34) & "summary_count" & Chr(34), iPosition:=1) + clsFrequencyTablesFunction.AddParameter("factors", clsRFunctionParameter:=clsCombineFrequencyFactorParameterFunction, iPosition:=2) + + clsRAnovaFunction.AddParameter("signif.stars", "FALSE", iPosition:=2) + clsRAnovaFunction.AddParameter("sign_level", "FALSE", iPosition:=3) + clsRAnovaFunction.AddParameter("means", "FALSE", iPosition:=4) + + clsSummariesListFunction.SetRCommand("c") + clsSummariesListFunction.AddParameter("summary_count_missing", Chr(34) & "summary_count_missing" & Chr(34), bIncludeArgumentName:=False, iPosition:=0) + clsSummariesListFunction.AddParameter("summary_min", Chr(34) & "summary_min" & Chr(34), bIncludeArgumentName:=False, iPosition:=1) + clsSummariesListFunction.AddParameter("p25", Chr(34) & "p25" & Chr(34), bIncludeArgumentName:=False, iPosition:=2) + clsSummariesListFunction.AddParameter("summary_median", Chr(34) & "summary_median" & Chr(34), bIncludeArgumentName:=False, iPosition:=3) + clsSummariesListFunction.AddParameter("summary_mean", Chr(34) & "summary_mean" & Chr(34), bIncludeArgumentName:=False, iPosition:=4) + clsSummariesListFunction.AddParameter("p75", Chr(34) & "p75" & Chr(34), bIncludeArgumentName:=False, iPosition:=5) + clsSummariesListFunction.AddParameter("summary_max", Chr(34) & "summary_max" & Chr(34), bIncludeArgumentName:=False, iPosition:=6) + + clsRCustomSummaryFunction.SetRCommand(frmMain.clsRLink.strInstatDataObject & "$summary") + clsRCustomSummaryFunction.AddParameter("summaries", clsRFunctionParameter:=clsSummariesListFunction) + + clsRCustomSummaryFunction.AddParameter("store_results", "FALSE", iPosition:=4) + clsRCustomSummaryFunction.AddParameter("drop", "TRUE", iPosition:=5) + clsRCustomSummaryFunction.AddParameter("na.rm", "FALSE", iPosition:=6) + clsRCustomSummaryFunction.AddParameter("return_output", "TRUE", iPosition:=7) + + clsRCorrelationFunction.SetRCommand(frmMain.clsRLink.strInstatDataObject & "$cor") + + clsRAnovaFunction.SetRCommand(frmMain.clsRLink.strInstatDataObject & "$anova_tables") + + ucrBase.clsRsyntax.SetBaseROperator(clsGroupByPipeOperator) + bResetSubdialog = True + End Sub + + Private Sub SetRCodeForControls(bReset As Boolean) + ucrReceiverSecondVar.AddAdditionalCodeParameterPair(clsRAnovaFunction, New RParameter("y_col_name", 2), iAdditionalPairNo:=1) + ucrReceiverSecondVar.AddAdditionalCodeParameterPair(clsRCorrelationFunction, New RParameter("y_col_name", 2), iAdditionalPairNo:=2) + ucrReceiverSecondVar.AddAdditionalCodeParameterPair(clsCombineFrequencyFactorParameterFunction, New RParameter("factor_one", 0, bNewIncludeArgumentName:=False), iAdditionalPairNo:=3) + + ucrReceiverFirstVars.AddAdditionalCodeParameterPair(clsRAnovaFunction, New RParameter("x_col_names", 1), iAdditionalPairNo:=1) + ucrReceiverFirstVars.AddAdditionalCodeParameterPair(clsRCorrelationFunction, New RParameter("x_col_names", 1), iAdditionalPairNo:=2) + ucrReceiverFirstVars.AddAdditionalCodeParameterPair(clsSkimrFunction, New RParameter("col_names", 1, bNewIncludeArgumentName:=False), iAdditionalPairNo:=3) + + ucrSelectorDescribeTwoVar.AddAdditionalCodeParameterPair(clsRAnovaFunction, ucrSelectorDescribeTwoVar.GetParameter(), iAdditionalPairNo:=1) + ucrSelectorDescribeTwoVar.AddAdditionalCodeParameterPair(clsRCustomSummaryFunction, ucrSelectorDescribeTwoVar.GetParameter(), iAdditionalPairNo:=2) + + ucrChkOmitMissing.SetRCode(clsRCustomSummaryFunction, bReset) + ucrReceiverFirstVars.SetRCode(clsRCustomSummaryFunction, bReset) + ucrReceiverSecondVar.SetRCode(clsRCustomSummaryFunction, bReset) + ucrSelectorDescribeTwoVar.SetRCode(clsRCorrelationFunction, bReset) + ucrReceiverSecondOpt.SetRCode(clsGroupByFunction, bReset) + ucrReceiverSecondFactor.SetRCode(clsGroupByFunction, bReset) + ucrChkDisplayMargins.SetRCode(clsCombineFrequencyParametersFunction, bReset) + ucrChkDisplayAsPercentage.SetRCode(clsCombineFrequencyParametersFunction, bReset) + ucrReceiverPercentages.SetRCode(clsCombineFrequencyParametersFunction, bReset) + ucrChkPercentageProportion.SetRCode(clsCombineFrequencyParametersFunction, bReset) + ucrPnlDescribe.SetRCode(clsDummyFunction, bReset) + ucrNudSigFigs.SetRCode(clsCombineFrequencyParametersFunction, bReset) Results() End Sub Public Sub TestOKEnabled() - If ((Not ucrReceiverSecondVar.IsEmpty()) AndAlso (Not ucrReceiverFirstVars.IsEmpty())) Then - If ((strFirstVariablesType = "numeric" OrElse strFirstVariablesType = "integer") AndAlso (strSecondVariableType = "factor")) AndAlso clsSummariesList.clsParameters.Count = 0 Then + If rdoCustomize.Checked Then + If ((Not ucrReceiverSecondVar.IsEmpty()) AndAlso (Not ucrReceiverFirstVars.IsEmpty())) Then + If ((strFirstVariablesType = "numeric" OrElse strFirstVariablesType = "integer") AndAlso (strSecondVariableType = "factor")) AndAlso clsSummariesListFunction.clsParameters.Count = 0 Then + ucrBase.OKEnabled(False) + Else + ucrBase.OKEnabled(True) + End If + Else + ucrBase.OKEnabled(False) + End If + Else + If ucrReceiverFirstVars.IsEmpty Then ucrBase.OKEnabled(False) Else ucrBase.OKEnabled(True) End If - Else - ucrBase.OKEnabled(False) End If End Sub @@ -151,14 +357,14 @@ Public Class dlgDescribeTwoVariable End Sub Private Sub cmdSummaries_Click(sender As Object, e As EventArgs) Handles cmdSummaries.Click - sdgSummaries.SetRFunction(clsSummariesList, clsRCustomSummary, clsConcFunction, ucrSelectorDescribeTwoVar, bResetSubdialog) + sdgSummaries.SetRFunction(clsSummariesListFunction, clsRCustomSummaryFunction, clsCombineFunction, ucrSelectorDescribeTwoVar, bResetSubdialog) bResetSubdialog = False sdgSummaries.ShowDialog() TestOKEnabled() End Sub Private Sub cmdDisplayOptions_Click(sender As Object, e As EventArgs) - sdgDescribeDisplay.SetRFunction(clsRFreqTables, clsRAnova, bResetSubdialog) + sdgDescribeDisplay.SetRFunction(clsFrequencyTablesFunction, clsRAnovaFunction, bResetSubdialog) bResetSubdialog = False sdgDescribeDisplay.ShowDialog() TestOKEnabled() @@ -166,86 +372,233 @@ Public Class dlgDescribeTwoVariable Public Sub Results() Dim lstFirstItemTypes As List(Of String) - - If Not ucrReceiverFirstVars.IsEmpty() Then - lstFirstItemTypes = ucrReceiverFirstVars.GetCurrentItemTypes(True, bIsCategoricalNumeric:=True) - If lstFirstItemTypes.Count = 1 AndAlso lstFirstItemTypes.Contains("logical") Then - lstFirstItemTypes(0) = "categorical" - Else - lstFirstItemTypes.RemoveAll(Function(x) x.Contains("logical")) - End If - If (lstFirstItemTypes.Count > 0) Then - strFirstVariablesType = lstFirstItemTypes(0) + ucrBase.clsRsyntax.RemoveFromAfterCodes(clsEmptyOperator) + ucrBase.clsRsyntax.RemoveFromAfterCodes(clsSecondEmptyOperator) + If rdoCustomize.Checked Then + grpSummaries.Visible = True + If Not ucrReceiverFirstVars.IsEmpty() Then + lstFirstItemTypes = ucrReceiverFirstVars.GetCurrentItemTypes(True, bIsCategoricalNumeric:=True) + If lstFirstItemTypes.Count = 1 AndAlso lstFirstItemTypes.Contains("logical") Then + lstFirstItemTypes(0) = "categorical" + Else + lstFirstItemTypes.RemoveAll(Function(x) x.Contains("logical")) + End If + If (lstFirstItemTypes.Count > 0) Then + strFirstVariablesType = lstFirstItemTypes(0) + Else + strFirstVariablesType = "" + End If + lblFirstType.Text = strFirstVariablesType + lblFirstType.ForeColor = SystemColors.Highlight Else strFirstVariablesType = "" lblFirstType.Text = "________" lblFirstType.ForeColor = SystemColors.ControlText End If - lblFirstType.Text = strFirstVariablesType - lblFirstType.ForeColor = SystemColors.Highlight - Else - strFirstVariablesType = "" - lblFirstType.Text = "________" - lblFirstType.ForeColor = SystemColors.ControlText - End If - If Not ucrReceiverSecondVar.IsEmpty() Then - strSecondVariableType = ucrReceiverSecondVar.strCurrDataType - If strSecondVariableType.Contains("factor") OrElse strSecondVariableType.Contains("character") OrElse strSecondVariableType.Contains("logical") Then - strSecondVariableType = "categorical" + If Not ucrReceiverSecondVar.IsEmpty() Then + strSecondVariableType = ucrReceiverSecondVar.strCurrDataType + If strSecondVariableType.Contains("factor") OrElse strSecondVariableType.Contains("character") OrElse strSecondVariableType.Contains("logical") Then + strSecondVariableType = "categorical" + Else + strSecondVariableType = "numeric" + End If + lblSecondType.Text = strSecondVariableType + lblSecondType.ForeColor = SystemColors.Highlight Else - strSecondVariableType = "numeric" + strSecondVariableType = "" + lblSecondType.Text = "________" + lblSecondType.ForeColor = SystemColors.ControlText End If - lblSecondType.Text = strSecondVariableType - lblSecondType.ForeColor = SystemColors.Highlight - Else - strSecondVariableType = "" - lblSecondType.Text = "________" - lblSecondType.ForeColor = SystemColors.ControlText - End If - If strFirstVariablesType = "numeric" AndAlso strSecondVariableType = "numeric" Then - grpOptions.Visible = True - cmdSummaries.Visible = False - ucrChkOmitMissing.Visible = True - ucrBase.clsRsyntax.SetBaseRFunction(clsRCorrelation) - lblSummaryName.Text = "Correlations" - lblSummaryName.ForeColor = SystemColors.Highlight - ElseIf strFirstVariablesType = "categorical" AndAlso strSecondVariableType = "numeric" Then - grpOptions.Visible = False - ucrBase.clsRsyntax.SetBaseRFunction(clsRAnova) - lblSummaryName.Text = "ANOVA tables" - lblSummaryName.ForeColor = SystemColors.Highlight - ElseIf strFirstVariablesType = "numeric" AndAlso strSecondVariableType = "categorical" Then - grpOptions.Visible = True - cmdSummaries.Visible = True - ucrChkOmitMissing.Visible = True - ucrBase.clsRsyntax.SetBaseRFunction(clsRCustomSummary) - ucrReceiverFirstVars.SetParameterIsString() - lblSummaryName.Text = "Numerical summaries" - lblSummaryName.ForeColor = SystemColors.Highlight - ElseIf strFirstVariablesType = "categorical" AndAlso strSecondVariableType = "categorical" Then - grpOptions.Visible = False - ucrBase.clsRsyntax.SetBaseRFunction(clsRFreqTables) - lblSummaryName.Text = "Frequency tables" - lblSummaryName.ForeColor = SystemColors.Highlight + If strFirstVariablesType = "numeric" AndAlso strSecondVariableType = "numeric" Then + grpOptions.Visible = True + cmdSummaries.Visible = False + ucrChkOmitMissing.Visible = True + ucrBase.clsRsyntax.SetBaseRFunction(clsRCorrelationFunction) + lblSummaryName.Text = "Correlations" + lblSummaryName.ForeColor = SystemColors.Highlight + ElseIf strFirstVariablesType = "categorical" AndAlso strSecondVariableType = "numeric" Then + grpOptions.Visible = False + ucrBase.clsRsyntax.SetBaseRFunction(clsRAnovaFunction) + lblSummaryName.Text = "ANOVA tables" + lblSummaryName.ForeColor = SystemColors.Highlight + ElseIf strFirstVariablesType = "numeric" AndAlso strSecondVariableType = "categorical" Then + grpOptions.Visible = True + cmdSummaries.Visible = True + ucrChkOmitMissing.Visible = True + ucrBase.clsRsyntax.SetBaseRFunction(clsRCustomSummaryFunction) + ucrReceiverFirstVars.SetParameterIsString() + lblSummaryName.Text = "Numerical summaries" + lblSummaryName.ForeColor = SystemColors.Highlight + ElseIf strFirstVariablesType = "categorical" AndAlso strSecondVariableType = "categorical" Then + grpOptions.Visible = False + ucrBase.clsRsyntax.SetBaseROperator(clsMapFrequencyPipeOperator) + ucrBase.clsRsyntax.AddToAfterCodes(clsEmptyOperator, 1) + ucrBase.clsRsyntax.AddToAfterCodes(clsSecondEmptyOperator, 2) + lblSummaryName.Text = "Frequency tables" + lblSummaryName.ForeColor = SystemColors.Highlight + Else + grpOptions.Visible = False + lblSummaryName.Text = "__________" + lblSummaryName.ForeColor = SystemColors.ControlText + End If Else grpOptions.Visible = False - lblSummaryName.Text = "__________" - lblSummaryName.ForeColor = SystemColors.ControlText + grpSummaries.Visible = False End If autoTranslate(Me) End Sub - Private Sub Controls_ControlContentsChanged(ucrChangedControl As ucrCore) Handles ucrReceiverFirstVars.ControlContentsChanged, ucrReceiverSecondVar.ControlContentsChanged + Private Sub Controls_ControlContentsChanged(ucrChangedControl As ucrCore) Handles ucrReceiverFirstVars.ControlContentsChanged, ucrReceiverSecondVar.ControlContentsChanged, ucrPnlDescribe.ControlContentsChanged + If Not ucrReceiverFirstVars.IsEmpty AndAlso (ucrChangedControl Is ucrReceiverFirstVars OrElse ucrChangedControl Is ucrReceiverSecondVar) Then + Dim iPosition As Integer = 0 + clsCombineMultipleColumnsFunction.ClearParameters() + clsCombineFactorsFunction.ClearParameters() + + For Each strColumn In ucrReceiverFirstVars.GetVariableNamesList() + clsCombineMultipleColumnsFunction.AddParameter(strColumn, strColumn, bIncludeArgumentName:=False, iPosition:=iPosition) + If ucrReceiverSecondVar.GetVariableNames <> strColumn Then + clsCombineFactorsFunction.AddParameter(strColumn, strColumn, bIncludeArgumentName:=False, iPosition:=iPosition) + End If + iPosition += 1 + Next + clsCombineFactorsFunction.AddParameter(ucrReceiverSecondVar.GetVariableNames, ucrReceiverSecondVar.GetVariableNames, + bIncludeArgumentName:=False, iPosition:=iPosition) + End If + SwapMmtableHeaderFunctions() Results() + EnableDisableFrequencyControls() + AddRemoveFrequencyParameters() + ChangeLocations() TestOKEnabled() End Sub Private Sub ucrChkOmitMissing_ControlValueChanged(ucrChangedControl As ucrCore) Handles ucrChkOmitMissing.ControlValueChanged If ucrChkOmitMissing.Checked Then - clsRCorrelation.AddParameter("use", Chr(34) & "pairwise.complete.obs" & Chr(34), iPosition:=2) + clsRCorrelationFunction.AddParameter("use", Chr(34) & "pairwise.complete.obs" & Chr(34), iPosition:=2) + Else + clsRCorrelationFunction.RemoveParameterByName("use") + End If + End Sub + + Private Sub ucrPnlDescribe_ControlValueChanged(ucrChangedControl As ucrCore) Handles ucrPnlDescribe.ControlValueChanged + ucrReceiverFirstVars.Clear() + ucrReceiverFirstVars.SetMeAsReceiver() + If rdoSkim.Checked Then + clsDummyFunction.AddParameter("checked", "skim", iPosition:=0) + ucrReceiverFirstVars.SetSingleTypeStatus(False) + ucrBase.clsRsyntax.SetBaseROperator(clsGroupByPipeOperator) + ElseIf rdoCustomize.Checked Then + clsDummyFunction.AddParameter("checked", "customize", iPosition:=0) + ucrBase.clsRsyntax.SetBaseRFunction(clsRCustomSummaryFunction) + ucrReceiverFirstVars.SetSingleTypeStatus(True, bIsCategoricalNumeric:=True) + Else + clsDummyFunction.AddParameter("checked", "three_variable", iPosition:=0) + End If + ChangeLocations() + End Sub + + Private Sub ChangeLocations() + If rdoSkim.Checked Then + ucrBase.Location = New Point(iUcrBaseXLocation, 328) + Me.Size = New System.Drawing.Point(iDialogueXsize, 425) + Else + If strFirstVariablesType = "categorical" AndAlso + strSecondVariableType = "categorical" Then + ucrBase.Location = New Point(iUcrBaseXLocation, 435) + Me.Size = New System.Drawing.Point(iDialogueXsize, 530) + Else + ucrBase.Location = New Point(iUcrBaseXLocation, 328) + Me.Size = New System.Drawing.Point(iDialogueXsize, 425) + End If + End If + End Sub + + Private Sub ucrReceiverSecondOpt_ControlValueChanged(ucrChangedControl As ucrCore) Handles ucrReceiverSecondOpt.ControlValueChanged + If ucrReceiverSecondOpt.IsEmpty Then + clsGroupByPipeOperator.RemoveParameterByName("group") Else - clsRCorrelation.RemoveParameterByName("use") + clsGroupByPipeOperator.AddParameter("group", clsRFunctionParameter:=clsGroupByFunction, iPosition:=1, bIncludeArgumentName:=False) End If End Sub + + Private Sub EnableDisableFrequencyControls() + If rdoCustomize.Checked Then + If strFirstVariablesType = "categorical" AndAlso strSecondVariableType = "categorical" Then + grpDisplay.Visible = True + grpFrequency.Visible = True + ucrChkDisplayMargins.Visible = True + ucrInputMarginName.Visible = ucrChkDisplayMargins.Checked + Else + ucrReceiverFirstVars.SetMeAsReceiver() + DisableFrequencyControls() + End If + Else + DisableFrequencyControls() + End If + End Sub + + Private Sub DisableFrequencyControls() + grpDisplay.Visible = False + grpFrequency.Visible = False + ucrChkDisplayMargins.Visible = False + ucrInputMarginName.Visible = False + End Sub + + Private Sub SwapMmtableHeaderFunctions() + If rdoCustomize.Checked Then + clsMmtablePlusOperator.RemoveParameterByName("summary_variable") + clsMmtablePlusOperator.AddParameter("header_top_left", clsRFunctionParameter:=clsHeaderTopLeftFunction, iPosition:=1) + If Not ucrReceiverSecondVar.IsEmpty Then + If ucrNudColumnFactors.GetText = 1 Then + clsHeaderLeftTopFunction.AddParameter("variable", Chr(39) & "by_var" & Chr(39), iPosition:=0) + clsHeaderTopLeftFunction.AddParameter("variable", ucrReceiverSecondVar.GetVariableNames(), iPosition:=0) + ElseIf ucrNudColumnFactors.GetText = 2 Then + clsHeaderTopLeftFunction.AddParameter("variable", Chr(39) & "by_var" & Chr(39), iPosition:=0) + clsHeaderLeftTopFunction.AddParameter("variable", ucrReceiverSecondVar.GetVariableNames(), iPosition:=0) + End If + End If + End If + End Sub + + Private Sub AddRemoveFrequencyParameters() + If strFirstVariablesType = "categorical" AndAlso strSecondVariableType = "categorical" Then + For Each strParameter In lstFrequencyParameters + clsFrequencyTablesFunction.RemoveParameterByName(strParameter) + Next + For Each clsParameter In clsCombineFrequencyParametersFunction.clsParameters + clsFrequencyTablesFunction.AddParameter(clsParameter) + Next + End If + End Sub + + Private Sub Frequencies_ControlValueChanged(ucrChangedControl As ucrCore) Handles ucrChkPercentageProportion.ControlValueChanged, + ucrChkDisplayAsPercentage.ControlValueChanged, ucrNudSigFigs.ControlValueChanged, ucrChkDisplayMargins.ControlValueChanged, + ucrReceiverPercentages.ControlValueChanged, ucrInputMarginName.ControlValueChanged + If rdoCustomize.Checked Then + If ucrChkDisplayAsPercentage.Checked Then + ucrReceiverPercentages.SetMeAsReceiver() + Else + ucrReceiverFirstVars.SetMeAsReceiver() + End If + End If + If ucrChkDisplayMargins.Checked Then + ucrInputMarginName.Visible = True + clsCombineFrequencyParametersFunction.AddParameter("margin_name", Chr(34) & ucrInputMarginName.GetText & Chr(34), iPosition:=6) + Else + ucrInputMarginName.Visible = False + clsCombineFrequencyParametersFunction.RemoveParameterByName("margin_name") + End If + AddRemoveFrequencyParameters() + End Sub + + Private Sub ucrNudColumnFactors_ControlValueChanged(ucrChangedControl As ucrCore) Handles ucrNudColumnFactors.ControlValueChanged + SwapMmtableHeaderFunctions() + End Sub + + Private Sub ucrSelectorDescribeTwoVar_ControlValueChanged(ucrChangedControl As ucrCore) Handles ucrSelectorDescribeTwoVar.ControlValueChanged + clsGroupByPipeOperator.AddParameter("data", clsRFunctionParameter:=ucrSelectorDescribeTwoVar.ucrAvailableDataFrames.clsCurrDataFrame, iPosition:=0) + clsMapFrequencyPipeOperator.AddParameter("data", clsRFunctionParameter:=ucrSelectorDescribeTwoVar.ucrAvailableDataFrames.clsCurrDataFrame, iPosition:=0) + clsFrequencyTablesFunction.AddParameter("data_name", Chr(34) & ucrSelectorDescribeTwoVar.ucrAvailableDataFrames.cboAvailableDataFrames.Text & Chr(34), iPosition:=0) + End Sub End Class \ No newline at end of file diff --git a/instat/dlgDuplicateColumns.vb b/instat/dlgDuplicateColumns.vb index 6b887be603d..b69e0e7aded 100644 --- a/instat/dlgDuplicateColumns.vb +++ b/instat/dlgDuplicateColumns.vb @@ -32,8 +32,8 @@ Imports instat.Translations Public Class dlgDuplicateColumns Public bFirstLoad As Boolean = True Private bReset As Boolean = True - Private clsDuplicateFunction As RFunction - Private clsConvertFunction As RFunction + Private clsDuplicateFunction As New RFunction + Private clsConvertFunction As New RFunction Public strSelectedDataFrame As String = "" Private bUseSelectedColumn As Boolean = False Private strSelectedColumn As String = "" diff --git a/instat/dlgDuplicates.Designer.vb b/instat/dlgDuplicates.Designer.vb index c436d639176..360c1cb81b7 100644 --- a/instat/dlgDuplicates.Designer.vb +++ b/instat/dlgDuplicates.Designer.vb @@ -1,5 +1,5 @@  -Partial Class dlgDuplicates +Partial Class dlgDuplicateRows Inherits System.Windows.Forms.Form 'Form overrides dispose to clean up the component list. @@ -59,7 +59,7 @@ Partial Class dlgDuplicates Me.rdoDataFrame.FlatAppearance.CheckedBackColor = System.Drawing.SystemColors.ActiveCaption Me.rdoDataFrame.FlatStyle = System.Windows.Forms.FlatStyle.Flat Me.rdoDataFrame.ImeMode = System.Windows.Forms.ImeMode.NoControl - Me.rdoDataFrame.Location = New System.Drawing.Point(11, 12) + Me.rdoDataFrame.Location = New System.Drawing.Point(142, 12) Me.rdoDataFrame.Name = "rdoDataFrame" Me.rdoDataFrame.Size = New System.Drawing.Size(135, 27) Me.rdoDataFrame.TabIndex = 1 @@ -76,7 +76,7 @@ Partial Class dlgDuplicates Me.rdoSelectedVariables.FlatAppearance.CheckedBackColor = System.Drawing.SystemColors.ActiveCaption Me.rdoSelectedVariables.FlatStyle = System.Windows.Forms.FlatStyle.Flat Me.rdoSelectedVariables.ImeMode = System.Windows.Forms.ImeMode.NoControl - Me.rdoSelectedVariables.Location = New System.Drawing.Point(144, 12) + Me.rdoSelectedVariables.Location = New System.Drawing.Point(11, 12) Me.rdoSelectedVariables.Name = "rdoSelectedVariables" Me.rdoSelectedVariables.Size = New System.Drawing.Size(135, 27) Me.rdoSelectedVariables.TabIndex = 2 @@ -327,7 +327,7 @@ Partial Class dlgDuplicates Me.ucrSelectorDuplicateswithVariables.Size = New System.Drawing.Size(213, 183) Me.ucrSelectorDuplicateswithVariables.TabIndex = 4 ' - 'dlgDuplicates + 'dlgDuplicateRows ' Me.AutoScaleDimensions = New System.Drawing.SizeF(96.0!, 96.0!) Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi @@ -355,9 +355,9 @@ Partial Class dlgDuplicates Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow Me.MaximizeBox = False Me.MinimizeBox = False - Me.Name = "dlgDuplicates" + Me.Name = "dlgDuplicateRows" Me.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen - Me.Text = "Duplicates" + Me.Text = "Duplicate Rows" Me.grpOptions.ResumeLayout(False) Me.grpOptions.PerformLayout() Me.ResumeLayout(False) diff --git a/instat/dlgDuplicates.vb b/instat/dlgDuplicates.vb index 1044d23c358..cce88ba4679 100644 --- a/instat/dlgDuplicates.vb +++ b/instat/dlgDuplicates.vb @@ -16,7 +16,7 @@ Imports RDotNet Imports instat.Translations -Public Class dlgDuplicates +Public Class dlgDuplicateRows Private bReset As Boolean = True Private bFirstLoad As Boolean = True Private clsDuplicated2, clsDuplicated, clsStreakFunction, clsSubsetCol, clsDupCountIndex, clsSummaryFunction, clsGetColumnsFunction As New RFunction @@ -58,7 +58,7 @@ Public Class dlgDuplicates ucrPnlDuplicates.AddRadioButton(rdoDuplicatesOnly) ucrPnlDuplicates.AddRadioButton(rdoIndexNumberOfDuplicates) - ucrPnlDuplicates.AddToLinkedControls(ucrInputComboType, {rdoIndexNumberOfDuplicates}, bNewLinkedAddRemoveParameter:=True, bNewLinkedHideIfParameterMissing:=True) + ucrPnlDuplicates.AddToLinkedControls(ucrInputComboType, {rdoIndexNumberOfDuplicates}, bNewLinkedHideIfParameterMissing:=True) ucrInputComboType.SetLinkedDisplayControl(lblType) ucrPnlDuplicates.AddFunctionNamesCondition(rdoAllDuplicateCases, "duplicated2") @@ -114,9 +114,8 @@ Public Class dlgDuplicates ucrInputConditions.SetDropDownStyleAsNonEditable() ucrInputComboType.SetParameter(New RParameter("type")) - dctType.Add("Count", Chr(34) & "count" & Chr(34)) dctType.Add("Index", Chr(34) & "index" & Chr(34)) - ucrInputComboType.SetRDefault(Chr(34) & "count" & Chr(34)) + dctType.Add("Count", Chr(34) & "count" & Chr(34)) ucrInputComboType.SetDropDownStyleAsNonEditable() ucrInputComboType.SetItems(dctType) @@ -156,6 +155,7 @@ Public Class dlgDuplicates clsStreakFunction.AddParameter("ignore", "NULL") clsDupCountIndex.SetRCommand("duplicated_count_index") + clsDupCountIndex.AddParameter("type", Chr(34) & "index" & Chr(34)) clsGetColumnsFunction.SetRCommand(frmMain.clsRLink.strInstatDataObject & "$get_columns_from_data") @@ -166,7 +166,7 @@ Public Class dlgDuplicates clsSubsetCol.SetRCommand(frmMain.clsRLink.strInstatDataObject & "$get_columns_from_data") ucrBase.clsRsyntax.ClearCodes() ucrBase.clsRsyntax.SetAssignTo(strAssignToName:=ucrNewColumnName.GetText, strTempDataframe:=ucrSelectorDuplicateswithVariables.ucrAvailableDataFrames.cboAvailableDataFrames.Text, strTempColumn:=ucrNewColumnName.GetText) - ucrBase.clsRsyntax.SetBaseRFunction(clsDuplicated2) + ucrBase.clsRsyntax.SetBaseRFunction(clsDuplicated) ucrBase.clsRsyntax.AddToAfterCodes(clsSummaryFunction, iPosition:=0) End Sub @@ -251,17 +251,15 @@ Public Class dlgDuplicates End Sub Private Sub SetDataFrameOrColumns() - If rdoDataFrame.Checked Then - ucrSelectorDuplicateswithVariables.SetVariablesVisible(False) - ucrSelectorDuplicateswithVariables.SetParameterIsrfunction() + If rdoSelectedVariables.Checked Then + ucrReceiverForSelectedVariables.SetMeAsReceiver() + ucrReceiverForSelectedVariables.SetParameterIsRFunction() + ucrSelectorDuplicateswithVariables.SetVariablesVisible(True) + ElseIf rdoDataFrame.Checked Then ' note that we have to run this here because the parameter x is used for both functions and all four radio buttons clsDuplicated.AddParameter("x", clsRFunctionParameter:=ucrSelectorDuplicateswithVariables.ucrAvailableDataFrames.clsCurrDataFrame, iPosition:=0) clsDuplicated2.AddParameter("x", clsRFunctionParameter:=ucrSelectorDuplicateswithVariables.ucrAvailableDataFrames.clsCurrDataFrame, iPosition:=0) clsDupCountIndex.AddParameter("x", clsRFunctionParameter:=ucrSelectorDuplicateswithVariables.ucrAvailableDataFrames.clsCurrDataFrame, iPosition:=0) - ElseIf rdoSelectedVariables.Checked Then - ucrReceiverForSelectedVariables.SetMeAsReceiver() - ucrReceiverForSelectedVariables.SetParameterIsRFunction() - ucrSelectorDuplicateswithVariables.SetVariablesVisible(True) ElseIf rdoSuccessiveValues.Checked Then ucrReceiverForSuccessiveValues.SetMeAsReceiver() ucrSelectorDuplicateswithVariables.SetParameterIsString() diff --git a/instat/dlgExportDataset.Designer.vb b/instat/dlgExportDataset.Designer.vb index a7314cf4dbe..e14538c84cf 100644 --- a/instat/dlgExportDataset.Designer.vb +++ b/instat/dlgExportDataset.Designer.vb @@ -56,7 +56,7 @@ Partial Class dlgExportDataset Me.lblConfirm.AutoSize = True Me.lblConfirm.ForeColor = System.Drawing.Color.Green Me.lblConfirm.ImeMode = System.Windows.Forms.ImeMode.NoControl - Me.lblConfirm.Location = New System.Drawing.Point(85, 245) + Me.lblConfirm.Location = New System.Drawing.Point(145, 246) Me.lblConfirm.Margin = New System.Windows.Forms.Padding(2, 0, 2, 0) Me.lblConfirm.Name = "lblConfirm" Me.lblConfirm.Size = New System.Drawing.Size(148, 13) @@ -108,7 +108,7 @@ Partial Class dlgExportDataset 'ucrBase ' Me.ucrBase.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink - Me.ucrBase.Location = New System.Drawing.Point(10, 270) + Me.ucrBase.Location = New System.Drawing.Point(10, 285) Me.ucrBase.Margin = New System.Windows.Forms.Padding(4, 5, 4, 5) Me.ucrBase.Name = "ucrBase" Me.ucrBase.Size = New System.Drawing.Size(405, 53) @@ -169,7 +169,7 @@ Partial Class dlgExportDataset ' Me.AutoScaleDimensions = New System.Drawing.SizeF(96.0!, 96.0!) Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi - Me.ClientSize = New System.Drawing.Size(441, 331) + Me.ClientSize = New System.Drawing.Size(441, 347) Me.Controls.Add(Me.chkSaveAsSingleFile) Me.Controls.Add(Me.cboFileType) Me.Controls.Add(Me.lblFileExtension) diff --git a/instat/dlgExportDataset.vb b/instat/dlgExportDataset.vb index 4f48d4477cc..15b97138126 100644 --- a/instat/dlgExportDataset.vb +++ b/instat/dlgExportDataset.vb @@ -19,7 +19,7 @@ Imports instat.Translations Public Class dlgExportDataset Dim bFirstLoad As Boolean = True Private bReset As Boolean = True - Private clsDefaultFunction As RFunction + Private clsDefaultFunction As New RFunction Private Sub dlgExportDataset_Load(sender As Object, e As EventArgs) Handles Me.Load 'temporarily commented out because it overwrites lblConfirm text contents @@ -92,16 +92,13 @@ Public Class dlgExportDataset Private Sub ucrReceiverMultipleDataFrames_ControlContentsChanged(ucrchangedControl As ucrCore) Handles ucrReceiverMultipleDataFrames.ControlContentsChanged chkSaveAsSingleFile.Visible = ucrReceiverMultipleDataFrames.GetVariableNamesList().Length > 1 ChangeFileControlsValues() - ucrFilePath.Clear() 'will raise event FilePathChanged End Sub Private Sub chkSaveAsSingleFile_CheckedChanged(sender As Object, e As EventArgs) Handles chkSaveAsSingleFile.CheckedChanged ChangeFileControlsValues() - ucrFilePath.Clear() 'will raise event FilePathChanged End Sub Private Sub cboFileExtension_SelectedIndexChanged(sender As Object, e As EventArgs) Handles cboFileType.SelectedIndexChanged - ucrFilePath.Clear() 'will raise event FilePathChanged ucrFilePath.FilePathDialogFilter = GetFilePathDialogFilterText(cboFileType.SelectedItem) End Sub @@ -113,7 +110,7 @@ Public Class dlgExportDataset 'if no or single data frame selected or save as single checked then just set the base function to the default If ucrReceiverMultipleDataFrames.GetVariableNamesList().Length <= 1 OrElse chkSaveAsSingleFile.Checked Then ucrBase.clsRsyntax.SetBaseRFunction(clsDefaultFunction) - lblConfirm.Text = GetTranslation("Click Ok to Confirm the Export.") + lblConfirm.Text = GetTranslation("File with the same name will be overwritten." & Environment.NewLine & "Click Ok to Confirm the Export.") Else 'else, create a string command for exporting separate files to a directory. 'note, as of 09/09/2020 rio didn't support exporting separate files in 1 command see issue #5590 @@ -137,14 +134,9 @@ Public Class dlgExportDataset Private Sub ChangeFileControlsValues() Dim strPrevSelectedFileType As String = cboFileType.SelectedItem Dim iSelectedDataFrames As Integer = ucrReceiverMultipleDataFrames.GetVariableNamesList().Length - ucrFilePath.FolderBrowse = False 'set file path control to open default SaveFileDialog prompt - ucrFilePath.DefaultFileSuggestionName = "" - ucrFilePath.FilePathDialogFilter = "" - cboFileType.Items.Clear() - - - ucrFilePath.FolderBrowse = iSelectedDataFrames > 1 AndAlso Not chkSaveAsSingleFile.Checked + Dim bSaveAsMultipleFiles As Boolean = iSelectedDataFrames > 1 AndAlso Not chkSaveAsSingleFile.Checked + cboFileType.Items.Clear() If iSelectedDataFrames > 1 AndAlso chkSaveAsSingleFile.Checked Then 'file types currently supported insaving of multiple files into a single file cboFileType.Items.Add("Excel files (*.xlsx)") @@ -175,20 +167,41 @@ Public Class dlgExportDataset cboFileType.Items.Add("SAS XPORT (*.xpt)") 'set the default suggested name - ucrFilePath.DefaultFileSuggestionName = ucrReceiverMultipleDataFrames.GetVariableNames(bWithQuotes:=False) + If Not ucrReceiverMultipleDataFrames.IsEmpty Then + ucrFilePath.DefaultFileSuggestionName = ucrReceiverMultipleDataFrames.GetVariableNamesList(bWithQuotes:=False)(0) + End If End If 'previous selected file type may not be there in the current combobox items - cboFileType.SelectedItem = strPrevSelectedFileType - If String.IsNullOrEmpty(cboFileType.SelectedItem) Then + If Not String.IsNullOrEmpty(strPrevSelectedFileType) AndAlso cboFileType.Items.Contains(strPrevSelectedFileType) Then + cboFileType.SelectedItem = strPrevSelectedFileType + Else cboFileType.SelectedIndex = 0 End If + 'If we are saving to multiple files, then path should be set to a folder. + 'If we are saving to a single file, then path should be set to a file. + 'Therefore `bSaveAsMultipleFiles` and `ucrFilePath.FolderBrowse` should always be equal. + 'If not, then we need to make the `ucrFilePath` control consistent with the state of `bSaveAsMultipleFiles`. + If bSaveAsMultipleFiles <> ucrFilePath.FolderBrowse Then + ucrFilePath.FolderBrowse = bSaveAsMultipleFiles + If Not ucrFilePath.IsEmpty Then + If ucrFilePath.FolderBrowse Then + ucrFilePath.FilePath = ucrFilePath.FilePathDirectory + Else + ucrFilePath.FilePath = ucrFilePath.FilePathDirectory & "\" & + ucrFilePath.SuggestionNameWithoutExtension & + GetSelectedExtension(cboFileType.SelectedItem) + End If + End If + End If + ucrFilePath.FilePathDialogFilter = GetFilePathDialogFilterText(cboFileType.SelectedItem) + End Sub ''' - ''' expected string format "filetype (*.ext)" + ''' expected string format: "filetype (*.ext)" ''' ''' ''' @@ -196,14 +209,14 @@ Public Class dlgExportDataset If String.IsNullOrEmpty(strText) Then Return "" End If - 'example of required format; Excel files (*.xlsx)|*.xlsx - Dim arrStr() As String = strText.Split({"(", ")"}, StringSplitOptions.RemoveEmptyEntries) - Return arrStr(0) & "(" & arrStr(1) & ")|" & arrStr(1) + 'example of filter string format returned: Excel files|*.xlsx + Dim arrStr() As String = strText.Split({"(", ")"}, StringSplitOptions.RemoveEmptyEntries) + Return arrStr(0) & "|" & arrStr(1) End Function ''' - ''' expected string format "filetype (*.ext)" + ''' expected string format: "filetype (*.ext)" ''' ''' ''' @@ -211,7 +224,7 @@ Public Class dlgExportDataset If String.IsNullOrEmpty(strText) Then Return "" End If - 'example of required format;.xlsx + 'example of string format returned: .xlsx Return strText.Split({"(", "*", ")"}, StringSplitOptions.RemoveEmptyEntries)(1) End Function diff --git a/instat/dlgExportRObjects.vb b/instat/dlgExportRObjects.vb index 844a25743b1..a8fb49b4e5d 100644 --- a/instat/dlgExportRObjects.vb +++ b/instat/dlgExportRObjects.vb @@ -18,7 +18,7 @@ Imports instat.Translations Public Class dlgExportRObjects Private bFirstLoad As Boolean = True Private bReset As Boolean = True - Private clsExport As RFunction + Private clsExport As New RFunction Private Sub dlgExportRObjects_Load(sender As Object, e As EventArgs) Handles MyBase.Load If bFirstLoad Then diff --git a/instat/dlgExportToWWR.vb b/instat/dlgExportToWWR.vb index 0c7b291d5f2..2ab1df0f6c3 100644 --- a/instat/dlgExportToWWR.vb +++ b/instat/dlgExportToWWR.vb @@ -22,7 +22,7 @@ Public Class dlgExportToWWR Private bResetSubdialog As Boolean = False 'R function - Private clsWWRExport As RFunction + Private clsWWRExport As New RFunction Private Sub dlgExportToWWR_Load(sender As Object, e As EventArgs) Handles MyBase.Load If bFirstLoad Then InitiliseDialog() diff --git a/instat/dlgFactorDataFrame.Designer.vb b/instat/dlgFactorDataFrame.Designer.vb index 12df5760677..ab081ac3190 100644 --- a/instat/dlgFactorDataFrame.Designer.vb +++ b/instat/dlgFactorDataFrame.Designer.vb @@ -46,6 +46,7 @@ Partial Class dlgFactorDataFrame Me.ucrBase = New instat.ucrButtons() Me.ucrReceiverFactorDataFrame = New instat.ucrReceiverSingle() Me.ucrSelectorFactorDataFrame = New instat.ucrSelectorByDataFrameAddRemove() + Me.ucrChkFrequencies = New instat.ucrCheck() Me.SuspendLayout() ' 'lblSelectedFactor @@ -129,12 +130,22 @@ Partial Class dlgFactorDataFrame Me.ucrSelectorFactorDataFrame.Size = New System.Drawing.Size(213, 183) Me.ucrSelectorFactorDataFrame.TabIndex = 0 ' + 'ucrChkFrequencies + ' + Me.ucrChkFrequencies.AutoSize = True + Me.ucrChkFrequencies.Checked = False + Me.ucrChkFrequencies.Location = New System.Drawing.Point(238, 176) + Me.ucrChkFrequencies.Name = "ucrChkFrequencies" + Me.ucrChkFrequencies.Size = New System.Drawing.Size(165, 23) + Me.ucrChkFrequencies.TabIndex = 8 + ' 'dlgFactorDataFrame ' 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(428, 264) + Me.Controls.Add(Me.ucrChkFrequencies) Me.Controls.Add(Me.ucrChkAddCurrentContrasts) Me.Controls.Add(Me.ucrChkReplaceIfAlreadyExists) Me.Controls.Add(Me.ucrInputFactorNames) @@ -162,4 +173,5 @@ Partial Class dlgFactorDataFrame Friend WithEvents ucrInputFactorNames As ucrInputTextBox Friend WithEvents ucrChkAddCurrentContrasts As ucrCheck Friend WithEvents ucrChkReplaceIfAlreadyExists As ucrCheck + Friend WithEvents ucrChkFrequencies As ucrCheck End Class diff --git a/instat/dlgFactorDataFrame.vb b/instat/dlgFactorDataFrame.vb index 62b8703733f..57cbc461b75 100644 --- a/instat/dlgFactorDataFrame.vb +++ b/instat/dlgFactorDataFrame.vb @@ -18,6 +18,7 @@ Imports instat.Translations Public Class dlgFactorDataFrame Public bFirstLoad As Boolean = True Private bReset As Boolean = True + Private clsDefaultFunction As New RFunction Private Sub ucrSelectorFactorDataFrame_Load(sender As Object, e As EventArgs) Handles ucrSelectorFactorDataFrame.Load If bFirstLoad Then @@ -55,29 +56,31 @@ Public Class dlgFactorDataFrame ucrChkAddCurrentContrasts.SetText("Add Current Contrasts") ucrChkAddCurrentContrasts.SetParameter(New RParameter("include_contrasts", 3)) ucrChkAddCurrentContrasts.SetValuesCheckedAndUnchecked("TRUE", "FALSE") - ucrChkAddCurrentContrasts.SetRDefault("TRUE") + ucrChkAddCurrentContrasts.SetRDefault("FALSE") ucrChkReplaceIfAlreadyExists.SetText("Replace if Already Exists") ucrChkReplaceIfAlreadyExists.SetParameter(New RParameter("replace", 4)) ucrChkReplaceIfAlreadyExists.SetValuesCheckedAndUnchecked("TRUE", "FALSE") - ucrChkReplaceIfAlreadyExists.SetRDefault("TRUE") + ucrChkReplaceIfAlreadyExists.SetRDefault("FALSE") + + ucrChkFrequencies.SetText("Frequencies") + ucrChkFrequencies.SetParameter(New RParameter("summary_count", 5)) + ucrChkFrequencies.SetValuesCheckedAndUnchecked("TRUE", "FALSE") + ucrChkFrequencies.SetRDefault("TRUE") End Sub Private Sub SetDefaults() - Dim clsDefaultFunction As New RFunction + clsDefaultFunction = New RFunction ucrInputFactorNames.Reset() ucrSelectorFactorDataFrame.Reset() ucrInputFactorNames.ResetText() clsDefaultFunction.SetRCommand(frmMain.clsRLink.strInstatDataObject & "$create_factor_data_frame") + clsDefaultFunction.AddParameter("replace", "TRUE", iPosition:=4) + clsDefaultFunction.AddParameter("summary_count", "TRUE", iPosition:=5) - ucrBase.clsRsyntax.SetBaseRFunction(clsDefaultFunction.Clone()) - - CheckAutoName() - End Sub - - Private Sub ReopenDialog() + ucrBase.clsRsyntax.SetBaseRFunction(clsDefaultFunction) End Sub Private Sub SetRCodeforControls(bReset As Boolean) @@ -85,7 +88,7 @@ Public Class dlgFactorDataFrame End Sub Private Sub TestOKEnabled() - If Not ucrReceiverFactorDataFrame.IsEmpty AndAlso Not ucrInputFactorNames.IsEmpty Then + If Not ucrReceiverFactorDataFrame.IsEmpty AndAlso Not ucrInputFactorNames.IsEmpty AndAlso (ucrChkAddCurrentContrasts.Checked OrElse ucrChkFrequencies.Checked) Then ucrBase.OKEnabled(True) Else ucrBase.OKEnabled(False) @@ -98,17 +101,14 @@ Public Class dlgFactorDataFrame TestOKEnabled() End Sub - Private Sub ucrInputFactorNames_ContentsChanged() Handles ucrInputFactorNames.ControlContentsChanged, ucrReceiverFactorDataFrame.ControlContentsChanged, ucrSelectorFactorDataFrame.ControlContentsChanged - TestOKEnabled() - End Sub - Private Sub ucrDataFrameToRename_ControlValueChanged(ucrChangedControl As ucrCore) Handles ucrReceiverFactorDataFrame.ControlValueChanged - CheckAutoName() - End Sub - - Private Sub CheckAutoName() If Not ucrReceiverFactorDataFrame.IsEmpty AndAlso Not ucrInputFactorNames.bUserTyped Then ucrInputFactorNames.SetName(ucrReceiverFactorDataFrame.GetVariableNames(False)) End If End Sub + + Private Sub ucrInputFactorNames_ContentsChanged() Handles ucrInputFactorNames.ControlContentsChanged, ucrReceiverFactorDataFrame.ControlContentsChanged, + ucrSelectorFactorDataFrame.ControlContentsChanged, ucrChkFrequencies.ControlContentsChanged, ucrChkAddCurrentContrasts.ControlContentsChanged + TestOKEnabled() + End Sub End Class \ No newline at end of file diff --git a/instat/dlgFindNonnumericValues.vb b/instat/dlgFindNonnumericValues.vb index 23030c59c73..41dcaa32832 100644 --- a/instat/dlgFindNonnumericValues.vb +++ b/instat/dlgFindNonnumericValues.vb @@ -22,9 +22,9 @@ Public Class dlgFindNonnumericValues Private bUseSelectedColumn As Boolean = False Private strSelectedColumn As String = "" Private strSelectedDataFrame As String = "" - Private clsIsNaFunction, clsIsNaNumericFunction, clsAsNumericFunction, clsSummaryFunction As New RFunction + Private clsIsNaFunction, clsIsNaNumericFunction, clsAsNumericFunction, clsAsCharacterFunction, clsSummaryFunction As New RFunction Private clsNonNumericCalcFunc, clsNonNumericFilterFunc, clsRunCalcFunction, clslSubCalcListFunc, clsGetColumnsFunction As New RFunction - Private clsCurrRunCalc As RFunction + Private clsCurrRunCalc As New RFunction Private clsNotEqualToOperator As New ROperator Private strCurrDataName As String @@ -56,8 +56,8 @@ Public Class dlgFindNonnumericValues ucrReceiverColumn.SetParameter(New RParameter("x", 1)) ucrReceiverColumn.SetParameterIsString() ucrReceiverColumn.bWithQuotes = False - ucrReceiverColumn.SetIncludedDataTypes({"character"}) - ucrReceiverColumn.strSelectorHeading = "characters" + ucrReceiverColumn.SetIncludedDataTypes({"factor", "character"}, bStrict:=True) + ucrReceiverColumn.strSelectorHeading = "Factors and Characters" 'save control ucrSaveColumn.SetPrefix("nonum") @@ -84,6 +84,7 @@ Public Class dlgFindNonnumericValues clsIsNaNumericFunction = New RFunction clsSummaryFunction = New RFunction clsNotEqualToOperator = New ROperator + clsAsCharacterFunction = New RFunction clsNonNumericCalcFunc.Clear() clsNonNumericFilterFunc.Clear() @@ -105,7 +106,9 @@ Public Class dlgFindNonnumericValues clsIsNaNumericFunction.SetRCommand("is.na") clsIsNaNumericFunction.AddParameter("numeric", bIncludeArgumentName:=False, clsRFunctionParameter:=clsAsNumericFunction) + clsAsCharacterFunction.SetRCommand("as.character") clsAsNumericFunction.SetRCommand("as.numeric") + clsAsNumericFunction.AddParameter("x", clsRFunctionParameter:=clsAsCharacterFunction, bIncludeArgumentName:=False, iPosition:=1) clsNonNumericCalcFunc.SetRCommand("instat_calculation$new") clsNonNumericCalcFunc.AddParameter("type", Chr(34) & "calculation" & Chr(34), iPosition:=0) @@ -140,7 +143,7 @@ Public Class dlgFindNonnumericValues End Sub Private Sub SetRCodeForControls(bReset As Boolean) - ucrReceiverColumn.AddAdditionalCodeParameterPair(clsAsNumericFunction, New RParameter("x", 1), iAdditionalPairNo:=1) + ucrReceiverColumn.AddAdditionalCodeParameterPair(clsAsCharacterFunction, New RParameter("x", 1), iAdditionalPairNo:=1) ucrReceiverColumn.SetRCode(clsIsNaFunction, bReset) ucrSaveColumn.SetRCode(clsNonNumericCalcFunc, bReset) ucrChkShowSummary.SetRSyntax(ucrBase.clsRsyntax, bReset) diff --git a/instat/dlgFitCorruptionModel.vb b/instat/dlgFitCorruptionModel.vb index f8120652a06..b17694a8fe5 100644 --- a/instat/dlgFitCorruptionModel.vb +++ b/instat/dlgFitCorruptionModel.vb @@ -26,7 +26,7 @@ Public Class dlgCorruptionFitModel Private clsCorruptionModel, clsBinomialModel As New RFunction Private clsFormula, clsExplanatoryVariables As New ROperator 'Function for display sub dialog - Public clsVisReg, clsFormulaFunction, clsAnovaFunction, clsSummaryFunction, clsConfint As RFunction + Public clsVisReg, clsFormulaFunction, clsAnovaFunction, clsSummaryFunction, clsConfint As New RFunction 'Saving Operators/Functions Private clsRstandardFunction, clsHatvaluesFunction, clsResidualFunction, clsFittedValuesFunction As New RFunction diff --git a/instat/dlgFitModel.vb b/instat/dlgFitModel.vb index 3013ef3f430..314ea4a4142 100644 --- a/instat/dlgFitModel.vb +++ b/instat/dlgFitModel.vb @@ -27,8 +27,8 @@ Public Class dlgFitModel Public clsRestpvalFunction, clsFamilyFunction, clsRCIFunction, clsRConvert, clsAutoPlot, clsVisReg As New RFunction Public bResetModelOptions As Boolean = False - Public clsRSingleModelFunction, clsFormulaFunction, clsAnovaFunction, clsSummaryFunction, clsConfint As RFunction - Public clsGLM, clsLM, clsLMOrGLM, clsAsNumeric As RFunction + Public clsRSingleModelFunction, clsFormulaFunction, clsAnovaFunction, clsSummaryFunction, clsConfint As New RFunction + Public clsGLM, clsLM, clsLMOrGLM, clsAsNumeric As New RFunction 'Saving Operators/Functions Private clsRstandardFunction, clsHatvaluesFunction, clsResidualFunction, clsFittedValuesFunction As New RFunction diff --git a/instat/dlgFourVariableModelling.vb b/instat/dlgFourVariableModelling.vb index 50d36dfc60d..256923b4fc0 100644 --- a/instat/dlgFourVariableModelling.vb +++ b/instat/dlgFourVariableModelling.vb @@ -25,12 +25,12 @@ Public Class dlgFourVariableModelling Public bResetSecondFunction As Boolean = False Public bResetThirdFunction As Boolean = False Public clsRCIFunction, clsRConvert, clsFamilyFunction, clsVisReg As New RFunction - Public clsRSingleModelFunction, clsRNumeric, clsGLM, clsLM, clsFormulaFunction, clsSummaryFunction, clsConfint As RFunction + Public clsRSingleModelFunction, clsRNumeric, clsGLM, clsLM, clsFormulaFunction, clsSummaryFunction, clsConfint As New RFunction Public clsFormulaOperator As ROperator Private clsFirstPowerOperator, clsSecondPowerOperator, clsThirdPowerOperator As ROperator Public clsSecoandndThirdExplanatoryOpertor, clsOverallExplanatoryOperator As New ROperator Private clsAnovaFunction, clsLMOrGLM, clsLmer, clsGlmer As RFunction - Private clsFirstTransformFunction, clsSecondTransformFunction, clsThirdTransformFunction As RFunction + Private clsFirstTransformFunction, clsSecondTransformFunction, clsThirdTransformFunction As New RFunction Private dctPlotFunctions As New Dictionary(Of String, RFunction) 'Saving Operators/Functions diff --git a/instat/dlgFrequency.Designer.vb b/instat/dlgFrequency.Designer.vb deleted file mode 100644 index fb8a3d1df95..00000000000 --- a/instat/dlgFrequency.Designer.vb +++ /dev/null @@ -1,360 +0,0 @@ -' R- Instat -' Copyright (C) 2015-2017 -' -' This program is free software: you can redistribute it and/or modify -' it under the terms of the GNU General Public License as published by -' the Free Software Foundation, either version 3 of the License, or -' (at your option) any later version. -' -' This program is distributed in the hope that it will be useful, -' but WITHOUT ANY WARRANTY; without even the implied warranty of -' MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -' GNU General Public License for more details. -' -' You should have received a copy of the GNU General Public License -' along with this program. If not, see . - - -Partial Class dlgFrequency - 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 - components.Dispose() - End If - Finally - MyBase.Dispose(disposing) - End Try - End Sub - - 'Required by the Windows Form Designer - Private components As System.ComponentModel.IContainer - - '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.lblFactors = New System.Windows.Forms.Label() - Me.cmdFormatTable = New System.Windows.Forms.Button() - Me.GroupBox1 = New System.Windows.Forms.GroupBox() - Me.ucrNudColumnFactors = New instat.ucrNud() - Me.ucrChkDisplaySummariesAsRow = New instat.ucrCheck() - Me.lblColumnFactors = New System.Windows.Forms.Label() - Me.ucrNudSigFigs = New instat.ucrNud() - Me.lblSigFigs = New System.Windows.Forms.Label() - Me.grpDisplay = New System.Windows.Forms.GroupBox() - Me.lblFactorsAsPercentage = New System.Windows.Forms.Label() - Me.ucrReceiverMultiplePercentages = New instat.ucrReceiverMultiple() - Me.ucrChkPercentageProportion = New instat.ucrCheck() - Me.ucrChkDisplayAsPercentage = New instat.ucrCheck() - Me.lblMarginName = New System.Windows.Forms.Label() - Me.ucrInputMarginName = New instat.ucrInputTextBox() - Me.ucrSaveTable = New instat.ucrSave() - Me.ucrChkDisplayMargins = New instat.ucrCheck() - Me.ucrChkStoreResults = New instat.ucrCheck() - Me.ucrReceiverFactors = New instat.ucrReceiverMultiple() - Me.ucrSelectorFrequency = New instat.ucrSelectorByDataFrameAddRemove() - Me.ucrBase = New instat.ucrButtons() - Me.UcrCheck1 = New instat.ucrCheck() - Me.GroupBox1.SuspendLayout() - Me.grpDisplay.SuspendLayout() - Me.SuspendLayout() - ' - 'lblFactors - ' - Me.lblFactors.AutoSize = True - Me.lblFactors.ImeMode = System.Windows.Forms.ImeMode.NoControl - Me.lblFactors.Location = New System.Drawing.Point(253, 45) - Me.lblFactors.Name = "lblFactors" - Me.lblFactors.Size = New System.Drawing.Size(45, 13) - Me.lblFactors.TabIndex = 1 - Me.lblFactors.Tag = "Factors:" - Me.lblFactors.Text = "Factors:" - ' - 'cmdFormatTable - ' - Me.cmdFormatTable.ImeMode = System.Windows.Forms.ImeMode.NoControl - Me.cmdFormatTable.Location = New System.Drawing.Point(323, 410) - Me.cmdFormatTable.Name = "cmdFormatTable" - Me.cmdFormatTable.Size = New System.Drawing.Size(86, 23) - Me.cmdFormatTable.TabIndex = 10 - Me.cmdFormatTable.Text = "Format Table..." - Me.cmdFormatTable.UseVisualStyleBackColor = True - ' - 'GroupBox1 - ' - Me.GroupBox1.Controls.Add(Me.ucrNudColumnFactors) - Me.GroupBox1.Controls.Add(Me.ucrChkDisplaySummariesAsRow) - Me.GroupBox1.Controls.Add(Me.lblColumnFactors) - Me.GroupBox1.Controls.Add(Me.ucrNudSigFigs) - Me.GroupBox1.Controls.Add(Me.lblSigFigs) - Me.GroupBox1.Location = New System.Drawing.Point(10, 292) - Me.GroupBox1.Name = "GroupBox1" - Me.GroupBox1.Size = New System.Drawing.Size(186, 113) - Me.GroupBox1.TabIndex = 3 - Me.GroupBox1.TabStop = False - Me.GroupBox1.Text = "Display" - ' - 'ucrNudColumnFactors - ' - Me.ucrNudColumnFactors.AutoSize = True - Me.ucrNudColumnFactors.DecimalPlaces = New Decimal(New Integer() {0, 0, 0, 0}) - Me.ucrNudColumnFactors.Increment = New Decimal(New Integer() {1, 0, 0, 0}) - Me.ucrNudColumnFactors.Location = New System.Drawing.Point(129, 48) - Me.ucrNudColumnFactors.Maximum = New Decimal(New Integer() {100, 0, 0, 0}) - Me.ucrNudColumnFactors.Minimum = New Decimal(New Integer() {0, 0, 0, 0}) - Me.ucrNudColumnFactors.Name = "ucrNudColumnFactors" - Me.ucrNudColumnFactors.Size = New System.Drawing.Size(50, 20) - Me.ucrNudColumnFactors.TabIndex = 22 - Me.ucrNudColumnFactors.Value = New Decimal(New Integer() {0, 0, 0, 0}) - ' - 'ucrChkDisplaySummariesAsRow - ' - Me.ucrChkDisplaySummariesAsRow.AutoSize = True - Me.ucrChkDisplaySummariesAsRow.Checked = False - Me.ucrChkDisplaySummariesAsRow.Location = New System.Drawing.Point(11, 74) - Me.ucrChkDisplaySummariesAsRow.Name = "ucrChkDisplaySummariesAsRow" - Me.ucrChkDisplaySummariesAsRow.Size = New System.Drawing.Size(175, 23) - Me.ucrChkDisplaySummariesAsRow.TabIndex = 14 - ' - 'lblColumnFactors - ' - Me.lblColumnFactors.AutoSize = True - Me.lblColumnFactors.ImeMode = System.Windows.Forms.ImeMode.NoControl - Me.lblColumnFactors.Location = New System.Drawing.Point(8, 53) - Me.lblColumnFactors.Name = "lblColumnFactors" - Me.lblColumnFactors.Size = New System.Drawing.Size(86, 13) - Me.lblColumnFactors.TabIndex = 21 - Me.lblColumnFactors.Tag = "" - Me.lblColumnFactors.Text = "Column Factors :" - ' - 'ucrNudSigFigs - ' - Me.ucrNudSigFigs.AutoSize = True - Me.ucrNudSigFigs.DecimalPlaces = New Decimal(New Integer() {0, 0, 0, 0}) - Me.ucrNudSigFigs.Increment = New Decimal(New Integer() {1, 0, 0, 0}) - Me.ucrNudSigFigs.Location = New System.Drawing.Point(129, 22) - Me.ucrNudSigFigs.Maximum = New Decimal(New Integer() {100, 0, 0, 0}) - Me.ucrNudSigFigs.Minimum = New Decimal(New Integer() {0, 0, 0, 0}) - Me.ucrNudSigFigs.Name = "ucrNudSigFigs" - Me.ucrNudSigFigs.Size = New System.Drawing.Size(50, 20) - Me.ucrNudSigFigs.TabIndex = 5 - Me.ucrNudSigFigs.Value = New Decimal(New Integer() {0, 0, 0, 0}) - ' - 'lblSigFigs - ' - Me.lblSigFigs.AutoSize = True - Me.lblSigFigs.ImeMode = System.Windows.Forms.ImeMode.NoControl - Me.lblSigFigs.Location = New System.Drawing.Point(8, 25) - Me.lblSigFigs.Name = "lblSigFigs" - Me.lblSigFigs.Size = New System.Drawing.Size(96, 13) - Me.lblSigFigs.TabIndex = 4 - Me.lblSigFigs.Tag = "Significant_Figures:" - Me.lblSigFigs.Text = "Significant Figures:" - ' - 'grpDisplay - ' - Me.grpDisplay.Controls.Add(Me.lblFactorsAsPercentage) - Me.grpDisplay.Controls.Add(Me.ucrReceiverMultiplePercentages) - Me.grpDisplay.Controls.Add(Me.ucrChkPercentageProportion) - Me.grpDisplay.Controls.Add(Me.ucrChkDisplayAsPercentage) - Me.grpDisplay.Location = New System.Drawing.Point(219, 213) - Me.grpDisplay.Name = "grpDisplay" - Me.grpDisplay.Size = New System.Drawing.Size(174, 192) - Me.grpDisplay.TabIndex = 4 - Me.grpDisplay.TabStop = False - Me.grpDisplay.Text = "Percentages" - ' - 'lblFactorsAsPercentage - ' - Me.lblFactorsAsPercentage.AutoSize = True - Me.lblFactorsAsPercentage.ImeMode = System.Windows.Forms.ImeMode.NoControl - Me.lblFactorsAsPercentage.Location = New System.Drawing.Point(18, 44) - Me.lblFactorsAsPercentage.Name = "lblFactorsAsPercentage" - Me.lblFactorsAsPercentage.Size = New System.Drawing.Size(117, 13) - Me.lblFactorsAsPercentage.TabIndex = 1 - Me.lblFactorsAsPercentage.Tag = "Factors as Percentage:" - Me.lblFactorsAsPercentage.Text = "Factors as Percentage:" - ' - 'ucrReceiverMultiplePercentages - ' - Me.ucrReceiverMultiplePercentages.AutoSize = True - Me.ucrReceiverMultiplePercentages.frmParent = Me - Me.ucrReceiverMultiplePercentages.Location = New System.Drawing.Point(18, 59) - Me.ucrReceiverMultiplePercentages.Margin = New System.Windows.Forms.Padding(0) - Me.ucrReceiverMultiplePercentages.Name = "ucrReceiverMultiplePercentages" - Me.ucrReceiverMultiplePercentages.Selector = Nothing - Me.ucrReceiverMultiplePercentages.Size = New System.Drawing.Size(120, 100) - Me.ucrReceiverMultiplePercentages.strNcFilePath = "" - Me.ucrReceiverMultiplePercentages.TabIndex = 2 - Me.ucrReceiverMultiplePercentages.ucrSelector = Nothing - ' - 'ucrChkPercentageProportion - ' - Me.ucrChkPercentageProportion.AutoSize = True - Me.ucrChkPercentageProportion.Checked = False - Me.ucrChkPercentageProportion.Location = New System.Drawing.Point(5, 171) - Me.ucrChkPercentageProportion.Name = "ucrChkPercentageProportion" - Me.ucrChkPercentageProportion.Size = New System.Drawing.Size(160, 23) - Me.ucrChkPercentageProportion.TabIndex = 3 - ' - 'ucrChkDisplayAsPercentage - ' - Me.ucrChkDisplayAsPercentage.AutoSize = True - Me.ucrChkDisplayAsPercentage.Checked = False - Me.ucrChkDisplayAsPercentage.Location = New System.Drawing.Point(14, 19) - Me.ucrChkDisplayAsPercentage.Name = "ucrChkDisplayAsPercentage" - Me.ucrChkDisplayAsPercentage.Size = New System.Drawing.Size(135, 23) - Me.ucrChkDisplayAsPercentage.TabIndex = 0 - ' - 'lblMarginName - ' - Me.lblMarginName.AutoSize = True - Me.lblMarginName.ImeMode = System.Windows.Forms.ImeMode.NoControl - Me.lblMarginName.Location = New System.Drawing.Point(7, 262) - Me.lblMarginName.Name = "lblMarginName" - Me.lblMarginName.Size = New System.Drawing.Size(76, 13) - Me.lblMarginName.TabIndex = 17 - Me.lblMarginName.Text = "Margin Name :" - ' - 'ucrInputMarginName - ' - Me.ucrInputMarginName.AddQuotesIfUnrecognised = True - Me.ucrInputMarginName.AutoSize = True - Me.ucrInputMarginName.IsMultiline = False - Me.ucrInputMarginName.IsReadOnly = False - Me.ucrInputMarginName.Location = New System.Drawing.Point(92, 258) - Me.ucrInputMarginName.Name = "ucrInputMarginName" - Me.ucrInputMarginName.Size = New System.Drawing.Size(70, 21) - Me.ucrInputMarginName.TabIndex = 18 - ' - 'ucrSaveTable - ' - Me.ucrSaveTable.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink - Me.ucrSaveTable.Location = New System.Drawing.Point(10, 411) - Me.ucrSaveTable.Margin = New System.Windows.Forms.Padding(4, 5, 4, 5) - Me.ucrSaveTable.Name = "ucrSaveTable" - Me.ucrSaveTable.Size = New System.Drawing.Size(270, 19) - Me.ucrSaveTable.TabIndex = 9 - ' - 'ucrChkDisplayMargins - ' - Me.ucrChkDisplayMargins.AutoSize = True - Me.ucrChkDisplayMargins.Checked = False - Me.ucrChkDisplayMargins.Location = New System.Drawing.Point(10, 232) - Me.ucrChkDisplayMargins.Name = "ucrChkDisplayMargins" - Me.ucrChkDisplayMargins.Size = New System.Drawing.Size(130, 23) - Me.ucrChkDisplayMargins.TabIndex = 8 - ' - 'ucrChkStoreResults - ' - Me.ucrChkStoreResults.AutoSize = True - Me.ucrChkStoreResults.Checked = False - Me.ucrChkStoreResults.Location = New System.Drawing.Point(10, 205) - Me.ucrChkStoreResults.Name = "ucrChkStoreResults" - Me.ucrChkStoreResults.Size = New System.Drawing.Size(135, 23) - Me.ucrChkStoreResults.TabIndex = 7 - ' - 'ucrReceiverFactors - ' - Me.ucrReceiverFactors.AutoSize = True - Me.ucrReceiverFactors.frmParent = Me - Me.ucrReceiverFactors.Location = New System.Drawing.Point(253, 60) - Me.ucrReceiverFactors.Margin = New System.Windows.Forms.Padding(0) - Me.ucrReceiverFactors.Name = "ucrReceiverFactors" - Me.ucrReceiverFactors.Selector = Nothing - Me.ucrReceiverFactors.Size = New System.Drawing.Size(120, 100) - Me.ucrReceiverFactors.strNcFilePath = "" - Me.ucrReceiverFactors.TabIndex = 2 - Me.ucrReceiverFactors.ucrSelector = Nothing - ' - 'ucrSelectorFrequency - ' - Me.ucrSelectorFrequency.AutoSize = True - Me.ucrSelectorFrequency.bDropUnusedFilterLevels = False - Me.ucrSelectorFrequency.bShowHiddenColumns = False - Me.ucrSelectorFrequency.bUseCurrentFilter = True - Me.ucrSelectorFrequency.Location = New System.Drawing.Point(10, 10) - Me.ucrSelectorFrequency.Margin = New System.Windows.Forms.Padding(0) - Me.ucrSelectorFrequency.Name = "ucrSelectorFrequency" - Me.ucrSelectorFrequency.Size = New System.Drawing.Size(213, 183) - Me.ucrSelectorFrequency.TabIndex = 0 - ' - 'ucrBase - ' - Me.ucrBase.AutoSize = True - Me.ucrBase.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink - Me.ucrBase.Location = New System.Drawing.Point(10, 442) - Me.ucrBase.Name = "ucrBase" - Me.ucrBase.Size = New System.Drawing.Size(405, 52) - Me.ucrBase.TabIndex = 11 - ' - 'UcrCheck1 - ' - Me.UcrCheck1.AutoSize = True - Me.UcrCheck1.Checked = False - Me.UcrCheck1.Location = New System.Drawing.Point(227, 311) - Me.UcrCheck1.Name = "UcrCheck1" - Me.UcrCheck1.Size = New System.Drawing.Size(91, 20) - Me.UcrCheck1.TabIndex = 9 - ' - 'dlgFrequency - ' - 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(444, 498) - Me.Controls.Add(Me.ucrInputMarginName) - Me.Controls.Add(Me.lblMarginName) - Me.Controls.Add(Me.GroupBox1) - Me.Controls.Add(Me.ucrSaveTable) - Me.Controls.Add(Me.ucrChkDisplayMargins) - Me.Controls.Add(Me.ucrChkStoreResults) - Me.Controls.Add(Me.cmdFormatTable) - Me.Controls.Add(Me.grpDisplay) - Me.Controls.Add(Me.lblFactors) - Me.Controls.Add(Me.ucrReceiverFactors) - Me.Controls.Add(Me.ucrSelectorFrequency) - Me.Controls.Add(Me.ucrBase) - Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow - Me.MaximizeBox = False - Me.MinimizeBox = False - Me.Name = "dlgFrequency" - Me.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen - Me.Text = "Frequency" - Me.GroupBox1.ResumeLayout(False) - Me.GroupBox1.PerformLayout() - Me.grpDisplay.ResumeLayout(False) - Me.grpDisplay.PerformLayout() - Me.ResumeLayout(False) - Me.PerformLayout() - - End Sub - - Friend WithEvents ucrBase As ucrButtons - Friend WithEvents ucrSelectorFrequency As ucrSelectorByDataFrameAddRemove - Friend WithEvents ucrReceiverFactors As ucrReceiverMultiple - Friend WithEvents lblFactors As Label - Friend WithEvents ucrChkDisplayMargins As ucrCheck - Friend WithEvents cmdFormatTable As Button - Friend WithEvents UcrCheck1 As ucrCheck - Friend WithEvents ucrChkStoreResults As ucrCheck - Friend WithEvents ucrNudSigFigs As ucrNud - Friend WithEvents ucrSaveTable As ucrSave - Friend WithEvents GroupBox1 As GroupBox - Friend WithEvents lblSigFigs As Label - Friend WithEvents ucrChkPercentageProportion As ucrCheck - Friend WithEvents grpDisplay As GroupBox - Friend WithEvents lblFactorsAsPercentage As Label - Friend WithEvents ucrReceiverMultiplePercentages As ucrReceiverMultiple - Friend WithEvents ucrChkDisplayAsPercentage As ucrCheck - Friend WithEvents ucrInputMarginName As ucrInputTextBox - Friend WithEvents lblMarginName As Label - Friend WithEvents ucrChkDisplaySummariesAsRow As ucrCheck - Friend WithEvents ucrNudColumnFactors As ucrNud - Friend WithEvents lblColumnFactors As Label -End Class diff --git a/instat/dlgFrequency.resx b/instat/dlgFrequency.resx deleted file mode 100644 index 1af7de150c9..00000000000 --- a/instat/dlgFrequency.resx +++ /dev/null @@ -1,120 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - \ No newline at end of file diff --git a/instat/dlgFrequency.sw-KE.resx b/instat/dlgFrequency.sw-KE.resx deleted file mode 100644 index dd65f7fccba..00000000000 --- a/instat/dlgFrequency.sw-KE.resx +++ /dev/null @@ -1,309 +0,0 @@ - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - True - - - 253, 45 - - - 45, 13 - - - 1 - - - True - - - 8, 128 - - - 83, 13 - - - 6 - - - 323, 392 - - - 86, 23 - - - 11 - - - chaguo - - - True - - - 8, 154 - - - 76, 13 - - - 8 - - - 129, 98 - - - 50, 20 - - - 5 - - - 130, 124 - - - 50, 20 - - - 7 - - - 90, 150 - - - 89, 21 - - - 9 - - - 11, 19 - - - 156, 20 - - - 0 - - - True - - - 8, 75 - - - 49, 13 - - - 2 - - - 60, 71 - - - 120, 21 - - - 3 - - - 11, 45 - - - 148, 20 - - - 1 - - - True - - - 8, 101 - - - 96, 13 - - - 4 - - - 223, 194 - - - 186, 192 - - - 8 - - - Onyesha - - - True - - - 18, 44 - - - 117, 13 - - - 1 - - - 6, 13 - - - 576, 478 - - - 10, 391 - - - 270, 24 - - - 10 - - - 10, 365 - - - 104, 20 - - - 7 - - - 10, 339 - - - 91, 20 - - - 6 - - - 101, 200 - - - 0, 0, 0, 0 - - - 117, 20 - - - 4 - - - 10, 200 - - - 88, 20 - - - 3 - - - 253, 60 - - - 0, 0, 0, 0 - - - 120, 100 - - - 2 - - - 10, 10 - - - 0, 0, 0, 0 - - - 210, 182 - - - 0 - - - 10, 421 - - - 425, 55 - - - 12 - - - CenterScreen - - - Uradidi: - - - 18, 59 - - - 0, 0, 0, 0 - - - 120, 100 - - - 2 - - - 14, 166 - - - 135, 20 - - - 3 - - - 14, 19 - - - 135, 20 - - - 0 - - - 414, 194 - - - 155, 192 - - - 9 - - - 227, 311 - - - 91, 20 - - - 9 - - - True - - \ No newline at end of file diff --git a/instat/dlgFrequency.vb b/instat/dlgFrequency.vb deleted file mode 100644 index 4fe2647acc9..00000000000 --- a/instat/dlgFrequency.vb +++ /dev/null @@ -1,344 +0,0 @@ - -' R- Instat -' Copyright (C) 2015-2017 -' -' This program is free software: you can redistribute it and/or modify -' it under the terms of the GNU General Public License as published by -' the Free Software Foundation, either version 3 of the License, or -' (at your option) any later version. -' -' This program is distributed in the hope that it will be useful, -' but WITHOUT ANY WARRANTY; without even the implied warranty of -' MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -' GNU General Public License for more details. -' -' You should have received a copy of the GNU General Public License -' along with this program. If not, see . - -Imports instat.Translations -Public Class dlgFrequency - Private bFirstLoad As Boolean = True - Private bReset As Boolean = True - Private clsDefaultFunction As New RFunction - Private clsMmtableFunction As New RFunction - Private clsFrequencyOperator As New ROperator - Private clsMmtableOperator, clsJoiningPipeOperator, clsPipeOperator, clsTabFootnoteOperator As New ROperator - Private clsSummariesHeaderLeftTopFunction, clsSummariesHeaderTopLeftFunction As New RFunction - Private clsTableTitleFunction, clsTabFootnoteTitleFunction, clsTableSourcenoteFunction, - clsCellTextFunction, clsCellBorderFunction, clsCellFillFunction, clsHeaderFormatFunction, - clsTabOptionsFunction, clsBorderWeightPxFunction, clsFootnoteTitleLocationFunction, clsFootnoteSubtitleLocationFunction, - clsTabFootnoteSubtitleFunction, clsStyleListFunction, clsFootnoteCellFunction, clsFootnoteCellBodyFunction, - clsSecondFootnoteCellFunction, clsSecondFootnoteCellBodyFunction, clsTabStyleFunction, clsDummyFunction, - clsTabStyleCellTextFunction, clsTabStylePxFunction, clsTabStyleCellTitleFunction, clsStubHeadFunction As New RFunction - - Private Sub dlgFrequency_Load(sender As Object, e As EventArgs) Handles MyBase.Load - If bFirstLoad Then - InitialiseDialog() - bFirstLoad = False - End If - If bReset Then - SetDefaults() - End If - SetRCodeForControls(bReset) - bReset = False - autoTranslate(Me) - TestOKEnabled() - End Sub - Private Sub InitialiseDialog() - ucrBase.clsRsyntax.iCallType = 2 - ucrBase.iHelpTopicID = 425 - - ucrBase.clsRsyntax.bExcludeAssignedFunctionOutput = False - - ucrSelectorFrequency.SetParameter(New RParameter("data_name", 0)) - ucrSelectorFrequency.SetParameterIsString() - - ucrReceiverFactors.SetParameter(New RParameter("factors", 1)) - ucrReceiverFactors.SetParameterIsString() - ucrReceiverFactors.Selector = ucrSelectorFrequency - ucrReceiverFactors.SetDataType("factor") - ucrReceiverFactors.SetMeAsReceiver() - - ucrChkStoreResults.SetParameter(New RParameter("store_results", 2)) - ucrChkStoreResults.SetText("Store Results") - ucrChkStoreResults.SetValuesCheckedAndUnchecked("TRUE", "FALSE") - ucrChkStoreResults.SetRDefault("FALSE") - - ucrChkDisplayMargins.SetParameter(New RParameter("include_margins", 3)) - ucrChkDisplayMargins.SetText("Display Margins") - ucrChkDisplayMargins.SetRDefault("FALSE") - - ucrInputMarginName.SetParameter(New RParameter("margin_name", iNewPosition:=5)) - ucrInputMarginName.SetLinkedDisplayControl(lblMarginName) - - ucrNudSigFigs.SetParameter(New RParameter("signif_fig", 6)) - ucrNudSigFigs.SetMinMax(0, 22) - ucrNudSigFigs.SetRDefault(2) - - ucrChkDisplayAsPercentage.SetParameter(New RParameter("percentage_type", 7)) - ucrChkDisplayAsPercentage.SetText("As Percentages") - ucrChkDisplayAsPercentage.SetValuesCheckedAndUnchecked(Chr(34) & "factors" & Chr(34), Chr(34) & "none" & Chr(34)) - ucrChkDisplayAsPercentage.SetRDefault(Chr(34) & "none" & Chr(34)) - - ucrReceiverMultiplePercentages.SetParameter(New RParameter("perc_total_factors", 8)) - ucrReceiverMultiplePercentages.SetParameterIsString() - ucrReceiverMultiplePercentages.Selector = ucrSelectorFrequency - ucrReceiverMultiplePercentages.SetDataType("factor") ' TODO data this accepts must be in the other receiver too - ucrChkDisplayAsPercentage.AddToLinkedControls(ucrReceiverMultiplePercentages, {True}, bNewLinkedAddRemoveParameter:=True, bNewLinkedHideIfParameterMissing:=True) - ucrReceiverMultiplePercentages.SetLinkedDisplayControl(lblFactorsAsPercentage) - - ucrChkPercentageProportion.SetParameter(New RParameter("perc_decimal", 9)) - ucrChkPercentageProportion.SetText("Display as Decimal") - ucrChkPercentageProportion.SetRDefault("FALSE") - - ucrNudColumnFactors.SetLinkedDisplayControl(lblColumnFactors) - ucrNudColumnFactors.SetMinMax(iNewMin:=0) - ucrNudColumnFactors.Increment = 1 - - ucrChkDisplayAsPercentage.AddToLinkedControls(ucrChkPercentageProportion, {True}, bNewLinkedAddRemoveParameter:=True, bNewLinkedHideIfParameterMissing:=True) - ucrChkDisplayMargins.AddToLinkedControls(ucrInputMarginName, {True}, bNewLinkedAddRemoveParameter:=True, bNewLinkedHideIfParameterMissing:=True, bNewLinkedChangeToDefaultState:=True, objNewDefaultState:="All") - - ucrChkDisplaySummariesAsRow.SetText("Display Summaries As Rows") - ucrChkDisplaySummariesAsRow.Enabled = False - - ucrSaveTable.SetPrefix("frequency_table") - ucrSaveTable.SetSaveTypeAsTable() - ucrSaveTable.SetDataFrameSelector(ucrSelectorFrequency.ucrAvailableDataFrames) - ucrSaveTable.SetIsComboBox() - ucrSaveTable.SetCheckBoxText("Save Table") - ucrSaveTable.SetAssignToIfUncheckedValue("last_table") - End Sub - - Private Sub SetDefaults() - clsDefaultFunction = New RFunction - clsMmtableFunction = New RFunction - clsFrequencyOperator = New ROperator - clsMmtableOperator = New ROperator - clsSummariesHeaderTopLeftFunction = New RFunction - clsSummariesHeaderLeftTopFunction = New RFunction - clsTableTitleFunction = New RFunction - clsTabFootnoteTitleFunction = New RFunction - clsTableSourcenoteFunction = New RFunction - clsCellTextFunction = New RFunction - clsCellBorderFunction = New RFunction - clsCellFillFunction = New RFunction - clsHeaderFormatFunction = New RFunction - clsTabOptionsFunction = New RFunction - clsBorderWeightPxFunction = New RFunction - clsFootnoteTitleLocationFunction = New RFunction - clsFootnoteSubtitleLocationFunction = New RFunction - clsTabFootnoteSubtitleFunction = New RFunction - clsStyleListFunction = New RFunction - clsFootnoteCellFunction = New RFunction - clsFootnoteCellBodyFunction = New RFunction - clsSecondFootnoteCellFunction = New RFunction - clsSecondFootnoteCellBodyFunction = New RFunction - clsTabStyleFunction = New RFunction - clsTabStyleCellTextFunction = New RFunction - clsTabStylePxFunction = New RFunction - clsTabStyleCellTitleFunction = New RFunction - clsJoiningPipeOperator = New ROperator - clsPipeOperator = New ROperator - clsTabFootnoteOperator = New ROperator - clsDummyFunction = New RFunction - - ucrReceiverFactors.SetMeAsReceiver() - ucrSelectorFrequency.Reset() - ucrSaveTable.Reset() - ucrNudColumnFactors.SetText(1) - ucrBase.clsRsyntax.lstBeforeCodes.Clear() - - clsPipeOperator.SetOperation("%>%") - clsPipeOperator.bBrackets = False - - clsTabFootnoteOperator.SetOperation("%>%") - clsTabFootnoteOperator.bBrackets = False - - clsJoiningPipeOperator.SetOperation("%>%") - clsJoiningPipeOperator.AddParameter("mutable", clsROperatorParameter:=clsFrequencyOperator, iPosition:=0) - - clsTableTitleFunction.SetPackageName("gt") - clsTableTitleFunction.SetRCommand("tab_header") - - clsTabFootnoteTitleFunction.SetPackageName("gt") - clsTabFootnoteTitleFunction.SetRCommand("tab_footnote") - - clsTabFootnoteSubtitleFunction.SetPackageName("gt") - clsTabFootnoteSubtitleFunction.SetRCommand("tab_footnote") - - clsFootnoteCellFunction.SetPackageName("gt") - clsFootnoteCellFunction.SetRCommand("tab_footnote") - - clsSecondFootnoteCellFunction.SetPackageName("gt") - clsSecondFootnoteCellFunction.SetRCommand("tab_footnote") - - clsFootnoteTitleLocationFunction.SetPackageName("gt") - clsFootnoteTitleLocationFunction.SetRCommand("cells_title") - - clsFootnoteSubtitleLocationFunction.SetPackageName("gt") - clsFootnoteSubtitleLocationFunction.SetRCommand("cells_title") - - clsTableSourcenoteFunction.SetPackageName("gt") - clsTableSourcenoteFunction.SetRCommand("tab_source_note") - - clsFootnoteCellBodyFunction.SetPackageName("gt") - clsFootnoteCellBodyFunction.SetRCommand("cells_body") - - clsSecondFootnoteCellBodyFunction.SetPackageName("gt") - clsSecondFootnoteCellBodyFunction.SetRCommand("cells_body") - - clsCellTextFunction.SetPackageName("gt") - clsCellTextFunction.SetRCommand("cell_text") - - clsCellBorderFunction.SetPackageName("gt") - clsCellBorderFunction.SetRCommand("cell_borders") - clsCellBorderFunction.AddParameter("weight", clsRFunctionParameter:=clsBorderWeightPxFunction, iPosition:=3) - - clsCellFillFunction.SetPackageName("gt") - clsCellFillFunction.SetRCommand("cell_fill") - - clsHeaderFormatFunction.SetPackageName("mmtable2") - clsHeaderFormatFunction.SetRCommand("header_format") - clsHeaderFormatFunction.AddParameter("header", Chr(34) & "all_cols" & Chr(34), iPosition:=0) - clsHeaderFormatFunction.AddParameter("style", clsRFunctionParameter:=clsStyleListFunction, iPosition:=1) - - clsTabOptionsFunction.SetPackageName("gt") - clsTabOptionsFunction.SetRCommand("tab_options") - - clsBorderWeightPxFunction.SetPackageName("gt") - clsBorderWeightPxFunction.SetRCommand("px") - clsBorderWeightPxFunction.AddParameter("weight", "1", iPosition:=0, bIncludeArgumentName:=False) - - clsStyleListFunction.SetRCommand("list") - - clsStubHeadFunction.SetPackageName("gt") - clsStubHeadFunction.SetRCommand("tab_stubhead") - - clsTabStyleFunction.SetRCommand("tab_style") - clsTabStyleFunction.SetPackageName("gt") - clsTabStyleFunction.AddParameter("style", clsRFunctionParameter:=clsTabStyleCellTextFunction, iPosition:=0) - clsTabStyleFunction.AddParameter("location", clsRFunctionParameter:=clsTabStyleCellTitleFunction, iPosition:=1) - - clsTabStyleCellTitleFunction.SetPackageName("gt") - clsTabStyleCellTitleFunction.SetRCommand("cells_title") - clsTabStyleCellTitleFunction.AddParameter("groups", Chr(34) & "title" & Chr(34), iPosition:=0) - - clsTabStyleCellTextFunction.SetPackageName("gt") - clsTabStyleCellTextFunction.SetRCommand("cell_text") - clsTabStyleCellTextFunction.AddParameter("size", clsRFunctionParameter:=clsTabStylePxFunction, iPosition:=0) - - clsTabStylePxFunction.SetPackageName("gt") - clsTabStylePxFunction.SetRCommand("px") - clsTabStylePxFunction.AddParameter("size", "18", bIncludeArgumentName:=False, iPosition:=0) - - clsSummariesHeaderLeftTopFunction.SetPackageName("mmtable2") - clsSummariesHeaderLeftTopFunction.SetRCommand("header_left_top") - clsSummariesHeaderLeftTopFunction.AddParameter("variable", "summary", iPosition:=0) - - clsSummariesHeaderTopLeftFunction.SetPackageName("mmtable2") - clsSummariesHeaderTopLeftFunction.SetRCommand("header_top_left") - clsSummariesHeaderTopLeftFunction.AddParameter("variable", "summary", iPosition:=0) - - clsMmtableOperator.SetOperation("+") - - clsFrequencyOperator.SetOperation("+") - clsFrequencyOperator.AddParameter("mmtable2", clsRFunctionParameter:=clsMmtableFunction, iPosition:=0) - - clsMmtableFunction.SetPackageName("mmtable2") - clsMmtableFunction.SetRCommand("mmtable") - clsMmtableFunction.AddParameter("data", "frequency_table", iPosition:=0) - clsMmtableFunction.AddParameter("cells", "value", iPosition:=1) - - clsDefaultFunction.SetRCommand(frmMain.clsRLink.strInstatDataObject & "$summary_table") - clsDefaultFunction.AddParameter("store_results", "FALSE", iPosition:=2) - clsDefaultFunction.AddParameter("treat_columns_as_factor", "FALSE", iPosition:=10) - clsDefaultFunction.AddParameter("summaries", "count_label", iPosition:=11) - clsDefaultFunction.SetAssignTo("frequency_table") - - ucrBase.clsRsyntax.AddToBeforeCodes(clsDefaultFunction, 0) - ucrBase.clsRsyntax.SetBaseROperator(clsJoiningPipeOperator) - End Sub - Private Sub SetRCodeForControls(bReset As Boolean) - ucrInputMarginName.SetRCode(clsDefaultFunction, bReset) - ucrReceiverFactors.SetRCode(clsDefaultFunction, bReset) - ucrChkDisplayMargins.SetRCode(clsDefaultFunction, bReset) - ucrChkStoreResults.SetRCode(clsDefaultFunction, bReset) - ucrSelectorFrequency.SetRCode(clsDefaultFunction, bReset) - ucrChkPercentageProportion.SetRCode(clsDefaultFunction, bReset) - ucrChkDisplayAsPercentage.SetRCode(clsDefaultFunction, bReset) - ucrReceiverMultiplePercentages.SetRCode(clsDefaultFunction, bReset) - ucrNudSigFigs.SetRCode(clsDefaultFunction, bReset) - ucrSaveTable.SetRCode(clsJoiningPipeOperator, bReset) - End Sub - - Private Sub TestOKEnabled() - If ucrReceiverFactors.IsEmpty _ - OrElse String.IsNullOrEmpty(ucrNudColumnFactors.GetText()) _ - OrElse Not ucrSaveTable.IsComplete _ - OrElse String.IsNullOrEmpty(ucrNudSigFigs.GetText()) _ - OrElse ucrReceiverFactors.IsEmpty Then - ucrBase.OKEnabled(False) - Else - ucrBase.OKEnabled(True) - End If - End Sub - - Private Sub ucrBase_ClickReset(sender As Object, e As EventArgs) Handles ucrBase.ClickReset - SetDefaults() - SetRCodeForControls(True) - TestOKEnabled() - End Sub - - Private Sub SettingReceiver_ControlValueChanged(ucrChangedControl As ucrCore) Handles ucrChkDisplayAsPercentage.ControlValueChanged - If ucrChkDisplayAsPercentage.Checked Then - ucrReceiverMultiplePercentages.SetMeAsReceiver() - Else - ucrReceiverFactors.SetMeAsReceiver() - End If - End Sub - - Private Sub ucrCoreControls_ControlContentsChanged(ucrChangedControl As ucrCore) Handles ucrReceiverFactors.ControlContentsChanged, - ucrSaveTable.ControlContentsChanged, ucrNudSigFigs.ControlContentsChanged, ucrNudColumnFactors.ControlContentsChanged - TestOKEnabled() - End Sub - - Private Sub cmdOptions_Click(sender As Object, e As EventArgs) Handles cmdFormatTable.Click - sdgFormatSummaryTables.SetRCode(clsNewTableTitleFunction:=clsTableTitleFunction, clsNewTabFootnoteTitleFunction:=clsTabFootnoteTitleFunction, clsNewTableSourcenoteFunction:=clsTableSourcenoteFunction, clsNewDummyFunction:=clsDummyFunction, - clsNewCellTextFunction:=clsCellTextFunction, clsNewCellBorderFunction:=clsCellBorderFunction, clsNewCellFillFunction:=clsCellFillFunction, clsNewHeaderFormatFunction:=clsHeaderFormatFunction, - clsNewTabOptionsFunction:=clsTabOptionsFunction, clsNewFootnoteCellFunction:=clsFootnoteCellFunction, clsNewStubHeadFunction:=clsStubHeadFunction, clsNewSecondFootnoteCellBodyFunction:=clsSecondFootnoteCellBodyFunction, - clsNewPipeOperator:=clsPipeOperator, clsNewBorderWeightPxFunction:=clsBorderWeightPxFunction, clsNewFootnoteTitleLocationFunction:=clsFootnoteTitleLocationFunction, clsNewFootnoteCellBodyFunction:=clsFootnoteCellBodyFunction, - clsNewFootnoteSubtitleLocationFunction:=clsFootnoteSubtitleLocationFunction, clsNewTabFootnoteSubtitleFunction:=clsTabFootnoteSubtitleFunction, clsNewJoiningOperator:=clsJoiningPipeOperator, - clsNewStyleListFunction:=clsStyleListFunction, clsNewMutableOPerator:=clsFrequencyOperator, clsNewSecondFootnoteCellFunction:=clsSecondFootnoteCellFunction, clsNewTabFootnoteOperator:=clsTabFootnoteOperator, - clsNewTabStyleCellTextFunction:=clsTabStyleCellTextFunction, clsNewTabStyleFunction:=clsTabStyleFunction, clsNewTabStylePxFunction:=clsTabStylePxFunction, bReset:=bReset) - sdgFormatSummaryTables.ShowDialog() - End Sub - - Private Sub ucrReceiverFactors_ControlValueChanged(ucrChangedControl As ucrCore) Handles ucrReceiverFactors.ControlValueChanged, ucrNudColumnFactors.ControlValueChanged - If ucrReceiverFactors.IsEmpty OrElse String.IsNullOrEmpty(ucrNudColumnFactors.GetText()) Then - Exit Sub - End If - - Dim iColumn As Integer = 1 - Dim iNumberOfColumns As Integer - clsMmtableOperator.ClearParameters() - - iNumberOfColumns = ucrNudColumnFactors.GetText() - For Each strcolumn As String In ucrReceiverFactors.GetVariableNamesAsList - If iColumn <= iNumberOfColumns Then - Dim clsHeaderLeftFunction As New RFunction - clsHeaderLeftFunction.SetPackageName("mmtable2") - clsHeaderLeftFunction.SetRCommand("header_top_left") - clsHeaderLeftFunction.AddParameter("variable", strcolumn, iPosition:=0) - clsMmtableOperator.AddParameter(strcolumn, clsRFunctionParameter:=clsHeaderLeftFunction, iPosition:=iColumn) - Else - Dim clsHeaderTopFunction As New RFunction - clsHeaderTopFunction.SetPackageName("mmtable2") - clsHeaderTopFunction.SetRCommand("header_left_top") - clsHeaderTopFunction.AddParameter("variable", strcolumn, iPosition:=0) - clsMmtableOperator.AddParameter(strcolumn, clsRFunctionParameter:=clsHeaderTopFunction, iPosition:=iColumn) - End If - iColumn += 1 - Next - clsFrequencyOperator.AddParameter("columnOp", clsROperatorParameter:=clsMmtableOperator, iPosition:=1) - End Sub -End Class \ No newline at end of file diff --git a/instat/dlgFromLibrary.Designer.vb b/instat/dlgFromLibrary.Designer.vb index 49a863ebf1f..1e304af6143 100644 --- a/instat/dlgFromLibrary.Designer.vb +++ b/instat/dlgFromLibrary.Designer.vb @@ -201,7 +201,9 @@ Partial Class dlgFromLibrary Me.MinimizeBox = False Me.Name = "dlgFromLibrary" Me.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen + Me.Text = "Import from Library" Me.Text = "Import From Library" + Me.ResumeLayout(False) Me.PerformLayout() diff --git a/instat/dlgFromLibrary.vb b/instat/dlgFromLibrary.vb index 1493ae4a817..c406c6e397e 100644 --- a/instat/dlgFromLibrary.vb +++ b/instat/dlgFromLibrary.vb @@ -326,4 +326,9 @@ Public Class dlgFromLibrary End If End Sub + Private Sub lstCollection_DoubleClick(sender As Object, e As EventArgs) Handles lstCollection.DoubleClick + If ucrBase.cmdOk.Enabled Then + ucrBase.cmdOk.PerformClick() + End If + End Sub End Class \ No newline at end of file diff --git a/instat/dlgGeneralForGraphics.vb b/instat/dlgGeneralForGraphics.vb index 759d002a0d4..99f84a104f7 100644 --- a/instat/dlgGeneralForGraphics.vb +++ b/instat/dlgGeneralForGraphics.vb @@ -17,7 +17,7 @@ Imports instat.Translations Public Class dlgGeneralForGraphics - Public clsGgplotFunction As RFunction + Public clsGgplotFunction As New RFunction Private bFirstLoad As Boolean = True Private bReset As Boolean = True Private lstLayerComplete As New List(Of Boolean) diff --git a/instat/dlgImportDataset.Designer.vb b/instat/dlgImportDataset.Designer.vb index ff17c79828d..533b3147fb0 100644 --- a/instat/dlgImportDataset.Designer.vb +++ b/instat/dlgImportDataset.Designer.vb @@ -38,6 +38,8 @@ Partial Class dlgImportDataset 'Do not modify it using the code editor. Private Sub InitializeComponent() + Me.components = New System.ComponentModel.Container() + Dim resources As System.ComponentModel.ComponentResourceManager = New System.ComponentModel.ComponentResourceManager(GetType(dlgImportDataset)) Me.lblTextFilePreview = New System.Windows.Forms.Label() Me.lblDataFrame = New System.Windows.Forms.Label() Me.lblEncodingCSV = New System.Windows.Forms.Label() @@ -71,6 +73,8 @@ Partial Class dlgImportDataset Me.clbSheets = New System.Windows.Forms.CheckedListBox() Me.lblSelectSheets = New System.Windows.Forms.Label() Me.lblImportingSheets = New System.Windows.Forms.Label() + Me.cmdStepBack = New System.Windows.Forms.Button() + Me.ttCmdStepBack = New System.Windows.Forms.ToolTip(Me.components) Me.ucrChkDropEmptyCols = New instat.ucrCheck() Me.ucrChkMultipleFiles = New instat.ucrCheck() Me.ucrSaveFile = New instat.ucrSave() @@ -212,7 +216,7 @@ Partial Class dlgImportDataset 'lblFileOpenPath ' Me.lblFileOpenPath.ImeMode = System.Windows.Forms.ImeMode.NoControl - Me.lblFileOpenPath.Location = New System.Drawing.Point(10, 20) + Me.lblFileOpenPath.Location = New System.Drawing.Point(8, 20) Me.lblFileOpenPath.Name = "lblFileOpenPath" Me.lblFileOpenPath.Size = New System.Drawing.Size(38, 13) Me.lblFileOpenPath.TabIndex = 0 @@ -231,7 +235,7 @@ Partial Class dlgImportDataset 'cmdBrowse ' Me.cmdBrowse.ImeMode = System.Windows.Forms.ImeMode.NoControl - Me.cmdBrowse.Location = New System.Drawing.Point(408, 18) + Me.cmdBrowse.Location = New System.Drawing.Point(401, 18) Me.cmdBrowse.Name = "cmdBrowse" Me.cmdBrowse.Size = New System.Drawing.Size(66, 23) Me.cmdBrowse.TabIndex = 2 @@ -387,9 +391,9 @@ Partial Class dlgImportDataset Me.lblNoPreview.ImeMode = System.Windows.Forms.ImeMode.NoControl Me.lblNoPreview.Location = New System.Drawing.Point(286, 290) Me.lblNoPreview.Name = "lblNoPreview" - Me.lblNoPreview.Size = New System.Drawing.Size(302, 18) + Me.lblNoPreview.Size = New System.Drawing.Size(298, 18) Me.lblNoPreview.TabIndex = 14 - Me.lblNoPreview.Text = "Preview not yet implemented for this file type." + Me.lblNoPreview.Text = "Preview not yet implemented for this file type" Me.lblNoPreview.TextAlign = System.Drawing.ContentAlignment.TopCenter Me.lblNoPreview.Visible = False ' @@ -533,6 +537,17 @@ Partial Class dlgImportDataset Me.lblImportingSheets.Text = "Importing the following sheets:" Me.lblImportingSheets.Visible = False ' + 'cmdStepBack + ' + Me.cmdStepBack.FlatStyle = System.Windows.Forms.FlatStyle.Flat + Me.cmdStepBack.ForeColor = System.Drawing.SystemColors.Control + Me.cmdStepBack.Image = CType(resources.GetObject("cmdStepBack.Image"), System.Drawing.Image) + Me.cmdStepBack.Location = New System.Drawing.Point(603, 18) + Me.cmdStepBack.Name = "cmdStepBack" + Me.cmdStepBack.Size = New System.Drawing.Size(23, 24) + Me.cmdStepBack.TabIndex = 32 + Me.cmdStepBack.UseVisualStyleBackColor = True + ' 'ucrChkDropEmptyCols ' Me.ucrChkDropEmptyCols.AutoSize = True @@ -547,9 +562,9 @@ Partial Class dlgImportDataset ' Me.ucrChkMultipleFiles.AutoSize = True Me.ucrChkMultipleFiles.Checked = False - Me.ucrChkMultipleFiles.Location = New System.Drawing.Point(480, 20) + Me.ucrChkMultipleFiles.Location = New System.Drawing.Point(470, 20) Me.ucrChkMultipleFiles.Name = "ucrChkMultipleFiles" - Me.ucrChkMultipleFiles.Size = New System.Drawing.Size(189, 23) + Me.ucrChkMultipleFiles.Size = New System.Drawing.Size(132, 23) Me.ucrChkMultipleFiles.TabIndex = 30 ' 'ucrSaveFile @@ -941,7 +956,7 @@ Partial Class dlgImportDataset Me.ucrInputFilePath.AutoSize = True Me.ucrInputFilePath.IsMultiline = False Me.ucrInputFilePath.IsReadOnly = False - Me.ucrInputFilePath.Location = New System.Drawing.Point(47, 17) + Me.ucrInputFilePath.Location = New System.Drawing.Point(45, 17) Me.ucrInputFilePath.Margin = New System.Windows.Forms.Padding(6, 8, 6, 8) Me.ucrInputFilePath.Name = "ucrInputFilePath" Me.ucrInputFilePath.RightToLeft = System.Windows.Forms.RightToLeft.Yes @@ -973,6 +988,7 @@ Partial Class dlgImportDataset Me.AutoScaleDimensions = New System.Drawing.SizeF(96.0!, 96.0!) Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi Me.ClientSize = New System.Drawing.Size(629, 502) + Me.Controls.Add(Me.cmdStepBack) Me.Controls.Add(Me.ucrChkDropEmptyCols) Me.Controls.Add(Me.ucrChkMultipleFiles) Me.Controls.Add(Me.ucrSaveFile) @@ -1093,4 +1109,6 @@ Partial Class dlgImportDataset Friend WithEvents ucrSaveFile As ucrSave Friend WithEvents ucrChkMultipleFiles As ucrCheck Friend WithEvents ucrChkDropEmptyCols As ucrCheck + Friend WithEvents cmdStepBack As Button + Friend WithEvents ttCmdStepBack As ToolTip End Class diff --git a/instat/dlgImportDataset.resx b/instat/dlgImportDataset.resx index 29dcb1b3a35..3207bacbb93 100644 --- a/instat/dlgImportDataset.resx +++ b/instat/dlgImportDataset.resx @@ -117,4 +117,18 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + + iVBORw0KGgoAAAANSUhEUgAAABEAAAARCAYAAAA7bUf6AAAABGdBTUEAALGPC/xhBQAAAENJREFUOE9j + IAL8h9JkA5ABMEwWQDaALIOQNSHTRBuErhidTdAgbIqw8fEahE2SWDG8gGQN2MCoIZhg1BBMQMAQBgYA + bRok3Hu/+V4AAAAASUVORK5CYII= + + + + 17, 17 + + + 25 + \ No newline at end of file diff --git a/instat/dlgImportDataset.vb b/instat/dlgImportDataset.vb index 383231dd382..fde30192815 100644 --- a/instat/dlgImportDataset.vb +++ b/instat/dlgImportDataset.vb @@ -5,17 +5,17 @@ Imports instat.Translations Public Class dlgImportDataset - Private clsImportTextFileFormats, clsImportCSVFileFormats, clsImportRDS, clsReadRDS, clsImportExcel, clsImport As RFunction - Private clsGetExcelSheetNames As RFunction - Private clsRangeOperator As ROperator + Private clsImportTextFileFormats, clsImportCSVFileFormats, clsImportRDS, clsReadRDS, clsImportExcel, clsImport As New RFunction + Private clsGetExcelSheetNames As New RFunction + Private clsRangeOperator As New ROperator ''' ''' Ensures that any file paths containing special characters (e.g. accents) are ''' correctly encoded. ''' - Private clsEnc2Native As RFunction + Private clsEnc2Native As New RFunction 'functions for multi Excel sheet impoty - Private clsImportExcelMulti As RFunction - Private clsGetFilesList, clsImportMultipleFiles, clsImportMultipleTextFiles, clsFileNamesWithExt As RFunction + Private clsImportExcelMulti As New RFunction + Private clsGetFilesList, clsImportMultipleFiles, clsImportMultipleTextFiles, clsFileNamesWithExt As New RFunction 'functions for importing multiple files Private bFirstLoad As Boolean = True Public bFromLibrary As Boolean = False @@ -29,6 +29,7 @@ Public Class dlgImportDataset Private strFilePathSystemTemp As String = "" Private strFilePathR As String = "" Private strCurrentDirectory As String = "" + Private strDirectoryPathTemp As String = "" Private bImportFromFolder As Boolean = False Private strFileName As String = "" Private strlastFileName As String = "" @@ -61,6 +62,7 @@ Public Class dlgImportDataset strFileExtension = "" 'reset End If SetDialogStateFromFile(strFileToOpenOn, strFileExtension) + strDirectoryPathTemp = strFileToOpenOn strFileToOpenOn = "" bStartOpenDialog = False ElseIf bStartOpenDialog Then @@ -80,7 +82,7 @@ Public Class dlgImportDataset End If End If End If - + HideDropEmptyCheckBox() bReset = False TestOkEnabled() End Sub @@ -279,6 +281,8 @@ Public Class dlgImportDataset ucrChkDropEmptyCols.SetText("Drop Empty Rows and Columns") ucrChkDropEmptyCols.SetParameter(New RParameter("isRFunction", 0)) ucrChkDropEmptyCols.SetValuesCheckedAndUnchecked("True", "False") + + ttCmdStepBack.SetToolTip(cmdStepBack, "Up to previous folder step 1.") End Sub Private Sub SetDefaults() @@ -303,6 +307,7 @@ Public Class dlgImportDataset clsEmptyDummyFunction = New RFunction ucrChkDropEmptyCols.Visible = False + cmdStepBack.Visible = False clsImportTextFileFormats.SetPackageName("readr") clsImportTextFileFormats.SetRCommand("read_table") @@ -343,8 +348,9 @@ Public Class dlgImportDataset 'commands for multiple files clsGetFilesList.SetRCommand("list.files") - clsGetFilesList.AddParameter("full.names", "TRUE", iPosition:=2) - clsGetFilesList.AddParameter("ignore.case", "TRUE", iPosition:=3) + clsGetFilesList.AddParameter("recursive", "TRUE", iPosition:=2) + clsGetFilesList.AddParameter("full.names", "TRUE", iPosition:=3) + clsGetFilesList.AddParameter("ignore.case", "TRUE", iPosition:=4) clsImportMultipleFiles.SetPackageName("rio") clsImportMultipleFiles.SetRCommand("import_list") @@ -381,7 +387,6 @@ Public Class dlgImportDataset ucrBase.clsRsyntax.SetBaseRFunction(clsImport) - dctSelectedExcelSheets.Clear() clbSheets.Items.Clear() 'reset this here. Not set by R code ucrInputMissingValueStringExcel.SetName("") 'reset this here. Not set by R code @@ -398,11 +403,14 @@ Public Class dlgImportDataset SetDefaults() SetRCodeForControls(True) TestOkEnabled() + HideDropEmptyCheckBox() End Sub Private Sub TestOkEnabled() If bImportFromFolder Then ucrBase.OKEnabled(GetDirectoryFiles(False).Count > 0) + ElseIf ucrInputFilePath.IsEmpty Then + ucrBase.OKEnabled(False) Else If IsExcelFileFormat() Then ucrBase.OKEnabled(dctSelectedExcelSheets.Count > 0 AndAlso bCanImport) @@ -441,7 +449,8 @@ Public Class dlgImportDataset Else dctSelectedExcelSheets.Clear() clbSheets.Items.Clear() - SetDialogStateFromFile(dlgOpen.FileName) + strDirectoryPathTemp = dlgOpen.FileName + SetDialogStateFromFile(strDirectoryPathTemp) End If End If End Using @@ -574,7 +583,7 @@ Public Class dlgImportDataset strlastFileName = Path.GetFileNameWithoutExtension(strFileOrFolderPath) strCurrentDirectory = Path.GetDirectoryName(strFileOrFolderPath) strFileExtension = Path.GetExtension(strFileOrFolderPath).ToLower 'extension check is done in lower case - ElseIf Directory.Exists(strFileOrFolderPath) AndAlso strFolderFileExt <> "" Then + ElseIf Directory.Exists(strFileOrFolderPath) AndAlso strFolderFileExt <> "" Then strCurrentDirectory = strFileOrFolderPath strFileExtension = strFolderFileExt.ToLower 'extension check is done in lower case bImportFromFolder = True @@ -702,6 +711,8 @@ Public Class dlgImportDataset End If End If + cmdStepBack.Enabled = If(strCurrentDirectory.Count(Function(x) x = GetCorrectSeparatorInPath()) <= 1, False, True) 'Disable the button to avoid getting the path not needed e.g D: + TryTextPreview() TryGridPreview() TestOkEnabled() @@ -897,14 +908,30 @@ Public Class dlgImportDataset TestOkEnabled() End Sub + Private Sub HideDropEmptyCheckBox() + If ucrInputFilePath.IsEmpty Then + ucrChkDropEmptyCols.Visible = False + ucrChkMultipleFiles.Visible = False + lblNoPreview.Text = "No file selected." + Else + ucrChkDropEmptyCols.Visible = True + ucrChkMultipleFiles.Visible = True + lblNoPreview.Text = "Preview not yet implemented for this file type" + End If + End Sub + Private Sub Controls_ControlValueChanged(ucrChangedControl As ucrCore) Handles ucrChkTrimWSExcel.ControlValueChanged, ucrNudRowsToSkipExcel.ControlValueChanged, ucrChkColumnNamesExcel.ControlValueChanged, ucrChkColumnNamesText.ControlValueChanged, ucrNudRowsToSkipText.ControlValueChanged, - ucrChkMaxRowsText.ControlValueChanged, ucrChkMaxRowsCSV.ControlValueChanged, ucrChkMaxRowsExcel.ControlValueChanged, ucrNudMaxRowsText.ControlValueChanged, ucrNudMaxRowsCSV.ControlValueChanged, ucrChkDropEmptyCols.ControlValueChanged, + ucrChkMaxRowsText.ControlValueChanged, ucrChkMaxRowsCSV.ControlValueChanged, ucrChkMaxRowsExcel.ControlValueChanged, ucrNudMaxRowsText.ControlValueChanged, ucrNudMaxRowsCSV.ControlValueChanged, ucrChkDropEmptyCols.ControlValueChanged, ucrInputFilePath.ControlValueChanged, ucrNudMaxRowsExcel.ControlValueChanged, ucrChkStringsAsFactorsCSV.ControlValueChanged, ucrInputEncodingCSV.ControlValueChanged, ucrInputSeparatorCSV.ControlValueChanged, ucrInputHeadersCSV.ControlValueChanged, ucrInputDecimalCSV.ControlValueChanged, ucrNudRowsToSkipCSV.ControlValueChanged TryGridPreview() TestOkEnabled() + HideDropEmptyCheckBox() End Sub - Private Sub MissingValuesInputControls_ContentsChanged() Handles ucrInputMissingValueStringText.ContentsChanged, ucrInputMissingValueStringCSV.ContentsChanged, ucrInputMissingValueStringExcel.ContentsChanged + Private Sub MissingValuesInputControls_ControlContentsChanged(ucrChangedControl As ucrCore) Handles ucrInputMissingValueStringText.ControlContentsChanged, ucrInputMissingValueStringCSV.ControlContentsChanged, ucrInputMissingValueStringExcel.ControlContentsChanged + 'todo. as of 11/04/2022, control rasing the event is passed in as the event parameter. + 'Refactor code to use control checks for updating the below R parameter? + 'currently we have no way of knowing which control has raised this event and therefore can't do that check 'so instead we are using the strFileType to identify which RFunctions should be updated accordingly If IsExcelFileFormat() Then @@ -1059,12 +1086,33 @@ Public Class dlgImportDataset TestOkEnabled() End Sub + Private Function GetCorrectSeparatorInPath() As String + Dim strSeparator As String = "" + If strCurrentDirectory.Contains("/") Then + strSeparator = "/" + ElseIf strCurrentDirectory.Contains("\") Then + strSeparator = "\" + End If + Return strSeparator + End Function + + Private Sub cmdStepBack_Click(sender As Object, e As EventArgs) Handles cmdStepBack.Click + If GetCorrectSeparatorInPath() <> "" Then + SetDialogStateFromFile(Strings.Left(strCurrentDirectory, InStrRev(strCurrentDirectory, GetCorrectSeparatorInPath()) - 1), strFileExtension) + Else + SetDialogStateFromFile("") + End If + End Sub + Private Sub ucrChkMultipleFiles_ControlValueChanged(ucrChangedControl As ucrCore) Handles ucrChkMultipleFiles.ControlValueChanged If ucrChkMultipleFiles.Checked Then SetDialogStateFromFile(strCurrentDirectory, strFileExtension) + cmdStepBack.Visible = True Else - SetDialogStateFromFile(strCurrentDirectory & "\" & strlastFileName & strFileExtension) + SetDialogStateFromFile(strDirectoryPathTemp) + cmdStepBack.Visible = False End If + TestOkEnabled() End Sub @@ -1115,7 +1163,7 @@ Public Class dlgImportDataset Dim lstFileNames As New List(Of String) Dim arrFilePathsAndNames() As String If strFilePathSystem <> "" AndAlso Directory.Exists(strFilePathSystem) Then - arrFilePathsAndNames = Directory.GetFiles(strFilePathSystem, "*" & strFileExtension) + arrFilePathsAndNames = Directory.GetFiles(strFilePathSystem, "*" & strFileExtension, SearchOption.AllDirectories) If bOnlyCleanedFileNames Then For Each strFilePathName As String In arrFilePathsAndNames lstFileNames.Add(GetCleanFileName(strFilePathName)) diff --git a/instat/dlgImportGriddedData.vb b/instat/dlgImportGriddedData.vb index 808804372d9..a292cd9ca1c 100644 --- a/instat/dlgImportGriddedData.vb +++ b/instat/dlgImportGriddedData.vb @@ -19,7 +19,7 @@ Public Class dlgImportGriddedData Private bFirstLoad As Boolean = True Private bReset As Boolean = True Private bShowMessageBox As Boolean - Private clsDownloadFromIRIFunction As RFunction + Private clsDownloadFromIRIFunction As New RFunction Private dctDownloadPairs, dctFiles As New Dictionary(Of String, String) Private Sub dlgImportGriddedData_Load(sender As Object, e As EventArgs) Handles MyBase.Load If bFirstLoad Then diff --git a/instat/dlgInventoryPlot.vb b/instat/dlgInventoryPlot.vb index 69d0f06e3d4..80841fa16c3 100644 --- a/instat/dlgInventoryPlot.vb +++ b/instat/dlgInventoryPlot.vb @@ -18,9 +18,9 @@ Imports instat.Translations Public Class dlgInventoryPlot Private bFirstLoad As Boolean = True Private bReset As Boolean = True - Private clsInventoryPlot As RFunction - Private clsClimaticMissing As RFunction - Private clsClimaticDetails As RFunction + Private clsInventoryPlot As New RFunction + Private clsClimaticMissing As New RFunction + Private clsClimaticDetails As New RFunction Private bResetSubdialog As Boolean = True Private Sub dlgInventoryPlot_Load(sender As Object, e As EventArgs) Handles MyBase.Load @@ -99,7 +99,7 @@ Public Class dlgInventoryPlot ucrChkDay.SetValuesCheckedAndUnchecked("TRUE", "FALSE") ucrChkDay.SetRDefault("TRUE") - ucrSaveDetails.SetPrefix("climatic_details") + ucrSaveDetails.SetPrefix("details") ucrSaveDetails.SetCheckBoxText("Save Details") ucrSaveDetails.SetSaveTypeAsDataFrame() ucrSaveDetails.SetDataFrameSelector(ucrInventoryPlotSelector.ucrAvailableDataFrames) @@ -170,6 +170,7 @@ Public Class dlgInventoryPlot ucrChkDetails.AddToLinkedControls({ucrChkDay}, {True}, bNewLinkedAddRemoveParameter:=True, bNewLinkedHideIfParameterMissing:=True) ucrChkDetails.AddToLinkedControls({ucrPnlOrder}, {True}, bNewLinkedAddRemoveParameter:=True, bNewLinkedHideIfParameterMissing:=True) ucrChkSummary.AddToLinkedControls({ucrChkOmitStart, ucrChkOmitEnd}, {True}, bNewLinkedAddRemoveParameter:=True, bNewLinkedHideIfParameterMissing:=True) + ucrChkDetails.AddToLinkedControls({ucrSaveDetails}, {True}, bNewLinkedAddRemoveParameter:=True, bNewLinkedHideIfParameterMissing:=True) ucrChkDay.SetLinkedDisplayControl(grpDetailsOptions) ucrChkSummary.SetLinkedDisplayControl(grpOptions) ucrPnlPlotType.SetLinkedDisplayControl(grpPlotType) diff --git a/instat/dlgLabelsLevels.Designer.vb b/instat/dlgLabelsLevels.Designer.vb index 77fa67e751f..9a25e5350aa 100644 --- a/instat/dlgLabelsLevels.Designer.vb +++ b/instat/dlgLabelsLevels.Designer.vb @@ -116,13 +116,10 @@ Partial Class dlgLabelsLevels ' Me.ucrFactorLabels.AutoSize = True Me.ucrFactorLabels.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle - Me.ucrFactorLabels.clsReceiver = Nothing Me.ucrFactorLabels.Location = New System.Drawing.Point(256, 66) Me.ucrFactorLabels.Name = "ucrFactorLabels" - Me.ucrFactorLabels.shtCurrSheet = Nothing Me.ucrFactorLabels.Size = New System.Drawing.Size(336, 299) Me.ucrFactorLabels.TabIndex = 2 - Me.ucrFactorLabels.ucrChkLevels = Nothing ' 'ucrSelectorForLabels ' diff --git a/instat/dlgLabelsLevels.vb b/instat/dlgLabelsLevels.vb index 73f3b90997b..c3eac2d5c01 100644 --- a/instat/dlgLabelsLevels.vb +++ b/instat/dlgLabelsLevels.vb @@ -36,18 +36,15 @@ Public Class dlgLabelsLevels If bUseSelectedColumn Then SetDefaultColumn() End If + CountLevels() autoTranslate(Me) End Sub Private Sub InitialiseDialog() ucrBase.iHelpTopicID = 35 - ucrFactorLabels.SetParameter(New RParameter("new_labels", 2)) - ucrFactorLabels.SetReceiver(ucrReceiverLabels) - ucrFactorLabels.SetAsViewerOnly() - ucrFactorLabels.AddEditableColumns({ucrFactorLabels.strLevelsName, ucrFactorLabels.strLabelsName}) - ucrFactorLabels.SetIsGridColumn(ucrFactorLabels.strLabelsName) - ucrFactorLabels.SetLevelsCheckbox(ucrChkIncludeLevelNumbers) + ucrSelectorForLabels.SetParameter(New RParameter("data_name", 0)) + ucrSelectorForLabels.SetParameterIsString() ucrReceiverLabels.SetParameter(New RParameter("col_name", 1)) ucrReceiverLabels.SetParameterIsString() @@ -56,8 +53,17 @@ Public Class dlgLabelsLevels ucrReceiverLabels.SetIncludedDataTypes({"factor"}, bStrict:=True) ucrReceiverLabels.strSelectorHeading = "Factors" - ucrSelectorForLabels.SetParameter(New RParameter("data_name", 0)) - ucrSelectorForLabels.SetParameterIsString() + Dim dctParamAndColNames As New Dictionary(Of String, String) + dctParamAndColNames.Add("new_labels", ucrFactor.DefaultColumnNames.Label) + 'todo. commented out temporarily + 'until when full support of adding or removing specific parameters will be implemented + 'dctParamAndColNames.Add("new_levels", ucrFactor.DefaultColumnNames.Level) + + ucrFactorLabels.SetParameter(New RParameter("new_labels", 2)) + ucrFactorLabels.SetAsNormalGridColumn(ucrReceiverLabels, dctParamAndColNames, + editableColNames:={ucrFactor.DefaultColumnNames.Label, + ucrFactor.DefaultColumnNames.Level}, + hiddenColNames:={ucrFactor.DefaultColumnNames.Level}) ucrChkIncludeLevelNumbers.SetText("Include Level Numbers") @@ -68,14 +74,16 @@ Public Class dlgLabelsLevels Private Sub SetDefaults() clsViewLabelsFunction = New RFunction clsSumCountMissingFunction = New RFunction + + cmdAddLevel.Enabled = False ucrSelectorForLabels.Reset() ucrSelectorForLabels.Focus() + clsSumCountMissingFunction.SetRCommand("summary_count_missing") clsViewLabelsFunction.SetRCommand(frmMain.clsRLink.strInstatDataObject & "$set_factor_levels") ucrBase.clsRsyntax.SetBaseRFunction(clsViewLabelsFunction) - AddLevelButtonEnabled() End Sub Public Sub SetCurrentColumn(strColumn As String, strDataFrame As String) @@ -91,16 +99,22 @@ Public Class dlgLabelsLevels End Sub Private Sub SetRCodeforControls(bReset As Boolean) - SetRCode(Me, ucrBase.clsRsyntax.clsBaseFunction, bReset) - TestOKEnabled() + + ucrSelectorForLabels.SetRCode(clsViewLabelsFunction, bReset) + ucrReceiverLabels.SetRCode(clsViewLabelsFunction, bReset) + + 'todo. commented out temporarily + 'until when full support of adding or removing specific parameters will be implemented + 'ucrFactorLabels.AddAdditionalCodeParameterPair(clsViewLabelsFunction, New RParameter("new_levels", 1), iAdditionalPairNo:=1) + ucrFactorLabels.SetRCode(clsViewLabelsFunction, bReset) + End Sub Private Sub TestOKEnabled() - If Not ucrReceiverLabels.IsEmpty() AndAlso ucrFactorLabels.IsColumnComplete(ucrFactorLabels.strLabelsName) AndAlso (ucrChkIncludeLevelNumbers.Visible AndAlso Not ucrChkIncludeLevelNumbers.Checked OrElse (ucrFactorLabels.IsColumnComplete(ucrFactorLabels.strLevelsName))) Then - ucrBase.OKEnabled(True) - Else - ucrBase.OKEnabled(False) - End If + ucrBase.OKEnabled(Not ucrReceiverLabels.IsEmpty() _ + AndAlso ucrFactorLabels.IsColumnComplete({ucrFactor.DefaultColumnNames.Label}) _ + AndAlso (ucrFactorLabels.IsColumnComplete({ucrFactor.DefaultColumnNames.Level}) _ + OrElse Not ucrChkIncludeLevelNumbers.Checked)) End Sub Private Sub ucrBase_ClickReset(sender As Object, e As EventArgs) Handles ucrBase.ClickReset @@ -110,45 +124,67 @@ Public Class dlgLabelsLevels End Sub Private Sub cmdAddLevel_Click(sender As Object, e As EventArgs) Handles cmdAddLevel.Click - ucrFactorLabels.AddLevel() - TestOKEnabled() + ucrFactorLabels.AddNewRowInGrid() End Sub - Private Sub ucrReceiverLabels_ControlValueChanged(ucrChangedControl As ucrCore) Handles ucrReceiverLabels.ControlValueChanged - Dim iMissingValue As Integer - Dim clsGetColumnFunction As RFunction = ucrReceiverLabels.GetVariables() + Private Sub CountLevels() + Static iMissingValue As Integer + Dim clsGetColumnFunction As RFunction + + clsGetColumnFunction = ucrReceiverLabels.GetVariables() clsGetColumnFunction.RemoveAssignTo() If Not ucrReceiverLabels.IsEmpty AndAlso {"factor"}.Contains(ucrReceiverLabels.strCurrDataType) Then clsSumCountMissingFunction.AddParameter("x", clsRFunctionParameter:=clsGetColumnFunction, iPosition:=0) iMissingValue = frmMain.clsRLink.RunInternalScriptGetValue(clsSumCountMissingFunction.ToScript(), bSilent:=False).AsNumeric(0) Else + iMissingValue = 0 clsSumCountMissingFunction.RemoveParameterByName("x") End If lblNaValue.Text = "Missing Values: " & iMissingValue lblNaValue.Visible = iMissingValue > 0 - lblLevelNumber.Visible = If(Not ucrReceiverLabels.IsEmpty, True, False) + lblLevelNumber.Text = "Levels: " & ucrFactorLabels.RowCount + lblLevelNumber.Visible = ucrFactorLabels.RowCount > 0 End Sub - Private Sub AddLevelButtonEnabled() - cmdAddLevel.Enabled = ucrFactorLabels.grdFactorData.Visible AndAlso Not ucrReceiverLabels.IsEmpty + Private Sub ucrReceiverLabels_ControlValueChanged(ucrChangedControl As ucrCore) Handles ucrReceiverLabels.ControlValueChanged + 'check if the variable selected has value labels. + 'If it has then disable ucrChkIncludeLevelNumbers and set it as checked + 'because it already has level number, so just show them to user + ucrChkIncludeLevelNumbers.Checked = frmMain.clsRLink.IsVariablesMetadata( + ucrReceiverLabels.GetDataName(), "labels", ucrReceiverLabels.GetVariableNames(False)) + ucrChkIncludeLevelNumbers.Enabled = Not ucrChkIncludeLevelNumbers.Checked End Sub - 'TODO modify factor control to be able to manage two parameters from different columns Private Sub ucrFactorLabels_ControlValueChanged(ucrChangedControl As ucrCore) Handles ucrFactorLabels.ControlValueChanged, ucrChkIncludeLevelNumbers.ControlValueChanged - If (ucrChkIncludeLevelNumbers.Checked OrElse Not ucrChkIncludeLevelNumbers.Visible) AndAlso ucrFactorLabels.IsColumnComplete(ucrFactorLabels.strLevelsName) Then - clsViewLabelsFunction.AddParameter("new_levels", strParameterValue:=ucrFactorLabels.GetColumnInFactorSheet(ucrFactorLabels.strLevelsName, bWithQuotes:=False)) + + 'only add levels if indicated by the user + Dim bAddParam As Boolean + If ucrChkIncludeLevelNumbers.Checked Then + ucrFactorLabels.ShowColumns({ucrFactor.DefaultColumnNames.Level}) + bAddParam = ucrFactorLabels.IsColumnComplete({ucrFactor.DefaultColumnNames.Level}) Else - clsViewLabelsFunction.RemoveParameterByName("new_levels") + ucrFactorLabels.HideColumns({ucrFactor.DefaultColumnNames.Level}) + bAddParam = False End If - If ucrFactorLabels.grdFactorData.CurrentWorksheet IsNot Nothing Then - lblLevelNumber.Text = "Levels: " & ucrFactorLabels.grdFactorData.CurrentWorksheet.RowCount + + 'this adding or removing could be possible if the custom controls could + 'add or remove their own specific parameters in a context like this + 'so we do it manually here + If bAddParam Then + clsViewLabelsFunction.AddParameter("new_levels", + strParameterValue:=mdlCoreControl.GetRVector( + ucrFactorLabels.GetCellValues(ucrFactor.DefaultColumnNames.Level, bWithQuotes:=False)), + iPosition:=3) + + Else + clsViewLabelsFunction.RemoveParameterByName("new_levels") End If - End Sub - Private Sub ucrReceiverLabels_ControlContentsChanged(ucrChangedControl As ucrCore) Handles ucrReceiverLabels.ControlContentsChanged, ucrFactorLabels.ControlContentsChanged - AddLevelButtonEnabled() + cmdAddLevel.Enabled = Not ucrReceiverLabels.IsEmpty + CountLevels() TestOKEnabled() End Sub + End Class \ No newline at end of file diff --git a/instat/dlgMerge.vb b/instat/dlgMerge.vb index 7ccc9644abf..a93fdeafbb1 100644 --- a/instat/dlgMerge.vb +++ b/instat/dlgMerge.vb @@ -19,14 +19,14 @@ Imports instat.Translations Public Class dlgMerge Private bFirstLoad As Boolean = True - Private clsMerge As RFunction - Private clsByList As RFunction + Private clsMergeFunction As New RFunction + Private clsByListFunction As New RFunction Private bReset As Boolean = True Private bResetSubdialog As Boolean = True Private ttJoinType As New ToolTip Private dctJoinTexts As New Dictionary(Of String, String) Private bMergeColumnsExist As Boolean - Private clsSuffixC As RFunction + Private clsSuffixCFunction As New RFunction ' This dialog has a bug when using numeric and integer columns as the joining columns. ' Issue reported here: https://github.com/hadley/dplyr/issues/2164 @@ -96,28 +96,28 @@ Public Class dlgMerge End Sub Private Sub SetDefaults() - clsMerge = New RFunction - clsByList = New RFunction - clsSuffixC = New RFunction + clsMergeFunction = New RFunction + clsByListFunction = New RFunction + clsSuffixCFunction = New RFunction ucrFirstDataFrame.Reset() ucrSecondDataFrame.Reset() ucrSaveMerge.Reset() - clsMerge.SetPackageName("dplyr") - clsMerge.SetRCommand("full_join") - clsByList.SetRCommand("c") - clsSuffixC.SetRCommand("c") + clsMergeFunction.SetPackageName("dplyr") + clsMergeFunction.SetRCommand("full_join") + clsByListFunction.SetRCommand("c") + clsSuffixCFunction.SetRCommand("c") - ucrBase.clsRsyntax.SetBaseRFunction(clsMerge) + ucrBase.clsRsyntax.SetBaseRFunction(clsMergeFunction) bResetSubdialog = True End Sub Private Sub SetRCodeForControls(bResetControls As Boolean) - ucrFirstDataFrame.SetRCode(clsMerge, bResetControls) - ucrSecondDataFrame.SetRCode(clsMerge, bResetControls) - ucrInputJoinType.SetRCode(clsMerge, bResetControls) - ucrSaveMerge.SetRCode(clsMerge, bResetControls) + ucrFirstDataFrame.SetRCode(clsMergeFunction, bResetControls) + ucrSecondDataFrame.SetRCode(clsMergeFunction, bResetControls) + ucrInputJoinType.SetRCode(clsMergeFunction, bResetControls) + ucrSaveMerge.SetRCode(clsMergeFunction, bResetControls) End Sub Private Sub TestOKEnabled() @@ -135,14 +135,14 @@ Public Class dlgMerge End Sub Private Sub cmdJoinOptions_Click(sender As Object, e As EventArgs) Handles cmdJoinOptions.Click - sdgMerge.Setup(ucrFirstDataFrame.cboAvailableDataFrames.Text, ucrSecondDataFrame.cboAvailableDataFrames.Text, clsMerge, clsByList, bResetSubdialog) + sdgMerge.Setup(ucrFirstDataFrame.cboAvailableDataFrames.Text, ucrSecondDataFrame.cboAvailableDataFrames.Text, clsMergeFunction, clsByListFunction, bResetSubdialog) sdgMerge.ShowDialog() bResetSubdialog = False SetMergingBy() End Sub Private Sub cmdColumnOptions_Click(sender As Object, e As EventArgs) Handles cmdColumnOptions.Click - sdgMergeColumnstoInclude.Setup(ucrFirstDataFrame.cboAvailableDataFrames.Text, ucrSecondDataFrame.cboAvailableDataFrames.Text, clsMerge, clsByList, bResetSubdialog) + sdgMergeColumnstoInclude.Setup(ucrFirstDataFrame.cboAvailableDataFrames.Text, ucrSecondDataFrame.cboAvailableDataFrames.Text, clsMergeFunction, clsByListFunction, bResetSubdialog) sdgMergeColumnstoInclude.ShowDialog() bResetSubdialog = False SetMergingBy() @@ -154,17 +154,17 @@ Public Class dlgMerge If Not ucrInputJoinType.IsEmpty() Then Select Case ucrInputJoinType.GetText() Case "Full Join" - clsMerge.SetRCommand("full_join") + clsMergeFunction.SetRCommand("full_join") Case "Left Join" - clsMerge.SetRCommand("left_join") + clsMergeFunction.SetRCommand("left_join") Case "Right Join" - clsMerge.SetRCommand("right_join") + clsMergeFunction.SetRCommand("right_join") Case "Inner Join" - clsMerge.SetRCommand("inner_join") + clsMergeFunction.SetRCommand("inner_join") Case "Semi Join" - clsMerge.SetRCommand("semi_join") + clsMergeFunction.SetRCommand("semi_join") Case "Anti Join" - clsMerge.SetRCommand("anti_join") + clsMergeFunction.SetRCommand("anti_join") Case Else bFound = False End Select @@ -179,16 +179,16 @@ Public Class dlgMerge Private Sub DataFrames_ControlValueChanged(ucrChangedControl As ucrCore) Handles ucrFirstDataFrame.ControlValueChanged, ucrSecondDataFrame.ControlValueChanged If ucrFirstDataFrame.cboAvailableDataFrames.Text <> "" AndAlso ucrSecondDataFrame.cboAvailableDataFrames.Text <> "" Then - clsSuffixC.AddParameter("0", strParameterValue:=Chr(34) & ucrFirstDataFrame.cboAvailableDataFrames.Text & Chr(34), iPosition:=0, bIncludeArgumentName:=False) - clsSuffixC.AddParameter("1", strParameterValue:=Chr(34) & ucrSecondDataFrame.cboAvailableDataFrames.Text & Chr(34), iPosition:=1, bIncludeArgumentName:=False) + clsSuffixCFunction.AddParameter("0", strParameterValue:=Chr(34) & ucrFirstDataFrame.cboAvailableDataFrames.Text & Chr(34), iPosition:=0, bIncludeArgumentName:=False) + clsSuffixCFunction.AddParameter("1", strParameterValue:=Chr(34) & ucrSecondDataFrame.cboAvailableDataFrames.Text & Chr(34), iPosition:=1, bIncludeArgumentName:=False) Else - clsMerge.RemoveParameterByName("suffix") + clsMergeFunction.RemoveParameterByName("suffix") End If ' Ensures options set on the subdialog are "reset" since they depend on data frame choice - clsMerge.RemoveParameterByName("by") - clsByList.ClearParameters() - clsMerge.AddParameter("x", clsRFunctionParameter:=ucrFirstDataFrame.clsCurrDataFrame, iPosition:=0) - clsMerge.AddParameter("y", clsRFunctionParameter:=ucrSecondDataFrame.clsCurrDataFrame, iPosition:=1) + clsMergeFunction.RemoveParameterByName("by") + clsByListFunction.ClearParameters() + clsMergeFunction.AddParameter("x", clsRFunctionParameter:=ucrFirstDataFrame.clsCurrDataFrame, iPosition:=0) + clsMergeFunction.AddParameter("y", clsRFunctionParameter:=ucrSecondDataFrame.clsCurrDataFrame, iPosition:=1) SetMergingBy() End Sub @@ -204,8 +204,8 @@ Public Class dlgMerge Dim i As Integer = 0 If ucrFirstDataFrame.cboAvailableDataFrames.Text <> "" AndAlso ucrSecondDataFrame.cboAvailableDataFrames.Text <> "" Then - If clsMerge.ContainsParameter("by") Then - For Each clsTempParam As RParameter In clsByList.clsParameters + If clsMergeFunction.ContainsParameter("by") Then + For Each clsTempParam As RParameter In clsByListFunction.clsParameters dctJoinColumns.Add(clsTempParam.strArgumentName.Trim(Chr(34)), clsTempParam.strArgumentValue.Trim(Chr(34))) Next Else @@ -215,12 +215,12 @@ Public Class dlgMerge For Each strFirst As String In lstFirstColumns If lstSecondColumns.Contains(strFirst) Then dctJoinColumns.Add(strFirst, strFirst) - clsByList.AddParameter(Chr(34) & strFirst & Chr(34), Chr(34) & strFirst & Chr(34), iPosition:=i) + clsByListFunction.AddParameter(Chr(34) & strFirst & Chr(34), Chr(34) & strFirst & Chr(34), iPosition:=i) i = i + 1 End If Next - If clsByList.iParameterCount > 0 Then - clsMerge.AddParameter("by", clsRFunctionParameter:=clsByList, iPosition:=2) + If clsByListFunction.iParameterCount > 0 Then + clsMergeFunction.AddParameter("by", clsRFunctionParameter:=clsByListFunction, iPosition:=2) End If End If If dctJoinColumns.Count > 0 Then @@ -239,8 +239,8 @@ Public Class dlgMerge Else ucrInputMergingBy.SetName("") ucrInputMergingBy.txtInput.BackColor = SystemColors.Control - clsMerge.RemoveParameterByName("by") - clsByList.ClearParameters() + clsMergeFunction.RemoveParameterByName("by") + clsByListFunction.ClearParameters() End If bMergeColumnsExist = (dctJoinColumns.Count > 0) TestOKEnabled() diff --git a/instat/dlgMergeAdditionalData.Designer.vb b/instat/dlgMergeAdditionalData.Designer.vb index e10c2f35c13..4620e225295 100644 --- a/instat/dlgMergeAdditionalData.Designer.vb +++ b/instat/dlgMergeAdditionalData.Designer.vb @@ -22,114 +22,163 @@ Partial Class dlgMergeAdditionalData 'Do not modify it using the code editor. _ Private Sub InitializeComponent() - Me.lblVariablesToIncludeSecond = New System.Windows.Forms.Label() + Me.lblMergeBy = New System.Windows.Forms.Label() Me.cmdModify = New System.Windows.Forms.Button() + Me.lblVariablesToIncludeSecond = New System.Windows.Forms.Label() + Me.cmdCheckUnique = New System.Windows.Forms.Button() + Me.ucrInputCheckInput = New instat.ucrInputTextBox() + Me.ucrInputSaveDataFrame = New instat.ucrInputTextBox() + Me.ucrChkSaveDataFrame = New instat.ucrCheck() Me.ucrInputMergingBy = New instat.ucrInputTextBox() - Me.ucrFirstDataFrame = New instat.ucrDataFrame() + Me.ucrToDataFrame = New instat.ucrDataFrame() Me.ucrReceiverSecond = New instat.ucrReceiverMultiple() - Me.ucrSecondSelector = New instat.ucrSelectorByDataFrameAddRemove() + Me.ucrFromDataFrame = New instat.ucrSelectorByDataFrameAddRemove() Me.ucrBase = New instat.ucrButtons() - Me.lblMergeBy = New System.Windows.Forms.Label() Me.SuspendLayout() ' - 'lblVariablesToIncludeSecond + 'lblMergeBy ' - Me.lblVariablesToIncludeSecond.AutoSize = True - Me.lblVariablesToIncludeSecond.ImeMode = System.Windows.Forms.ImeMode.NoControl - Me.lblVariablesToIncludeSecond.Location = New System.Drawing.Point(248, 121) - Me.lblVariablesToIncludeSecond.Name = "lblVariablesToIncludeSecond" - Me.lblVariablesToIncludeSecond.Size = New System.Drawing.Size(103, 13) - Me.lblVariablesToIncludeSecond.TabIndex = 2 - Me.lblVariablesToIncludeSecond.Text = "Variables to Include:" + Me.lblMergeBy.AutoSize = True + Me.lblMergeBy.Location = New System.Drawing.Point(7, 212) + Me.lblMergeBy.Name = "lblMergeBy" + Me.lblMergeBy.Size = New System.Drawing.Size(44, 13) + Me.lblMergeBy.TabIndex = 14 + Me.lblMergeBy.Text = "Join By:" ' 'cmdModify ' Me.cmdModify.ImeMode = System.Windows.Forms.ImeMode.NoControl - Me.cmdModify.Location = New System.Drawing.Point(282, 332) + Me.cmdModify.Location = New System.Drawing.Point(328, 207) Me.cmdModify.Name = "cmdModify" Me.cmdModify.Size = New System.Drawing.Size(90, 23) - Me.cmdModify.TabIndex = 6 + Me.cmdModify.TabIndex = 16 Me.cmdModify.Text = "Join Options" Me.cmdModify.UseVisualStyleBackColor = True ' + 'lblVariablesToIncludeSecond + ' + Me.lblVariablesToIncludeSecond.AutoSize = True + Me.lblVariablesToIncludeSecond.ImeMode = System.Windows.Forms.ImeMode.NoControl + Me.lblVariablesToIncludeSecond.Location = New System.Drawing.Point(248, 69) + Me.lblVariablesToIncludeSecond.Name = "lblVariablesToIncludeSecond" + Me.lblVariablesToIncludeSecond.Size = New System.Drawing.Size(103, 13) + Me.lblVariablesToIncludeSecond.TabIndex = 12 + Me.lblVariablesToIncludeSecond.Text = "Variables to Include:" + ' + 'cmdCheckUnique + ' + Me.cmdCheckUnique.ImeMode = System.Windows.Forms.ImeMode.NoControl + Me.cmdCheckUnique.Location = New System.Drawing.Point(7, 245) + Me.cmdCheckUnique.Name = "cmdCheckUnique" + Me.cmdCheckUnique.Size = New System.Drawing.Size(98, 23) + Me.cmdCheckUnique.TabIndex = 20 + Me.cmdCheckUnique.Text = "Check Unique" + Me.cmdCheckUnique.UseVisualStyleBackColor = True + ' + 'ucrInputCheckInput + ' + Me.ucrInputCheckInput.AddQuotesIfUnrecognised = True + Me.ucrInputCheckInput.AutoSize = True + Me.ucrInputCheckInput.IsMultiline = False + Me.ucrInputCheckInput.IsReadOnly = False + Me.ucrInputCheckInput.Location = New System.Drawing.Point(112, 247) + Me.ucrInputCheckInput.Name = "ucrInputCheckInput" + Me.ucrInputCheckInput.Size = New System.Drawing.Size(294, 21) + Me.ucrInputCheckInput.TabIndex = 21 + ' + 'ucrInputSaveDataFrame + ' + Me.ucrInputSaveDataFrame.AddQuotesIfUnrecognised = True + Me.ucrInputSaveDataFrame.AutoSize = True + Me.ucrInputSaveDataFrame.IsMultiline = False + Me.ucrInputSaveDataFrame.IsReadOnly = False + Me.ucrInputSaveDataFrame.Location = New System.Drawing.Point(157, 275) + Me.ucrInputSaveDataFrame.Name = "ucrInputSaveDataFrame" + Me.ucrInputSaveDataFrame.Size = New System.Drawing.Size(137, 21) + Me.ucrInputSaveDataFrame.TabIndex = 19 + ' + 'ucrChkSaveDataFrame + ' + Me.ucrChkSaveDataFrame.AutoSize = True + Me.ucrChkSaveDataFrame.Checked = False + Me.ucrChkSaveDataFrame.Location = New System.Drawing.Point(7, 275) + Me.ucrChkSaveDataFrame.Name = "ucrChkSaveDataFrame" + Me.ucrChkSaveDataFrame.Size = New System.Drawing.Size(143, 23) + Me.ucrChkSaveDataFrame.TabIndex = 18 + ' 'ucrInputMergingBy ' Me.ucrInputMergingBy.AddQuotesIfUnrecognised = True Me.ucrInputMergingBy.AutoSize = True Me.ucrInputMergingBy.IsMultiline = False Me.ucrInputMergingBy.IsReadOnly = False - Me.ucrInputMergingBy.Location = New System.Drawing.Point(72, 286) + Me.ucrInputMergingBy.Location = New System.Drawing.Point(56, 209) Me.ucrInputMergingBy.Name = "ucrInputMergingBy" - Me.ucrInputMergingBy.Size = New System.Drawing.Size(300, 40) - Me.ucrInputMergingBy.TabIndex = 5 + Me.ucrInputMergingBy.Size = New System.Drawing.Size(266, 32) + Me.ucrInputMergingBy.TabIndex = 15 ' - 'ucrFirstDataFrame + 'ucrToDataFrame ' - Me.ucrFirstDataFrame.AutoSize = True - Me.ucrFirstDataFrame.bDropUnusedFilterLevels = False - Me.ucrFirstDataFrame.bUseCurrentFilter = True - Me.ucrFirstDataFrame.Location = New System.Drawing.Point(10, 10) - Me.ucrFirstDataFrame.Margin = New System.Windows.Forms.Padding(0) - Me.ucrFirstDataFrame.Name = "ucrFirstDataFrame" - Me.ucrFirstDataFrame.Size = New System.Drawing.Size(151, 50) - Me.ucrFirstDataFrame.TabIndex = 0 + Me.ucrToDataFrame.AutoSize = True + Me.ucrToDataFrame.bDropUnusedFilterLevels = False + Me.ucrToDataFrame.bUseCurrentFilter = True + Me.ucrToDataFrame.Location = New System.Drawing.Point(248, 14) + Me.ucrToDataFrame.Margin = New System.Windows.Forms.Padding(0) + Me.ucrToDataFrame.Name = "ucrToDataFrame" + Me.ucrToDataFrame.Size = New System.Drawing.Size(151, 50) + Me.ucrToDataFrame.TabIndex = 10 ' 'ucrReceiverSecond ' Me.ucrReceiverSecond.AutoSize = True Me.ucrReceiverSecond.frmParent = Me - Me.ucrReceiverSecond.Location = New System.Drawing.Point(248, 136) + Me.ucrReceiverSecond.Location = New System.Drawing.Point(248, 87) Me.ucrReceiverSecond.Margin = New System.Windows.Forms.Padding(0) Me.ucrReceiverSecond.Name = "ucrReceiverSecond" Me.ucrReceiverSecond.Selector = Nothing - Me.ucrReceiverSecond.Size = New System.Drawing.Size(120, 119) + Me.ucrReceiverSecond.Size = New System.Drawing.Size(120, 88) Me.ucrReceiverSecond.strNcFilePath = "" - Me.ucrReceiverSecond.TabIndex = 3 + Me.ucrReceiverSecond.TabIndex = 13 Me.ucrReceiverSecond.ucrSelector = Nothing ' - 'ucrSecondSelector + 'ucrFromDataFrame ' - Me.ucrSecondSelector.AutoSize = True - Me.ucrSecondSelector.bDropUnusedFilterLevels = False - Me.ucrSecondSelector.bShowHiddenColumns = False - Me.ucrSecondSelector.bUseCurrentFilter = True - Me.ucrSecondSelector.Location = New System.Drawing.Point(10, 86) - Me.ucrSecondSelector.Margin = New System.Windows.Forms.Padding(0) - Me.ucrSecondSelector.Name = "ucrSecondSelector" - Me.ucrSecondSelector.Size = New System.Drawing.Size(213, 183) - Me.ucrSecondSelector.TabIndex = 1 + Me.ucrFromDataFrame.AutoSize = True + Me.ucrFromDataFrame.bDropUnusedFilterLevels = False + Me.ucrFromDataFrame.bShowHiddenColumns = False + Me.ucrFromDataFrame.bUseCurrentFilter = True + Me.ucrFromDataFrame.Location = New System.Drawing.Point(7, 14) + Me.ucrFromDataFrame.Margin = New System.Windows.Forms.Padding(0) + Me.ucrFromDataFrame.Name = "ucrFromDataFrame" + Me.ucrFromDataFrame.Size = New System.Drawing.Size(213, 183) + Me.ucrFromDataFrame.TabIndex = 11 ' 'ucrBase ' Me.ucrBase.AutoSize = True Me.ucrBase.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink - Me.ucrBase.Location = New System.Drawing.Point(10, 364) + Me.ucrBase.Location = New System.Drawing.Point(7, 301) Me.ucrBase.Name = "ucrBase" Me.ucrBase.Size = New System.Drawing.Size(405, 52) - Me.ucrBase.TabIndex = 7 - ' - 'lblMergeBy - ' - Me.lblMergeBy.AutoSize = True - Me.lblMergeBy.Location = New System.Drawing.Point(12, 289) - Me.lblMergeBy.Name = "lblMergeBy" - Me.lblMergeBy.Size = New System.Drawing.Size(44, 13) - Me.lblMergeBy.TabIndex = 4 - Me.lblMergeBy.Text = "Join By:" + Me.ucrBase.TabIndex = 17 ' 'dlgMergeAdditionalData ' 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(420, 424) + Me.ClientSize = New System.Drawing.Size(420, 356) + Me.Controls.Add(Me.ucrInputCheckInput) + Me.Controls.Add(Me.cmdCheckUnique) + Me.Controls.Add(Me.ucrInputSaveDataFrame) + Me.Controls.Add(Me.ucrChkSaveDataFrame) Me.Controls.Add(Me.lblMergeBy) Me.Controls.Add(Me.cmdModify) Me.Controls.Add(Me.ucrInputMergingBy) - Me.Controls.Add(Me.ucrFirstDataFrame) + Me.Controls.Add(Me.ucrToDataFrame) Me.Controls.Add(Me.lblVariablesToIncludeSecond) Me.Controls.Add(Me.ucrReceiverSecond) - Me.Controls.Add(Me.ucrSecondSelector) + Me.Controls.Add(Me.ucrFromDataFrame) Me.Controls.Add(Me.ucrBase) Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow Me.MaximizeBox = False @@ -137,18 +186,22 @@ Partial Class dlgMergeAdditionalData Me.Name = "dlgMergeAdditionalData" Me.ShowIcon = False Me.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen - Me.Text = "Merge Additional Data" + Me.Text = "Add (Merge) Data" Me.ResumeLayout(False) Me.PerformLayout() End Sub - Friend WithEvents ucrBase As ucrButtons + Friend WithEvents ucrInputSaveDataFrame As ucrInputTextBox + Friend WithEvents ucrChkSaveDataFrame As ucrCheck + Friend WithEvents lblMergeBy As Label + Friend WithEvents cmdModify As Button + Friend WithEvents ucrInputMergingBy As ucrInputTextBox + Friend WithEvents ucrToDataFrame As ucrDataFrame Friend WithEvents lblVariablesToIncludeSecond As Label Friend WithEvents ucrReceiverSecond As ucrReceiverMultiple - Friend WithEvents ucrSecondSelector As ucrSelectorByDataFrameAddRemove - Friend WithEvents ucrFirstDataFrame As ucrDataFrame - Friend WithEvents ucrInputMergingBy As ucrInputTextBox - Friend WithEvents cmdModify As Button - Friend WithEvents lblMergeBy As Label + Friend WithEvents ucrFromDataFrame As ucrSelectorByDataFrameAddRemove + Friend WithEvents ucrBase As ucrButtons + Friend WithEvents ucrInputCheckInput As ucrInputTextBox + Friend WithEvents cmdCheckUnique As Button End Class diff --git a/instat/dlgMergeAdditionalData.vb b/instat/dlgMergeAdditionalData.vb index da5a126de71..da4d4522640 100644 --- a/instat/dlgMergeAdditionalData.vb +++ b/instat/dlgMergeAdditionalData.vb @@ -20,10 +20,14 @@ Imports RDotNet Public Class dlgMergeAdditionalData Private bFirstLoad As Boolean = True Private bReset As Boolean = True - Private clsLeftJoin As RFunction - Private clsByList As RFunction + Private clsInsertColumnFunction, clsGetColumnsFromData As New RFunction + Private lstJoinColumns As New List(Of String) + Private clsLeftJoinFunction As New RFunction + Private clsByListFunction As New RFunction + Private clsGetVariablesFunction As New RFunction Private bResetSubdialog As Boolean = True Private bBySpecified As Boolean + Private bJoinColsAreUnique As Boolean = False Private Sub dlgMergeAdditionalData_Load(sender As Object, e As EventArgs) Handles MyBase.Load If bFirstLoad Then @@ -35,52 +39,73 @@ Public Class dlgMergeAdditionalData End If SetRCodeforControls(bReset) bReset = False + SetMergingBy() autoTranslate(Me) TestOkEnabled() End Sub Private Sub InitialiseDialog() - ucrFirstDataFrame.SetParameter(New RParameter("x", 0)) - ucrFirstDataFrame.SetParameterIsRFunction() - ucrFirstDataFrame.SetLabelText("Main Data Frame:") + ucrToDataFrame.SetParameter(New RParameter("x", 0)) + ucrToDataFrame.SetParameterIsRFunction() + ucrToDataFrame.SetLabelText("To Data Frame:") - ucrSecondSelector.SetLabelText("Additional Data Frame:") + ucrFromDataFrame.SetLabelText("From Data Frame:") + ucrFromDataFrame.SetParameter(New RParameter("data_name", 0)) + ucrFromDataFrame.SetParameterIsString() - ucrReceiverSecond.SetParameter(New RParameter("y", 1)) - ucrReceiverSecond.SetParameterIsRFunction() - ucrReceiverSecond.Selector = ucrSecondSelector + ucrReceiverSecond.Selector = ucrFromDataFrame ucrReceiverSecond.bForceAsDataFrame = True + ucrChkSaveDataFrame.SetText("New Data Frame:") + ucrChkSaveDataFrame.AddFunctionNamesCondition(True, "left_join") + ucrChkSaveDataFrame.AddFunctionNamesCondition(False, frmMain.clsRLink.strInstatDataObject & "$add_columns_to_data") + ucrInputMergingBy.IsReadOnly = True ucrInputMergingBy.IsMultiline = True + ucrInputCheckInput.IsReadOnly = True + EnableDisableCmdCheckUnique() End Sub Private Sub SetDefaults() - clsLeftJoin = New RFunction - clsByList = New RFunction + clsLeftJoinFunction = New RFunction + clsByListFunction = New RFunction + clsInsertColumnFunction = New RFunction + clsGetColumnsFromData = New RFunction + clsGetVariablesFunction = New RFunction - ucrFirstDataFrame.Reset() - ucrSecondSelector.Reset() + ucrToDataFrame.Reset() + ucrFromDataFrame.Reset() ucrReceiverSecond.SetMeAsReceiver() - ucrInputMergingBy.SetName("") + ucrInputSaveDataFrame.SetName("merge") + ucrInputCheckInput.Reset() + + clsGetVariablesFunction.SetRCommand(frmMain.clsRLink.strInstatDataObject & "$get_columns_from_data") + + clsLeftJoinFunction.SetPackageName("dplyr") + clsLeftJoinFunction.SetRCommand("left_join") + clsLeftJoinFunction.AddParameter("y", clsRFunctionParameter:=clsGetColumnsFromData, iPosition:=1) - clsLeftJoin.SetPackageName("dplyr") - clsLeftJoin.SetRCommand("left_join") + clsByListFunction.SetRCommand("c") - clsByList.SetRCommand("c") + clsGetColumnsFromData.SetRCommand(frmMain.clsRLink.strInstatDataObject & "$get_columns_from_data") + clsGetColumnsFromData.AddParameter("use_current_filter", "FALSE", iPosition:=2) + + clsInsertColumnFunction.SetRCommand(frmMain.clsRLink.strInstatDataObject & "$add_columns_to_data") SetDataFrameAssign() - ucrBase.clsRsyntax.SetBaseRFunction(clsLeftJoin) + ucrBase.clsRsyntax.SetBaseRFunction(clsInsertColumnFunction) bResetSubdialog = True End Sub Private Sub SetRCodeforControls(bResetControls As Boolean) - ucrFirstDataFrame.SetRCode(clsLeftJoin, bResetControls) - ucrReceiverSecond.SetRCode(clsLeftJoin, bResetControls) + ucrFromDataFrame.SetRCode(clsGetVariablesFunction, bResetControls) + ucrToDataFrame.SetRCode(clsLeftJoinFunction, bResetControls) + ucrChkSaveDataFrame.SetRCode(ucrBase.clsRsyntax.clsBaseFunction, bReset) End Sub Private Sub TestOkEnabled() - If ucrFirstDataFrame.cboAvailableDataFrames.Text <> "" AndAlso ucrSecondSelector.ucrAvailableDataFrames.cboAvailableDataFrames.Text <> "" AndAlso Not ucrReceiverSecond.IsEmpty() AndAlso bBySpecified Then + If ucrToDataFrame.cboAvailableDataFrames.Text <> "" AndAlso ucrFromDataFrame.ucrAvailableDataFrames.cboAvailableDataFrames.Text <> "" AndAlso + Not ucrReceiverSecond.IsEmpty() AndAlso bBySpecified AndAlso bJoinColsAreUnique Then ucrBase.OKEnabled(True) Else ucrBase.OKEnabled(False) @@ -93,120 +118,172 @@ Public Class dlgMergeAdditionalData TestOkEnabled() End Sub - Private Sub ucrFirstDataFrame_ControlValueChanged(ucrChangedControl As ucrCore) Handles ucrFirstDataFrame.ControlValueChanged + Private Sub DataFrames_ControlValueChanged(ucrChangedControl As ucrCore) Handles ucrFromDataFrame.ControlValueChanged, ucrToDataFrame.ControlValueChanged + ' Ensures options set on the subdialog are "reset" since they depend on data frame choice + clsLeftJoinFunction.RemoveParameterByName("by") + clsByListFunction.ClearParameters() + SetDataFrameAssign() + SetMergingBy() + SetInputCheckVisibility(False) + End Sub + + Private Sub ucrChkSaveDataFrame_ControlValueChanged(ucrChangedControl As ucrCore) Handles ucrChkSaveDataFrame.ControlValueChanged, ucrInputSaveDataFrame.ControlValueChanged SetDataFrameAssign() - GetLinkInformation() End Sub Private Sub SetDataFrameAssign() - If clsLeftJoin IsNot Nothing Then - If ucrFirstDataFrame.cboAvailableDataFrames.Text <> "" Then - clsLeftJoin.SetAssignTo(ucrFirstDataFrame.cboAvailableDataFrames.Text, ucrFirstDataFrame.cboAvailableDataFrames.Text) + If clsLeftJoinFunction IsNot Nothing Then + If ucrToDataFrame.cboAvailableDataFrames.Text <> "" Then + clsLeftJoinFunction.RemoveAssignTo() + If ucrChkSaveDataFrame.Checked Then + clsLeftJoinFunction.SetAssignTo(ucrInputSaveDataFrame.GetText, strTempDataframe:=ucrInputSaveDataFrame.GetText) + ucrBase.clsRsyntax.SetBaseRFunction(clsLeftJoinFunction) + ucrInputSaveDataFrame.Visible = True + bJoinColsAreUnique = True + cmdCheckUnique.Visible = False + SetInputCheckVisibility(False) + Else + clsLeftJoinFunction.SetAssignTo(ucrToDataFrame.cboAvailableDataFrames.Text) + clsInsertColumnFunction.AddParameter("data_name", Chr(34) & ucrToDataFrame.cboAvailableDataFrames.Text & Chr(34), iPosition:=0) + clsInsertColumnFunction.AddParameter("col_data", clsRFunctionParameter:=clsLeftJoinFunction, iPosition:=1) + ucrBase.clsRsyntax.SetBaseRFunction(clsInsertColumnFunction) + ucrInputSaveDataFrame.Visible = False + cmdCheckUnique.Visible = True + End If Else - clsLeftJoin.RemoveAssignTo() + clsLeftJoinFunction.RemoveAssignTo() End If End If + TestOkEnabled() End Sub - Private Sub GetLinkInformation() - Dim expTemp As SymbolicExpression - Dim clsGetLink As New RFunction - Dim clsItemOperator As New ROperator - Dim chrColumns As CharacterVector - - clsByList.ClearParameters() - If ucrFirstDataFrame.cboAvailableDataFrames.Text <> "" AndAlso ucrSecondSelector.ucrAvailableDataFrames.cboAvailableDataFrames.Text <> "" Then - clsGetLink.SetRCommand(frmMain.clsRLink.strInstatDataObject & "$get_link_between") - clsGetLink.AddParameter("from_data_frame", Chr(34) & ucrFirstDataFrame.cboAvailableDataFrames.Text & Chr(34), iPosition:=0) - clsGetLink.AddParameter("to_data_frame", Chr(34) & ucrSecondSelector.ucrAvailableDataFrames.cboAvailableDataFrames.Text & Chr(34), iPosition:=1) - clsGetLink.AddParameter("ordered", "TRUE", iPosition:=2) - clsItemOperator.SetOperation("$") - clsItemOperator.AddParameter("left", clsRFunctionParameter:=clsGetLink, iPosition:=0) - clsItemOperator.AddParameter("right", "link_columns", iPosition:=1) - expTemp = frmMain.clsRLink.RunInternalScriptGetValue(clsItemOperator.ToScript(), bSilent:=True) - If expTemp IsNot Nothing AndAlso expTemp.Type = Internals.SymbolicExpressionType.List AndAlso expTemp.AsList.Count > 0 Then - chrColumns = expTemp.AsList(0).AsCharacter - For i As Integer = 0 To chrColumns.Count - 1 - clsByList.AddParameter(Chr(34) & chrColumns.Names(i) & Chr(34), Chr(34) & chrColumns(i) & Chr(34)) - ucrReceiverSecond.Add(chrColumns(i), ucrSecondSelector.ucrAvailableDataFrames.cboAvailableDataFrames.Text) + Private Sub SetMergingBy() + Dim dctJoinColumns As New Dictionary(Of String, String) + lstJoinColumns.Clear() + If ucrFromDataFrame.ucrAvailableDataFrames.cboAvailableDataFrames.Text <> "" AndAlso ucrToDataFrame.cboAvailableDataFrames.Text <> "" Then + If clsLeftJoinFunction.ContainsParameter("by") Then + For Each clsTempParam As RParameter In clsByListFunction.clsParameters + dctJoinColumns.Add(clsTempParam.strArgumentName.Trim(Chr(34)), clsTempParam.strArgumentValue.Trim(Chr(34))) Next - clsLeftJoin.AddParameter("by", clsRFunctionParameter:=clsByList, iPosition:=2) - PopulateMergeByText() - bBySpecified = True Else - ucrInputMergingBy.SetName("No link between these data frames. Click 'Join Options' to specify merging columns.") - clsLeftJoin.RemoveParameterByName("by") - bBySpecified = False + Dim lstFirstColumns As List(Of String) + Dim lstSecondColumns As List(Of String) + lstFirstColumns = frmMain.clsRLink.GetColumnNames(ucrFromDataFrame.ucrAvailableDataFrames.cboAvailableDataFrames.Text) + lstSecondColumns = frmMain.clsRLink.GetColumnNames(ucrToDataFrame.cboAvailableDataFrames.Text) + Dim i As Integer = 0 + For Each strFirst As String In lstFirstColumns + If lstSecondColumns.Contains(strFirst) Then + dctJoinColumns.Add(strFirst, strFirst) + clsByListFunction.AddParameter(Chr(34) & strFirst & Chr(34), Chr(34) & strFirst & Chr(34), iPosition:=i) + i += 1 + End If + Next + If clsByListFunction.iParameterCount > 0 Then + clsLeftJoinFunction.AddParameter("by", clsRFunctionParameter:=clsByListFunction, iPosition:=2) + End If + End If + If dctJoinColumns.Count > 0 Then + Dim lstJoinPairs As New List(Of String) + For Each kvpTemp As KeyValuePair(Of String, String) In dctJoinColumns + lstJoinPairs.Add(kvpTemp.Key & " = " & kvpTemp.Value) + lstJoinColumns.Add(kvpTemp.Value) + Next + ucrInputMergingBy.SetName(String.Join(", ", lstJoinPairs)) + ucrInputMergingBy.txtInput.BackColor = SystemColors.Control + cmdModify.BackColor = SystemColors.ButtonFace + cmdModify.UseVisualStyleBackColor = True + Else + ucrInputMergingBy.SetName("No columns to merge by!" & Environment.NewLine & "Click Join Options to specify merging columns.") + ucrInputMergingBy.txtInput.BackColor = Color.LightCoral + cmdModify.BackColor = Color.LemonChiffon End If Else ucrInputMergingBy.SetName("") - clsLeftJoin.RemoveParameterByName("by") - bBySpecified = False + ucrInputMergingBy.txtInput.BackColor = SystemColors.Control + clsLeftJoinFunction.RemoveParameterByName("by") + clsByListFunction.ClearParameters() End If - End Sub - - Private Sub Controls_ControlContentsChanged(ucrChangedControl As ucrCore) Handles ucrFirstDataFrame.ControlContentsChanged, ucrSecondSelector.ControlContentsChanged, ucrReceiverSecond.ControlContentsChanged + bBySpecified = (dctJoinColumns.Count > 0) TestOkEnabled() End Sub - Private Sub ucrSecondSelector_ControlValueChanged(ucrChangedControl As ucrCore) Handles ucrSecondSelector.ControlValueChanged - GetLinkInformation() - End Sub - Private Sub cmdModify_Click(sender As Object, e As EventArgs) Handles cmdModify.Click - sdgMerge.Setup(ucrFirstDataFrame.cboAvailableDataFrames.Text, ucrSecondSelector.ucrAvailableDataFrames.cboAvailableDataFrames.Text, clsLeftJoin, clsByList, bResetSubdialog) + sdgMerge.Setup(ucrToDataFrame.cboAvailableDataFrames.Text, ucrFromDataFrame.ucrAvailableDataFrames.cboAvailableDataFrames.Text, clsLeftJoinFunction, clsByListFunction, bResetSubdialog) sdgMerge.ShowDialog() - PopulateMergeByText() + SetMergingBy() bResetSubdialog = False TestOkEnabled() End Sub - Private Sub PopulateMergeByText() - Dim strMergeBy As String - Dim clsNames1 As New RFunction - Dim clsNames2 As New RFunction - Dim clsIntersect As New RFunction - Dim expTemp As SymbolicExpression - Dim chrColumns As CharacterVector - Dim strTemp As String = "" - Dim strScript As String = "" - - If clsLeftJoin.ContainsParameter("by") AndAlso clsByList.clsParameters.Count > 0 Then - strMergeBy = clsByList.ToScript() - ucrInputMergingBy.SetName(strMergeBy.Substring(2, strMergeBy.Length - 3).Replace(Chr(34), "")) - For i As Integer = 0 To clsByList.clsParameters.Count - 1 - ucrReceiverSecond.Add(clsByList.clsParameters(i).strArgumentValue.Replace(Chr(34), ""), ucrSecondSelector.ucrAvailableDataFrames.cboAvailableDataFrames.Text) + Private Sub AddColumns() + Dim lstVariables As New List(Of String) + If ucrReceiverSecond.lstSelectedVariables.Items.Count > 0 Then + lstVariables.Clear() + lstVariables = ucrReceiverSecond.GetVariableNamesAsList() + For Each var In lstJoinColumns + lstVariables.Add(var) Next - Else - strMergeBy = "" - clsNames1.SetRCommand(frmMain.clsRLink.strInstatDataObject & "$get_column_names") - clsNames1.AddParameter("data_name", Chr(34) & ucrFirstDataFrame.cboAvailableDataFrames.Text & Chr(34), iPosition:=0) - clsNames2.SetRCommand(frmMain.clsRLink.strInstatDataObject & "$get_column_names") - clsNames2.AddParameter("data_name", Chr(34) & ucrSecondSelector.ucrAvailableDataFrames.cboAvailableDataFrames.Text & Chr(34), iPosition:=0) - clsIntersect.SetPackageName("dplyr") - clsIntersect.SetRCommand("intersect") - clsIntersect.AddParameter("x", clsRFunctionParameter:=clsNames1, iPosition:=0) - clsIntersect.AddParameter("y", clsRFunctionParameter:=clsNames2, iPosition:=1) - strScript = clsIntersect.ToScript(strTemp) - strScript = strTemp & strScript - expTemp = frmMain.clsRLink.RunInternalScriptGetValue(strScript, bSilent:=True) - If expTemp IsNot Nothing AndAlso expTemp.Type <> Internals.SymbolicExpressionType.Null Then - chrColumns = expTemp.AsCharacter - If chrColumns.Count > 0 Then - For i As Integer = 0 To chrColumns.Count - 1 - If i <> 0 Then - strMergeBy = strMergeBy & ", " - End If - strMergeBy = strMergeBy & chrColumns(i) & "=" & chrColumns(i) - ucrReceiverSecond.Add(chrColumns(i), ucrSecondSelector.ucrAvailableDataFrames.cboAvailableDataFrames.Text) - Next - bBySpecified = True - Else - strMergeBy = "No columns with the same name. Click 'Join Options' to specify merging columns." - bBySpecified = False - End If + clsGetColumnsFromData.AddParameter("data_name", Chr(34) & ucrFromDataFrame.ucrAvailableDataFrames.strCurrDataFrame & Chr(34), iPosition:=0) + clsGetColumnsFromData.AddParameter("col_names", frmMain.clsRLink.GetListAsRString(lstVariables, bWithQuotes:=True), iPosition:=1) + End If + End Sub + + Private Sub EnableDisableCmdCheckUnique() + cmdCheckUnique.Enabled = Not ucrReceiverSecond.IsEmpty OrElse Not ucrInputMergingBy.IsEmpty + End Sub + + Private Sub CheckUnique() + Dim clsAnyDuplicatesFunction As New RFunction + Dim iAnyDuplicated As Integer + + If ucrInputMergingBy.GetText <> "" AndAlso lstJoinColumns.Count > 0 Then + clsGetVariablesFunction.AddParameter("col_names", frmMain.clsRLink.GetListAsRString(lstJoinColumns, bWithQuotes:=True), iPosition:=1) + clsAnyDuplicatesFunction.SetRCommand("anyDuplicated") + clsAnyDuplicatesFunction.AddParameter("x", clsRFunctionParameter:=clsGetVariablesFunction) + Try + iAnyDuplicated = frmMain.clsRLink.RunInternalScriptGetValue(clsAnyDuplicatesFunction.ToScript()).AsInteger(0) + Catch ex As Exception + iAnyDuplicated = -1 + End Try + bJoinColsAreUnique = False + If iAnyDuplicated = -1 Then + ucrInputCheckInput.SetName("Developer error! Could not check uniqueness.") + ucrInputCheckInput.txtInput.BackColor = Color.Yellow + ElseIf iAnyDuplicated > 0 Then + ucrInputCheckInput.SetName("From Data Frame entries not unique.") + ucrInputCheckInput.txtInput.BackColor = Color.LightCoral + Else + ucrInputCheckInput.SetName("Join column(s) unique in From Data Frame.") + ucrInputCheckInput.txtInput.BackColor = Color.LightGreen + bJoinColsAreUnique = True End If - ucrInputMergingBy.SetName(strMergeBy) End If + TestOkEnabled() + End Sub + + Private Sub cmdCheckUnique_Click(sender As Object, e As EventArgs) Handles cmdCheckUnique.Click + CheckUnique() + SetInputCheckVisibility(True) + End Sub + + Private Sub SetInputCheckVisibility(bCheck As Boolean) + ucrInputCheckInput.Visible = bCheck + End Sub + + Private Sub ucrReceiverSecond_ControlValueChanged(ucrChangedControl As ucrCore) Handles ucrReceiverSecond.ControlValueChanged + AddColumns() + EnableDisableCmdCheckUnique() + SetInputCheckVisibility(False) + End Sub + + Private Sub ucrInputMergingBy_TextChanged(sender As Object, e As EventArgs) Handles ucrInputMergingBy.TextChanged + AddColumns() + CheckUnique() + SetDataFrameAssign() + SetInputCheckVisibility(False) + End Sub + + Private Sub Controls_ControlContentsChanged(ucrChangedControl As ucrCore) Handles ucrToDataFrame.ControlContentsChanged, ucrFromDataFrame.ControlContentsChanged, ucrReceiverSecond.ControlContentsChanged + TestOkEnabled() End Sub End Class \ No newline at end of file diff --git a/instat/dlgModelling.vb b/instat/dlgModelling.vb index a0cd1a37725..80afd5edd59 100644 --- a/instat/dlgModelling.vb +++ b/instat/dlgModelling.vb @@ -22,16 +22,16 @@ Public Class dlgModelling Private bReset As Boolean = True Private clsAttach, clsDetach As New RFunction - Public clsRModelFunction As RFunction + Public clsRModelFunction As New RFunction Public clsRYVariable, clsRXVariable As String Private ucrAvailableDataframe As ucrDataFrame Public clsRAovFunction, clsRAovPValFunction, clsREstPValFunction, clsRgeom_point, clsRPredFunction, clsRDFFunction, clsRFittedValues, clsRWriteFitted, clsRResiduals, clsRWriteResiduals, clsRStdResiduals, clsRWriteStdResiduals, clsRLeverage, clsRWriteLeverage As New RFunction Public clsVisReg, clsRaesFunction, clsRStat_smooth, clsR_ribbon, clsRaes_ribbon As New RFunction - Public clsWhichFunction As RFunction + Public clsWhichFunction As New RFunction Public bUpdating As Boolean = False 'Display tab functions - Public clsFormulaFunction, clsAnovaFunction, clsSummaryFunction, clsConfint As RFunction + Public clsFormulaFunction, clsAnovaFunction, clsSummaryFunction, clsConfint As New RFunction Private clsFittedValuesFunction, clsResidualFunction, clsRstandardFunction, clsHatvaluesFunction As New RFunction Private bResetDisplayOptions = False diff --git a/instat/dlgName.Designer.vb b/instat/dlgName.Designer.vb index c7fca0fba32..fa63068e152 100644 --- a/instat/dlgName.Designer.vb +++ b/instat/dlgName.Designer.vb @@ -47,7 +47,11 @@ Partial Class dlgName Me.rdoToLower = New System.Windows.Forms.RadioButton() Me.rdoMakeCleanNames = New System.Windows.Forms.RadioButton() Me.lblCase = New System.Windows.Forms.Label() - Me.ucrInputCase = New instat.ucrInputComboBox() + Me.grpOptions = New System.Windows.Forms.GroupBox() + Me.rdoAbbreviate = New System.Windows.Forms.RadioButton() + Me.rdoRenameWith = New System.Windows.Forms.RadioButton() + Me.grdRenameColumns = New unvell.ReoGrid.ReoGridControl() + Me.ucrChkIncludeVariable = New instat.ucrCheck() Me.ucrReceiverColumns = New instat.ucrReceiverMultiple() Me.ucrInputVariableLabel = New instat.ucrInputTextBox() Me.ucrReceiverName = New instat.ucrReceiverSingle() @@ -55,14 +59,15 @@ Partial Class dlgName Me.ucrSelectVariables = New instat.ucrSelectorByDataFrameAddRemove() Me.ucrBase = New instat.ucrButtons() Me.ucrPnlOptions = New instat.UcrPanel() + Me.ucrNudAbbreviate = New instat.ucrNud() + Me.ucrInputCase = New instat.ucrInputComboBox() Me.ucrPnlCase = New instat.UcrPanel() - Me.grpOptions = New System.Windows.Forms.GroupBox() Me.grpOptions.SuspendLayout() Me.SuspendLayout() ' 'lblName ' - Me.lblName.Location = New System.Drawing.Point(317, 112) + Me.lblName.Location = New System.Drawing.Point(251, 114) Me.lblName.Name = "lblName" Me.lblName.Size = New System.Drawing.Size(100, 23) Me.lblName.TabIndex = 9 @@ -71,7 +76,7 @@ Partial Class dlgName ' 'lblCurrentName ' - Me.lblCurrentName.Location = New System.Drawing.Point(317, 66) + Me.lblCurrentName.Location = New System.Drawing.Point(251, 68) Me.lblCurrentName.Name = "lblCurrentName" Me.lblCurrentName.Size = New System.Drawing.Size(100, 15) Me.lblCurrentName.TabIndex = 5 @@ -80,11 +85,11 @@ Partial Class dlgName 'lblVariableLabel ' Me.lblVariableLabel.AutoSize = True - Me.lblVariableLabel.Location = New System.Drawing.Point(317, 160) + Me.lblVariableLabel.Location = New System.Drawing.Point(251, 162) Me.lblVariableLabel.Name = "lblVariableLabel" - Me.lblVariableLabel.Size = New System.Drawing.Size(74, 13) + Me.lblVariableLabel.Size = New System.Drawing.Size(121, 13) Me.lblVariableLabel.TabIndex = 10 - Me.lblVariableLabel.Text = "Column Label:" + Me.lblVariableLabel.Text = "Column (Variable Label):" ' 'rdoMultiple ' @@ -95,7 +100,7 @@ Partial Class dlgName Me.rdoMultiple.FlatAppearance.CheckedBackColor = System.Drawing.SystemColors.ActiveCaption Me.rdoMultiple.FlatStyle = System.Windows.Forms.FlatStyle.Flat Me.rdoMultiple.ImeMode = System.Windows.Forms.ImeMode.NoControl - Me.rdoMultiple.Location = New System.Drawing.Point(269, 12) + Me.rdoMultiple.Location = New System.Drawing.Point(218, 10) Me.rdoMultiple.Name = "rdoMultiple" Me.rdoMultiple.Size = New System.Drawing.Size(110, 28) Me.rdoMultiple.TabIndex = 2 @@ -114,7 +119,7 @@ Partial Class dlgName Me.rdoSingle.FlatAppearance.CheckedBackColor = System.Drawing.SystemColors.ActiveCaption Me.rdoSingle.FlatStyle = System.Windows.Forms.FlatStyle.Flat Me.rdoSingle.ImeMode = System.Windows.Forms.ImeMode.NoControl - Me.rdoSingle.Location = New System.Drawing.Point(159, 12) + Me.rdoSingle.Location = New System.Drawing.Point(108, 10) Me.rdoSingle.Name = "rdoSingle" Me.rdoSingle.Size = New System.Drawing.Size(110, 28) Me.rdoSingle.TabIndex = 1 @@ -126,7 +131,7 @@ Partial Class dlgName ' 'lblColumns ' - Me.lblColumns.Location = New System.Drawing.Point(317, 66) + Me.lblColumns.Location = New System.Drawing.Point(251, 68) Me.lblColumns.Name = "lblColumns" Me.lblColumns.Size = New System.Drawing.Size(55, 15) Me.lblColumns.TabIndex = 4 @@ -135,7 +140,7 @@ Partial Class dlgName 'rdoToLower ' Me.rdoToLower.AutoSize = True - Me.rdoToLower.Location = New System.Drawing.Point(10, 18) + Me.rdoToLower.Location = New System.Drawing.Point(7, 41) Me.rdoToLower.Name = "rdoToLower" Me.rdoToLower.Size = New System.Drawing.Size(70, 17) Me.rdoToLower.TabIndex = 12 @@ -146,7 +151,7 @@ Partial Class dlgName 'rdoMakeCleanNames ' Me.rdoMakeCleanNames.AutoSize = True - Me.rdoMakeCleanNames.Location = New System.Drawing.Point(10, 42) + Me.rdoMakeCleanNames.Location = New System.Drawing.Point(7, 17) Me.rdoMakeCleanNames.Name = "rdoMakeCleanNames" Me.rdoMakeCleanNames.Size = New System.Drawing.Size(88, 17) Me.rdoMakeCleanNames.TabIndex = 19 @@ -156,28 +161,90 @@ Partial Class dlgName ' 'lblCase ' - Me.lblCase.Location = New System.Drawing.Point(109, 43) + Me.lblCase.Location = New System.Drawing.Point(109, 18) Me.lblCase.Name = "lblCase" Me.lblCase.Size = New System.Drawing.Size(37, 16) Me.lblCase.TabIndex = 21 Me.lblCase.Text = "Case:" ' - 'ucrInputCase + 'grpOptions ' - Me.ucrInputCase.AddQuotesIfUnrecognised = True - Me.ucrInputCase.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink - Me.ucrInputCase.GetSetSelectedIndex = -1 - Me.ucrInputCase.IsReadOnly = False - Me.ucrInputCase.Location = New System.Drawing.Point(148, 41) - Me.ucrInputCase.Name = "ucrInputCase" - Me.ucrInputCase.Size = New System.Drawing.Size(106, 21) - Me.ucrInputCase.TabIndex = 20 + Me.grpOptions.Controls.Add(Me.ucrNudAbbreviate) + Me.grpOptions.Controls.Add(Me.rdoAbbreviate) + Me.grpOptions.Controls.Add(Me.ucrInputCase) + Me.grpOptions.Controls.Add(Me.lblCase) + Me.grpOptions.Controls.Add(Me.rdoMakeCleanNames) + Me.grpOptions.Controls.Add(Me.rdoToLower) + Me.grpOptions.Controls.Add(Me.ucrPnlCase) + Me.grpOptions.Location = New System.Drawing.Point(251, 206) + Me.grpOptions.Name = "grpOptions" + Me.grpOptions.Size = New System.Drawing.Size(269, 88) + Me.grpOptions.TabIndex = 11 + Me.grpOptions.TabStop = False + Me.grpOptions.Text = "Rename Options" + ' + 'rdoAbbreviate + ' + Me.rdoAbbreviate.AutoSize = True + Me.rdoAbbreviate.Location = New System.Drawing.Point(7, 65) + Me.rdoAbbreviate.Name = "rdoAbbreviate" + Me.rdoAbbreviate.Size = New System.Drawing.Size(76, 17) + Me.rdoAbbreviate.TabIndex = 22 + Me.rdoAbbreviate.TabStop = True + Me.rdoAbbreviate.Text = "Abbreviate" + Me.rdoAbbreviate.UseVisualStyleBackColor = True + ' + 'rdoRenameWith + ' + Me.rdoRenameWith.Appearance = System.Windows.Forms.Appearance.Button + Me.rdoRenameWith.BackColor = System.Drawing.SystemColors.Control + Me.rdoRenameWith.FlatAppearance.BorderColor = System.Drawing.SystemColors.ActiveCaption + Me.rdoRenameWith.FlatAppearance.BorderSize = 2 + Me.rdoRenameWith.FlatAppearance.CheckedBackColor = System.Drawing.SystemColors.ActiveCaption + Me.rdoRenameWith.FlatStyle = System.Windows.Forms.FlatStyle.Flat + Me.rdoRenameWith.ImeMode = System.Windows.Forms.ImeMode.NoControl + Me.rdoRenameWith.Location = New System.Drawing.Point(328, 10) + Me.rdoRenameWith.Name = "rdoRenameWith" + Me.rdoRenameWith.Size = New System.Drawing.Size(110, 28) + Me.rdoRenameWith.TabIndex = 13 + Me.rdoRenameWith.TabStop = True + Me.rdoRenameWith.Tag = "" + Me.rdoRenameWith.Text = "Rename With" + Me.rdoRenameWith.TextAlign = System.Drawing.ContentAlignment.MiddleCenter + Me.rdoRenameWith.UseVisualStyleBackColor = False + ' + 'grdRenameColumns + ' + Me.grdRenameColumns.BackColor = System.Drawing.Color.White + Me.grdRenameColumns.ColumnHeaderContextMenuStrip = Nothing + Me.grdRenameColumns.LeadHeaderContextMenuStrip = Nothing + Me.grdRenameColumns.Location = New System.Drawing.Point(185, 66) + Me.grdRenameColumns.Name = "grdRenameColumns" + Me.grdRenameColumns.RowHeaderContextMenuStrip = Nothing + Me.grdRenameColumns.Script = Nothing + Me.grdRenameColumns.SheetTabContextMenuStrip = Nothing + Me.grdRenameColumns.SheetTabNewButtonVisible = True + Me.grdRenameColumns.SheetTabVisible = True + Me.grdRenameColumns.SheetTabWidth = 154 + Me.grdRenameColumns.ShowScrollEndSpacing = True + Me.grdRenameColumns.Size = New System.Drawing.Size(349, 210) + Me.grdRenameColumns.TabIndex = 18 + Me.grdRenameColumns.Text = "Variables" + ' + 'ucrChkIncludeVariable + ' + Me.ucrChkIncludeVariable.AutoSize = True + Me.ucrChkIncludeVariable.Checked = False + Me.ucrChkIncludeVariable.Location = New System.Drawing.Point(185, 43) + Me.ucrChkIncludeVariable.Name = "ucrChkIncludeVariable" + Me.ucrChkIncludeVariable.Size = New System.Drawing.Size(225, 23) + Me.ucrChkIncludeVariable.TabIndex = 17 ' 'ucrReceiverColumns ' Me.ucrReceiverColumns.AutoSize = True Me.ucrReceiverColumns.frmParent = Me - Me.ucrReceiverColumns.Location = New System.Drawing.Point(317, 81) + Me.ucrReceiverColumns.Location = New System.Drawing.Point(251, 83) Me.ucrReceiverColumns.Margin = New System.Windows.Forms.Padding(0) Me.ucrReceiverColumns.Name = "ucrReceiverColumns" Me.ucrReceiverColumns.Selector = Nothing @@ -192,20 +259,20 @@ Partial Class dlgName Me.ucrInputVariableLabel.AutoSize = True Me.ucrInputVariableLabel.IsMultiline = False Me.ucrInputVariableLabel.IsReadOnly = False - Me.ucrInputVariableLabel.Location = New System.Drawing.Point(317, 175) + Me.ucrInputVariableLabel.Location = New System.Drawing.Point(251, 177) Me.ucrInputVariableLabel.Name = "ucrInputVariableLabel" - Me.ucrInputVariableLabel.Size = New System.Drawing.Size(137, 21) + Me.ucrInputVariableLabel.Size = New System.Drawing.Size(194, 21) Me.ucrInputVariableLabel.TabIndex = 7 ' 'ucrReceiverName ' Me.ucrReceiverName.AutoSize = True Me.ucrReceiverName.frmParent = Me - Me.ucrReceiverName.Location = New System.Drawing.Point(317, 81) + Me.ucrReceiverName.Location = New System.Drawing.Point(251, 83) Me.ucrReceiverName.Margin = New System.Windows.Forms.Padding(0) Me.ucrReceiverName.Name = "ucrReceiverName" Me.ucrReceiverName.Selector = Nothing - Me.ucrReceiverName.Size = New System.Drawing.Size(137, 21) + Me.ucrReceiverName.Size = New System.Drawing.Size(148, 21) Me.ucrReceiverName.strNcFilePath = "" Me.ucrReceiverName.TabIndex = 5 Me.ucrReceiverName.ucrSelector = Nothing @@ -216,9 +283,9 @@ Partial Class dlgName Me.ucrInputNewName.AutoSize = True Me.ucrInputNewName.IsMultiline = False Me.ucrInputNewName.IsReadOnly = False - Me.ucrInputNewName.Location = New System.Drawing.Point(317, 128) + Me.ucrInputNewName.Location = New System.Drawing.Point(251, 130) Me.ucrInputNewName.Name = "ucrInputNewName" - Me.ucrInputNewName.Size = New System.Drawing.Size(137, 21) + Me.ucrInputNewName.Size = New System.Drawing.Size(148, 21) Me.ucrInputNewName.TabIndex = 6 ' 'ucrSelectVariables @@ -227,7 +294,7 @@ Partial Class dlgName Me.ucrSelectVariables.bDropUnusedFilterLevels = False Me.ucrSelectVariables.bShowHiddenColumns = False Me.ucrSelectVariables.bUseCurrentFilter = True - Me.ucrSelectVariables.Location = New System.Drawing.Point(10, 50) + Me.ucrSelectVariables.Location = New System.Drawing.Point(9, 50) Me.ucrSelectVariables.Margin = New System.Windows.Forms.Padding(0) Me.ucrSelectVariables.Name = "ucrSelectVariables" Me.ucrSelectVariables.Size = New System.Drawing.Size(213, 183) @@ -237,7 +304,7 @@ Partial Class dlgName ' Me.ucrBase.AutoSize = True Me.ucrBase.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink - Me.ucrBase.Location = New System.Drawing.Point(10, 291) + Me.ucrBase.Location = New System.Drawing.Point(9, 307) Me.ucrBase.Name = "ucrBase" Me.ucrBase.Size = New System.Drawing.Size(405, 52) Me.ucrBase.TabIndex = 12 @@ -245,39 +312,52 @@ Partial Class dlgName 'ucrPnlOptions ' Me.ucrPnlOptions.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink - Me.ucrPnlOptions.Location = New System.Drawing.Point(134, 4) + Me.ucrPnlOptions.Location = New System.Drawing.Point(97, 2) Me.ucrPnlOptions.Name = "ucrPnlOptions" - Me.ucrPnlOptions.Size = New System.Drawing.Size(303, 44) + Me.ucrPnlOptions.Size = New System.Drawing.Size(355, 44) Me.ucrPnlOptions.TabIndex = 0 ' + 'ucrNudAbbreviate + ' + Me.ucrNudAbbreviate.AutoSize = True + Me.ucrNudAbbreviate.DecimalPlaces = New Decimal(New Integer() {0, 0, 0, 0}) + Me.ucrNudAbbreviate.Increment = New Decimal(New Integer() {1, 0, 0, 0}) + Me.ucrNudAbbreviate.Location = New System.Drawing.Point(112, 62) + Me.ucrNudAbbreviate.Maximum = New Decimal(New Integer() {100, 0, 0, 0}) + Me.ucrNudAbbreviate.Minimum = New Decimal(New Integer() {0, 0, 0, 0}) + Me.ucrNudAbbreviate.Name = "ucrNudAbbreviate" + Me.ucrNudAbbreviate.Size = New System.Drawing.Size(50, 20) + Me.ucrNudAbbreviate.TabIndex = 23 + Me.ucrNudAbbreviate.Value = New Decimal(New Integer() {0, 0, 0, 0}) + ' + 'ucrInputCase + ' + Me.ucrInputCase.AddQuotesIfUnrecognised = True + Me.ucrInputCase.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink + Me.ucrInputCase.GetSetSelectedIndex = -1 + Me.ucrInputCase.IsReadOnly = False + Me.ucrInputCase.Location = New System.Drawing.Point(148, 15) + Me.ucrInputCase.Name = "ucrInputCase" + Me.ucrInputCase.Size = New System.Drawing.Size(106, 21) + Me.ucrInputCase.TabIndex = 20 + ' 'ucrPnlCase ' Me.ucrPnlCase.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink - Me.ucrPnlCase.Location = New System.Drawing.Point(3, 13) + Me.ucrPnlCase.Location = New System.Drawing.Point(4, 13) Me.ucrPnlCase.Name = "ucrPnlCase" - Me.ucrPnlCase.Size = New System.Drawing.Size(251, 58) + Me.ucrPnlCase.Size = New System.Drawing.Size(259, 69) Me.ucrPnlCase.TabIndex = 17 ' - 'grpOptions - ' - Me.grpOptions.Controls.Add(Me.ucrInputCase) - Me.grpOptions.Controls.Add(Me.lblCase) - Me.grpOptions.Controls.Add(Me.rdoMakeCleanNames) - Me.grpOptions.Controls.Add(Me.rdoToLower) - Me.grpOptions.Controls.Add(Me.ucrPnlCase) - Me.grpOptions.Location = New System.Drawing.Point(257, 199) - Me.grpOptions.Name = "grpOptions" - Me.grpOptions.Size = New System.Drawing.Size(259, 77) - Me.grpOptions.TabIndex = 11 - Me.grpOptions.TabStop = False - Me.grpOptions.Text = "Options" - ' 'dlgName ' 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(538, 346) + Me.ClientSize = New System.Drawing.Size(545, 364) + Me.Controls.Add(Me.grdRenameColumns) + Me.Controls.Add(Me.ucrChkIncludeVariable) + Me.Controls.Add(Me.rdoRenameWith) Me.Controls.Add(Me.lblColumns) Me.Controls.Add(Me.ucrReceiverColumns) Me.Controls.Add(Me.rdoSingle) @@ -324,4 +404,9 @@ Partial Class dlgName Friend WithEvents ucrInputCase As ucrInputComboBox Friend WithEvents lblCase As Label Friend WithEvents grpOptions As GroupBox + Friend WithEvents rdoRenameWith As RadioButton + Friend WithEvents ucrChkIncludeVariable As ucrCheck + Friend WithEvents grdRenameColumns As unvell.ReoGrid.ReoGridControl + Friend WithEvents rdoAbbreviate As RadioButton + Friend WithEvents ucrNudAbbreviate As ucrNud End Class diff --git a/instat/dlgName.vb b/instat/dlgName.vb index 151050bd77f..a789691907d 100644 --- a/instat/dlgName.vb +++ b/instat/dlgName.vb @@ -16,14 +16,26 @@ Imports instat.Translations Imports RDotNet +Imports unvell.ReoGrid +Imports unvell.ReoGrid.Events Public Class dlgName Dim bFirstLoad As Boolean = True Private bReset As Boolean = True - Dim bUseSelectedColumn As Boolean = False - Dim strSelectedColumn As String = "" - Dim strSelectedDataFrame As String = "" + Private bUseSelectedColumn As Boolean = False + Private strSelectedColumn As String = "" + Private strSelectedDataFrame As String = "" + Private strEmpty As String = " " Private clsDefaultRFunction As New RFunction + Private clsNewColNameDataframeFunction As New RFunction + Private clsNewLabelDataframeFunction As New RFunction + Private clsDummyFunction As New RFunction + Private WithEvents grdCurrentWorkSheet As Worksheet + Private dctRowsNewNameChanged As New Dictionary(Of Integer, String) + Private dctRowsNewLabelChanged As New Dictionary(Of Integer, String) + Private dctNameRowsValues As New Dictionary(Of Integer, String) + Private dctCaseOptions As New Dictionary(Of String, String) + Private bCurrentCell As Boolean = False Private Sub dlgName_Load(sender As Object, e As EventArgs) Handles Me.Load If bFirstLoad Then @@ -43,44 +55,37 @@ Public Class dlgName Private Sub InitialiseDialog() ucrBase.iHelpTopicID = 33 - Dim dctCaseOptions As New Dictionary(Of String, String) - 'Selector ucrSelectVariables.SetParameter(New RParameter("data_name", 0)) ucrSelectVariables.SetParameterIsString() - 'Receiver ucrReceiverName.SetParameter(New RParameter("column_name", 1)) ucrReceiverName.SetParameterIsString() ucrReceiverName.Selector = ucrSelectVariables - 'New Name Input ucrInputNewName.SetParameter(New RParameter("new_val", 2)) 'set validation of ucrInputNewName as an RVariable.(input should not have any R reserved words like 'if','while') ucrInputNewName.SetValidationTypeAsRVariable() - 'Label Input + ucrChkIncludeVariable.SetText("Include Variable Labels") + ucrChkIncludeVariable.SetParameter(New RParameter("checked", 0)) + ucrChkIncludeVariable.SetValuesCheckedAndUnchecked("TRUE", "FALSE") + ucrInputVariableLabel.SetParameter(New RParameter("label", 3)) ucrPnlOptions.SetParameter(New RParameter("type", 4)) ucrPnlOptions.AddRadioButton(rdoSingle, Chr(34) & "single" & Chr(34)) ucrPnlOptions.AddRadioButton(rdoMultiple, Chr(34) & "multiple" & Chr(34)) + ucrPnlOptions.AddRadioButton(rdoRenameWith, Chr(34) & "rename_with" & Chr(34)) ucrPnlOptions.SetRDefault(Chr(34) & "single" & Chr(34)) - ucrPnlOptions.AddToLinkedControls({ucrReceiverName, ucrInputNewName, ucrInputVariableLabel}, {rdoSingle}, bNewLinkedAddRemoveParameter:=True, bNewLinkedHideIfParameterMissing:=True) - ucrPnlOptions.AddToLinkedControls(ucrReceiverColumns, {rdoMultiple}, bNewLinkedAddRemoveParameter:=True, bNewLinkedHideIfParameterMissing:=True) - ucrPnlOptions.AddToLinkedControls(ucrPnlCase, {rdoMultiple}, bNewLinkedHideIfParameterMissing:=True) - ucrPnlCase.AddToLinkedControls(ucrInputCase, {rdoMakeCleanNames}, bNewLinkedAddRemoveParameter:=True, bNewLinkedHideIfParameterMissing:=True, bNewLinkedChangeToDefaultState:=True, objNewDefaultState:="Snake") - ucrReceiverName.SetLinkedDisplayControl(lblCurrentName) - ucrInputNewName.SetLinkedDisplayControl(lblName) - ucrInputVariableLabel.SetLinkedDisplayControl(lblVariableLabel) - ucrReceiverColumns.SetLinkedDisplayControl(lblColumns) - ucrInputCase.SetLinkedDisplayControl(lblCase) - ucrPnlCase.SetLinkedDisplayControl(grpOptions) + ucrNudAbbreviate.SetParameter(New RParameter("minlength", 10)) + ucrNudAbbreviate.SetMinMax(Integer.MinValue, Integer.MaxValue) ucrPnlCase.SetParameter(New RParameter(".fn", 5)) - ucrPnlCase.AddRadioButton(rdoToLower, "tolower") ucrPnlCase.AddRadioButton(rdoMakeCleanNames, "janitor::make_clean_names") + ucrPnlCase.AddRadioButton(rdoToLower, "tolower") + ucrPnlCase.AddRadioButton(rdoAbbreviate, "abbreviate") ucrReceiverColumns.SetParameter(New RParameter(".cols", 6)) ucrReceiverColumns.Selector = ucrSelectVariables @@ -107,21 +112,60 @@ Public Class dlgName dctCaseOptions.Add("Title", Chr(34) & "title" & Chr(34)) ucrInputCase.SetDropDownStyleAsNonEditable() ucrInputCase.SetItems(dctCaseOptions) + + ucrPnlOptions.AddToLinkedControls({ucrReceiverName, ucrInputNewName, ucrInputVariableLabel}, {rdoSingle}, bNewLinkedAddRemoveParameter:=True, bNewLinkedHideIfParameterMissing:=True) + ucrPnlOptions.AddToLinkedControls(ucrReceiverColumns, {rdoRenameWith}, bNewLinkedAddRemoveParameter:=True, bNewLinkedHideIfParameterMissing:=True) + ucrPnlOptions.AddToLinkedControls(ucrChkIncludeVariable, {rdoMultiple}, bNewLinkedHideIfParameterMissing:=True) + ucrPnlOptions.AddToLinkedControls(ucrPnlCase, {rdoRenameWith}, bNewLinkedAddRemoveParameter:=True, bNewLinkedHideIfParameterMissing:=True) + ucrPnlCase.AddToLinkedControls(ucrInputCase, {rdoMakeCleanNames}, bNewLinkedAddRemoveParameter:=True, bNewLinkedHideIfParameterMissing:=True, bNewLinkedChangeToDefaultState:=True, objNewDefaultState:="Snake") + ucrPnlCase.AddToLinkedControls(ucrNudAbbreviate, {rdoAbbreviate}, bNewLinkedAddRemoveParameter:=True, bNewLinkedHideIfParameterMissing:=True, bNewLinkedChangeToDefaultState:=True, objNewDefaultState:="8") + ucrReceiverName.SetLinkedDisplayControl(lblCurrentName) + ucrInputNewName.SetLinkedDisplayControl(lblName) + ucrInputVariableLabel.SetLinkedDisplayControl(lblVariableLabel) + ucrReceiverColumns.SetLinkedDisplayControl(lblColumns) + ucrInputCase.SetLinkedDisplayControl(lblCase) + ucrPnlCase.SetLinkedDisplayControl(grpOptions) + ucrChkIncludeVariable.SetLinkedDisplayControl(grdRenameColumns) End Sub - Public Sub SetDefaults() + Private Sub SetDefaults() clsDefaultRFunction = New RFunction + clsNewColNameDataframeFunction = New RFunction + clsNewLabelDataframeFunction = New RFunction + clsDummyFunction = New RFunction ucrSelectVariables.Reset() + dctRowsNewNameChanged.Clear() + dctRowsNewLabelChanged.Clear() + + clsNewColNameDataframeFunction.SetRCommand("data.frame") + + clsNewLabelDataframeFunction.SetRCommand("data.frame") clsDefaultRFunction.SetRCommand(frmMain.clsRLink.strInstatDataObject & "$rename_column_in_data") clsDefaultRFunction.AddParameter("type", Chr(34) & "single" & Chr(34), iPosition:=4) - clsDefaultRFunction.AddParameter(".fn", "tolower", iPosition:=5) + clsDefaultRFunction.AddParameter(".fn", "janitor::make_clean_names", iPosition:=5) clsDefaultRFunction.AddParameter("case", Chr(34) & "snake" & Chr(34), iPosition:=7) + clsDefaultRFunction.AddParameter("minlength", "8", iPosition:=10) ucrBase.clsRsyntax.SetBaseRFunction(clsDefaultRFunction) End Sub + Private Sub SetRCodeForControls(bReset As Boolean) + ucrSelectVariables.SetRCode(clsDefaultRFunction, bReset) + ucrReceiverName.SetRCode(clsDefaultRFunction, bReset) + ucrInputNewName.SetRCode(clsDefaultRFunction, bReset) + ucrInputVariableLabel.SetRCode(clsDefaultRFunction, bReset) + ucrReceiverColumns.SetRCode(clsDefaultRFunction, bReset) + If bReset Then + ucrPnlCase.SetRCode(clsDefaultRFunction, bReset) + End If + ucrInputCase.SetRCode(clsDefaultRFunction, bReset) + ucrNudAbbreviate.SetRCode(clsDefaultRFunction, bReset) + ucrPnlOptions.SetRCode(clsDefaultRFunction, bReset) + ucrChkIncludeVariable.SetRCode(clsDummyFunction, bReset) + End Sub + Private Sub TestOKEnabled() If rdoSingle.Checked Then If Not ucrReceiverName.IsEmpty() AndAlso Not ucrInputNewName.IsEmpty() Then @@ -129,13 +173,277 @@ Public Class dlgName Else ucrBase.OKEnabled(False) End If - Else + ElseIf rdoRenameWith.Checked Then ucrBase.OKEnabled(True) + Else + ucrBase.OKEnabled(bCurrentCell) End If End Sub - Private Sub SetRCodeForControls(bReset As Boolean) - SetRCode(Me, ucrBase.clsRsyntax.clsBaseFunction, bReset) + Private Sub AddChangedNewNameRows(iRow As Integer, strNewData As String) + If Not dctRowsNewNameChanged.ContainsKey(iRow) Then + dctRowsNewNameChanged.Add(iRow, strNewData) + Else + dctRowsNewNameChanged(iRow) = strNewData + End If + End Sub + + Private Sub AddChangedNewLabelRows(iRow As Integer, strNewData As String) + 'TODO this need to be implemented in the appropriare ucrControl + If Not dctRowsNewLabelChanged.ContainsKey(iRow) Then + dctRowsNewLabelChanged.Add(iRow, strNewData) + Else + dctRowsNewLabelChanged(iRow) = strNewData + End If + End Sub + + Private Sub AddRowNameValue(iRow As Integer, strNewData As String) + 'TODO this need to be implemented in the appropriare ucrControl + If Not dctNameRowsValues.ContainsKey(iRow) Then + dctNameRowsValues.Add(iRow, strNewData) + End If + End Sub + + Private Function GetValuesAsVector(dctValues As Dictionary(Of Integer, String)) As String + 'TODO this need to be implemented in the appropriare ucrControl + Dim strValue As String = "" + Dim i As Integer + strValue = strValue & "c(" + For Each iRow As Integer In dctValues.Keys + If i > 0 Then + strValue = strValue & "," + End If + strValue = strValue & Chr(34) & dctValues(iRow) & Chr(34) + i = i + 1 + Next + strValue = strValue & ")" + Return strValue + End Function + + Private Sub ValidateNamesFromDictionary(iColIndex As Integer) + 'TODO this need to be implemented in the appropriare ucrControl + If iColIndex = 1 Then + For Each value In dctRowsNewNameChanged.Values + If Not CheckNames(value, iColIndex) Then + MsgBox("The column name must not be a numeric or contains space or french accent or be a boolean e.g TRUE, FALSE, T, F.") + bCurrentCell = False + Exit For + Else + bCurrentCell = True + End If + Next + End If + TestOKEnabled() + End Sub + + Private Function ValidateRVariable(strText As String, iCol As Integer) As String + 'TODO this need to be implemented in the appropriare ucrControl + Dim strNewDataText As String = strText + If iCol = 1 Then + For Each chrCurr In strNewDataText + If Not Char.IsLetterOrDigit(chrCurr) AndAlso Not chrCurr = "." AndAlso Not chrCurr = "_" Then + strNewDataText = strNewDataText.Replace(chrCurr, ".") + End If + Next + End If + Return strNewDataText + End Function + + Private Sub grdCurrentWorkSheet_AfterPaste(sender As Object, e As RangeEventArgs) Handles grdCurrentWorkSheet.AfterPaste + Dim iStartRowIndex As Integer = grdCurrentWorkSheet.SelectionRange.Row + Dim iColIndex As Integer = grdCurrentWorkSheet.SelectionRange.Col + + If e.Range.Rows > 1 Then + For iRow As Integer = iStartRowIndex To grdCurrentWorkSheet.SelectionRange.EndRow + Dim strNewData As String = ValidateRVariable(grdCurrentWorkSheet.GetCellData(row:=iRow, col:=iColIndex), iColIndex) + RenameColumns(strNewData, iRow, iColIndex) + Next + Else + Dim strNewData As String = ValidateRVariable(grdCurrentWorkSheet.GetCellData(row:=e.Range.Row, col:=iColIndex), iColIndex) + RenameColumns(strNewData, iStartRowIndex, iColIndex) + End If + ValidateNamesFromDictionary(iColIndex) + End Sub + + Private Sub GetSelectedRows() + For i As Integer = grdCurrentWorkSheet.SelectionRange.Row To grdCurrentWorkSheet.SelectionRange.Row + grdCurrentWorkSheet.SelectionRange.Rows - 1 + Dim iRow As Integer = grdCurrentWorkSheet.RowHeaders.Item(i).Index + 1 + AddChangedNewLabelRows(iRow, strEmpty) + Next + End Sub + + Private Sub Worksheet_AfterCellKeyDown(sender As Object, e As AfterCellKeyDownEventArgs) Handles grdCurrentWorkSheet.AfterCellKeyDown + If (e.KeyCode = unvell.ReoGrid.Interaction.KeyCode.Delete OrElse e.KeyCode = unvell.ReoGrid.Interaction.KeyCode.Back) Then + GetSelectedRows() + clsNewLabelDataframeFunction.AddParameter("cols", GetValuesAsVector(dctRowsNewLabelChanged), iPosition:=0) + clsNewLabelDataframeFunction.AddParameter("index", "c(" & String.Join(",", dctRowsNewLabelChanged.Keys.ToArray) & ")", iPosition:=1) + clsDefaultRFunction.AddParameter("new_labels_df", clsRFunctionParameter:=clsNewLabelDataframeFunction, iPosition:=9) + End If + End Sub + + Private Function containsFrench(ByVal strData As String) As Boolean + Dim bFind As Boolean = False + Dim lstFrench As String = "ç,é,ê,î,ô,œ,û" + Dim words As String() = lstFrench.Split(New Char() {","c}) + For Each word In words + If strData.Contains(word) Then + bFind = True + Exit For + End If + Next + Return bFind + End Function + + Private Function CheckNames(strNewData As String, iColIndex As Integer) As Boolean + Dim bCheck As Boolean + Dim parsedValue As Boolean + If (containsFrench(strNewData) OrElse strNewData.Equals("") OrElse Boolean.TryParse(strNewData, parsedValue) _ + OrElse strNewData.Equals("t") OrElse strNewData.Equals("T") OrElse strNewData.Equals("f") OrElse strNewData.Equals("F") OrElse IsNumeric(strNewData)) AndAlso iColIndex = 1 Then + bCheck = False + Else + bCheck = True + End If + Return bCheck + End Function + + Private Sub RenameColumns(strNewData As String, iRowIndex As Integer, iColIndex As Integer) + GetVariables(strNewData, iRowIndex + 1, iColIndex) + TestOKEnabled() + End Sub + + Private Sub Worksheet_BeforeCellKeyDown(sender As Object, e As BeforeCellKeyDownEventArgs) Handles grdCurrentWorkSheet.BeforeCellKeyDown + If (e.KeyCode = unvell.ReoGrid.Interaction.KeyCode.Delete OrElse e.KeyCode = unvell.ReoGrid.Interaction.KeyCode.Back) AndAlso e.Cell.Column = 1 Then + MsgBox("The column name must not be an empty string.", MsgBoxStyle.Information) + e.IsCancelled = True + End If + End Sub + + Private Sub grdCurrSheet_AfterCellEdit(sender As Object, e As CellAfterEditEventArgs) Handles grdCurrentWorkSheet.AfterCellEdit + Dim iCol As Integer = e.Cell.Column + Dim strNewData As String = ValidateRVariable(e.NewData, iCol) + RenameColumns(strNewData, e.Cell.Row, iCol) + ValidateNamesFromDictionary(iCol) + End Sub + + Private Sub GetVariables(strNewData As String, iRowIndex As Integer, iColIndex As Integer) + If rdoMultiple.Checked Then + If iColIndex = 1 Then + If strNewData <> "" Then + AddChangedNewNameRows(iRowIndex, strNewData) + + clsNewColNameDataframeFunction.AddParameter("cols", GetValuesAsVector(dctRowsNewNameChanged), iPosition:=0) + clsNewColNameDataframeFunction.AddParameter("index", "c(" & String.Join(",", dctRowsNewNameChanged.Keys.ToArray) & ")", iPosition:=1) + clsDefaultRFunction.AddParameter("new_column_names_df", clsRFunctionParameter:=clsNewColNameDataframeFunction, iPosition:=8) + Else + clsNewColNameDataframeFunction.RemoveParameterByName("cols") + clsNewColNameDataframeFunction.RemoveParameterByName("index") + clsDefaultRFunction.RemoveParameterByName("new_column_names_df") + End If + End If + + If ucrChkIncludeVariable.Checked Then + If iColIndex = 2 Then + If strNewData <> "" Then + AddChangedNewLabelRows(iRowIndex, strNewData) + Else + AddChangedNewLabelRows(iRowIndex, strEmpty) + End If + + clsNewLabelDataframeFunction.AddParameter("cols", GetValuesAsVector(dctRowsNewLabelChanged), iPosition:=0) + clsNewLabelDataframeFunction.AddParameter("index", "c(" & String.Join(",", dctRowsNewLabelChanged.Keys.ToArray) & ")", iPosition:=1) + clsDefaultRFunction.AddParameter("new_labels_df", clsRFunctionParameter:=clsNewLabelDataframeFunction, iPosition:=9) + End If + Else + clsDefaultRFunction.RemoveParameterByName("new_labels_df") + End If + End If + End Sub + + Private Sub RemoveLabelsParams() + clsDefaultRFunction.RemoveParameterByName("new_column_names_df") + clsDefaultRFunction.RemoveParameterByName("new_labels_df") + End Sub + + Private Sub RemoveParameters() + If rdoMultiple.Checked OrElse rdoSingle.Checked Then + clsDefaultRFunction.RemoveParameterByName(".fn") + RemoveLabelsParams() + End If + End Sub + + Private Sub UpdateGrid() + Dim vecColumns As GenericVector = Nothing + Dim chrCurrColumns As CharacterVector + Dim clsGetItems As New RFunction + Dim clsGetColumnLabels As New RFunction + Dim strCurrColumnLables() As String + Dim expItems As SymbolicExpression + + grdRenameColumns.Worksheets.Clear() + dctRowsNewNameChanged.Clear() + dctNameRowsValues.Clear() + dctRowsNewLabelChanged.Clear() + + grdCurrentWorkSheet = grdRenameColumns.CreateWorksheet(ucrSelectVariables.strCurrentDataFrame) + grdCurrentWorkSheet.ColumnCount = 3 + + grdCurrentWorkSheet.ColumnHeaders(0).Text = "Name" + grdCurrentWorkSheet.ColumnHeaders(1).Text = "New Name" + grdCurrentWorkSheet.ColumnHeaders(2).Text = "Label" + grdCurrentWorkSheet.SetColumnsWidth(2, 1, 150) + + If rdoMultiple.Checked Then + If ucrSelectVariables IsNot Nothing Then + clsGetItems.SetRCommand(frmMain.clsRLink.strInstatDataObject & "$get_column_names") + clsGetItems.AddParameter("data_name", Chr(34) & ucrSelectVariables.strCurrentDataFrame & Chr(34), iPosition:=0) + clsGetItems.AddParameter("as_list", "TRUE") + expItems = frmMain.clsRLink.RunInternalScriptGetValue(clsGetItems.ToScript(), bSilent:=True) + If expItems IsNot Nothing AndAlso Not expItems.Type = Internals.SymbolicExpressionType.Null Then + vecColumns = expItems.AsList + For i As Integer = 0 To vecColumns.Count - 1 + chrCurrColumns = vecColumns(i).AsCharacter + Dim strText As String = vecColumns.Names(i) + + If chrCurrColumns IsNot Nothing Then + grdCurrentWorkSheet.RowCount = chrCurrColumns.Count + For j As Integer = 0 To chrCurrColumns.Count - 1 + grdCurrentWorkSheet.Item(row:=j, col:=0) = chrCurrColumns(j) + grdCurrentWorkSheet.GetCell(row:=j, col:=0).IsReadOnly = True + grdCurrentWorkSheet.Item(row:=j, col:=1) = chrCurrColumns(j) + Next + clsGetColumnLabels.SetRCommand(frmMain.clsRLink.strInstatDataObject & "$get_column_labels") + clsGetColumnLabels.AddParameter("data_name", Chr(34) & vecColumns.Names(i) & Chr(34)) + clsGetColumnLabels.AddParameter("columns", frmMain.clsRLink.GetListAsRString(chrCurrColumns.ToList)) + expItems = frmMain.clsRLink.RunInternalScriptGetValue(clsGetColumnLabels.ToScript()) + If expItems IsNot Nothing AndAlso Not expItems.Type = Internals.SymbolicExpressionType.Null Then + strCurrColumnLables = expItems.AsCharacter.ToArray + Else + strCurrColumnLables = New String(chrCurrColumns.Count - 1) {} + End If + For j = 0 To chrCurrColumns.Count - 1 + grdCurrentWorkSheet.Item(row:=j, col:=2) = strCurrColumnLables(j) + Next + End If + Next + End If + + For iRow As Integer = 0 To grdCurrentWorkSheet.RowCount - 1 + AddRowNameValue(iRow, grdCurrentWorkSheet.Item(iRow, 0)) + Next + End If + End If + + grdCurrentWorkSheet.SetRangeDataFormat(New RangePosition(0, 0, grdCurrentWorkSheet.Rows, grdCurrentWorkSheet.Columns), DataFormat.CellDataFormatFlag.Text) + grdCurrentWorkSheet.SelectionForwardDirection = unvell.ReoGrid.SelectionForwardDirection.Down + grdCurrentWorkSheet.SetSettings(unvell.ReoGrid.WorksheetSettings.Edit_DragSelectionToMoveCells, False) + grdCurrentWorkSheet.SetSettings(unvell.ReoGrid.WorksheetSettings.Edit_DragSelectionToFillSerial, False) + grdCurrentWorkSheet.SetSettings(unvell.ReoGrid.WorksheetSettings.View_AllowCellTextOverflow, False) + + grdRenameColumns.AddWorksheet(grdCurrentWorkSheet) + grdRenameColumns.SheetTabNewButtonVisible = False + grdRenameColumns.SheetTabWidth = 450 + + MakeLabelColumnVisible() End Sub Public Sub SetCurrentColumn(strColumn As String, strDataFrame As String) @@ -199,12 +507,39 @@ Public Class dlgName Return strColLabel End Function - Private Sub ucrPnlOptions_ControlValueChanged(ucrChangedControl As ucrCore) Handles ucrPnlOptions.ControlValueChanged + Private Sub ucrPnlOptions_ControlValueChanged(ucrChangedControl As ucrCore) Handles ucrPnlOptions.ControlValueChanged, ucrPnlCase.ControlValueChanged, ucrInputCase.ControlValueChanged, ucrNudAbbreviate.ControlValueChanged If rdoSingle.Checked Then ucrReceiverName.SetMeAsReceiver() - Else + ElseIf rdoRenameWith.Checked Then ucrReceiverColumns.SetMeAsReceiver() End If + ucrSelectVariables.lstAvailableVariable.Visible = If(rdoSingle.Checked OrElse rdoRenameWith.Checked, True, False) + ucrSelectVariables.btnAdd.Visible = If(rdoSingle.Checked OrElse rdoRenameWith.Checked, True, False) + ucrSelectVariables.btnDataOptions.Visible = If(rdoSingle.Checked OrElse rdoRenameWith.Checked, True, False) + + UpdateGrid() + RemoveParameters() + End Sub + + Private Sub MakeLabelColumnVisible() + If ucrChkIncludeVariable.Checked Then + grdCurrentWorkSheet.ShowColumns(2, 1) + Else + grdCurrentWorkSheet.HideColumns(2, 1) + End If + End Sub + + Private Sub ucrChkIncludeVariable_ControlValueChanged(ucrChangedControl As ucrCore) Handles ucrChkIncludeVariable.ControlValueChanged + MakeLabelColumnVisible() + End Sub + + Private Sub cmdAddkeyboard_Click(sender As Object, e As EventArgs) + sdgConstructRegexExpression.ShowDialog() + End Sub + + Private Sub ucrSelectVariables_DataFrameChanged() Handles ucrSelectVariables.DataFrameChanged + RemoveLabelsParams() + UpdateGrid() End Sub Private Sub ucrBase_ClickOk(sender As Object, e As EventArgs) Handles ucrBase.ClickOk @@ -213,7 +548,7 @@ Public Class dlgName End If End Sub - Private Sub ucrCoreControls_ControlContentsChanged() Handles ucrInputNewName.ControlContentsChanged, ucrReceiverName.ControlContentsChanged, ucrSelectVariables.ControlContentsChanged, ucrPnlOptions.ControlContentsChanged + Private Sub ucrCoreControls_ControlContentsChanged() Handles ucrInputNewName.ControlContentsChanged, ucrReceiverName.ControlContentsChanged, ucrPnlOptions.ControlContentsChanged TestOKEnabled() End Sub End Class diff --git a/instat/dlgNewDataFrame.Designer.vb b/instat/dlgNewDataFrame.Designer.vb index 152efee643d..583ad803356 100644 --- a/instat/dlgNewDataFrame.Designer.vb +++ b/instat/dlgNewDataFrame.Designer.vb @@ -39,6 +39,10 @@ Partial Class dlgNewDataFrame Private Sub InitializeComponent() Me.components = New System.ComponentModel.Container() + Dim DataGridViewCellStyle1 As System.Windows.Forms.DataGridViewCellStyle = New System.Windows.Forms.DataGridViewCellStyle() + Dim DataGridViewCellStyle2 As System.Windows.Forms.DataGridViewCellStyle = New System.Windows.Forms.DataGridViewCellStyle() + Dim DataGridViewCellStyle3 As System.Windows.Forms.DataGridViewCellStyle = New System.Windows.Forms.DataGridViewCellStyle() + Dim DataGridViewCellStyle4 As System.Windows.Forms.DataGridViewCellStyle = New System.Windows.Forms.DataGridViewCellStyle() Me.lblRows = New System.Windows.Forms.Label() Me.lblColumns = New System.Windows.Forms.Label() Me.rdoCommand = New System.Windows.Forms.RadioButton() @@ -57,21 +61,32 @@ Partial Class dlgNewDataFrame Me.SelectAllToolStripMenuItem = New System.Windows.Forms.ToolStripMenuItem() Me.lblCommand = New System.Windows.Forms.Label() Me.btnExample = New System.Windows.Forms.Button() + Me.dataTypeGridView = New System.Windows.Forms.DataGridView() + Me.ucrChkIncludeLabel = New instat.ucrCheck() + Me.ucrChkVariable = New instat.ucrCheck() + Me.ucrTryNewDataFrame = New instat.ucrTry() Me.ucrInputCommand = New instat.ucrInputTextBox() Me.ucrPnlDataFrame = New instat.UcrPanel() Me.ucrNewDFName = New instat.ucrSave() Me.ucrNudCols = New instat.ucrNud() Me.ucrNudRows = New instat.ucrNud() Me.ucrBase = New instat.ucrButtons() - Me.ucrTryNewDataFrame = New instat.ucrTry() + Me.no = New System.Windows.Forms.DataGridViewTextBoxColumn() + Me.colNames = New System.Windows.Forms.DataGridViewTextBoxColumn() + Me.cbType = New System.Windows.Forms.DataGridViewComboBoxColumn() + Me.colDefault = New System.Windows.Forms.DataGridViewComboBoxColumn() + Me.colLevels = New System.Windows.Forms.DataGridViewComboBoxColumn() + Me.colLabel = New System.Windows.Forms.DataGridViewTextBoxColumn() CType(Me.dataGridView, System.ComponentModel.ISupportInitialize).BeginInit() Me.mnuStripCommand.SuspendLayout() + CType(Me.dataTypeGridView, System.ComponentModel.ISupportInitialize).BeginInit() Me.SuspendLayout() ' 'lblRows ' + Me.lblRows.AutoSize = True Me.lblRows.ImeMode = System.Windows.Forms.ImeMode.NoControl - Me.lblRows.Location = New System.Drawing.Point(30, 99) + Me.lblRows.Location = New System.Drawing.Point(261, 58) Me.lblRows.Name = "lblRows" Me.lblRows.Size = New System.Drawing.Size(37, 13) Me.lblRows.TabIndex = 8 @@ -79,8 +94,9 @@ Partial Class dlgNewDataFrame ' 'lblColumns ' + Me.lblColumns.AutoSize = True Me.lblColumns.ImeMode = System.Windows.Forms.ImeMode.NoControl - Me.lblColumns.Location = New System.Drawing.Point(30, 143) + Me.lblColumns.Location = New System.Drawing.Point(37, 59) Me.lblColumns.Name = "lblColumns" Me.lblColumns.Size = New System.Drawing.Size(50, 13) Me.lblColumns.TabIndex = 10 @@ -157,9 +173,25 @@ Partial Class dlgNewDataFrame 'dataGridView ' Me.dataGridView.AutoSizeRowsMode = System.Windows.Forms.DataGridViewAutoSizeRowsMode.AllCells + DataGridViewCellStyle1.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft + DataGridViewCellStyle1.BackColor = System.Drawing.SystemColors.Control + DataGridViewCellStyle1.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) + DataGridViewCellStyle1.ForeColor = System.Drawing.SystemColors.WindowText + DataGridViewCellStyle1.SelectionBackColor = System.Drawing.SystemColors.Highlight + DataGridViewCellStyle1.SelectionForeColor = System.Drawing.SystemColors.HighlightText + DataGridViewCellStyle1.WrapMode = System.Windows.Forms.DataGridViewTriState.[True] + Me.dataGridView.ColumnHeadersDefaultCellStyle = DataGridViewCellStyle1 Me.dataGridView.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize Me.dataGridView.Columns.AddRange(New System.Windows.Forms.DataGridViewColumn() {Me.colRowNum, Me.colName, Me.colExpression}) - Me.dataGridView.Location = New System.Drawing.Point(9, 84) + DataGridViewCellStyle2.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft + DataGridViewCellStyle2.BackColor = System.Drawing.SystemColors.Window + DataGridViewCellStyle2.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) + DataGridViewCellStyle2.ForeColor = System.Drawing.SystemColors.ControlText + DataGridViewCellStyle2.SelectionBackColor = System.Drawing.SystemColors.Highlight + DataGridViewCellStyle2.SelectionForeColor = System.Drawing.SystemColors.HighlightText + DataGridViewCellStyle2.WrapMode = System.Windows.Forms.DataGridViewTriState.[False] + Me.dataGridView.DefaultCellStyle = DataGridViewCellStyle2 + Me.dataGridView.Location = New System.Drawing.Point(19, 81) Me.dataGridView.Margin = New System.Windows.Forms.Padding(2) Me.dataGridView.Name = "dataGridView" Me.dataGridView.RowHeadersVisible = False @@ -232,7 +264,7 @@ Partial Class dlgNewDataFrame ' Me.lblCommand.AutoSize = True Me.lblCommand.ImeMode = System.Windows.Forms.ImeMode.NoControl - Me.lblCommand.Location = New System.Drawing.Point(10, 59) + Me.lblCommand.Location = New System.Drawing.Point(19, 59) Me.lblCommand.Name = "lblCommand" Me.lblCommand.Size = New System.Drawing.Size(57, 13) Me.lblCommand.TabIndex = 5 @@ -241,7 +273,7 @@ Partial Class dlgNewDataFrame 'btnExample ' Me.btnExample.ImeMode = System.Windows.Forms.ImeMode.NoControl - Me.btnExample.Location = New System.Drawing.Point(83, 54) + Me.btnExample.Location = New System.Drawing.Point(94, 55) Me.btnExample.Margin = New System.Windows.Forms.Padding(2) Me.btnExample.Name = "btnExample" Me.btnExample.Size = New System.Drawing.Size(166, 22) @@ -249,13 +281,70 @@ Partial Class dlgNewDataFrame Me.btnExample.Text = "Command Examples" Me.btnExample.UseVisualStyleBackColor = True ' + 'dataTypeGridView + ' + Me.dataTypeGridView.AllowUserToAddRows = False + Me.dataTypeGridView.AutoSizeRowsMode = System.Windows.Forms.DataGridViewAutoSizeRowsMode.AllCells + DataGridViewCellStyle3.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft + DataGridViewCellStyle3.BackColor = System.Drawing.SystemColors.Control + DataGridViewCellStyle3.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) + DataGridViewCellStyle3.ForeColor = System.Drawing.SystemColors.WindowText + DataGridViewCellStyle3.SelectionBackColor = System.Drawing.SystemColors.Highlight + DataGridViewCellStyle3.SelectionForeColor = System.Drawing.SystemColors.HighlightText + DataGridViewCellStyle3.WrapMode = System.Windows.Forms.DataGridViewTriState.[True] + Me.dataTypeGridView.ColumnHeadersDefaultCellStyle = DataGridViewCellStyle3 + Me.dataTypeGridView.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize + Me.dataTypeGridView.Columns.AddRange(New System.Windows.Forms.DataGridViewColumn() {Me.no, Me.colNames, Me.cbType, Me.colDefault, Me.colLevels, Me.colLabel}) + DataGridViewCellStyle4.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft + DataGridViewCellStyle4.BackColor = System.Drawing.SystemColors.Window + DataGridViewCellStyle4.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) + DataGridViewCellStyle4.ForeColor = System.Drawing.SystemColors.ControlText + DataGridViewCellStyle4.SelectionBackColor = System.Drawing.SystemColors.Highlight + DataGridViewCellStyle4.SelectionForeColor = System.Drawing.SystemColors.HighlightText + DataGridViewCellStyle4.WrapMode = System.Windows.Forms.DataGridViewTriState.[False] + Me.dataTypeGridView.DefaultCellStyle = DataGridViewCellStyle4 + Me.dataTypeGridView.Location = New System.Drawing.Point(20, 133) + Me.dataTypeGridView.Margin = New System.Windows.Forms.Padding(2) + Me.dataTypeGridView.Name = "dataTypeGridView" + Me.dataTypeGridView.RowHeadersVisible = False + Me.dataTypeGridView.RowTemplate.Height = 28 + Me.dataTypeGridView.Size = New System.Drawing.Size(416, 115) + Me.dataTypeGridView.TabIndex = 163 + ' + 'ucrChkIncludeLabel + ' + Me.ucrChkIncludeLabel.AutoSize = True + Me.ucrChkIncludeLabel.Checked = False + Me.ucrChkIncludeLabel.Location = New System.Drawing.Point(194, 101) + Me.ucrChkIncludeLabel.Name = "ucrChkIncludeLabel" + Me.ucrChkIncludeLabel.Size = New System.Drawing.Size(100, 23) + Me.ucrChkIncludeLabel.TabIndex = 164 + ' + 'ucrChkVariable + ' + Me.ucrChkVariable.AutoSize = True + Me.ucrChkVariable.Checked = False + Me.ucrChkVariable.Location = New System.Drawing.Point(37, 101) + Me.ucrChkVariable.Name = "ucrChkVariable" + Me.ucrChkVariable.Size = New System.Drawing.Size(100, 23) + Me.ucrChkVariable.TabIndex = 162 + ' + 'ucrTryNewDataFrame + ' + Me.ucrTryNewDataFrame.AutoSize = True + Me.ucrTryNewDataFrame.Location = New System.Drawing.Point(10, 253) + Me.ucrTryNewDataFrame.Name = "ucrTryNewDataFrame" + Me.ucrTryNewDataFrame.RunCommandAsMultipleLines = False + Me.ucrTryNewDataFrame.Size = New System.Drawing.Size(404, 33) + Me.ucrTryNewDataFrame.TabIndex = 161 + ' 'ucrInputCommand ' Me.ucrInputCommand.AddQuotesIfUnrecognised = True Me.ucrInputCommand.AutoSize = True Me.ucrInputCommand.IsMultiline = True Me.ucrInputCommand.IsReadOnly = False - Me.ucrInputCommand.Location = New System.Drawing.Point(9, 84) + Me.ucrInputCommand.Location = New System.Drawing.Point(19, 81) Me.ucrInputCommand.Name = "ucrInputCommand" Me.ucrInputCommand.Size = New System.Drawing.Size(417, 159) Me.ucrInputCommand.TabIndex = 7 @@ -272,7 +361,7 @@ Partial Class dlgNewDataFrame 'ucrNewDFName ' Me.ucrNewDFName.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink - Me.ucrNewDFName.Location = New System.Drawing.Point(10, 285) + Me.ucrNewDFName.Location = New System.Drawing.Point(20, 290) Me.ucrNewDFName.Margin = New System.Windows.Forms.Padding(4, 5, 4, 5) Me.ucrNewDFName.Name = "ucrNewDFName" Me.ucrNewDFName.Size = New System.Drawing.Size(416, 24) @@ -283,12 +372,12 @@ Partial Class dlgNewDataFrame Me.ucrNudCols.AutoSize = True Me.ucrNudCols.DecimalPlaces = New Decimal(New Integer() {0, 0, 0, 0}) Me.ucrNudCols.Increment = New Decimal(New Integer() {1, 0, 0, 0}) - Me.ucrNudCols.Location = New System.Drawing.Point(141, 143) + Me.ucrNudCols.Location = New System.Drawing.Point(94, 56) Me.ucrNudCols.Margin = New System.Windows.Forms.Padding(4, 5, 4, 5) Me.ucrNudCols.Maximum = New Decimal(New Integer() {100, 0, 0, 0}) Me.ucrNudCols.Minimum = New Decimal(New Integer() {0, 0, 0, 0}) Me.ucrNudCols.Name = "ucrNudCols" - Me.ucrNudCols.Size = New System.Drawing.Size(60, 20) + Me.ucrNudCols.Size = New System.Drawing.Size(57, 20) Me.ucrNudCols.TabIndex = 11 Me.ucrNudCols.Value = New Decimal(New Integer() {0, 0, 0, 0}) ' @@ -297,12 +386,12 @@ Partial Class dlgNewDataFrame Me.ucrNudRows.AutoSize = True Me.ucrNudRows.DecimalPlaces = New Decimal(New Integer() {0, 0, 0, 0}) Me.ucrNudRows.Increment = New Decimal(New Integer() {1, 0, 0, 0}) - Me.ucrNudRows.Location = New System.Drawing.Point(124, 99) + Me.ucrNudRows.Location = New System.Drawing.Point(310, 56) Me.ucrNudRows.Margin = New System.Windows.Forms.Padding(4, 5, 4, 5) Me.ucrNudRows.Maximum = New Decimal(New Integer() {100, 0, 0, 0}) Me.ucrNudRows.Minimum = New Decimal(New Integer() {0, 0, 0, 0}) Me.ucrNudRows.Name = "ucrNudRows" - Me.ucrNudRows.Size = New System.Drawing.Size(77, 20) + Me.ucrNudRows.Size = New System.Drawing.Size(57, 20) Me.ucrNudRows.TabIndex = 9 Me.ucrNudRows.Value = New Decimal(New Integer() {0, 0, 0, 0}) ' @@ -313,24 +402,59 @@ Partial Class dlgNewDataFrame Me.ucrBase.Location = New System.Drawing.Point(20, 318) Me.ucrBase.Margin = New System.Windows.Forms.Padding(4, 5, 4, 5) Me.ucrBase.Name = "ucrBase" - Me.ucrBase.Size = New System.Drawing.Size(405, 52) + Me.ucrBase.Size = New System.Drawing.Size(408, 52) Me.ucrBase.TabIndex = 15 ' - 'ucrTryNewDataFrame + 'no ' - Me.ucrTryNewDataFrame.AutoSize = True - Me.ucrTryNewDataFrame.Location = New System.Drawing.Point(12, 249) - Me.ucrTryNewDataFrame.Name = "ucrTryNewDataFrame" - Me.ucrTryNewDataFrame.RunCommandAsMultipleLines = False - Me.ucrTryNewDataFrame.Size = New System.Drawing.Size(413, 33) - Me.ucrTryNewDataFrame.TabIndex = 161 + Me.no.FillWeight = 90.0! + Me.no.HeaderText = "No." + Me.no.Name = "no" + Me.no.ReadOnly = True + Me.no.Width = 30 + ' + 'colNames + ' + Me.colNames.HeaderText = "Name" + Me.colNames.Name = "colNames" + Me.colNames.Width = 60 + ' + 'cbType + ' + Me.cbType.HeaderText = "Type" + Me.cbType.Items.AddRange(New Object() {"Character", "Numeric", "Factor", "Integer"}) + Me.cbType.MaxDropDownItems = 4 + Me.cbType.Name = "cbType" + Me.cbType.Width = 60 + ' + 'colDefault + ' + Me.colDefault.HeaderText = "Default" + Me.colDefault.Items.AddRange(New Object() {"NA", "0", "1", "1,10", "letters[1:10]", "LETTERS[1:10]"}) + Me.colDefault.Name = "colDefault" + ' + 'colLevels + ' + Me.colLevels.HeaderText = "Levels" + Me.colLevels.Items.AddRange(New Object() {"No, Yes", "Bad, Poor, Average, Good, Great", "0-4,5-9,10-14,15-19, 20-64, 65+", "1:5"}) + Me.colLevels.Name = "colLevels" + ' + 'colLabel + ' + Me.colLabel.HeaderText = "Label" + Me.colLabel.Name = "colLabel" + Me.colLabel.Visible = False + Me.colLabel.Width = 80 ' 'dlgNewDataFrame ' 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(439, 378) + Me.ClientSize = New System.Drawing.Size(458, 378) + Me.Controls.Add(Me.ucrChkIncludeLabel) + Me.Controls.Add(Me.dataTypeGridView) + Me.Controls.Add(Me.ucrChkVariable) Me.Controls.Add(Me.ucrTryNewDataFrame) Me.Controls.Add(Me.ucrInputCommand) Me.Controls.Add(Me.btnExample) @@ -355,6 +479,7 @@ Partial Class dlgNewDataFrame Me.Text = "New Data Frame" CType(Me.dataGridView, System.ComponentModel.ISupportInitialize).EndInit() Me.mnuStripCommand.ResumeLayout(False) + CType(Me.dataTypeGridView, System.ComponentModel.ISupportInitialize).EndInit() Me.ResumeLayout(False) Me.PerformLayout() @@ -385,4 +510,13 @@ Partial Class dlgNewDataFrame Friend WithEvents colName As DataGridViewTextBoxColumn Friend WithEvents colExpression As DataGridViewTextBoxColumn Friend WithEvents ucrTryNewDataFrame As ucrTry + Friend WithEvents ucrChkVariable As ucrCheck + Friend WithEvents dataTypeGridView As DataGridView + Friend WithEvents ucrChkIncludeLabel As ucrCheck + Friend WithEvents no As DataGridViewTextBoxColumn + Friend WithEvents colNames As DataGridViewTextBoxColumn + Friend WithEvents cbType As DataGridViewComboBoxColumn + Friend WithEvents colDefault As DataGridViewComboBoxColumn + Friend WithEvents colLevels As DataGridViewComboBoxColumn + Friend WithEvents colLabel As DataGridViewTextBoxColumn End Class diff --git a/instat/dlgNewDataFrame.resx b/instat/dlgNewDataFrame.resx index ed4b73cde43..159ca18fd53 100644 --- a/instat/dlgNewDataFrame.resx +++ b/instat/dlgNewDataFrame.resx @@ -129,6 +129,24 @@ 17, 17 + + True + + + True + + + True + + + True + + + True + + + True + 25 diff --git a/instat/dlgNewDataFrame.vb b/instat/dlgNewDataFrame.vb index 647dfb55833..de596bd1d5a 100644 --- a/instat/dlgNewDataFrame.vb +++ b/instat/dlgNewDataFrame.vb @@ -18,8 +18,8 @@ Imports instat.Translations Imports RDotNet Public Class dlgNewDataFrame - Private clsEmptyOverallFunction, clsEmptyMatrixFunction As New RFunction - Private clsConstructFunction As New RFunction + Private clsEmptyOverallFunction, clsEmptyMatrixFunction, clsNewDataFrameFunction, clsSjLabelledFunction As New RFunction + Private clsConstructFunction, clsDummyLabelFunction, clsDummyVarFunction, clsAsCharacterFunction, clsRepFunction As New RFunction Public bFirstLoad As Boolean = True Private bReset As Boolean = True @@ -41,9 +41,8 @@ Public Class dlgNewDataFrame ucrInputCommand.txtInput.WordWrap = False ucrInputCommand.txtInput.ScrollBars = ScrollBars.Both - 'nudRows - ucrNudRows.SetParameter(New RParameter("nrow", iNewPosition:=1)) + ucrNudRows.SetParameter(New RParameter("times", iNewPosition:=1)) ucrNudRows.SetMinMax(1, Integer.MaxValue) 'nudCols @@ -68,15 +67,24 @@ Public Class dlgNewDataFrame 'ucrPnlDataFrame.AddFunctionNamesCondition(rdoRandom, "") ucrPnlDataFrame.AddFunctionNamesCondition(rdoEmpty, "data.frame") - ucrPnlDataFrame.AddToLinkedControls(ucrNudCols, {rdoEmpty}, bNewLinkedAddRemoveParameter:=True, bNewLinkedHideIfParameterMissing:=True) - ucrPnlDataFrame.AddToLinkedControls(ucrNudRows, {rdoEmpty}, bNewLinkedAddRemoveParameter:=True, bNewLinkedHideIfParameterMissing:=True) + ucrPnlDataFrame.AddToLinkedControls({ucrNudCols, ucrNudRows}, {rdoEmpty}, bNewLinkedHideIfParameterMissing:=True) + ucrPnlDataFrame.AddToLinkedControls(ucrChkVariable, {rdoEmpty}, bNewLinkedHideIfParameterMissing:=True) + ucrChkVariable.AddToLinkedControls(ucrChkIncludeLabel, {True}, bNewLinkedHideIfParameterMissing:=True) ucrPnlDataFrame.AddToLinkedControls(ucrInputCommand, {rdoCommand, rdoRandom}, bNewLinkedAddRemoveParameter:=True, bNewLinkedHideIfParameterMissing:=True) ucrNudRows.SetLinkedDisplayControl(lblRows) ucrNudCols.SetLinkedDisplayControl(lblColumns) + ucrChkIncludeLabel.SetLinkedDisplayControl(dataTypeGridView) + + ucrChkVariable.SetText("Variable Name") + ucrChkVariable.SetParameter(New RParameter("var", 0)) + ucrChkVariable.SetValuesCheckedAndUnchecked("TRUE", "FALSE") + + ucrChkIncludeLabel.SetText("Variable Label") + ucrChkIncludeLabel.SetParameter(New RParameter("label", 0)) + ucrChkIncludeLabel.SetValuesCheckedAndUnchecked("TRUE", "FALSE") ucrTryNewDataFrame.SetIsCommand() ucrTryNewDataFrame.RunCommandAsMultipleLines = True - End Sub Private Sub SetDefaults() @@ -84,14 +92,33 @@ Public Class dlgNewDataFrame 'Empty option functions clsEmptyOverallFunction = New RFunction clsEmptyMatrixFunction = New RFunction + clsNewDataFrameFunction = New RFunction + clsDummyLabelFunction = New RFunction + clsDummyVarFunction = New RFunction + clsAsCharacterFunction = New RFunction + clsRepFunction = New RFunction + clsSjLabelledFunction = New RFunction 'reset the controls ucrNewDFName.Reset() ucrTryNewDataFrame.SetRSyntax(ucrBase.clsRsyntax) + ucrNudCols.SetText(2) + 'e.g of Function to be constructed . data.frame(data=matrix(data = NA,nrow = 10, ncol = 2)) clsEmptyOverallFunction.SetRCommand("data.frame") - clsEmptyOverallFunction.AddParameter("data", clsRFunctionParameter:=clsEmptyMatrixFunction, iPosition:=0) + + clsSjLabelledFunction.SetPackageName("sjlabelled") + clsSjLabelledFunction.SetRCommand("set_label") + clsSjLabelledFunction.AddParameter("x", clsRFunctionParameter:=clsNewDataFrameFunction, iPosition:=0) + + clsNewDataFrameFunction.SetRCommand("data.frame") + + clsRepFunction.SetRCommand("rep") + clsRepFunction.AddParameter("x", "NA", bIncludeArgumentName:=False, iPosition:=0) + clsRepFunction.AddParameter("times", "10", bIncludeArgumentName:=False, iPosition:=1) + clsAsCharacterFunction.SetRCommand("as.character") + clsAsCharacterFunction.AddParameter("x", clsRFunctionParameter:=clsRepFunction, bIncludeArgumentName:=False, iPosition:=0) 'matrix(data = NA,nrow = 10, ncol = 2) clsEmptyMatrixFunction.SetRCommand("matrix") @@ -102,10 +129,11 @@ Public Class dlgNewDataFrame 'Construct option function clsConstructFunction.SetRCommand("data.frame") + CreateEmptyDataFrame(2) + UpdateGrid(2, dataTypeGridView) 'empty and create 5 (+1) default rows dataGridView.Rows.Clear() dataGridView.Rows.Add(5) - ucrBase.clsRsyntax.SetBaseRFunction(clsEmptyOverallFunction) End Sub @@ -185,11 +213,14 @@ Public Class dlgNewDataFrame End Sub Private Sub SetRCodeforControls(bReset As Boolean) - ucrNudCols.SetRCode(clsEmptyMatrixFunction, bReset) - ucrNudRows.SetRCode(clsEmptyMatrixFunction, bReset) + ucrNudRows.SetRCode(clsRepFunction, bReset) ucrNewDFName.AddAdditionalRCode(clsEmptyOverallFunction, iAdditionalPairNo:=1) + ucrNewDFName.AddAdditionalRCode(clsNewDataFrameFunction, iAdditionalPairNo:=2) + ucrNewDFName.AddAdditionalRCode(clsSjLabelledFunction, iAdditionalPairNo:=3) ucrNewDFName.SetRCode(clsConstructFunction, bReset) + ucrChkIncludeLabel.SetRCode(clsDummyLabelFunction, bReset) + ucrChkVariable.SetRCode(clsDummyVarFunction, bReset) If bReset Then ucrPnlDataFrame.SetRCode(ucrBase.clsRsyntax.clsBaseFunction, bReset) @@ -206,7 +237,7 @@ Public Class dlgNewDataFrame TestOKEnabled() End Sub - Private Sub ucrPnlDataFrame_ControlValueChanged(ucrChangedControl As ucrCore) Handles ucrPnlDataFrame.ControlValueChanged + Private Sub ucrPnlDataFrame_ControlValueChanged(ucrChangedControl As ucrCore) Handles ucrPnlDataFrame.ControlValueChanged, ucrChkVariable.ControlValueChanged, ucrChkIncludeLabel.ControlValueChanged, ucrNewDFName.ControlValueChanged If rdoConstruct.Checked Then btnExample.Text = "Construct Examples" 'this is being done here cause of the datagridview. We don't have its custom control lblCommand.Visible = True @@ -240,18 +271,27 @@ Public Class dlgNewDataFrame btnExample.Visible = False ucrTryNewDataFrame.Visible = False dataGridView.Visible = False - ucrBase.clsRsyntax.SetBaseRFunction(clsEmptyOverallFunction) + If ucrChkVariable.Checked Then + If ucrChkIncludeLabel.Checked Then + clsNewDataFrameFunction.RemoveAssignTo() + ucrBase.clsRsyntax.SetBaseRFunction(clsSjLabelledFunction) + Else + clsNewDataFrameFunction.SetAssignTo(ucrNewDFName.GetText(), strTempDataframe:=ucrNewDFName.GetText()) + ucrBase.clsRsyntax.SetBaseRFunction(clsNewDataFrameFunction) + End If + Else + ucrBase.clsRsyntax.SetBaseRFunction(clsEmptyOverallFunction) + End If End If - autoTranslate(Me) - End Sub - - Private Sub ucrNewDFName_ControlValueChanged(ucrChangedControl As ucrCore) Handles ucrNewDFName.ControlValueChanged If rdoCommand.Checked OrElse rdoRandom.Checked Then ucrBase.clsRsyntax.SetAssignTo(ucrNewDFName.GetText(), strTempDataframe:=ucrNewDFName.GetText()) End If + + dataTypeGridView.Columns("colLabel").Visible = ucrChkIncludeLabel.Checked + autoTranslate(Me) End Sub - Private Sub ucrInputCommand_ContentsChanged() Handles ucrInputCommand.ContentsChanged + Private Sub ucrInputCommand_ControlContentsChanged(ucrChangedControl As ucrCore) Handles ucrInputCommand.ControlContentsChanged ucrTryNewDataFrame.ClearTryText() ucrBase.clsRsyntax.SetCommandString(ucrInputCommand.GetText()) TestOKEnabled() @@ -266,7 +306,7 @@ Public Class dlgNewDataFrame 'used column index instead of column name because of argument exception If Not String.IsNullOrEmpty(row.Cells(1).Value) OrElse Not String.IsNullOrEmpty(row.Cells(2).Value) Then clsConstructFunction.AddParameter(row.Cells(1).Value, row.Cells(2).Value, iPosition:=iPosition) - iPosition = iPosition + 1 + iPosition += 1 End If Next @@ -274,6 +314,123 @@ Public Class dlgNewDataFrame TestOKEnabled() End Sub + Private Sub SampleEmpty() + Dim lstLabels As New List(Of String) + Dim iColPosition As Integer = 0 + clsNewDataFrameFunction.ClearParameters() + For Each row As DataGridViewRow In dataTypeGridView.Rows + 'labels column is optional, so check for empty if it exists + Dim clsColExpRFunction As New RFunction + Dim clsEmptyRepFunction As New RFunction + Dim iRows As Integer = ucrNudRows.Value + Dim strType As String = row.Cells("cbType").Value + If strType IsNot Nothing Then + Select Case strType + Case "Character" + clsColExpRFunction.SetRCommand("as.character") + Case "Numeric" + clsColExpRFunction.SetRCommand("as.numeric") + Case "Factor" + clsColExpRFunction.SetRCommand("factor") + Dim strLevels As String = row.Cells("colLevels").Value + If strLevels <> "" Then + If strLevels.Count(Function(x) x = ":") = 1 Then + If IsNumeric(strLevels.Split(":")(0)) _ + AndAlso IsNumeric(strLevels.Split(":")(1)) Then + clsColExpRFunction.AddParameter("levels", strLevels, iPosition:=1) + End If + Else + clsColExpRFunction.AddParameter("levels", GetLevelsAsRString(strLevels), iPosition:=1) + End If + End If + Case "Integer" + clsColExpRFunction.SetRCommand("as.integer") + Case Else + MsgBox("Developer error: Only expected one predefined item to set the column type.") + End Select + End If + + lstLabels.Add(row.Cells("colLabel").Value) + clsSjLabelledFunction.AddParameter("label", GetLabelAsRString(lstLabels), iPosition:=1) + + clsEmptyRepFunction.SetRCommand("rep") + clsEmptyRepFunction.AddParameter("times", iRows, bIncludeArgumentName:=False, iPosition:=1) + clsEmptyRepFunction.RemoveParameterByName("each") + clsEmptyRepFunction.RemoveParameterByName("length.out") + + Dim strDefault As String = row.Cells("colDefault").Value + If strDefault IsNot Nothing Then + If strDefault = "NA" Then + clsEmptyRepFunction.AddParameter("x", "NA", bIncludeArgumentName:=False, iPosition:=0) + ElseIf IsNumeric(strDefault) Then + clsEmptyRepFunction.AddParameter("x", strDefault, bIncludeArgumentName:=False, iPosition:=0) + Else + clsEmptyRepFunction.AddParameter("x", Chr(34) & strDefault & Chr(34), bIncludeArgumentName:=False, iPosition:=0) + End If + + Dim strColumnName As String = row.Cells("colNames").Value + If (strType = "Integer" OrElse strType = "Numeric") AndAlso Not strDefault = "NA" _ + AndAlso IsNumeric(strDefault) AndAlso strDefault.Contains(",") Then + + Dim clsSeqFunction As New RFunction + clsSeqFunction.SetRCommand("seq") + clsSeqFunction.AddParameter("from", strDefault, bIncludeArgumentName:=False, iPosition:=0) + clsEmptyRepFunction.RemoveParameterByName("times") + clsEmptyRepFunction.AddParameter("x", clsRFunctionParameter:=clsSeqFunction, bIncludeArgumentName:=False, iPosition:=0) + clsEmptyRepFunction.AddParameter("each", "1", iPosition:=1) + clsEmptyRepFunction.AddParameter("length.out", iRows, iPosition:=2) + clsColExpRFunction.AddParameter("x", clsRFunctionParameter:=clsEmptyRepFunction, bIncludeArgumentName:=False, iPosition:=0) + ElseIf strDefault.Contains("LETTERS") OrElse strDefault.Contains("letters") Then + clsColExpRFunction.AddParameter("x", strDefault, bIncludeArgumentName:=False, iPosition:=0) + Else + clsColExpRFunction.AddParameter("x", clsRFunctionParameter:=clsEmptyRepFunction, bIncludeArgumentName:=False, iPosition:=0) + End If + clsNewDataFrameFunction.AddParameter(strColumnName, clsRFunctionParameter:=clsColExpRFunction, iPosition:=iColPosition) + iColPosition += 1 + End If + Next + End Sub + + Private Sub CreateEmptyDataFrame(iCol As Integer) + clsEmptyOverallFunction.ClearParameters() + For i = 1 To iCol + clsEmptyOverallFunction.AddParameter("x" & i, clsRFunctionParameter:=clsAsCharacterFunction, iPosition:=i) + Next + End Sub + + Private Function GetLevelsAsRString(strLevel As String) As String + Dim i As Integer = 0 + Dim strLevels As String() = strLevel.Split(New Char() {","c}) + Dim strTemp As String = "c" & "(" + For Each strCh As String In strLevels + strTemp &= If(i > 0, ",", "") _ + & Chr(34) _ + & If(String.IsNullOrEmpty(strCh), "", strCh.Trim()) _ + & Chr(34) + i += 1 + Next + strTemp &= ")" + + Return strTemp + End Function + + Private Function GetLabelAsRString(lstLabels As List(Of String)) As String + Dim i As Integer + Dim strTemp As String + + strTemp = "c" & "(" + For Each strCh As String In lstLabels + strTemp &= If(i > 0, ",", "") _ + & Chr(34) _ + & If(String.IsNullOrEmpty(strCh), "", strCh.Trim()) _ + & Chr(34) + i += 1 + Next + strTemp &= ")" + + Return strTemp + End Function + Private Sub dataGridView_RowsAdded(sender As Object, e As DataGridViewRowsAddedEventArgs) Handles dataGridView.RowsAdded 'used column index instead of column name because of argument exception For i As Integer = 0 To dataGridView.Rows.Count - 1 @@ -281,6 +438,123 @@ Public Class dlgNewDataFrame Next End Sub + Private Sub dataTypeGridView_ValueChanged(sender As Object, e As EventArgs) Handles dataTypeGridView.CellValueChanged + SampleEmpty() + End Sub + + Private Sub DataGridView_DataError(ByVal sender As Object, ByVal e As DataGridViewDataErrorEventArgs) Handles dataTypeGridView.DataError + If e.Context _ + = (DataGridViewDataErrorContexts.Formatting Or DataGridViewDataErrorContexts.PreferredSize) Then + e.ThrowException = False + End If + End Sub + + Private Sub FillGrid(iRow As Integer, dgrView As DataGridView, bInsert As Boolean) + If bInsert Then + With dgrView.Rows + .Item(iRow).Cells(0).Value = iRow + 1 + .Item(iRow).Cells(1).Value = "x" & (iRow + 1) + .Item(iRow).Cells(2).Value = "Character" + .Item(iRow).Cells(3).Value = "NA" + .Item(iRow).Cells(4).Value = "" + .Item(iRow).Cells(5).Value = "" + End With + Else + For i As Integer = 0 To dgrView.Rows.Count - 1 + With dgrView.Rows + .Item(i).Cells(0).Value = i + 1 + .Item(i).Cells(1).Value = "x" & (i + 1) + .Item(i).Cells(2).Value = "Character" + .Item(i).Cells(3).Value = "NA" + .Item(i).Cells(4).Value = "" + .Item(i).Cells(5).Value = "" + End With + Next + End If + End Sub + + Private Sub ucrNudCols_ControlValueChanged(ucrChangedControl As ucrCore) Handles ucrNudCols.ControlValueChanged + Dim iValue As Integer = ucrNudCols.Value + Dim iRow As Integer = dataTypeGridView.RowCount + If iRow <> 0 Then + If iValue > iRow Then + Dim iNumRowsToInsert As Integer = iValue - iRow + dataTypeGridView.Rows.Insert(iRow, iNumRowsToInsert) + FillGrid(iValue - 1, dataTypeGridView, True) + ElseIf iValue < iRow Then + dataTypeGridView.Rows.RemoveAt(iRow - 1) + End If + End If + CreateEmptyDataFrame(ucrNudCols.Value) + SampleEmpty() + End Sub + + Private Sub dataTypeGridView_CellValidating(sender As Object, e As DataGridViewCellValidatingEventArgs) Handles dataTypeGridView.CellValidating + If e.ColumnIndex = 4 Then + Dim cbLevels = CType(dataTypeGridView.Columns(4), DataGridViewComboBoxColumn) + If Not cbLevels.Items.Contains(e.FormattedValue) Then + cbLevels.Items.Add(e.FormattedValue) + Dim iColumnIndex As Integer = dataTypeGridView.CurrentRow.Cells("colLevels").ColumnIndex + Dim iRowIndex As Integer = dataTypeGridView.CurrentRow.Cells("colLevels").RowIndex + dataTypeGridView(iColumnIndex, iRowIndex).Value = e.FormattedValue + End If + ElseIf e.ColumnIndex = 3 Then + Dim cbDefault = CType(dataTypeGridView.Columns(3), DataGridViewComboBoxColumn) + If Not cbDefault.Items.Contains(e.FormattedValue) Then + cbDefault.Items.Add(e.FormattedValue) + Dim iColumnIndex As Integer = dataTypeGridView.CurrentRow.Cells("colDefault").ColumnIndex + Dim iRowIndex As Integer = dataTypeGridView.CurrentRow.Cells("colDefault").RowIndex + dataTypeGridView(iColumnIndex, iRowIndex).Value = e.FormattedValue + End If + End If + End Sub + + Private Sub ucrNudRows_ControlValueChanged(ucrChangedControl As ucrCore) Handles ucrNudRows.ControlValueChanged + SampleEmpty() + End Sub + + Private Sub UpdateGrid(iRow As Integer, dgrView As DataGridView) + Try + dgrView.Rows.Clear() + dgrView.Rows.Add(iRow) + dgrView.Columns("colLevels").ReadOnly = True + FillGrid(iRow, dgrView, False) + Catch ex As Exception + MsgBox(ex.Message) + End Try + End Sub + + Private Sub dataTypeGridView_CellFormatting(sender As Object, e As DataGridViewCellFormattingEventArgs) Handles dataTypeGridView.CellFormatting + If e.ColumnIndex = dataTypeGridView.Columns("colLevels").Index Then + dataTypeGridView.Rows(e.RowIndex).Cells(e.ColumnIndex).ToolTipText = "Type Levels by separating them with comma e.g A,B,C" + End If + End Sub + + Private Sub dataTypeGridView_EditingControlShowing(sender As Object, e As DataGridViewEditingControlShowingEventArgs) Handles dataTypeGridView.EditingControlShowing + If dataTypeGridView.CurrentCell.GetType Is GetType(DataGridViewComboBoxCell) Then + Dim selectedComboBox As ComboBox = DirectCast(e.Control, ComboBox) + AddHandler selectedComboBox.SelectionChangeCommitted, AddressOf selectedComboBox_SelectionChangeCommitted + If dataTypeGridView.CurrentCell.ColumnIndex = 4 _ + OrElse dataTypeGridView.CurrentCell.ColumnIndex = 3 Then + selectedComboBox.DropDownStyle = ComboBoxStyle.DropDown + End If + End If + End Sub + + Private Sub selectedComboBox_SelectionChangeCommitted(ByVal sender As Object, ByVal e As EventArgs) + If dataTypeGridView.CurrentCell.ColumnIndex = 2 Then + Dim iColumnLevelIndex As Integer = dataTypeGridView.CurrentRow.Cells("colLevels").ColumnIndex + Dim iRowLevelIndex As Integer = dataTypeGridView.CurrentRow.Cells("colLevels").RowIndex + Dim selectedCombobox As ComboBox = DirectCast(sender, ComboBox) + If selectedCombobox.SelectedItem = "Factor" Then + dataTypeGridView(iColumnLevelIndex, iRowLevelIndex).ReadOnly = False + Else + dataTypeGridView(iColumnLevelIndex, iRowLevelIndex).ReadOnly = True + dataTypeGridView(iColumnLevelIndex, iRowLevelIndex).Value = "" + End If + End If + End Sub + Private Sub btnExample_Click(sender As Object, e As EventArgs) Handles btnExample.Click 'shows a popup that displays the example commands Dim frm As New Form @@ -419,4 +693,26 @@ Public Class dlgNewDataFrame frm.Show() End Sub + Private Sub dataTypeGridView_KeyUp(sender As Object, e As KeyEventArgs) Handles dataTypeGridView.KeyUp + Dim i As Integer = 0 + Dim strColName As String = dataTypeGridView.Columns(dataTypeGridView.CurrentCell.ColumnIndex).HeaderText + If e.Control AndAlso e.KeyCode = Keys.V AndAlso (strColName = "Name" OrElse strColName = "Label") Then + Try + For Each element As String In Clipboard.GetText.Split(vbNewLine) + If Not element.Trim.ToString = "" Then + Dim strLabel() As String = element.Split(vbTab(0)) + Dim strValue As String = strLabel(0).Replace(vbLf, "") + If strColName = "Name" Then + dataTypeGridView.Rows.Item(i).Cells(1).Value = strValue + ElseIf strColName = "Label" Then + dataTypeGridView.Rows.Item(i).Cells(5).Value = strValue + End If + i += 1 + End If + Next + Catch ex As Exception + MessageBox.Show(ex.Message, My.Application.Info.Title, MessageBoxButtons.OK, MessageBoxIcon.Error) + End Try + End If + End Sub End Class diff --git a/instat/dlgOneVariableSummarise.Designer.vb b/instat/dlgOneVariableSummarise.Designer.vb index 144fd9819f6..cc66302a47f 100644 --- a/instat/dlgOneVariableSummarise.Designer.vb +++ b/instat/dlgOneVariableSummarise.Designer.vb @@ -41,21 +41,25 @@ Partial Class dlgOneVariableSummarise Me.lblSelectedVariable = New System.Windows.Forms.Label() Me.lblMaxSum = New System.Windows.Forms.Label() Me.cmdSummaries = New System.Windows.Forms.Button() - Me.lblSummaries = New System.Windows.Forms.Label() - Me.rdoDefault = New System.Windows.Forms.RadioButton() Me.rdoCustomised = New System.Windows.Forms.RadioButton() + Me.rdoDefault = New System.Windows.Forms.RadioButton() + Me.ucrPnlSummaries = New instat.UcrPanel() + Me.ucrChkDisplaySummariesAsRows = New instat.ucrCheck() + Me.ucrChkDisplayVariablesAsRows = New instat.ucrCheck() Me.ucrNudMaxSum = New instat.ucrNud() Me.ucrChkOmitMissing = New instat.ucrCheck() Me.ucrSelectorOneVarSummarise = New instat.ucrSelectorByDataFrameAddRemove() Me.ucrReceiverOneVarSummarise = New instat.ucrReceiverMultiple() Me.ucrBase = New instat.ucrButtons() - Me.ucrPnlSummaries = New instat.UcrPanel() + Me.ucrInputMarginName = New instat.ucrInputTextBox() + Me.lblMarginName = New System.Windows.Forms.Label() + Me.ucrChkDisplayMargins = New instat.ucrCheck() Me.SuspendLayout() ' 'lblSelectedVariable ' Me.lblSelectedVariable.ImeMode = System.Windows.Forms.ImeMode.NoControl - Me.lblSelectedVariable.Location = New System.Drawing.Point(258, 46) + Me.lblSelectedVariable.Location = New System.Drawing.Point(258, 64) Me.lblSelectedVariable.Name = "lblSelectedVariable" Me.lblSelectedVariable.Size = New System.Drawing.Size(142, 14) Me.lblSelectedVariable.TabIndex = 1 @@ -65,9 +69,9 @@ Partial Class dlgOneVariableSummarise 'lblMaxSum ' Me.lblMaxSum.ImeMode = System.Windows.Forms.ImeMode.NoControl - Me.lblMaxSum.Location = New System.Drawing.Point(10, 236) + Me.lblMaxSum.Location = New System.Drawing.Point(13, 253) Me.lblMaxSum.Name = "lblMaxSum" - Me.lblMaxSum.Size = New System.Drawing.Size(187, 19) + Me.lblMaxSum.Size = New System.Drawing.Size(189, 24) Me.lblMaxSum.TabIndex = 7 Me.lblMaxSum.Text = "Maximum Factor Levels Shown:" ' @@ -75,7 +79,7 @@ Partial Class dlgOneVariableSummarise ' Me.cmdSummaries.AutoSize = True Me.cmdSummaries.ImeMode = System.Windows.Forms.ImeMode.NoControl - Me.cmdSummaries.Location = New System.Drawing.Point(261, 197) + Me.cmdSummaries.Location = New System.Drawing.Point(261, 215) Me.cmdSummaries.Name = "cmdSummaries" Me.cmdSummaries.Size = New System.Drawing.Size(120, 23) Me.cmdSummaries.TabIndex = 6 @@ -83,46 +87,72 @@ Partial Class dlgOneVariableSummarise Me.cmdSummaries.Text = "Choose Summaries..." Me.cmdSummaries.UseVisualStyleBackColor = True ' - 'lblSummaries + 'rdoCustomised ' - Me.lblSummaries.AutoSize = True - Me.lblSummaries.ImeMode = System.Windows.Forms.ImeMode.NoControl - Me.lblSummaries.Location = New System.Drawing.Point(10, 205) - Me.lblSummaries.Name = "lblSummaries" - Me.lblSummaries.Size = New System.Drawing.Size(61, 13) - Me.lblSummaries.TabIndex = 3 - Me.lblSummaries.Text = "Summaries:" + Me.rdoCustomised.Appearance = System.Windows.Forms.Appearance.Button + Me.rdoCustomised.FlatAppearance.BorderColor = System.Drawing.SystemColors.ActiveCaption + Me.rdoCustomised.FlatAppearance.BorderSize = 2 + Me.rdoCustomised.FlatAppearance.CheckedBackColor = System.Drawing.SystemColors.ActiveCaption + Me.rdoCustomised.FlatStyle = System.Windows.Forms.FlatStyle.Flat + Me.rdoCustomised.ImeMode = System.Windows.Forms.ImeMode.NoControl + Me.rdoCustomised.Location = New System.Drawing.Point(200, 12) + Me.rdoCustomised.Name = "rdoCustomised" + Me.rdoCustomised.Size = New System.Drawing.Size(128, 27) + Me.rdoCustomised.TabIndex = 22 + Me.rdoCustomised.TabStop = True + Me.rdoCustomised.Text = "Customised" + Me.rdoCustomised.TextAlign = System.Drawing.ContentAlignment.MiddleCenter + Me.rdoCustomised.UseVisualStyleBackColor = True ' 'rdoDefault ' - Me.rdoDefault.AutoSize = True + Me.rdoDefault.Appearance = System.Windows.Forms.Appearance.Button + Me.rdoDefault.FlatAppearance.BorderColor = System.Drawing.SystemColors.ActiveCaption + Me.rdoDefault.FlatAppearance.BorderSize = 2 + Me.rdoDefault.FlatAppearance.CheckedBackColor = System.Drawing.SystemColors.ActiveCaption + Me.rdoDefault.FlatStyle = System.Windows.Forms.FlatStyle.Flat Me.rdoDefault.ImeMode = System.Windows.Forms.ImeMode.NoControl - Me.rdoDefault.Location = New System.Drawing.Point(79, 203) + Me.rdoDefault.Location = New System.Drawing.Point(77, 12) Me.rdoDefault.Name = "rdoDefault" - Me.rdoDefault.Size = New System.Drawing.Size(59, 17) - Me.rdoDefault.TabIndex = 4 + Me.rdoDefault.Size = New System.Drawing.Size(125, 27) + Me.rdoDefault.TabIndex = 21 Me.rdoDefault.TabStop = True - Me.rdoDefault.Text = "Default" + Me.rdoDefault.Text = "Defaults" + Me.rdoDefault.TextAlign = System.Drawing.ContentAlignment.MiddleCenter Me.rdoDefault.UseVisualStyleBackColor = True ' - 'rdoCustomised + 'ucrPnlSummaries ' - Me.rdoCustomised.AutoSize = True - Me.rdoCustomised.ImeMode = System.Windows.Forms.ImeMode.NoControl - Me.rdoCustomised.Location = New System.Drawing.Point(157, 203) - Me.rdoCustomised.Name = "rdoCustomised" - Me.rdoCustomised.Size = New System.Drawing.Size(79, 17) - Me.rdoCustomised.TabIndex = 5 - Me.rdoCustomised.TabStop = True - Me.rdoCustomised.Text = "Customised" - Me.rdoCustomised.UseVisualStyleBackColor = True + Me.ucrPnlSummaries.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink + Me.ucrPnlSummaries.Location = New System.Drawing.Point(75, 11) + Me.ucrPnlSummaries.Name = "ucrPnlSummaries" + Me.ucrPnlSummaries.Size = New System.Drawing.Size(255, 29) + Me.ucrPnlSummaries.TabIndex = 20 + ' + 'ucrChkDisplaySummariesAsRows + ' + Me.ucrChkDisplaySummariesAsRows.AutoSize = True + Me.ucrChkDisplaySummariesAsRows.Checked = False + Me.ucrChkDisplaySummariesAsRows.Location = New System.Drawing.Point(10, 267) + Me.ucrChkDisplaySummariesAsRows.Name = "ucrChkDisplaySummariesAsRows" + Me.ucrChkDisplaySummariesAsRows.Size = New System.Drawing.Size(241, 23) + Me.ucrChkDisplaySummariesAsRows.TabIndex = 19 + ' + 'ucrChkDisplayVariablesAsRows + ' + Me.ucrChkDisplayVariablesAsRows.AutoSize = True + Me.ucrChkDisplayVariablesAsRows.Checked = False + Me.ucrChkDisplayVariablesAsRows.Location = New System.Drawing.Point(10, 290) + Me.ucrChkDisplayVariablesAsRows.Name = "ucrChkDisplayVariablesAsRows" + Me.ucrChkDisplayVariablesAsRows.Size = New System.Drawing.Size(227, 23) + Me.ucrChkDisplayVariablesAsRows.TabIndex = 18 ' 'ucrNudMaxSum ' Me.ucrNudMaxSum.AutoSize = True Me.ucrNudMaxSum.DecimalPlaces = New Decimal(New Integer() {0, 0, 0, 0}) Me.ucrNudMaxSum.Increment = New Decimal(New Integer() {1, 0, 0, 0}) - Me.ucrNudMaxSum.Location = New System.Drawing.Point(261, 235) + Me.ucrNudMaxSum.Location = New System.Drawing.Point(261, 248) Me.ucrNudMaxSum.Maximum = New Decimal(New Integer() {100, 0, 0, 0}) Me.ucrNudMaxSum.Minimum = New Decimal(New Integer() {0, 0, 0, 0}) Me.ucrNudMaxSum.Name = "ucrNudMaxSum" @@ -134,7 +164,7 @@ Partial Class dlgOneVariableSummarise ' Me.ucrChkOmitMissing.AutoSize = True Me.ucrChkOmitMissing.Checked = False - Me.ucrChkOmitMissing.Location = New System.Drawing.Point(14, 235) + Me.ucrChkOmitMissing.Location = New System.Drawing.Point(10, 314) Me.ucrChkOmitMissing.Name = "ucrChkOmitMissing" Me.ucrChkOmitMissing.Size = New System.Drawing.Size(241, 23) Me.ucrChkOmitMissing.TabIndex = 9 @@ -145,7 +175,7 @@ Partial Class dlgOneVariableSummarise Me.ucrSelectorOneVarSummarise.bDropUnusedFilterLevels = False Me.ucrSelectorOneVarSummarise.bShowHiddenColumns = False Me.ucrSelectorOneVarSummarise.bUseCurrentFilter = True - Me.ucrSelectorOneVarSummarise.Location = New System.Drawing.Point(10, 10) + Me.ucrSelectorOneVarSummarise.Location = New System.Drawing.Point(10, 55) Me.ucrSelectorOneVarSummarise.Margin = New System.Windows.Forms.Padding(0) Me.ucrSelectorOneVarSummarise.Name = "ucrSelectorOneVarSummarise" Me.ucrSelectorOneVarSummarise.Size = New System.Drawing.Size(213, 183) @@ -155,7 +185,7 @@ Partial Class dlgOneVariableSummarise ' Me.ucrReceiverOneVarSummarise.AutoSize = True Me.ucrReceiverOneVarSummarise.frmParent = Me - Me.ucrReceiverOneVarSummarise.Location = New System.Drawing.Point(261, 60) + Me.ucrReceiverOneVarSummarise.Location = New System.Drawing.Point(261, 82) Me.ucrReceiverOneVarSummarise.Margin = New System.Windows.Forms.Padding(0) Me.ucrReceiverOneVarSummarise.Name = "ucrReceiverOneVarSummarise" Me.ucrReceiverOneVarSummarise.Selector = Nothing @@ -168,28 +198,55 @@ Partial Class dlgOneVariableSummarise ' Me.ucrBase.AutoSize = True Me.ucrBase.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink - Me.ucrBase.Location = New System.Drawing.Point(10, 273) + Me.ucrBase.Location = New System.Drawing.Point(8, 336) Me.ucrBase.Name = "ucrBase" - Me.ucrBase.Size = New System.Drawing.Size(405, 52) + Me.ucrBase.Size = New System.Drawing.Size(408, 52) Me.ucrBase.TabIndex = 11 ' - 'ucrPnlSummaries + 'ucrInputMarginName ' - Me.ucrPnlSummaries.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink - Me.ucrPnlSummaries.Location = New System.Drawing.Point(10, 192) - Me.ucrPnlSummaries.Name = "ucrPnlSummaries" - Me.ucrPnlSummaries.Size = New System.Drawing.Size(352, 37) - Me.ucrPnlSummaries.TabIndex = 12 + Me.ucrInputMarginName.AddQuotesIfUnrecognised = True + Me.ucrInputMarginName.AutoSize = True + Me.ucrInputMarginName.IsMultiline = False + Me.ucrInputMarginName.IsReadOnly = False + Me.ucrInputMarginName.Location = New System.Drawing.Point(206, 243) + Me.ucrInputMarginName.Name = "ucrInputMarginName" + Me.ucrInputMarginName.Size = New System.Drawing.Size(74, 21) + Me.ucrInputMarginName.TabIndex = 25 + ' + 'lblMarginName + ' + Me.lblMarginName.AutoSize = True + Me.lblMarginName.ImeMode = System.Windows.Forms.ImeMode.NoControl + Me.lblMarginName.Location = New System.Drawing.Point(159, 246) + Me.lblMarginName.Name = "lblMarginName" + Me.lblMarginName.Size = New System.Drawing.Size(41, 13) + Me.lblMarginName.TabIndex = 24 + Me.lblMarginName.Text = "Name :" + ' + 'ucrChkDisplayMargins + ' + Me.ucrChkDisplayMargins.AutoSize = True + Me.ucrChkDisplayMargins.Checked = False + Me.ucrChkDisplayMargins.Location = New System.Drawing.Point(10, 246) + Me.ucrChkDisplayMargins.Name = "ucrChkDisplayMargins" + Me.ucrChkDisplayMargins.Size = New System.Drawing.Size(150, 23) + Me.ucrChkDisplayMargins.TabIndex = 23 ' 'dlgOneVariableSummarise ' 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(421, 327) + Me.ClientSize = New System.Drawing.Size(421, 395) + Me.Controls.Add(Me.ucrInputMarginName) + Me.Controls.Add(Me.lblMarginName) + Me.Controls.Add(Me.ucrChkDisplayMargins) Me.Controls.Add(Me.rdoCustomised) Me.Controls.Add(Me.rdoDefault) - Me.Controls.Add(Me.lblSummaries) + Me.Controls.Add(Me.ucrPnlSummaries) + Me.Controls.Add(Me.ucrChkDisplaySummariesAsRows) + Me.Controls.Add(Me.ucrChkDisplayVariablesAsRows) Me.Controls.Add(Me.ucrNudMaxSum) Me.Controls.Add(Me.ucrChkOmitMissing) Me.Controls.Add(Me.ucrSelectorOneVarSummarise) @@ -197,7 +254,6 @@ Partial Class dlgOneVariableSummarise Me.Controls.Add(Me.ucrBase) Me.Controls.Add(Me.lblSelectedVariable) Me.Controls.Add(Me.cmdSummaries) - Me.Controls.Add(Me.ucrPnlSummaries) Me.Controls.Add(Me.lblMaxSum) Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow Me.MaximizeBox = False @@ -219,8 +275,12 @@ Partial Class dlgOneVariableSummarise Friend WithEvents lblMaxSum As Label Friend WithEvents ucrNudMaxSum As ucrNud Friend WithEvents cmdSummaries As Button + Friend WithEvents ucrChkDisplaySummariesAsRows As ucrCheck + Friend WithEvents ucrChkDisplayVariablesAsRows As ucrCheck + Friend WithEvents ucrPnlSummaries As UcrPanel Friend WithEvents rdoCustomised As RadioButton Friend WithEvents rdoDefault As RadioButton - Friend WithEvents lblSummaries As Label - Friend WithEvents ucrPnlSummaries As UcrPanel + Friend WithEvents ucrInputMarginName As ucrInputTextBox + Friend WithEvents lblMarginName As Label + Friend WithEvents ucrChkDisplayMargins As ucrCheck End Class \ No newline at end of file diff --git a/instat/dlgOneVariableSummarise.vb b/instat/dlgOneVariableSummarise.vb index 08aa1517293..7a4a975217a 100644 --- a/instat/dlgOneVariableSummarise.vb +++ b/instat/dlgOneVariableSummarise.vb @@ -20,7 +20,12 @@ Imports instat.Translations Public Class dlgOneVariableSummarise Private bFirstLoad As Boolean = True Private bReset As Boolean = True - Private clsSummaryFunction, clsSummariesList, clsInstatSummaryFunction, clsConcFunction As New RFunction + Private bRCodeSet As Boolean = True + Private clsSummaryFunction, clsSummariesList, clsMmtableFunction, + clsConcFunction, clsSummaryTableFunction, clsHeaderLeftTopVariableFunction, + clsHeaderLeftTopSummaryFunction, clsHeaderTopLeftVariableFunction, + clsHeaderTopLeftSummaryFunction, clsDummyFunction As New RFunction + Private clsMmtableOperator As ROperator Private bResetSubdialog As Boolean = False Public strDefaultDataFrame As String = "" Public strDefaultColumns() As String = Nothing @@ -58,28 +63,85 @@ Public Class dlgOneVariableSummarise ucrPnlSummaries.AddRadioButton(rdoDefault) ucrPnlSummaries.AddRadioButton(rdoCustomised) - ucrPnlSummaries.AddFunctionNamesCondition(rdoCustomised, frmMain.clsRLink.strInstatDataObject & "$summary") - ucrPnlSummaries.AddFunctionNamesCondition(rdoDefault, "summary") + ucrPnlSummaries.AddParameterValuesCondition(rdoCustomised, "checked_radio", "customised") + ucrPnlSummaries.AddParameterValuesCondition(rdoDefault, "checked_radio", "defaults") ucrPnlSummaries.AddToLinkedControls(ucrNudMaxSum, {rdoDefault}, bNewLinkedAddRemoveParameter:=True, bNewLinkedHideIfParameterMissing:=True) - ucrPnlSummaries.AddToLinkedControls(ucrChkOmitMissing, {rdoCustomised}, bNewLinkedAddRemoveParameter:=True, bNewLinkedHideIfParameterMissing:=True) + ucrPnlSummaries.AddToLinkedControls({ucrChkOmitMissing, ucrChkDisplaySummariesAsRows, ucrChkDisplayVariablesAsRows, ucrChkDisplayMargins}, + {rdoCustomised}, bNewLinkedHideIfParameterMissing:=True) ucrChkOmitMissing.SetParameter(New RParameter("na.rm", 3)) ucrChkOmitMissing.SetText("Omit Missing Values") ucrChkOmitMissing.SetRDefault("FALSE") ucrChkOmitMissing.SetValuesCheckedAndUnchecked("TRUE", "FALSE") ucrChkOmitMissing.bUpdateRCodeFromControl = True + + ucrChkDisplayMargins.SetParameter(New RParameter("include_margins", 3)) + ucrChkDisplayMargins.SetText("Display Outer Margins") + ucrChkDisplayMargins.SetRDefault("FALSE") + ucrChkDisplayMargins.AddToLinkedControls({ucrInputMarginName}, {True}, bNewLinkedAddRemoveParameter:=True, bNewLinkedUpdateFunction:=True, + bNewLinkedHideIfParameterMissing:=True, bNewLinkedChangeToDefaultState:=True, objNewDefaultState:="All") + + ucrInputMarginName.SetParameter(New RParameter("margin_name", iNewPosition:=4)) + ucrInputMarginName.SetLinkedDisplayControl(lblMarginName) + + ucrChkDisplaySummariesAsRows.SetText("Display Summaries As Rows") + ucrChkDisplaySummariesAsRows.AddParameterValuesCondition(True, "summary_by_row", "TRUE") + ucrChkDisplaySummariesAsRows.AddParameterValuesCondition(False, "summary_by_row", "FALSE") + + ucrChkDisplayVariablesAsRows.SetText("Display Variables As Rows") + ucrChkDisplayVariablesAsRows.AddParameterValuesCondition(True, "variable_by_row", "TRUE") + ucrChkDisplayVariablesAsRows.AddParameterPresentCondition(False, "variable_by_row", "FALSE") End Sub Private Sub SetDefaults() clsSummariesList = New RFunction clsSummaryFunction = New RFunction - clsInstatSummaryFunction = New RFunction clsConcFunction = New RFunction + clsSummaryTableFunction = New RFunction + clsMmtableOperator = New ROperator + clsMmtableFunction = New RFunction + clsHeaderLeftTopVariableFunction = New RFunction + clsHeaderLeftTopSummaryFunction = New RFunction + clsHeaderTopLeftVariableFunction = New RFunction + clsHeaderTopLeftSummaryFunction = New RFunction + clsDummyFunction = New RFunction ucrSelectorOneVarSummarise.Reset() + ucrBase.clsRsyntax.lstBeforeCodes.Clear() + + 'Dummy function used t set conditions for the summary and variable checkbox + clsDummyFunction.AddParameter("variable_by_row", "TRUE", iPosition:=0) + clsDummyFunction.AddParameter("summary_by_row", "FALSE", iPosition:=1) + clsDummyFunction.AddParameter("checked_radio", "defaults", iPosition:=2) clsConcFunction.SetRCommand("c") + clsMmtableOperator.SetOperation("+") + clsMmtableOperator.AddParameter("mmtable_function", clsRFunctionParameter:=clsMmtableFunction, iPosition:=0) + clsMmtableOperator.AddParameter("header_left_top_variable", clsRFunctionParameter:=clsHeaderLeftTopVariableFunction, iPosition:=1) + clsMmtableOperator.AddParameter("header_top_left_summary", clsRFunctionParameter:=clsHeaderTopLeftSummaryFunction, iPosition:=2) + + clsHeaderLeftTopVariableFunction.SetPackageName("mmtable2") + clsHeaderLeftTopVariableFunction.SetRCommand("header_left_top") + clsHeaderLeftTopVariableFunction.AddParameter("variable", Chr(39) & "variable" & Chr(39), iPosition:=0) + + clsHeaderLeftTopSummaryFunction.SetPackageName("mmtable2") + clsHeaderLeftTopSummaryFunction.SetRCommand("header_left_top") + clsHeaderLeftTopSummaryFunction.AddParameter("variable", Chr(39) & "summary" & Chr(39), iPosition:=0) + + clsHeaderTopLeftVariableFunction.SetPackageName("mmtable2") + clsHeaderTopLeftVariableFunction.SetRCommand("header_top_left") + clsHeaderTopLeftVariableFunction.AddParameter("variable", Chr(39) & "variable" & Chr(39), iPosition:=0) + + clsHeaderTopLeftSummaryFunction.SetPackageName("mmtable2") + clsHeaderTopLeftSummaryFunction.SetRCommand("header_top_left") + clsHeaderTopLeftSummaryFunction.AddParameter("variable", Chr(39) & "summary" & Chr(39), iPosition:=0) + + clsMmtableFunction.SetPackageName("mmtable2") + clsMmtableFunction.SetRCommand("mmtable") + clsMmtableFunction.AddParameter("data", clsRFunctionParameter:=clsSummaryTableFunction, iPosition:=0) + clsMmtableFunction.AddParameter("cells", "value", iPosition:=1) + clsSummariesList.SetRCommand("c") clsSummariesList.AddParameter("summary_count_non_missing", Chr(34) & "summary_count_non_missing" & Chr(34), bIncludeArgumentName:=False) clsSummariesList.AddParameter("summary_count", Chr(34) & "summary_count" & Chr(34), bIncludeArgumentName:=False) @@ -89,22 +151,28 @@ Public Class dlgOneVariableSummarise clsSummaryFunction.AddParameter("maxsum", 7) clsSummaryFunction.AddParameter("na.rm", "FALSE", iPosition:=3) - clsInstatSummaryFunction.SetRCommand(frmMain.clsRLink.strInstatDataObject & "$summary") - clsInstatSummaryFunction.AddParameter("return_output", "TRUE") - clsInstatSummaryFunction.AddParameter("summaries", clsRFunctionParameter:=clsSummariesList) + clsSummaryTableFunction.SetRCommand(frmMain.clsRLink.strInstatDataObject & "$summary_table") + clsSummaryTableFunction.AddParameter("treat_columns_as_factor", "TRUE", iPosition:=0) + clsSummaryTableFunction.AddParameter("margins", Chr(34) & "summary" & Chr(34), iPosition:=1) + clsSummaryTableFunction.AddParameter("summaries", clsRFunctionParameter:=clsSummariesList, iPosition:=2) + clsSummaryTableFunction.SetAssignTo("summary_table") ucrBase.clsRsyntax.SetBaseRFunction(clsSummaryFunction) bResetSubdialog = True End Sub Private Sub SetRCodeForControls(bReset As Boolean) - ucrChkOmitMissing.AddAdditionalCodeParameterPair(clsInstatSummaryFunction, ucrChkOmitMissing.GetParameter(), iAdditionalPairNo:=1) + bRCodeSet = False + ucrChkOmitMissing.AddAdditionalCodeParameterPair(clsSummaryTableFunction, New RParameter("na.rm", iNewPosition:=2), iAdditionalPairNo:=1) ucrNudMaxSum.SetRCode(clsSummaryFunction, bReset) ucrReceiverOneVarSummarise.SetRCode(clsSummaryFunction, bReset) ucrChkOmitMissing.SetRCode(clsSummaryFunction, bReset) - ucrPnlSummaries.SetRCode(ucrBase.clsRsyntax.clsBaseFunction, bReset) - ucrSelectorOneVarSummarise.SetRCode(clsInstatSummaryFunction, bReset) - ChangeBaseFunction() + ucrChkDisplayMargins.SetRCode(clsSummaryTableFunction, bReset) + ucrPnlSummaries.SetRCode(clsDummyFunction, bReset) + ucrSelectorOneVarSummarise.SetRCode(clsSummaryTableFunction, bReset) + ucrChkDisplayVariablesAsRows.SetRCode(clsDummyFunction, bReset) + ucrChkDisplaySummariesAsRows.SetRCode(clsDummyFunction, bReset) + bRCodeSet = True End Sub Public Sub TestOKEnabled() @@ -123,7 +191,7 @@ Public Class dlgOneVariableSummarise End Sub Private Sub cmdSummaries_Click(sender As Object, e As EventArgs) Handles cmdSummaries.Click - sdgSummaries.SetRFunction(clsSummariesList, clsInstatSummaryFunction, clsConcFunction, ucrSelectorOneVarSummarise, bResetSubdialog) + sdgSummaries.SetRFunction(clsSummariesList, clsSummaryTableFunction, clsConcFunction, ucrSelectorOneVarSummarise, bResetSubdialog) bResetSubdialog = False sdgSummaries.bEnable2VariableTab = False sdgSummaries.ShowDialog() @@ -131,21 +199,11 @@ Public Class dlgOneVariableSummarise TestOKEnabled() End Sub - Private Sub ChangeBaseFunction() - If rdoCustomised.Checked Then - ucrBase.clsRsyntax.SetBaseRFunction(clsInstatSummaryFunction) - cmdSummaries.Visible = True - ElseIf rdoDefault.Checked Then - ucrBase.clsRsyntax.SetBaseRFunction(clsSummaryFunction) - cmdSummaries.Visible = False - End If - End Sub - Private Sub ucrReceiverDescribeOneVar_ControlValueChanged(ucrChangedControl As ucrCore) Handles ucrReceiverOneVarSummarise.ControlValueChanged If Not ucrReceiverOneVarSummarise.IsEmpty Then - clsInstatSummaryFunction.AddParameter("columns_to_summarise", ucrReceiverOneVarSummarise.GetVariableNames()) + clsSummaryTableFunction.AddParameter("columns_to_summarise", ucrReceiverOneVarSummarise.GetVariableNames(), iPosition:=4) Else - clsInstatSummaryFunction.RemoveParameterByName("columns_to_summarise") + clsSummaryTableFunction.RemoveParameterByName("columns_to_summarise") End If End Sub @@ -162,11 +220,55 @@ Public Class dlgOneVariableSummarise strDefaultColumns = Nothing End Sub - Private Sub Controls_ControlContentsChanged(ucrChangedControl As ucrCore) Handles ucrReceiverOneVarSummarise.ControlContentsChanged, ucrNudMaxSum.ControlContentsChanged, ucrPnlSummaries.ControlValueChanged + Private Sub Controls_ControlContentsChanged(ucrChangedControl As ucrCore) Handles ucrReceiverOneVarSummarise.ControlContentsChanged, ucrNudMaxSum.ControlContentsChanged TestOKEnabled() End Sub Private Sub ucrPnlSummaries_ControlValueChanged(ucrChangedControl As ucrCore) Handles ucrPnlSummaries.ControlValueChanged - ChangeBaseFunction() + If rdoCustomised.Checked Then + clsDummyFunction.AddParameter("checked_radio", "customised", iPosition:=2) + ucrBase.clsRsyntax.SetBaseROperator(clsMmtableOperator) + cmdSummaries.Visible = True + Else + clsDummyFunction.AddParameter("checked_radio", "defaults", iPosition:=2) + ucrBase.clsRsyntax.SetBaseRFunction(clsSummaryFunction) + cmdSummaries.Visible = False + End If + End Sub + + Private Sub ucrChkDisplayVariablesAsRows_ControlValueChanged(ucrChangedControl As ucrCore) Handles ucrChkDisplayVariablesAsRows.ControlValueChanged, ucrChkDisplaySummariesAsRows.ControlValueChanged + If bRCodeSet Then + clsMmtableOperator.RemoveParameterByName("header_left_top_variable") + clsMmtableOperator.RemoveParameterByName("header_top_left_summary") + clsMmtableOperator.RemoveParameterByName("header_left_top_summaries") + clsMmtableOperator.RemoveParameterByName("header_top_left_variable") + clsMmtableOperator.RemoveParameterByName("header_left_top_summary") + clsMmtableOperator.RemoveParameterByName("header_top__left_summary") + If ucrChkDisplaySummariesAsRows.Checked AndAlso ucrChkDisplayVariablesAsRows.Checked Then + clsMmtableOperator.AddParameter("header_left_top_variable", clsRFunctionParameter:=clsHeaderLeftTopVariableFunction, iPosition:=1) + clsMmtableOperator.AddParameter("header_left_top_summary", clsRFunctionParameter:=clsHeaderLeftTopSummaryFunction, iPosition:=2) + ElseIf ucrChkDisplayVariablesAsRows.Checked Then + clsMmtableOperator.AddParameter("header_left_top_variable", clsRFunctionParameter:=clsHeaderLeftTopVariableFunction, iPosition:=1) + clsMmtableOperator.AddParameter("header_top_left_summary", clsRFunctionParameter:=clsHeaderTopLeftSummaryFunction, iPosition:=2) + ElseIf ucrChkDisplaySummariesAsRows.Checked Then + clsMmtableOperator.AddParameter("header_left_top_summaries", clsRFunctionParameter:=clsHeaderLeftTopSummaryFunction, iPosition:=1) + clsMmtableOperator.AddParameter("header_top_left_variable", clsRFunctionParameter:=clsHeaderTopLeftVariableFunction, iPosition:=2) + Else + clsMmtableOperator.AddParameter("header_top_left_variable", clsRFunctionParameter:=clsHeaderTopLeftVariableFunction, iPosition:=1) + clsMmtableOperator.AddParameter("header_top__left_summary", clsRFunctionParameter:=clsHeaderTopLeftSummaryFunction, iPosition:=2) + End If + + If ucrChkDisplayVariablesAsRows.Checked Then + clsDummyFunction.AddParameter("variable_by_row", "TRUE", iPosition:=0) + Else + clsDummyFunction.AddParameter("variable_by_row", "FALSE", iPosition:=0) + End If + + If ucrChkDisplaySummariesAsRows.Checked Then + clsDummyFunction.AddParameter("summary_by_row", "TRUE", iPosition:=1) + Else + clsDummyFunction.AddParameter("summary_by_row", "FALSE", iPosition:=1) + End If + End If End Sub -End Class +End Class \ No newline at end of file diff --git a/instat/dlgOptionsByContextFItModel.vb b/instat/dlgOptionsByContextFItModel.vb index 28c1c040e33..424447c7f5b 100644 --- a/instat/dlgOptionsByContextFItModel.vb +++ b/instat/dlgOptionsByContextFItModel.vb @@ -28,13 +28,13 @@ Public Class dlgOptionsByContextFitModel Public bDefaultsSet As Boolean = False Public clsFamilyFunction, clsVisReg As New RFunction - Public clsRSingleModelFunction, clsFormulaFunction, clsAnovaFunction, clsSummaryFunction, clsConfint As RFunction - Public clsGLM, clsLM, clsLMOrGLM, clsAsNumeric As RFunction + Public clsRSingleModelFunction, clsFormulaFunction, clsAnovaFunction, clsSummaryFunction, clsConfint As New RFunction + Public clsGLM, clsLM, clsLMOrGLM, clsAsNumeric As New RFunction 'Saving Operators/Functions Private clsRstandardFunction, clsHatvaluesFunction, clsResidualFunction, clsFittedValuesFunction As New RFunction - Public clsModelFormula As ROperator + Public clsModelFormula As New ROperator Private clsOverallInteractions As New ROperator Private clsContextsInteractions As New ROperator Private clsBlockingContextsAddition As New ROperator diff --git a/instat/dlgPICSARainfall.vb b/instat/dlgPICSARainfall.vb index 5623f36abe6..6171e729e4b 100644 --- a/instat/dlgPICSARainfall.vb +++ b/instat/dlgPICSARainfall.vb @@ -852,18 +852,30 @@ Public Class dlgPICSARainfall SetPipeAssignTo() End Sub + Private Sub GetParameterValue(clsOperator As ROperator) + Dim i As Integer = 0 + For Each clsTempParam As RParameter In clsOperator.clsParameters + If clsTempParam.strArgumentValue <> "" AndAlso clsTempParam.strArgumentValue <> "." Then + clsGroupByFunction.AddParameter(i, clsTempParam.strArgumentValue, bIncludeArgumentName:=False, iPosition:=i) + i = i + 1 + End If + Next + End Sub + Private Sub AddRemoveGroupBy() Dim i As Integer = 0 If clsPipeOperator.ContainsParameter("mutate") Then clsGroupByFunction.ClearParameters() If clsBaseOperator.ContainsParameter("facets") Then - For Each clsTempParam As RParameter In clsFacetOperator.clsParameters - If clsTempParam.strArgumentValue <> "" AndAlso clsTempParam.strArgumentValue <> "." Then - clsGroupByFunction.AddParameter(i, clsTempParam.strArgumentValue, bIncludeArgumentName:=False, iPosition:=i) - i = i + 1 - End If - Next + Select Case ucrInputStation.GetText() + Case strFacetWrap + GetParameterValue(clsFacetOperator) + Case strFacetCol + GetParameterValue(clsFacetColOp) + Case strFacetRow + GetParameterValue(clsFacetRowOp) + End Select End If If clsRaesFunction.ContainsParameter("colour") Then diff --git a/instat/dlgPermuteColumn.Designer.vb b/instat/dlgPermuteColumn.Designer.vb index 5a2befaba87..b44647e1528 100644 --- a/instat/dlgPermuteColumn.Designer.vb +++ b/instat/dlgPermuteColumn.Designer.vb @@ -47,6 +47,7 @@ Partial Class dlgPermuteColumn Me.ucrReceiverPermuteRows = New instat.ucrReceiverSingle() Me.ucrPermuteRowsSelector = New instat.ucrSelectorByDataFrameAddRemove() Me.ucrBase = New instat.ucrButtons() + Me.ucrChkWithReplacement = New instat.ucrCheck() Me.SuspendLayout() ' 'lblSelected @@ -144,15 +145,25 @@ Partial Class dlgPermuteColumn Me.ucrBase.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink Me.ucrBase.Location = New System.Drawing.Point(10, 224) Me.ucrBase.Name = "ucrBase" - Me.ucrBase.Size = New System.Drawing.Size(405, 52) + Me.ucrBase.Size = New System.Drawing.Size(408, 52) Me.ucrBase.TabIndex = 8 ' + 'ucrChkWithReplacement + ' + Me.ucrChkWithReplacement.AutoSize = True + Me.ucrChkWithReplacement.Checked = False + Me.ucrChkWithReplacement.Location = New System.Drawing.Point(242, 151) + Me.ucrChkWithReplacement.Name = "ucrChkWithReplacement" + Me.ucrChkWithReplacement.Size = New System.Drawing.Size(116, 23) + Me.ucrChkWithReplacement.TabIndex = 9 + ' 'dlgPermuteColumn ' 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, 282) + Me.Controls.Add(Me.ucrChkWithReplacement) Me.Controls.Add(Me.ucrChkSetSeed) Me.Controls.Add(Me.ucrNudSetSeed) Me.Controls.Add(Me.ucrNudNumberofColumns) @@ -183,4 +194,5 @@ Partial Class dlgPermuteColumn Friend WithEvents ucrNudNumberofColumns As ucrNud Friend WithEvents ucrNudSetSeed As ucrNud Friend WithEvents ucrChkSetSeed As ucrCheck + Friend WithEvents ucrChkWithReplacement As ucrCheck End Class diff --git a/instat/dlgPermuteColumn.vb b/instat/dlgPermuteColumn.vb index 7e55fdf6d83..6dc726eca49 100644 --- a/instat/dlgPermuteColumn.vb +++ b/instat/dlgPermuteColumn.vb @@ -50,6 +50,11 @@ Public Class dlgPermuteColumn ucrNudNumberofColumns.Maximum = Integer.MaxValue ucrNudNumberofColumns.Minimum = 1 + ucrChkWithReplacement.SetParameter(New RParameter("replace", 1)) + ucrChkWithReplacement.SetText("With Replacement") + ucrChkWithReplacement.SetValuesCheckedAndUnchecked("TRUE", "FALSE") + ucrChkWithReplacement.SetRDefault("FALSE") + ucrChkSetSeed.AddRSyntaxContainsFunctionNamesCondition(True, {"set.seed"}) ucrChkSetSeed.AddRSyntaxContainsFunctionNamesCondition(False, {"set.seed"}, False) ucrChkSetSeed.AddToLinkedControls(ucrNudSetSeed, {True}, bNewLinkedHideIfParameterMissing:=True, bNewLinkedAddRemoveParameter:=True, bNewLinkedChangeToDefaultState:=True, objNewDefaultState:=5) @@ -74,8 +79,7 @@ Public Class dlgPermuteColumn SetNewColumName() clsSetSampleFunction.SetRCommand("sample") - clsSetSampleFunction.AddParameter("replace", "FALSE") - clsSetSampleFunction.AddParameter("size", ucrPermuteRowsSelector.ucrAvailableDataFrames.iDataFrameLength) + clsSetSampleFunction.AddParameter("size", ucrPermuteRowsSelector.ucrAvailableDataFrames.iDataFrameLength, iPosition:=2) clsSetSeedFunction.SetRCommand("set.seed") @@ -90,9 +94,9 @@ Public Class dlgPermuteColumn ucrNudNumberofColumns.SetRCode(clsOverallFunction, bReset) ucrReceiverPermuteRows.SetRCode(clsSetSampleFunction, bReset) ucrNudSetSeed.SetRCode(clsSetSeedFunction, bReset) - ucrChkSetSeed.SetRCode(clsSetSeedFunction, bReset) ucrChkSetSeed.SetRSyntax(ucrBase.clsRsyntax, bReset) ucrSavePermute.SetRCode(clsOverallFunction, bReset) + ucrChkWithReplacement.SetRCode(clsSetSampleFunction, bReset) End Sub Private Sub TestOkEnabled() @@ -109,15 +113,6 @@ Public Class dlgPermuteColumn TestOkEnabled() End Sub - Private Sub ucrBase_BeforeClickOk(sender As Object, e As EventArgs) Handles ucrBase.BeforeClickOk - If ucrChkSetSeed.Checked Then - ucrBase.clsRsyntax.AddToBeforeCodes(clsSetSeedFunction, iPosition:=0) - Else - ucrBase.clsRsyntax.RemoveFromBeforeCodes(clsSetSeedFunction) - - End If - End Sub - Private Sub SetNewColumName() If ucrNudNumberofColumns.Value = 1 Then ucrSavePermute.SetAssignToBooleans(bTempAssignToIsPrefix:=False) @@ -143,7 +138,15 @@ Public Class dlgPermuteColumn SetNewColumName() End Sub - Private Sub ucrReceiverPermuteRows_ControlContentsChanged(ucrChangedControl As ucrCore) Handles ucrReceiverPermuteRows.ControlContentsChanged, ucrSavePermute.ControlContentsChanged + Private Sub ucrReceiverPermuteRows_ControlContentsChanged(ucrChangedControl As ucrCore) Handles ucrReceiverPermuteRows.ControlContentsChanged, ucrSavePermute.ControlContentsChanged, ucrChkWithReplacement.ControlContentsChanged TestOkEnabled() End Sub + + Private Sub ucrChkSetSeed_ControlValueChanged(ucrChangedControl As ucrCore) Handles ucrChkSetSeed.ControlValueChanged + If ucrChkSetSeed.Checked Then + ucrBase.clsRsyntax.AddToBeforeCodes(clsSetSeedFunction, iPosition:=0) + Else + ucrBase.clsRsyntax.RemoveFromBeforeCodes(clsSetSeedFunction) + End If + End Sub End Class \ No newline at end of file diff --git a/instat/dlgPlotRegion.vb b/instat/dlgPlotRegion.vb index c21d4d54275..580ca0ae4f5 100644 --- a/instat/dlgPlotRegion.vb +++ b/instat/dlgPlotRegion.vb @@ -19,9 +19,9 @@ Public Class dlgPlotRegion Public bFirstLoad As Boolean = True Private bReset As Boolean = True Private bResetSubdialog As Boolean = True - Private clsPlotRegionFunction As RFunction - Private clsAsDateTimeFunction As RFunction - Private clsSequenceFunction As RFunction + Private clsPlotRegionFunction As New RFunction + Private clsAsDateTimeFunction As New RFunction + Private clsSequenceFunction As New RFunction Private Sub dlgPlotRegion_Load(sender As Object, e As EventArgs) Handles MyBase.Load If bFirstLoad Then diff --git a/instat/dlgPopulationPyramids.Designer.vb b/instat/dlgPopulationPyramids.Designer.vb deleted file mode 100644 index bbe227cb5c3..00000000000 --- a/instat/dlgPopulationPyramids.Designer.vb +++ /dev/null @@ -1,183 +0,0 @@ -' R- Instat -' Copyright (C) 2015-2017 -' -' This program is free software: you can redistribute it and/or modify -' it under the terms of the GNU General Public License as published by -' the Free Software Foundation, either version 3 of the License, or -' (at your option) any later version. -' -' This program is distributed in the hope that it will be useful, -' but WITHOUT ANY WARRANTY; without even the implied warranty of -' MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -' GNU General Public License for more details. -' -' You should have received a copy of the GNU General Public License -' along with this program. If not, see . - - -Partial Class dlgPopulationPyramids - 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 - components.Dispose() - End If - Finally - MyBase.Dispose(disposing) - End Try - End Sub - - 'Required by the Windows Form Designer - Private components As System.ComponentModel.IContainer - - '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.ucrBase = New instat.ucrButtons() - Me.ucrPopulationPyramidselector = New instat.ucrSelectorByDataFrameAddRemove() - Me.lblXVariable = New System.Windows.Forms.Label() - Me.ucrXVariableReceiver = New instat.ucrReceiverSingle() - Me.lblYVariable = New System.Windows.Forms.Label() - Me.ucrYVariableReceiver = New instat.ucrReceiverSingle() - Me.lblSecondFactor = New System.Windows.Forms.Label() - Me.ucrSecondFactorReceiver = New instat.ucrReceiverSingle() - Me.ucrSavePopulationPyramid = New instat.ucrSaveGraph() - Me.SuspendLayout() - ' - 'ucrBase - ' - Me.ucrBase.AutoSize = True - Me.ucrBase.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink - Me.ucrBase.Location = New System.Drawing.Point(10, 244) - Me.ucrBase.Name = "ucrBase" - Me.ucrBase.Size = New System.Drawing.Size(405, 52) - Me.ucrBase.TabIndex = 0 - ' - 'ucrPopulationPyramidselector - ' - Me.ucrPopulationPyramidselector.AutoSize = True - Me.ucrPopulationPyramidselector.bDropUnusedFilterLevels = False - Me.ucrPopulationPyramidselector.bShowHiddenColumns = False - Me.ucrPopulationPyramidselector.bUseCurrentFilter = True - Me.ucrPopulationPyramidselector.Location = New System.Drawing.Point(10, 10) - Me.ucrPopulationPyramidselector.Margin = New System.Windows.Forms.Padding(0) - Me.ucrPopulationPyramidselector.Name = "ucrPopulationPyramidselector" - Me.ucrPopulationPyramidselector.Size = New System.Drawing.Size(213, 183) - Me.ucrPopulationPyramidselector.TabIndex = 1 - ' - 'lblXVariable - ' - Me.lblXVariable.AutoSize = True - Me.lblXVariable.Location = New System.Drawing.Point(255, 25) - Me.lblXVariable.Name = "lblXVariable" - Me.lblXVariable.Size = New System.Drawing.Size(55, 13) - Me.lblXVariable.TabIndex = 2 - Me.lblXVariable.Text = "X Variable" - ' - 'ucrXVariableReceiver - ' - Me.ucrXVariableReceiver.AutoSize = True - Me.ucrXVariableReceiver.frmParent = Me - Me.ucrXVariableReceiver.Location = New System.Drawing.Point(258, 42) - Me.ucrXVariableReceiver.Margin = New System.Windows.Forms.Padding(0) - Me.ucrXVariableReceiver.Name = "ucrXVariableReceiver" - Me.ucrXVariableReceiver.Selector = Nothing - Me.ucrXVariableReceiver.Size = New System.Drawing.Size(120, 20) - Me.ucrXVariableReceiver.strNcFilePath = "" - Me.ucrXVariableReceiver.TabIndex = 3 - Me.ucrXVariableReceiver.ucrSelector = Nothing - ' - 'lblYVariable - ' - Me.lblYVariable.AutoSize = True - Me.lblYVariable.Location = New System.Drawing.Point(255, 76) - Me.lblYVariable.Name = "lblYVariable" - Me.lblYVariable.Size = New System.Drawing.Size(55, 13) - Me.lblYVariable.TabIndex = 2 - Me.lblYVariable.Text = "Y Variable" - ' - 'ucrYVariableReceiver - ' - Me.ucrYVariableReceiver.AutoSize = True - Me.ucrYVariableReceiver.frmParent = Me - Me.ucrYVariableReceiver.Location = New System.Drawing.Point(258, 92) - Me.ucrYVariableReceiver.Margin = New System.Windows.Forms.Padding(0) - Me.ucrYVariableReceiver.Name = "ucrYVariableReceiver" - Me.ucrYVariableReceiver.Selector = Nothing - Me.ucrYVariableReceiver.Size = New System.Drawing.Size(120, 20) - Me.ucrYVariableReceiver.strNcFilePath = "" - Me.ucrYVariableReceiver.TabIndex = 3 - Me.ucrYVariableReceiver.ucrSelector = Nothing - ' - 'lblSecondFactor - ' - Me.lblSecondFactor.AutoSize = True - Me.lblSecondFactor.Location = New System.Drawing.Point(255, 125) - Me.lblSecondFactor.Name = "lblSecondFactor" - Me.lblSecondFactor.Size = New System.Drawing.Size(77, 13) - Me.lblSecondFactor.TabIndex = 2 - Me.lblSecondFactor.Text = "Second Factor" - ' - 'ucrSecondFactorReceiver - ' - Me.ucrSecondFactorReceiver.AutoSize = True - Me.ucrSecondFactorReceiver.frmParent = Me - Me.ucrSecondFactorReceiver.Location = New System.Drawing.Point(258, 142) - Me.ucrSecondFactorReceiver.Margin = New System.Windows.Forms.Padding(0) - Me.ucrSecondFactorReceiver.Name = "ucrSecondFactorReceiver" - Me.ucrSecondFactorReceiver.Selector = Nothing - Me.ucrSecondFactorReceiver.Size = New System.Drawing.Size(120, 20) - Me.ucrSecondFactorReceiver.strNcFilePath = "" - Me.ucrSecondFactorReceiver.TabIndex = 3 - Me.ucrSecondFactorReceiver.ucrSelector = Nothing - ' - 'ucrSavePopulationPyramid - ' - Me.ucrSavePopulationPyramid.AutoSize = True - Me.ucrSavePopulationPyramid.Location = New System.Drawing.Point(10, 209) - Me.ucrSavePopulationPyramid.Name = "ucrSavePopulationPyramid" - Me.ucrSavePopulationPyramid.Size = New System.Drawing.Size(265, 23) - Me.ucrSavePopulationPyramid.TabIndex = 4 - ' - 'dlgPopulationPyramids - ' - 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(421, 298) - Me.Controls.Add(Me.ucrSavePopulationPyramid) - Me.Controls.Add(Me.ucrSecondFactorReceiver) - Me.Controls.Add(Me.lblSecondFactor) - Me.Controls.Add(Me.ucrYVariableReceiver) - Me.Controls.Add(Me.lblYVariable) - Me.Controls.Add(Me.ucrXVariableReceiver) - Me.Controls.Add(Me.lblXVariable) - Me.Controls.Add(Me.ucrPopulationPyramidselector) - Me.Controls.Add(Me.ucrBase) - Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow - Me.MaximizeBox = False - Me.MinimizeBox = False - Me.Name = "dlgPopulationPyramids" - Me.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen - Me.Tag = "Population Pyramids" - Me.Text = "Population Pyramids" - Me.ResumeLayout(False) - Me.PerformLayout() - - End Sub - - Friend WithEvents ucrBase As ucrButtons - Friend WithEvents ucrPopulationPyramidselector As ucrSelectorByDataFrameAddRemove - Friend WithEvents lblXVariable As Label - Friend WithEvents ucrXVariableReceiver As ucrReceiverSingle - Friend WithEvents lblYVariable As Label - Friend WithEvents ucrYVariableReceiver As ucrReceiverSingle - Friend WithEvents lblSecondFactor As Label - Friend WithEvents ucrSecondFactorReceiver As ucrReceiverSingle - Friend WithEvents ucrSavePopulationPyramid As ucrSaveGraph -End Class diff --git a/instat/dlgPopulationPyramids.resx b/instat/dlgPopulationPyramids.resx deleted file mode 100644 index 29dcb1b3a35..00000000000 --- a/instat/dlgPopulationPyramids.resx +++ /dev/null @@ -1,120 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - \ No newline at end of file diff --git a/instat/dlgPopulationPyramids.sw-KE.resx b/instat/dlgPopulationPyramids.sw-KE.resx deleted file mode 100644 index a3df4f013d3..00000000000 --- a/instat/dlgPopulationPyramids.sw-KE.resx +++ /dev/null @@ -1,15 +0,0 @@ - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - \ No newline at end of file diff --git a/instat/dlgPopulationPyramids.vb b/instat/dlgPopulationPyramids.vb deleted file mode 100644 index 529fa644e53..00000000000 --- a/instat/dlgPopulationPyramids.vb +++ /dev/null @@ -1,136 +0,0 @@ -' R- Instat -' Copyright (C) 2015-2017 -' -' This program is free software: you can redistribute it and/or modify -' it under the terms of the GNU General Public License as published by -' the Free Software Foundation, either version 3 of the License, or -' (at your option) any later version. -' -' This program is distributed in the hope that it will be useful, -' but WITHOUT ANY WARRANTY; without even the implied warranty of -' MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -' GNU General Public License for more details. -' -' You should have received a copy of the GNU General Public License -' along with this program. If not, see . - -Imports instat.Translations -Public Class dlgPopulationPyramids - Private clsRggplotFunction As New RFunction - Private clsRgeom_bar As New RFunction - Private clsRgeom_bar2 As New RFunction - Private clsRaesFunction As New RFunction - Private clsRgeom_CoordFlip As New RFunction - Private bFirstLoad As Boolean = True - Private Sub dlgPopulationPyramids_Load(sender As Object, e As EventArgs) Handles MyBase.Load - If bFirstLoad Then - InitialiseDialog() - SetDefaults() - bFirstLoad = False - Else - ReopenDialog() - - End If - autoTranslate(Me) - TestOkEnabled() - End Sub - - Private Sub InitialiseDialog() - ucrBase.iHelpTopicID = 455 - ucrBase.clsRsyntax.SetOperation("+") - - clsRggplotFunction.SetPackageName("ggplot") - clsRggplotFunction.SetRCommand("ggplot") - - clsRaesFunction.SetPackageName("ggplot") - clsRaesFunction.SetRCommand("aes") - clsRggplotFunction.AddParameter("mapping", clsRFunctionParameter:=clsRaesFunction) - ucrBase.clsRsyntax.SetOperatorParameter(True, clsRFunc:=clsRggplotFunction) - - clsRgeom_bar.SetPackageName("ggplot") - clsRgeom_bar.SetRCommand("geom_bar") - clsRgeom_bar.AddParameter("stat", Chr(34) & "identity" & Chr(34)) - ucrBase.clsRsyntax.SetOperatorParameter(False, clsRFunc:=clsRgeom_bar) - - clsRgeom_bar2.SetPackageName("ggplot") - clsRgeom_bar2.SetRCommand("geom_bar") - clsRgeom_bar2.AddParameter("stat", Chr(34) & "identity" & Chr(34)) - ucrBase.clsRsyntax.AddOperatorParameter("geom_bar", clsRFunc:=clsRgeom_bar) - - clsRgeom_CoordFlip.SetPackageName("ggplot") - clsRgeom_CoordFlip.SetRCommand("coord_flip") - ucrBase.clsRsyntax.AddOperatorParameter("coord_flip", "coord_flip") - - ucrBase.clsRsyntax.bExcludeAssignedFunctionOutput = False - - ucrXVariableReceiver.Selector = ucrPopulationPyramidselector - ucrYVariableReceiver.Selector = ucrPopulationPyramidselector - ucrSecondFactorReceiver.Selector = ucrPopulationPyramidselector - ucrBase.clsRsyntax.iCallType = 3 - - End Sub - - Private Sub SetDefaults() - ucrPopulationPyramidselector.Reset() - ucrXVariableReceiver.SetMeAsReceiver() - TestOkEnabled() - End Sub - - Private Sub ReopenDialog() - - End Sub - Private Sub TestOkEnabled() - If (ucrXVariableReceiver.IsEmpty AndAlso ucrYVariableReceiver.IsEmpty) Then - ucrBase.OKEnabled(False) - Else - ucrBase.OKEnabled(True) - End If - - End Sub - - Private Sub ucrBase_ClickReset(sender As Object, e As EventArgs) Handles ucrBase.ClickReset - SetDefaults() - End Sub - - Private Sub ucrPopulationPyramidselector_DataFrameChanged() Handles ucrPopulationPyramidselector.DataFrameChanged - clsRggplotFunction.AddParameter("data", clsRFunctionParameter:=ucrPopulationPyramidselector.ucrAvailableDataFrames.clsCurrDataFrame) - End Sub - Private Sub ucrXVariableReceiver_SelectionChanged(sender As Object, e As EventArgs) Handles ucrXVariableReceiver.SelectionChanged - If Not ucrXVariableReceiver.IsEmpty Then - clsRaesFunction.AddParameter("x", ucrXVariableReceiver.GetVariableNames(False)) - Else - clsRaesFunction.RemoveParameterByName("x") - End If - TestOkEnabled() - End Sub - - Private Sub ucrYVariableReceiver_SelectionChanged(sender As Object, e As EventArgs) Handles ucrYVariableReceiver.SelectionChanged - If Not ucrYVariableReceiver.IsEmpty Then - clsRaesFunction.AddParameter("y", ucrYVariableReceiver.GetVariableNames(False)) - Else - clsRaesFunction.RemoveParameterByName("y") - End If - TestOkEnabled() - End Sub - - Private Sub ucrSecondFactorReceiver_SelectionChanged(sender As Object, e As EventArgs) Handles ucrSecondFactorReceiver.SelectionChanged - If Not ucrSecondFactorReceiver.IsEmpty Then - clsRaesFunction.AddParameter("fill", ucrSecondFactorReceiver.GetVariableNames(False)) - Else - clsRaesFunction.RemoveParameterByName("fill") - End If - End Sub - - Private Sub ucrSavePopulationPyramid_ContentsChanged() Handles ucrSavePopulationPyramid.ContentsChanged - TestOkEnabled() - End Sub - - Private Sub ucrSavePopulationPyramid_GraphNameChanged() Handles ucrSavePopulationPyramid.GraphNameChanged, ucrSavePopulationPyramid.SaveGraphCheckedChanged - If ucrSavePopulationPyramid.bSaveGraph Then - ucrBase.clsRsyntax.SetAssignTo(ucrSavePopulationPyramid.strGraphName, strTempDataframe:=ucrPopulationPyramidselector.ucrAvailableDataFrames.cboAvailableDataFrames.Text, strTempGraph:=ucrSavePopulationPyramid.strGraphName) - Else - ucrBase.clsRsyntax.SetAssignTo("last_graph", strTempDataframe:=ucrPopulationPyramidselector.ucrAvailableDataFrames.cboAvailableDataFrames.Text, strTempGraph:="last_graph") - End If - TestOkEnabled() - End Sub -End Class \ No newline at end of file diff --git a/instat/dlgRandomSample.designer.vb b/instat/dlgRandomSample.designer.vb index 3aef9ee539c..7ee509bd3cf 100644 --- a/instat/dlgRandomSample.designer.vb +++ b/instat/dlgRandomSample.designer.vb @@ -145,7 +145,6 @@ Partial Class dlgRandomSample Me.ucrSampleSize.Name = "ucrSampleSize" Me.ucrSampleSize.Size = New System.Drawing.Size(55, 23) Me.ucrSampleSize.TabIndex = 7 - Me.ucrSampleSize.ucrDataFrameSelector = Nothing ' 'ucrSelectorRandomSamples ' diff --git a/instat/dlgRecodeFactor.Designer.vb b/instat/dlgRecodeFactor.Designer.vb index 404b08b7a2b..93d02003da4 100644 --- a/instat/dlgRecodeFactor.Designer.vb +++ b/instat/dlgRecodeFactor.Designer.vb @@ -348,14 +348,11 @@ Partial Class dlgRecodeFactor ' Me.ucrFactorLevels.AutoSize = True Me.ucrFactorLevels.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle - Me.ucrFactorLevels.clsReceiver = Nothing Me.ucrFactorLevels.Location = New System.Drawing.Point(248, 99) Me.ucrFactorLevels.Margin = New System.Windows.Forms.Padding(5) Me.ucrFactorLevels.Name = "ucrFactorLevels" - Me.ucrFactorLevels.shtCurrSheet = Nothing Me.ucrFactorLevels.Size = New System.Drawing.Size(295, 210) Me.ucrFactorLevels.TabIndex = 15 - Me.ucrFactorLevels.ucrChkLevels = Nothing ' 'ucrPnlOptions ' @@ -389,13 +386,10 @@ Partial Class dlgRecodeFactor ' Me.ucrFactorGrid.AutoSize = True Me.ucrFactorGrid.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle - Me.ucrFactorGrid.clsReceiver = Nothing Me.ucrFactorGrid.Location = New System.Drawing.Point(248, 99) Me.ucrFactorGrid.Name = "ucrFactorGrid" - Me.ucrFactorGrid.shtCurrSheet = Nothing Me.ucrFactorGrid.Size = New System.Drawing.Size(288, 210) Me.ucrFactorGrid.TabIndex = 10 - Me.ucrFactorGrid.ucrChkLevels = Nothing ' 'ucrReceiverFactor ' diff --git a/instat/dlgRecodeFactor.vb b/instat/dlgRecodeFactor.vb index 6322fb7b800..352ae140b42 100644 --- a/instat/dlgRecodeFactor.vb +++ b/instat/dlgRecodeFactor.vb @@ -21,11 +21,12 @@ Public Class dlgRecodeFactor Private bFirstLoad As Boolean = True Private clsPlyrRevalueFunction, clsReplaceFunction, clsFctOtherFunction, clsFctExplicitNaFunction As New RFunction Private clsFctLowFreqFunction, clsFctLumpPropFunction, clsFctLumpMinFunction, clsFctLumpNFunction As New RFunction - + Private clsRemoveLabelsFunction As New RFunction Private clsCFunction As New RFunction Private clsOtherDummyFunction As New RFunction Private clsDummyFunction As New RFunction Private bReset As Boolean = True + Private Const strNewLabelColName As String = "New Label" Private Sub dlgRecodeFactor_Load(sender As Object, e As EventArgs) Handles MyBase.Load If bFirstLoad Then @@ -92,15 +93,14 @@ Public Class dlgRecodeFactor ucrInputAddNa.SetParameter(New RParameter("na_level", 1)) - ucrFactorGrid.SetReceiver(ucrReceiverFactor) - ucrFactorGrid.SetAsViewerOnly() - ucrFactorGrid.bIncludeCopyOfLevels = True - ucrFactorGrid.AddEditableColumns({"New Label"}) + ucrFactorGrid.SetAsNormalGridColumn(ucrReceiverFactor, + extraColNames:={strNewLabelColName}, + editableColNames:={strNewLabelColName}, + hiddenColNames:={ucrFactor.DefaultColumnNames.Level}) - ucrFactorLevels.SetAsMultipleSelector() - ucrFactorLevels.SetReceiver(ucrReceiverFactor) - ucrFactorLevels.SetIncludeLevels(False) - ucrFactorLevels.bIncludeNA = True + ucrFactorLevels.SetAsMultipleSelectorGrid(ucrReceiverFactor, + hiddenColNames:={ucrFactor.DefaultColumnNames.Level}, + bIncludeNALevel:=True) ucrSaveNewColumn.SetSaveTypeAsColumn() ucrSaveNewColumn.SetDataFrameSelector(ucrSelectorForRecode.ucrAvailableDataFrames) @@ -135,6 +135,7 @@ Public Class dlgRecodeFactor clsCFunction = New RFunction clsDummyFunction = New RFunction clsOtherDummyFunction = New RFunction + clsRemoveLabelsFunction = New RFunction ucrSelectorForRecode.Reset() ucrSelectorForRecode.Focus() @@ -150,6 +151,10 @@ Public Class dlgRecodeFactor clsCFunction.SetRCommand("c") + clsRemoveLabelsFunction.SetRCommand(frmMain.clsRLink.strInstatDataObject & "$append_to_variables_metadata") + clsRemoveLabelsFunction.AddParameter("property", Chr(34) & "labels" & Chr(34), iPosition:=2) + clsRemoveLabelsFunction.AddParameter("new_val", Chr(34) & Chr(34), iPosition:=3) + clsFctLumpMinFunction.SetPackageName("forcats") clsFctLumpMinFunction.SetRCommand("fct_lump_min") clsFctLumpMinFunction.AddParameter("min", "1", iPosition:=1) @@ -180,6 +185,17 @@ Public Class dlgRecodeFactor clsReplaceFunction.SetRCommand("c") ucrBase.clsRsyntax.SetBaseRFunction(clsPlyrRevalueFunction) + ucrBase.clsRsyntax.AddToAfterCodes(clsRemoveLabelsFunction, 0) + End Sub + + Private Sub ucrSelectorForRecode_DataFrameChanged() Handles ucrSelectorForRecode.DataFrameChanged + clsRemoveLabelsFunction.AddParameter("data_name", Chr(34) & ucrSelectorForRecode.strCurrentDataFrame & Chr(34), iPosition:=0) + End Sub + + Private Sub ucrSaveNewColumn_ControlValueChanged(ucrChangedControl As ucrCore) Handles ucrSaveNewColumn.ControlValueChanged + If ucrSaveNewColumn.GetText <> "" AndAlso ucrSaveNewColumn.IsComplete() Then + clsRemoveLabelsFunction.AddParameter("col_names", Chr(34) & ucrSaveNewColumn.GetText & Chr(34), iPosition:=1) + End If End Sub Private Sub SetRCodeforControls(bReset As Boolean) @@ -190,12 +206,14 @@ Public Class dlgRecodeFactor ucrReceiverFactor.AddAdditionalCodeParameterPair(clsFctLumpNFunction, New RParameter("f", 0), iAdditionalPairNo:=4) ucrReceiverFactor.AddAdditionalCodeParameterPair(clsFctLumpMinFunction, New RParameter("f", 0), iAdditionalPairNo:=5) ucrReceiverFactor.AddAdditionalCodeParameterPair(clsFctExplicitNaFunction, New RParameter("f", 0), iAdditionalPairNo:=6) + ucrSaveNewColumn.AddAdditionalRCode(clsFctLumpPropFunction, iAdditionalPairNo:=1) ucrSaveNewColumn.AddAdditionalRCode(clsFctLowFreqFunction, iAdditionalPairNo:=2) ucrSaveNewColumn.AddAdditionalRCode(clsFctLumpMinFunction, iAdditionalPairNo:=3) ucrSaveNewColumn.AddAdditionalRCode(clsFctLumpNFunction, iAdditionalPairNo:=4) ucrSaveNewColumn.AddAdditionalRCode(clsFctExplicitNaFunction, iAdditionalPairNo:=5) ucrSaveNewColumn.AddAdditionalRCode(clsFctOtherFunction, bReset) + ucrReceiverFactor.SetRCode(clsPlyrRevalueFunction, bReset) ucrSaveNewColumn.SetRCode(clsPlyrRevalueFunction, bReset) ucrNudFrequentValues.SetRCode(clsFctLumpPropFunction, bReset) @@ -211,9 +229,9 @@ Public Class dlgRecodeFactor ElseIf rdoAddNa.Checked AndAlso Not ucrReceiverFactor.IsEmpty AndAlso ucrSaveNewColumn.IsComplete Then ucrBase.OKEnabled(True) ElseIf rdoRecode.Checked Then - ucrBase.OKEnabled(ucrFactorGrid.IsColumnComplete("New Label")) + ucrBase.OKEnabled(ucrFactorGrid.IsColumnComplete({strNewLabelColName})) ElseIf rdoOther.Checked Then - ucrBase.OKEnabled(Not String.IsNullOrEmpty(ucrFactorLevels.GetSelectedLevels())) + ucrBase.OKEnabled(ucrFactorLevels.IsAnyGridRowSelected) ElseIf rdoLump.Checked Then ucrBase.OKEnabled(rdoLevels.Checked OrElse rdoCommonValues.Checked OrElse rdoFrequentValues.Checked OrElse rdoMore.Checked) End If @@ -225,20 +243,37 @@ Public Class dlgRecodeFactor TestOKEnabled() End Sub - Private Sub ucrFactorGrid_GridContentChanged() Handles ucrFactorGrid.GridContentChanged - Dim strCurrentLabels As List(Of String) - Dim strNewLabels As List(Of String) + Private Sub ucrFactorGrid_GridContentReFilledFromR() Handles ucrFactorGrid.GridContentReFilledFromR + 'copy all cell values of the 'Label' column into the 'New Label' column everytime the grid is refilled from R + 'GridContentReFilledFromR event is always followed by ControlValueChanged so no need to raise ControlValueChanged event + ucrFactorGrid.SetCellValues(strNewLabelColName, + ucrFactorGrid.GetCellValues(ucrFactor.DefaultColumnNames.Label, False), + bRaisedControlValueChangedEvent:=False) + End Sub + + Private Sub ucrFactorGrid_ControlValueChanged(ucrChangedControl As ucrCore) Handles ucrFactorGrid.ControlValueChanged - strCurrentLabels = ucrFactorGrid.GetColumnAsList(ucrFactorGrid.strLabelsName, False) - strNewLabels = ucrFactorGrid.GetColumnAsList("New Label", False) + 'remove all the labels parameters clsReplaceFunction.ClearParameters() - If ucrFactorGrid.IsColumnComplete("New Label") AndAlso strCurrentLabels.Count = strNewLabels.Count Then - For i = 0 To strCurrentLabels.Count - 1 - 'Backtick needed for names of the vector incase the levels are not valid R names - clsReplaceFunction.AddParameter(Chr(96) & strCurrentLabels(i) & Chr(96), Chr(34) & strNewLabels(i) & Chr(34), iPosition:=i + 1) + 'if no empty new label. Then add them. + If ucrFactorGrid.IsColumnComplete({strNewLabelColName}) Then + Dim lstCurrentLabels As List(Of String) + Dim lstNewLabels As List(Of String) + + 'get the current labels without the quotes + lstCurrentLabels = ucrFactorGrid.GetCellValues(ucrFactor.DefaultColumnNames.Label, False) + 'get the new labels with the quotes + lstNewLabels = ucrFactorGrid.GetCellValues(strNewLabelColName, True) + + 'add the parameters + For i = 0 To lstCurrentLabels.Count - 1 + 'todo. why not use the double quotes here?? + 'Backtick(') needed for names of the vector incase the levels are not valid R names + clsReplaceFunction.AddParameter(Chr(96) & lstCurrentLabels(i) & Chr(96), lstNewLabels(i), iPosition:=i + 1) Next End If + TestOKEnabled() End Sub @@ -265,10 +300,16 @@ Public Class dlgRecodeFactor clsFctOtherFunction.RemoveParameterByName("keep") clsFctOtherFunction.RemoveParameterByName("drop") If rdoKeep.Checked Then - clsFctOtherFunction.AddParameter("keep", ucrFactorLevels.GetSelectedLevels(), iPosition:=1) + clsFctOtherFunction.AddParameter("keep", mdlCoreControl.GetRVector( + ucrFactorLevels.GetSelectedCellValues( + ucrFactor.DefaultColumnNames.Label, True)), + iPosition:=1) clsOtherDummyFunction.AddParameter("checked", "keep", iPosition:=0) ElseIf rdoDrop.Checked Then - clsFctOtherFunction.AddParameter("drop", ucrFactorLevels.GetSelectedLevels(), iPosition:=1) + clsFctOtherFunction.AddParameter("drop", mdlCoreControl.GetRVector( + ucrFactorLevels.GetSelectedCellValues( + ucrFactor.DefaultColumnNames.Label, True)), + iPosition:=1) clsOtherDummyFunction.AddParameter("checked", "drop", iPosition:=0) End If ucrBase.clsRsyntax.SetBaseRFunction(clsFctOtherFunction) diff --git a/instat/dlgReferenceLevel.Designer.vb b/instat/dlgReferenceLevel.Designer.vb index 21b4421e925..645d7e6147a 100644 --- a/instat/dlgReferenceLevel.Designer.vb +++ b/instat/dlgReferenceLevel.Designer.vb @@ -85,13 +85,10 @@ Partial Class dlgReferenceLevel ' Me.ucrFactorReferenceLevels.AutoSize = True Me.ucrFactorReferenceLevels.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle - Me.ucrFactorReferenceLevels.clsReceiver = Nothing Me.ucrFactorReferenceLevels.Location = New System.Drawing.Point(255, 58) Me.ucrFactorReferenceLevels.Name = "ucrFactorReferenceLevels" - Me.ucrFactorReferenceLevels.shtCurrSheet = Nothing Me.ucrFactorReferenceLevels.Size = New System.Drawing.Size(267, 181) Me.ucrFactorReferenceLevels.TabIndex = 3 - Me.ucrFactorReferenceLevels.ucrChkLevels = Nothing ' 'ucrBase ' diff --git a/instat/dlgReferenceLevel.vb b/instat/dlgReferenceLevel.vb index 0bdc2aa8758..0cb04de14a2 100644 --- a/instat/dlgReferenceLevel.vb +++ b/instat/dlgReferenceLevel.vb @@ -48,10 +48,16 @@ Public Class dlgReferenceLevel ucrReceiverReferenceLevels.strSelectorHeading = "Factors" ucrReceiverReferenceLevels.SetExcludedDataTypes({"ordered,factor"}) + + Dim dctParamAndColNames As New Dictionary(Of String, String) + dctParamAndColNames.Add("new_ref_level", ucrFactor.DefaultColumnNames.Label) + ucrFactorReferenceLevels.SetParameter(New RParameter("new_ref_level", 2)) - ucrFactorReferenceLevels.SetReceiver(ucrReceiverReferenceLevels) - ucrFactorReferenceLevels.SetAsSingleSelector() - ucrFactorReferenceLevels.SetIncludeLevels(False) + ucrFactorReferenceLevels.SetAsSingleSelectorGrid(ucrReceiverReferenceLevels, + dctParamAndColNames:=dctParamAndColNames, + hiddenColNames:={ucrFactor.DefaultColumnNames.Level}, + bIncludeNALevel:=False) + End Sub Private Sub SetDefaults() @@ -63,15 +69,13 @@ Public Class dlgReferenceLevel End Sub Private Sub SetRCodeforControls(bReset As Boolean) - SetRCode(Me, ucrBase.clsRsyntax.clsBaseFunction, bReset) + ucrSelectorForReferenceLevels.SetRCode(clsSetRefLevel, bReset) + ucrReceiverReferenceLevels.SetRCode(clsSetRefLevel, bReset) + ucrFactorReferenceLevels.SetRCode(clsSetRefLevel, bReset) End Sub Private Sub TestOKEnabled() - If Not ucrReceiverReferenceLevels.IsEmpty Then - ucrBase.OKEnabled(True) - Else - ucrBase.OKEnabled(False) - End If + ucrBase.OKEnabled(Not ucrReceiverReferenceLevels.IsEmpty AndAlso ucrFactorReferenceLevels.IsAnyGridRowSelected) End Sub Private Sub ucrBase_ClickReset(sender As Object, e As EventArgs) Handles ucrBase.ClickReset @@ -80,14 +84,7 @@ Public Class dlgReferenceLevel TestOKEnabled() End Sub - Private Sub SetDefaultDataFrame() - If strDefaultDataFrame <> "" Then - ucrSelectorForReferenceLevels.SetDataframe(strDefaultDataFrame) - End If - strDefaultDataFrame = "" - End Sub - - Private Sub ucrReceiverReferenceLevels_ControlContentsChanged(ucrChangedControl As ucrCore) Handles ucrReceiverReferenceLevels.ControlContentsChanged + Private Sub ucrControls_ControlValueChanged(ucrChangedControl As ucrCore) Handles ucrReceiverReferenceLevels.ControlValueChanged, ucrFactorReferenceLevels.ControlValueChanged TestOKEnabled() End Sub End Class \ No newline at end of file diff --git a/instat/dlgRegularSequence.designer.vb b/instat/dlgRegularSequence.designer.vb index 12ecc3dc9b1..bf9efe7ff0b 100644 --- a/instat/dlgRegularSequence.designer.vb +++ b/instat/dlgRegularSequence.designer.vb @@ -39,30 +39,31 @@ Partial Class dlgRegularSequence Private Sub InitializeComponent() Me.grpSequenceDefinition = New System.Windows.Forms.GroupBox() - Me.ucrInputComboDatesBy = New instat.ucrInputComboBox() - Me.ucrChkDefineAsFactor = New instat.ucrCheck() - Me.ucrNudRepeatValues = New instat.ucrNud() - Me.ucrInputInStepsOf = New instat.ucrInputTextBox() - Me.ucrInputTo = New instat.ucrInputTextBox() - Me.ucrInputFrom = New instat.ucrInputTextBox() - Me.ucrDataFrameLengthForRegularSequence = New instat.ucrDataFrameLength() Me.lblLength = New System.Windows.Forms.Label() Me.lblTimes = New System.Windows.Forms.Label() Me.lblRepeatValues = New System.Windows.Forms.Label() Me.lblInStepsOf = New System.Windows.Forms.Label() Me.lblTo = New System.Windows.Forms.Label() Me.lblFrom = New System.Windows.Forms.Label() - Me.ucrDateTimePickerTo = New instat.ucrDateTimePicker() - Me.ucrDateTimePickerFrom = New instat.ucrDateTimePicker() Me.lblPreview = New System.Windows.Forms.Label() - Me.txtGetPreview = New System.Windows.Forms.RichTextBox() Me.lblMessage = New System.Windows.Forms.Label() Me.rdoDates = New System.Windows.Forms.RadioButton() Me.rdoNumeric = New System.Windows.Forms.RadioButton() + Me.txtPreview = New System.Windows.Forms.TextBox() Me.ucrPnlSequenceType = New instat.UcrPanel() Me.ucrNewColumnName = New instat.ucrSave() + Me.ucrInputComboDatesBy = New instat.ucrInputComboBox() + Me.ucrChkDefineAsFactor = New instat.ucrCheck() + Me.ucrNudRepeatValues = New instat.ucrNud() + Me.ucrInputInStepsOf = New instat.ucrInputTextBox() + Me.ucrInputTo = New instat.ucrInputTextBox() + Me.ucrInputFrom = New instat.ucrInputTextBox() + Me.ucrDataFrameLength = New instat.ucrDataFrameLength() + Me.ucrDateTimePickerTo = New instat.ucrDateTimePicker() + Me.ucrDateTimePickerFrom = New instat.ucrDateTimePicker() Me.ucrSelectDataFrameRegularSequence = New instat.ucrDataFrame() Me.ucrBase = New instat.ucrButtons() + Me.ucrChkPreview = New instat.ucrCheck() Me.grpSequenceDefinition.SuspendLayout() Me.SuspendLayout() ' @@ -74,7 +75,7 @@ Partial Class dlgRegularSequence Me.grpSequenceDefinition.Controls.Add(Me.ucrInputInStepsOf) Me.grpSequenceDefinition.Controls.Add(Me.ucrInputTo) Me.grpSequenceDefinition.Controls.Add(Me.ucrInputFrom) - Me.grpSequenceDefinition.Controls.Add(Me.ucrDataFrameLengthForRegularSequence) + Me.grpSequenceDefinition.Controls.Add(Me.ucrDataFrameLength) Me.grpSequenceDefinition.Controls.Add(Me.lblLength) Me.grpSequenceDefinition.Controls.Add(Me.lblTimes) Me.grpSequenceDefinition.Controls.Add(Me.lblRepeatValues) @@ -93,81 +94,6 @@ Partial Class dlgRegularSequence Me.grpSequenceDefinition.Text = "Sequence Definition" Me.grpSequenceDefinition.UseCompatibleTextRendering = True ' - 'ucrInputComboDatesBy - ' - Me.ucrInputComboDatesBy.AddQuotesIfUnrecognised = True - Me.ucrInputComboDatesBy.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink - Me.ucrInputComboDatesBy.GetSetSelectedIndex = -1 - Me.ucrInputComboDatesBy.IsReadOnly = False - Me.ucrInputComboDatesBy.Location = New System.Drawing.Point(173, 76) - Me.ucrInputComboDatesBy.Name = "ucrInputComboDatesBy" - Me.ucrInputComboDatesBy.Size = New System.Drawing.Size(62, 23) - Me.ucrInputComboDatesBy.TabIndex = 17 - ' - 'ucrChkDefineAsFactor - ' - Me.ucrChkDefineAsFactor.AutoSize = True - Me.ucrChkDefineAsFactor.Checked = False - Me.ucrChkDefineAsFactor.Location = New System.Drawing.Point(5, 158) - Me.ucrChkDefineAsFactor.Name = "ucrChkDefineAsFactor" - Me.ucrChkDefineAsFactor.Size = New System.Drawing.Size(176, 23) - Me.ucrChkDefineAsFactor.TabIndex = 13 - ' - 'ucrNudRepeatValues - ' - Me.ucrNudRepeatValues.AutoSize = True - Me.ucrNudRepeatValues.DecimalPlaces = New Decimal(New Integer() {0, 0, 0, 0}) - Me.ucrNudRepeatValues.Increment = New Decimal(New Integer() {1, 0, 0, 0}) - Me.ucrNudRepeatValues.Location = New System.Drawing.Point(111, 101) - Me.ucrNudRepeatValues.Maximum = New Decimal(New Integer() {100, 0, 0, 0}) - Me.ucrNudRepeatValues.Minimum = New Decimal(New Integer() {0, 0, 0, 0}) - Me.ucrNudRepeatValues.Name = "ucrNudRepeatValues" - Me.ucrNudRepeatValues.Size = New System.Drawing.Size(50, 23) - Me.ucrNudRepeatValues.TabIndex = 9 - Me.ucrNudRepeatValues.Value = New Decimal(New Integer() {0, 0, 0, 0}) - ' - 'ucrInputInStepsOf - ' - Me.ucrInputInStepsOf.AddQuotesIfUnrecognised = True - Me.ucrInputInStepsOf.AutoSize = True - Me.ucrInputInStepsOf.IsMultiline = False - Me.ucrInputInStepsOf.IsReadOnly = False - Me.ucrInputInStepsOf.Location = New System.Drawing.Point(111, 76) - Me.ucrInputInStepsOf.Name = "ucrInputInStepsOf" - Me.ucrInputInStepsOf.Size = New System.Drawing.Size(50, 23) - Me.ucrInputInStepsOf.TabIndex = 7 - ' - 'ucrInputTo - ' - Me.ucrInputTo.AddQuotesIfUnrecognised = True - Me.ucrInputTo.AutoSize = True - Me.ucrInputTo.IsMultiline = False - Me.ucrInputTo.IsReadOnly = False - Me.ucrInputTo.Location = New System.Drawing.Point(111, 50) - Me.ucrInputTo.Name = "ucrInputTo" - Me.ucrInputTo.Size = New System.Drawing.Size(50, 23) - Me.ucrInputTo.TabIndex = 4 - ' - 'ucrInputFrom - ' - Me.ucrInputFrom.AddQuotesIfUnrecognised = True - Me.ucrInputFrom.AutoSize = True - Me.ucrInputFrom.IsMultiline = False - Me.ucrInputFrom.IsReadOnly = False - Me.ucrInputFrom.Location = New System.Drawing.Point(111, 24) - Me.ucrInputFrom.Name = "ucrInputFrom" - Me.ucrInputFrom.Size = New System.Drawing.Size(50, 23) - Me.ucrInputFrom.TabIndex = 1 - ' - 'ucrDataFrameLengthForRegularSequence - ' - Me.ucrDataFrameLengthForRegularSequence.AutoSize = True - Me.ucrDataFrameLengthForRegularSequence.Location = New System.Drawing.Point(111, 128) - Me.ucrDataFrameLengthForRegularSequence.Name = "ucrDataFrameLengthForRegularSequence" - Me.ucrDataFrameLengthForRegularSequence.Size = New System.Drawing.Size(54, 23) - Me.ucrDataFrameLengthForRegularSequence.TabIndex = 12 - Me.ucrDataFrameLengthForRegularSequence.ucrDataFrameSelector = Nothing - ' 'lblLength ' Me.lblLength.AutoSize = True @@ -236,56 +162,23 @@ Partial Class dlgRegularSequence Me.lblFrom.Tag = "From:" Me.lblFrom.Text = "From:" ' - 'ucrDateTimePickerTo - ' - Me.ucrDateTimePickerTo.AutoSize = True - Me.ucrDateTimePickerTo.DateValue = New Date(2021, 5, 19, 13, 55, 53, 370) - Me.ucrDateTimePickerTo.Format = "dd MMM yyyy" - Me.ucrDateTimePickerTo.Location = New System.Drawing.Point(78, 50) - Me.ucrDateTimePickerTo.MaxDate = New Date(9998, 12, 31, 0, 0, 0, 0) - Me.ucrDateTimePickerTo.MinDate = New Date(1753, 1, 1, 0, 0, 0, 0) - Me.ucrDateTimePickerTo.Name = "ucrDateTimePickerTo" - Me.ucrDateTimePickerTo.Size = New System.Drawing.Size(157, 20) - Me.ucrDateTimePickerTo.TabIndex = 15 - ' - 'ucrDateTimePickerFrom - ' - Me.ucrDateTimePickerFrom.AutoSize = True - Me.ucrDateTimePickerFrom.DateValue = New Date(2021, 5, 19, 13, 55, 53, 410) - Me.ucrDateTimePickerFrom.Format = "dd MMM yyyy" - Me.ucrDateTimePickerFrom.Location = New System.Drawing.Point(78, 24) - Me.ucrDateTimePickerFrom.MaxDate = New Date(9998, 12, 31, 0, 0, 0, 0) - Me.ucrDateTimePickerFrom.MinDate = New Date(1753, 1, 1, 0, 0, 0, 0) - Me.ucrDateTimePickerFrom.Name = "ucrDateTimePickerFrom" - Me.ucrDateTimePickerFrom.Size = New System.Drawing.Size(157, 20) - Me.ucrDateTimePickerFrom.TabIndex = 14 - ' 'lblPreview ' Me.lblPreview.AutoSize = True Me.lblPreview.ImeMode = System.Windows.Forms.ImeMode.NoControl - Me.lblPreview.Location = New System.Drawing.Point(258, 59) + Me.lblPreview.Location = New System.Drawing.Point(258, 84) Me.lblPreview.Name = "lblPreview" Me.lblPreview.Size = New System.Drawing.Size(100, 13) Me.lblPreview.TabIndex = 5 Me.lblPreview.Tag = "Preview" Me.lblPreview.Text = "Sequence Preview:" ' - 'txtGetPreview - ' - Me.txtGetPreview.Location = New System.Drawing.Point(256, 75) - Me.txtGetPreview.Name = "txtGetPreview" - Me.txtGetPreview.ReadOnly = True - Me.txtGetPreview.Size = New System.Drawing.Size(185, 140) - Me.txtGetPreview.TabIndex = 6 - Me.txtGetPreview.Text = "" - ' 'lblMessage ' Me.lblMessage.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle Me.lblMessage.Font = New System.Drawing.Font("Microsoft Sans Serif", 9.75!) Me.lblMessage.ImeMode = System.Windows.Forms.ImeMode.NoControl - Me.lblMessage.Location = New System.Drawing.Point(255, 218) + Me.lblMessage.Location = New System.Drawing.Point(255, 241) Me.lblMessage.Name = "lblMessage" Me.lblMessage.Size = New System.Drawing.Size(185, 52) Me.lblMessage.TabIndex = 7 @@ -322,6 +215,16 @@ Partial Class dlgRegularSequence Me.rdoNumeric.TextAlign = System.Drawing.ContentAlignment.MiddleCenter Me.rdoNumeric.UseVisualStyleBackColor = True ' + 'txtPreview + ' + Me.txtPreview.Location = New System.Drawing.Point(255, 99) + Me.txtPreview.Multiline = True + Me.txtPreview.Name = "txtPreview" + Me.txtPreview.ReadOnly = True + Me.txtPreview.ScrollBars = System.Windows.Forms.ScrollBars.Both + Me.txtPreview.Size = New System.Drawing.Size(185, 140) + Me.txtPreview.TabIndex = 10 + ' 'ucrPnlSequenceType ' Me.ucrPnlSequenceType.AccessibleRole = System.Windows.Forms.AccessibleRole.None @@ -340,6 +243,107 @@ Partial Class dlgRegularSequence Me.ucrNewColumnName.Size = New System.Drawing.Size(325, 24) Me.ucrNewColumnName.TabIndex = 8 ' + 'ucrInputComboDatesBy + ' + Me.ucrInputComboDatesBy.AddQuotesIfUnrecognised = True + Me.ucrInputComboDatesBy.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink + Me.ucrInputComboDatesBy.GetSetSelectedIndex = -1 + Me.ucrInputComboDatesBy.IsReadOnly = False + Me.ucrInputComboDatesBy.Location = New System.Drawing.Point(173, 76) + Me.ucrInputComboDatesBy.Name = "ucrInputComboDatesBy" + Me.ucrInputComboDatesBy.Size = New System.Drawing.Size(62, 23) + Me.ucrInputComboDatesBy.TabIndex = 17 + ' + 'ucrChkDefineAsFactor + ' + Me.ucrChkDefineAsFactor.AutoSize = True + Me.ucrChkDefineAsFactor.Checked = False + Me.ucrChkDefineAsFactor.Location = New System.Drawing.Point(5, 158) + Me.ucrChkDefineAsFactor.Name = "ucrChkDefineAsFactor" + Me.ucrChkDefineAsFactor.Size = New System.Drawing.Size(176, 23) + Me.ucrChkDefineAsFactor.TabIndex = 13 + ' + 'ucrNudRepeatValues + ' + Me.ucrNudRepeatValues.AutoSize = True + Me.ucrNudRepeatValues.DecimalPlaces = New Decimal(New Integer() {0, 0, 0, 0}) + Me.ucrNudRepeatValues.Increment = New Decimal(New Integer() {1, 0, 0, 0}) + Me.ucrNudRepeatValues.Location = New System.Drawing.Point(111, 101) + Me.ucrNudRepeatValues.Maximum = New Decimal(New Integer() {100, 0, 0, 0}) + Me.ucrNudRepeatValues.Minimum = New Decimal(New Integer() {0, 0, 0, 0}) + Me.ucrNudRepeatValues.Name = "ucrNudRepeatValues" + Me.ucrNudRepeatValues.Size = New System.Drawing.Size(50, 23) + Me.ucrNudRepeatValues.TabIndex = 9 + Me.ucrNudRepeatValues.Value = New Decimal(New Integer() {0, 0, 0, 0}) + ' + 'ucrInputInStepsOf + ' + Me.ucrInputInStepsOf.AddQuotesIfUnrecognised = True + Me.ucrInputInStepsOf.AutoSize = True + Me.ucrInputInStepsOf.IsMultiline = False + Me.ucrInputInStepsOf.IsReadOnly = False + Me.ucrInputInStepsOf.Location = New System.Drawing.Point(111, 76) + Me.ucrInputInStepsOf.Name = "ucrInputInStepsOf" + Me.ucrInputInStepsOf.Size = New System.Drawing.Size(50, 23) + Me.ucrInputInStepsOf.TabIndex = 7 + ' + 'ucrInputTo + ' + Me.ucrInputTo.AddQuotesIfUnrecognised = True + Me.ucrInputTo.AutoSize = True + Me.ucrInputTo.IsMultiline = False + Me.ucrInputTo.IsReadOnly = False + Me.ucrInputTo.Location = New System.Drawing.Point(111, 50) + Me.ucrInputTo.Name = "ucrInputTo" + Me.ucrInputTo.Size = New System.Drawing.Size(50, 23) + Me.ucrInputTo.TabIndex = 4 + ' + 'ucrInputFrom + ' + Me.ucrInputFrom.AddQuotesIfUnrecognised = True + Me.ucrInputFrom.AutoSize = True + Me.ucrInputFrom.IsMultiline = False + Me.ucrInputFrom.IsReadOnly = False + Me.ucrInputFrom.Location = New System.Drawing.Point(111, 24) + Me.ucrInputFrom.Name = "ucrInputFrom" + Me.ucrInputFrom.Size = New System.Drawing.Size(50, 23) + Me.ucrInputFrom.TabIndex = 1 + ' + 'ucrDataFrameLength + ' + Me.ucrDataFrameLength.AddQuotesIfUnrecognised = True + Me.ucrDataFrameLength.AutoSize = True + Me.ucrDataFrameLength.IsMultiline = False + Me.ucrDataFrameLength.IsReadOnly = True + Me.ucrDataFrameLength.Location = New System.Drawing.Point(111, 128) + Me.ucrDataFrameLength.Name = "ucrDataFrameLength" + Me.ucrDataFrameLength.Size = New System.Drawing.Size(54, 23) + Me.ucrDataFrameLength.TabIndex = 12 + ' + 'ucrDateTimePickerTo + ' + Me.ucrDateTimePickerTo.AutoSize = True + Me.ucrDateTimePickerTo.DateValue = New Date(2021, 5, 19, 13, 55, 53, 370) + Me.ucrDateTimePickerTo.Format = "dd MMM yyyy" + Me.ucrDateTimePickerTo.Location = New System.Drawing.Point(78, 50) + Me.ucrDateTimePickerTo.MaxDate = New Date(9998, 12, 31, 0, 0, 0, 0) + Me.ucrDateTimePickerTo.MinDate = New Date(1753, 1, 1, 0, 0, 0, 0) + Me.ucrDateTimePickerTo.Name = "ucrDateTimePickerTo" + Me.ucrDateTimePickerTo.Size = New System.Drawing.Size(157, 20) + Me.ucrDateTimePickerTo.TabIndex = 15 + ' + 'ucrDateTimePickerFrom + ' + Me.ucrDateTimePickerFrom.AutoSize = True + Me.ucrDateTimePickerFrom.DateValue = New Date(2021, 5, 19, 13, 55, 53, 410) + Me.ucrDateTimePickerFrom.Format = "dd MMM yyyy" + Me.ucrDateTimePickerFrom.Location = New System.Drawing.Point(78, 24) + Me.ucrDateTimePickerFrom.MaxDate = New Date(9998, 12, 31, 0, 0, 0, 0) + Me.ucrDateTimePickerFrom.MinDate = New Date(1753, 1, 1, 0, 0, 0, 0) + Me.ucrDateTimePickerFrom.Name = "ucrDateTimePickerFrom" + Me.ucrDateTimePickerFrom.Size = New System.Drawing.Size(157, 20) + Me.ucrDateTimePickerFrom.TabIndex = 14 + ' 'ucrSelectDataFrameRegularSequence ' Me.ucrSelectDataFrameRegularSequence.AutoSize = True @@ -357,21 +361,31 @@ Partial Class dlgRegularSequence Me.ucrBase.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink Me.ucrBase.Location = New System.Drawing.Point(10, 330) Me.ucrBase.Name = "ucrBase" - Me.ucrBase.Size = New System.Drawing.Size(405, 52) + Me.ucrBase.Size = New System.Drawing.Size(408, 52) Me.ucrBase.TabIndex = 9 ' + 'ucrChkPreview + ' + Me.ucrChkPreview.AutoSize = True + Me.ucrChkPreview.Checked = False + Me.ucrChkPreview.Location = New System.Drawing.Point(261, 60) + Me.ucrChkPreview.Name = "ucrChkPreview" + Me.ucrChkPreview.Size = New System.Drawing.Size(122, 23) + Me.ucrChkPreview.TabIndex = 11 + ' 'dlgRegularSequence ' 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(448, 387) + Me.Controls.Add(Me.ucrChkPreview) + Me.Controls.Add(Me.txtPreview) Me.Controls.Add(Me.rdoNumeric) Me.Controls.Add(Me.rdoDates) Me.Controls.Add(Me.ucrPnlSequenceType) Me.Controls.Add(Me.lblMessage) Me.Controls.Add(Me.ucrNewColumnName) - Me.Controls.Add(Me.txtGetPreview) Me.Controls.Add(Me.grpSequenceDefinition) Me.Controls.Add(Me.lblPreview) Me.Controls.Add(Me.ucrSelectDataFrameRegularSequence) @@ -400,8 +414,7 @@ Partial Class dlgRegularSequence Friend WithEvents lblLength As Label Friend WithEvents lblTimes As Label Friend WithEvents lblRepeatValues As Label - Friend WithEvents txtGetPreview As RichTextBox - Friend WithEvents ucrDataFrameLengthForRegularSequence As ucrDataFrameLength + Friend WithEvents ucrDataFrameLength As ucrDataFrameLength Friend WithEvents ucrNewColumnName As ucrSave Friend WithEvents ucrInputInStepsOf As ucrInputTextBox Friend WithEvents ucrInputTo As ucrInputTextBox @@ -415,4 +428,6 @@ Partial Class dlgRegularSequence Friend WithEvents ucrDateTimePickerTo As ucrDateTimePicker Friend WithEvents ucrDateTimePickerFrom As ucrDateTimePicker Friend WithEvents ucrInputComboDatesBy As ucrInputComboBox + Friend WithEvents txtPreview As TextBox + Friend WithEvents ucrChkPreview As ucrCheck End Class diff --git a/instat/dlgRegularSequence.vb b/instat/dlgRegularSequence.vb index 3b08ec379a5..27a7b64ed10 100644 --- a/instat/dlgRegularSequence.vb +++ b/instat/dlgRegularSequence.vb @@ -20,13 +20,17 @@ Imports RDotNet Public Class dlgRegularSequence Public bFirstLoad As Boolean = True Private bReset As Boolean = True - Private clsSeqFunction, clsRepFunction As New RFunction - Private clsSeqDateFunction As New RFunction - Private bUpdateBy As Boolean = False - Private clsByDateOperator As New ROperator - Private clsDefaultStartDate As RFunction - Private clsDefaultEndDate As RFunction - Public bNumericIsDefault As Boolean + Private clsRepFunction, clsSeqFunction, clsSeqDateFunction As New RFunction + Private clsByOperator As New ROperator + Private enumDefaultSequenceOption As DefaultSequenceOption = DefaultSequenceOption.NumericOption + Private bDefaultOptionChanged As Boolean = False + 'used to determine if the preview script has changed and whether to reresh preview or not + Private strPreviewScript As String = "" + + Private Enum DefaultSequenceOption + NumericOption + DateOption + End Enum Private Sub dlgRegularSequence_Load(sender As Object, e As EventArgs) Handles MyBase.Load If bFirstLoad Then @@ -36,25 +40,46 @@ Public Class dlgRegularSequence If bReset Then SetDefaults() End If - SetDefaultRdo() SetRCodeForControls(bReset) + + If bDefaultOptionChanged Then + SetSelectedDefaultSequenceOption() + bDefaultOptionChanged = False + End If + bReset = False autoTranslate(Me) End Sub - 'This sub is meant to set the default radiobutton on diffrent places on the Menu. - Private Sub SetDefaultRdo() - If bNumericIsDefault Then - rdoNumeric.Checked = True - Else - rdoDates.Checked = True - End If + + Private Sub SetSelectedDefaultSequenceOption() + Select Case enumDefaultSequenceOption + Case DefaultSequenceOption.NumericOption + rdoNumeric.Checked = True + Case DefaultSequenceOption.DateOption + rdoDates.Checked = True + End Select + End Sub + + ''' + ''' sets the dialog to be shown with 'numeric' option as the default option + ''' + Public Sub SetNumericSequenceAsDefaultOption() + enumDefaultSequenceOption = DefaultSequenceOption.NumericOption + bDefaultOptionChanged = True + End Sub + + ''' + ''' sets the dialog to be shown with 'numeric' option as the default option + ''' + Public Sub SetDateSequenceAsDefaultOption() + enumDefaultSequenceOption = DefaultSequenceOption.DateOption + bDefaultOptionChanged = True End Sub Private Sub InitialiseDialog() - Dim dctDatesBy As New Dictionary(Of String, String) ucrBase.iHelpTopicID = 30 - + '-------------- seq controls ----------------------- ucrInputFrom.SetParameter(New RParameter("from", 0)) ucrInputFrom.AddQuotesIfUnrecognised = False ucrInputFrom.SetValidationTypeAsNumeric() @@ -63,170 +88,141 @@ Public Class dlgRegularSequence ucrInputTo.AddQuotesIfUnrecognised = False ucrInputTo.SetValidationTypeAsNumeric() - ucrInputInStepsOf.SetParameter(New RParameter("by", 2)) - ucrInputInStepsOf.AddQuotesIfUnrecognised = False - ucrInputInStepsOf.SetValidationTypeAsNumeric(dcmMin:=0, bIncludeMin:=False) - - ucrNudRepeatValues.SetParameter(New RParameter("each", 1)) - ucrNudRepeatValues.SetMinMax(1, Integer.MaxValue) - + '--------------- seq.Date controls --------------- ucrDateTimePickerFrom.SetParameter(New RParameter("from", 0)) ucrDateTimePickerFrom.SetParameterIsRDate() ucrDateTimePickerTo.SetParameter(New RParameter("to", 1)) ucrDateTimePickerTo.SetParameterIsRDate() + Dim dctDatesBy As New Dictionary(Of String, String) From { + {"Days", "days"}, + {"Weeks", "weeks"}, + {"Months", "months"}, + {"Years", "years"} + } ucrInputComboDatesBy.SetParameter(New RParameter("period", 1, bNewIncludeArgumentName:=False)) - - dctDatesBy.Add("Days", "days") - dctDatesBy.Add("Weeks", "weeks") - dctDatesBy.Add("Months", "months") - dctDatesBy.Add("Years", "years") ucrInputComboDatesBy.SetItems(dctDatesBy) ucrInputComboDatesBy.SetDropDownStyleAsNonEditable() - ucrDataFrameLengthForRegularSequence.SetDataFrameSelector(ucrSelectDataFrameRegularSequence) + '---------------- seq and seq.Date controls----------- + ucrInputInStepsOf.SetParameter(New RParameter("by", 2)) + ucrInputInStepsOf.AddQuotesIfUnrecognised = False + ucrInputInStepsOf.SetValidationTypeAsNumeric() + + '--------------- repeat controls -------------------- + ucrNudRepeatValues.SetParameter(New RParameter("each", 1)) + ucrNudRepeatValues.SetMinMax(1, Integer.MaxValue) + + ucrDataFrameLength.SetDataFrameSelector(ucrSelectDataFrameRegularSequence) + ucrDataFrameLength.SetParameter(New RParameter("length.out", 3)) + ucrDataFrameLength.AddQuotesIfUnrecognised = False ucrPnlSequenceType.AddRadioButton(rdoNumeric) ucrPnlSequenceType.AddRadioButton(rdoDates) - 'This will be linked to the rep function which will always have the correct sequence function as its x argument ucrPnlSequenceType.AddParameterValueFunctionNamesCondition(rdoNumeric, "x", "seq") ucrPnlSequenceType.AddParameterValueFunctionNamesCondition(rdoDates, "x", "seq.Date") - ucrPnlSequenceType.AddToLinkedControls(ucrInputFrom, {rdoNumeric}, bNewLinkedAddRemoveParameter:=True, bNewLinkedHideIfParameterMissing:=True) - ucrPnlSequenceType.AddToLinkedControls(ucrInputTo, {rdoNumeric}, bNewLinkedAddRemoveParameter:=True, bNewLinkedHideIfParameterMissing:=True) - ucrPnlSequenceType.AddToLinkedControls(ucrDateTimePickerFrom, {rdoDates}, bNewLinkedHideIfParameterMissing:=True) - ucrPnlSequenceType.AddToLinkedControls(ucrDateTimePickerTo, {rdoDates}, bNewLinkedHideIfParameterMissing:=True) - ucrPnlSequenceType.AddToLinkedControls(ucrInputComboDatesBy, {rdoDates}, bNewLinkedHideIfParameterMissing:=True) + ucrPnlSequenceType.AddToLinkedControls({ucrInputFrom, ucrInputTo}, {rdoNumeric}, bNewLinkedHideIfParameterMissing:=True) + ucrPnlSequenceType.AddToLinkedControls({ucrDateTimePickerFrom, ucrDateTimePickerTo}, {rdoDates}, bNewLinkedHideIfParameterMissing:=True) + ucrPnlSequenceType.AddToLinkedControls({ucrInputComboDatesBy}, {rdoDates}, bNewLinkedHideIfParameterMissing:=True) + + ucrChkPreview.SetText("Preview") ucrNewColumnName.SetPrefix("regular") ucrNewColumnName.SetDataFrameSelector(ucrSelectDataFrameRegularSequence) ucrNewColumnName.SetIsComboBox() ucrNewColumnName.SetSaveTypeAsColumn() ucrNewColumnName.SetLabelText("New Column Name:") - - ucrChkDefineAsFactor.SetText("Define As Factor") - CheckSequenceLength() - - clsDefaultStartDate = New RFunction - clsDefaultStartDate.SetRCommand("as.Date") - clsDefaultStartDate.AddParameter("x", Chr(34) & "2018/1/1" & Chr(34)) - - clsDefaultEndDate = New RFunction - clsDefaultEndDate.SetRCommand("as.Date") - clsDefaultEndDate.AddParameter("x", Chr(34) & "2018/12/31" & Chr(34)) + '--------------------------------------------------- 'Temporarily disabled + ucrChkDefineAsFactor.SetText("Define As Factor") ucrChkDefineAsFactor.Enabled = False + '--------------------------------------------------- End Sub Private Sub SetDefaults() clsRepFunction = New RFunction clsSeqFunction = New RFunction - clsByDateOperator = New ROperator clsSeqDateFunction = New RFunction + clsByOperator = New ROperator ucrSelectDataFrameRegularSequence.Reset() + ucrDateTimePickerFrom.DateValue = DateAndTime.Now() + ucrDateTimePickerTo.DateValue = DateAndTime.Now() ucrNewColumnName.Reset() + txtPreview.Visible = False + lblPreview.Visible = False + lblMessage.Visible = False + clsSeqFunction.SetRCommand("seq") clsSeqFunction.AddParameter("from", 1, iPosition:=0) - clsSeqFunction.AddParameter("to", ucrSelectDataFrameRegularSequence.iDataFrameLength, iPosition:=1) + clsSeqFunction.AddParameter("to", ucrDataFrameLength.GetDataFrameLength, iPosition:=1) clsSeqFunction.AddParameter("by", 1, iPosition:=2) - clsRepFunction.SetRCommand("rep") - clsRepFunction.AddParameter("x", clsRFunctionParameter:=clsSeqFunction, iPosition:=0) - clsRepFunction.AddParameter("each", 1, iPosition:=2) - clsRepFunction.AddParameter("length.out", ucrSelectDataFrameRegularSequence.iDataFrameLength, iPosition:=3) - - clsByDateOperator.SetOperation(" ") - clsByDateOperator.AddParameter("number", 1, iPosition:=0) - clsByDateOperator.AddParameter("period", "days", iPosition:=1) - clsByDateOperator.bToScriptAsRString = True - clsByDateOperator.bSpaceAroundOperation = False + clsByOperator.SetOperation(" ") + clsByOperator.AddParameter("number", 1, iPosition:=0) + clsByOperator.AddParameter("period", "days", iPosition:=1) + clsByOperator.bToScriptAsRString = True + clsByOperator.bSpaceAroundOperation = False clsSeqDateFunction.SetRCommand("seq.Date") - clsSeqDateFunction.AddParameter("from", clsRFunctionParameter:=clsDefaultStartDate, iPosition:=0) - clsSeqDateFunction.AddParameter("to", clsRFunctionParameter:=clsDefaultEndDate, iPosition:=1) - clsSeqDateFunction.AddParameter("by", clsROperatorParameter:=clsByDateOperator, iPosition:=2) + clsSeqDateFunction.AddParameter("from", clsRFunctionParameter:=ucrDateTimePickerFrom.ValueAsRDate, iPosition:=0) + clsSeqDateFunction.AddParameter("to", clsRFunctionParameter:=ucrDateTimePickerTo.ValueAsRDate, iPosition:=1) + clsSeqDateFunction.AddParameter("by", clsROperatorParameter:=clsByOperator, iPosition:=2) - ucrBase.clsRsyntax.SetAssignTo(strAssignToName:=ucrNewColumnName.GetText, strTempDataframe:=ucrSelectDataFrameRegularSequence.cboAvailableDataFrames.Text, strTempColumn:=ucrNewColumnName.GetText) - ResetNumberFromToByParameters() - ucrBase.clsRsyntax.SetBaseRFunction(clsSeqFunction) - End Sub + clsRepFunction.SetRCommand("rep") + clsRepFunction.AddParameter("x", clsRFunctionParameter:=clsSeqFunction, iPosition:=0) + clsRepFunction.AddParameter("each", 1, iPosition:=2) + clsRepFunction.AddParameter("length.out", ucrDataFrameLength.GetDataFrameLength, iPosition:=3) - Private Sub ResetNumberFromToByParameters() - If rdoNumeric.Checked Then - clsSeqFunction.AddParameter("from", 1, iPosition:=0) - clsSeqFunction.AddParameter("to", ucrSelectDataFrameRegularSequence.iDataFrameLength, iPosition:=1) - clsSeqFunction.AddParameter("by", 1, iPosition:=2) - End If - End Sub + clsRepFunction.SetAssignTo(ucrNewColumnName.GetText, strTempDataframe:=ucrSelectDataFrameRegularSequence.cboAvailableDataFrames.Text, strTempColumn:=ucrNewColumnName.GetText, bAssignToIsPrefix:=True) + ucrBase.clsRsyntax.SetBaseRFunction(clsRepFunction) - Private Sub ucrPnlSequenceType_ControlValueChanged(ucrChangedControl As ucrCore) Handles ucrPnlSequenceType.ControlValueChanged - If rdoDates.Checked Then - clsRepFunction.AddParameter("x", clsRFunctionParameter:=clsSeqDateFunction, iPosition:=0) - ElseIf rdoNumeric.Checked Then - clsRepFunction.AddParameter("x", clsRFunctionParameter:=clsSeqFunction, iPosition:=0) - End If - SetBaseFunction() - CheckSequenceLength() End Sub Private Sub SetRCodeForControls(bReset As Boolean) - Dim strBy As String - Dim dcmBy As Decimal + 'command 'seq.Date' and 'seq' controls + ucrInputInStepsOf.AddAdditionalCodeParameterPair(clsByOperator, New RParameter("number", 0), iAdditionalPairNo:=1) + ucrInputInStepsOf.SetRCode(clsSeqFunction, bReset) - bUpdateBy = False - ucrNudRepeatValues.AddAdditionalCodeParameterPair(clsSeqDateFunction, ucrNudRepeatValues.GetParameter(), iAdditionalPairNo:=1) + 'command 'seq' controls + ucrInputFrom.SetRCode(clsSeqFunction, bReset) + ucrInputTo.SetRCode(clsSeqFunction, bReset) + 'command 'seq.Date' controls ucrDateTimePickerFrom.SetRCode(clsSeqDateFunction, bReset) ucrDateTimePickerTo.SetRCode(clsSeqDateFunction, bReset) - ucrInputComboDatesBy.SetRCode(clsByDateOperator, bReset) - - 'Set to base function so that control is set correctly - ucrNewColumnName.SetRCode(ucrBase.clsRsyntax.clsBaseFunction, bReset) + ucrInputComboDatesBy.SetRCode(clsByOperator, bReset) + 'base command 'rep' controls ucrPnlSequenceType.SetRCode(clsRepFunction, bReset) - ucrInputFrom.SetRCode(clsSeqFunction, bReset) - ucrInputTo.SetRCode(clsSeqFunction, bReset) ucrNudRepeatValues.SetRCode(clsRepFunction, bReset) - If clsSeqFunction.ContainsParameter("by") Then - strBy = clsSeqFunction.GetParameter("by").strArgumentValue - If strBy IsNot Nothing Then - If Decimal.TryParse(strBy, dcmBy) Then - ucrInputInStepsOf.SetName(Math.Abs(dcmBy)) - Else - ucrInputInStepsOf.SetName("") - End If - Else - ucrInputInStepsOf.SetName("") - End If - Else - ucrInputInStepsOf.SetName("") - End If - bUpdateBy = True - CheckSequenceLength() + ucrDataFrameLength.SetRCode(clsRepFunction, bReset) + ucrNewColumnName.SetRCode(clsRepFunction, bReset) End Sub Private Sub ucrBase_ClickReset(sender As Object, e As EventArgs) Handles ucrBase.ClickReset + bReset = True SetDefaults() - SetRCodeForControls(True) - SetDefaultRdo() + SetRCodeForControls(bReset) + SetSelectedDefaultSequenceOption() TestOKEnabled() + bReset = False End Sub Private Sub TestOKEnabled() - If ucrNewColumnName.IsComplete Then + If Not String.IsNullOrEmpty(ucrSelectDataFrameRegularSequence.cboAvailableDataFrames.Text) AndAlso + ucrNewColumnName.IsComplete AndAlso Not ucrInputInStepsOf.IsEmpty AndAlso + Not ucrNudRepeatValues.IsEmpty Then + If rdoNumeric.Checked Then - If ucrInputFrom.GetText <> "" AndAlso ucrInputTo.GetText <> "" AndAlso ucrInputInStepsOf.GetText <> "" AndAlso ucrNudRepeatValues.GetText <> "" AndAlso ucrSelectDataFrameRegularSequence.cboAvailableDataFrames.Text <> "" Then - ucrBase.OKEnabled(True) - Else - ucrBase.OKEnabled(False) - End If - ElseIf rdoDates.Checked AndAlso Not ucrInputInStepsOf.IsEmpty AndAlso Not ucrInputComboDatesBy.IsEmpty AndAlso ucrNudRepeatValues.GetText <> "" Then - ucrBase.OKEnabled(True) + ucrBase.OKEnabled(Not ucrInputFrom.IsEmpty AndAlso Not ucrInputTo.IsEmpty) + ElseIf rdoDates.Checked Then + ucrBase.OKEnabled(Not ucrInputComboDatesBy.IsEmpty) Else ucrBase.OKEnabled(False) End If @@ -235,157 +231,103 @@ Public Class dlgRegularSequence End If End Sub - Private Sub SetInStepsOfDateParameter() - If ucrDateTimePickerTo.DateValue >= ucrDateTimePickerFrom.DateValue Then - clsByDateOperator.AddParameter("number", ucrInputInStepsOf.GetText(), iPosition:=0) - Else - clsByDateOperator.AddParameter("number", "-" & ucrInputInStepsOf.GetText(), iPosition:=0) + ''' + ''' displays the sequence that would be added when the R script is executed. + ''' Also gives feedback on whether the sequence will be truncated or extended + ''' + Private Sub PreviewSequence() + If ucrChkPreview.Checked = False Then + Exit Sub End If - CheckSequenceLength() - End Sub - - Private Sub SetInStepsOfNumberParameter() - Dim dcmTo As Decimal - Dim dcmFrom As Decimal + Try + Dim clsNewRepClone As RFunction + Dim clsAsCharacter As New RFunction + Dim vecSequence As CharacterVector + Dim strNewPreviewScript As String + Dim iLength As Integer + + 'clone the "rep" command base function + clsNewRepClone = clsRepFunction.Clone() + clsNewRepClone.bToBeAssigned = False + clsNewRepClone.bIsAssigned = False + + 'set up "as.character" command to be usde for testing + clsAsCharacter.SetRCommand("as.character") + clsAsCharacter.AddParameter("x", clsRFunctionParameter:=clsNewRepClone) - If Not ucrInputTo.IsEmpty AndAlso Not ucrInputFrom.IsEmpty Then - If Decimal.TryParse(ucrInputTo.GetText, dcmTo) AndAlso Decimal.TryParse(ucrInputFrom.GetText, dcmFrom) Then - If dcmTo >= dcmFrom Then - clsSeqFunction.AddParameter("by", ucrInputInStepsOf.GetText()) - Else - clsSeqFunction.AddParameter("by", "-" & ucrInputInStepsOf.GetText()) - End If - Else - clsSeqFunction.RemoveParameterByName("by") + 'if the new peview script is the same as the previous one then no need to refresh preview + 'this check is useful for large data frames. + strNewPreviewScript = clsAsCharacter.ToScript() + If strNewPreviewScript = strPreviewScript Then + Exit Sub End If - Else - clsSeqFunction.RemoveParameterByName("by") - End If - CheckSequenceLength() - End Sub - + strPreviewScript = strNewPreviewScript - Private Sub SetBaseFunction() - If ucrNudRepeatValues.Value = 1 Then - If rdoDates.Checked Then - ucrBase.clsRsyntax.SetBaseRFunction(clsSeqDateFunction) - Else - ucrBase.clsRsyntax.SetBaseRFunction(clsSeqFunction) - End If - Else - ucrBase.clsRsyntax.SetBaseRFunction(clsRepFunction) - End If - SetAssignTo() - End Sub + 'get the sequence from the R command as it is, and dispay it + vecSequence = frmMain.clsRLink.RunInternalScriptGetValue(strPreviewScript, bSilent:=True).AsCharacter + txtPreview.Text = String.Join(", ", vecSequence) - Private Sub CheckSequenceLength() - Dim iLength As Integer - Dim vecSequence As CharacterVector - Dim expTemp As SymbolicExpression - Dim strRCommand As String - Dim bIsAssigned As Boolean - Dim bToBeAssigned As Boolean - Dim clsAsCharacter As New RFunction - Dim clsRepClone As New RFunction - - lblMessage.Text = "" - Try - bIsAssigned = ucrBase.clsRsyntax.clsBaseFunction.bIsAssigned - bToBeAssigned = ucrBase.clsRsyntax.clsBaseFunction.bToBeAssigned - ucrBase.clsRsyntax.clsBaseFunction.bIsAssigned = False - ucrBase.clsRsyntax.clsBaseFunction.bToBeAssigned = False - ucrBase.clsRsyntax.RemoveParameter("length.out") - clsAsCharacter.SetRCommand("as.character") - clsAsCharacter.AddParameter("x", clsRFunctionParameter:=ucrBase.clsRsyntax.clsBaseFunction) - strRCommand = clsAsCharacter.ToScript() - expTemp = frmMain.clsRLink.RunInternalScriptGetValue(strRCommand, bSilent:=True) - vecSequence = expTemp.AsCharacter + 'remove the "length.out", then check if sequence is truncated or extended + clsNewRepClone.RemoveParameterByName("length.out") + vecSequence = frmMain.clsRLink.RunInternalScriptGetValue(clsAsCharacter.ToScript(), bSilent:=True).AsCharacter iLength = vecSequence.Length - If iLength <> ucrSelectDataFrameRegularSequence.iDataFrameLength Then - ucrBase.clsRsyntax.SetBaseRFunction(clsRepFunction) - clsRepFunction.AddParameter("length.out", ucrSelectDataFrameRegularSequence.iDataFrameLength, iPosition:=3) - clsRepClone = clsRepFunction.Clone() - clsRepClone.bToBeAssigned = False - clsRepClone.bIsAssigned = False - clsAsCharacter.SetRCommand("as.character") - clsAsCharacter.AddParameter("x", clsRFunctionParameter:=clsRepClone) - strRCommand = clsAsCharacter.ToScript() - bIsAssigned = False - vecSequence = frmMain.clsRLink.RunInternalScriptGetValue(strRCommand, bSilent:=True).AsCharacter - ucrBase.clsRsyntax.SetAssignTo(strAssignToName:=ucrNewColumnName.GetText, strTempDataframe:=ucrSelectDataFrameRegularSequence.cboAvailableDataFrames.Text, strTempColumn:=ucrNewColumnName.GetText) - If iLength < ucrSelectDataFrameRegularSequence.iDataFrameLength Then - lblMessage.Text = "Sequence extended to match" & Environment.NewLine & "the length of the data frame." - ElseIf iLength > ucrSelectDataFrameRegularSequence.iDataFrameLength Then - lblMessage.Text = "Sequence truncated to match" & Environment.NewLine & "the length of the data frame." - End If - Else - clsRepFunction.RemoveParameterByName("length.out") - lblMessage.Text = "Sequence matches the length of the data frame." + If iLength = ucrDataFrameLength.GetDataFrameLength Then + lblMessage.Text = GetTranslation("Sequence matches the length of the data frame.") + ElseIf iLength < ucrDataFrameLength.GetDataFrameLength Then + lblMessage.Text = GetTranslation("Sequence extended to match the length of the data frame.") + ElseIf iLength > ucrDataFrameLength.GetDataFrameLength Then + lblMessage.Text = GetTranslation("Sequence truncated to match the length of the data frame.") End If - txtGetPreview.Text = "" - txtGetPreview.Text = String.Join(", ", vecSequence) - ucrBase.clsRsyntax.clsBaseFunction.bIsAssigned = bIsAssigned - ucrBase.clsRsyntax.clsBaseFunction.bToBeAssigned = bToBeAssigned Catch ex As Exception - txtGetPreview.Text = "" + txtPreview.Text = "" lblMessage.Text = "No preview available." End Try End Sub - Private Sub ucrSelectDataFrameRegularSequence_ControlValueChanged(ucrChangedControl As ucrCore) Handles ucrSelectDataFrameRegularSequence.ControlValueChanged - If ucrSelectDataFrameRegularSequence.cboAvailableDataFrames.Text <> "" Then - Try - ucrInputTo.SetName(frmMain.clsRLink.GetDataFrameLength(ucrSelectDataFrameRegularSequence.cboAvailableDataFrames.Text)) - Catch ex As Exception - ucrInputTo.SetName("") - End Try + Private Sub ucrPnlSequenceType_ControlValueChanged(ucrChangedControl As ucrCore) Handles ucrPnlSequenceType.ControlValueChanged + If rdoNumeric.Checked Then + clsRepFunction.AddParameter("x", clsRFunctionParameter:=clsSeqFunction, iPosition:=0) + ElseIf rdoDates.Checked Then + clsRepFunction.AddParameter("x", clsRFunctionParameter:=clsSeqDateFunction, iPosition:=0) End If - SetAssignTo() End Sub - Private Sub ucrNudRepeatValues_ControlValueChanged(ucrChangedControl As ucrCore) Handles ucrNudRepeatValues.ControlValueChanged - SetBaseFunction() - CheckSequenceLength() - End Sub - - Private Sub ucrInputNumberControls_ControlValueChanged(ucrChangedControl As ucrCore) Handles ucrInputFrom.ControlValueChanged, ucrInputTo.ControlValueChanged, ucrInputInStepsOf.ControlValueChanged - If bUpdateBy Then - SetInStepsOfNumberParameter() + Private Sub ucrInputStepsOfControls_ControlValueChanged(ucrChangedControl As ucrCore) Handles ucrInputFrom.ControlValueChanged, ucrInputTo.ControlValueChanged, ucrDateTimePickerFrom.ControlValueChanged, ucrDateTimePickerTo.ControlValueChanged, ucrInputComboDatesBy.ControlValueChanged, ucrPnlSequenceType.ControlValueChanged + 'ucrInputInStepsOf will be empty when dialog loads for the first time + 'no need to st value for ucrInputInStepsOf if its empty + If ucrInputInStepsOf.IsEmpty Then + Exit Sub End If - End Sub - Private Sub ucrInputDateControls_ControlValueChanged(ucrChangedControl As ucrCore) Handles ucrDateTimePickerFrom.ControlValueChanged, ucrDateTimePickerTo.ControlValueChanged, ucrInputComboDatesBy.ControlValueChanged - If bUpdateBy Then - SetInStepsOfDateParameter() + If rdoNumeric.Checked Then + Dim dcmTo As Decimal + Dim dcmFrom As Decimal + If Decimal.TryParse(ucrInputTo.GetText, dcmTo) AndAlso Decimal.TryParse(ucrInputFrom.GetText, dcmFrom) Then + ucrInputInStepsOf.SetName(If(dcmTo >= dcmFrom, "", "-") & ucrInputInStepsOf.GetText().Replace("-", "")) + End If + ElseIf rdoDates.Checked Then + ucrInputInStepsOf.SetName(If(ucrDateTimePickerTo.DateValue >= ucrDateTimePickerFrom.DateValue, + "", "-") & ucrInputInStepsOf.GetText().Replace("-", "")) End If - End Sub - - Private Sub ucrNewColumnName_ControlValueChanged(ucrChangedControl As ucrCore) Handles ucrNewColumnName.ControlValueChanged - SetAssignTo() - End Sub - Private Sub SetAssignTo() - If ucrNewColumnName.IsComplete AndAlso ucrSelectDataFrameRegularSequence.cboAvailableDataFrames.Text <> "" Then - ucrBase.clsRsyntax.SetAssignTo(ucrNewColumnName.GetText(), strTempDataframe:=ucrSelectDataFrameRegularSequence.cboAvailableDataFrames.Text, strTempColumn:=ucrNewColumnName.GetText()) - Else - ucrBase.clsRsyntax.RemoveAssignTo() - End If End Sub - Private Sub ucrInputComboDatesBy_ControlValueChanged(ucrChangedControl As ucrCore) Handles ucrInputComboDatesBy.ControlValueChanged - If bUpdateBy Then - ResetNumberFromToByParameters() - End If + Private Sub ucrInputInStepsOf_ControlValueChanged(ucrChangedControl As ucrCore) Handles ucrInputInStepsOf.ControlValueChanged + PreviewSequence() End Sub - Private Sub lblPreview_Click(sender As Object, e As EventArgs) Handles lblPreview.Click + Private Sub ucrRepeatControls_ControlValueChanged(ucrChangedControl As ucrCore) Handles ucrNudRepeatValues.ControlValueChanged, ucrDataFrameLength.ControlValueChanged + PreviewSequence() End Sub - Private Sub lblMessage_Click(sender As Object, e As EventArgs) Handles lblMessage.Click - + Private Sub ucrControls_ControlContentsChanged(ucrChangedControl As ucrCore) Handles ucrNewColumnName.ControlContentsChanged, ucrInputTo.ControlContentsChanged, ucrInputFrom.ControlContentsChanged, ucrInputInStepsOf.ControlContentsChanged, ucrSelectDataFrameRegularSequence.ControlContentsChanged, ucrInputFrom.ControlContentsChanged, ucrInputTo.ControlContentsChanged, ucrInputInStepsOf.ControlContentsChanged, ucrNudRepeatValues.ControlContentsChanged, ucrPnlSequenceType.ControlContentsChanged, ucrInputComboDatesBy.ControlContentsChanged + TestOKEnabled() End Sub - Private Sub ucrNewColumnName_ControlContentsChanged(ucrChangedControl As ucrCore) Handles ucrNewColumnName.ControlContentsChanged, ucrInputTo.ControlContentsChanged, ucrInputFrom.ControlContentsChanged, ucrInputInStepsOf.ControlContentsChanged, ucrSelectDataFrameRegularSequence.ControlContentsChanged, ucrInputFrom.ControlContentsChanged, ucrInputTo.ControlContentsChanged, ucrInputInStepsOf.ControlContentsChanged, ucrNudRepeatValues.ControlContentsChanged, ucrPnlSequenceType.ControlContentsChanged, ucrInputComboDatesBy.ControlContentsChanged - TestOKEnabled() + Private Sub ucrChkPreview_ControlValueChanged(ucrChangedControl As ucrCore) Handles ucrChkPreview.ControlValueChanged + txtPreview.Visible = ucrChkPreview.Checked + lblPreview.Visible = ucrChkPreview.Checked + lblMessage.Visible = ucrChkPreview.Checked + PreviewSequence() End Sub End Class diff --git a/instat/dlgRemoveUnusedLevels.Designer.vb b/instat/dlgRemoveUnusedLevels.Designer.vb index 853c450c08d..036ccf7ebc9 100644 --- a/instat/dlgRemoveUnusedLevels.Designer.vb +++ b/instat/dlgRemoveUnusedLevels.Designer.vb @@ -60,13 +60,10 @@ Partial Class dlgRemoveUnusedLevels ' Me.ucrRemoveUnusedFactorLevels.AutoSize = True Me.ucrRemoveUnusedFactorLevels.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle - Me.ucrRemoveUnusedFactorLevels.clsReceiver = Nothing Me.ucrRemoveUnusedFactorLevels.Location = New System.Drawing.Point(239, 57) Me.ucrRemoveUnusedFactorLevels.Name = "ucrRemoveUnusedFactorLevels" - Me.ucrRemoveUnusedFactorLevels.shtCurrSheet = Nothing Me.ucrRemoveUnusedFactorLevels.Size = New System.Drawing.Size(255, 175) Me.ucrRemoveUnusedFactorLevels.TabIndex = 3 - Me.ucrRemoveUnusedFactorLevels.ucrChkLevels = Nothing ' 'ucrReceiverFactorColumn ' diff --git a/instat/dlgRemoveUnusedLevels.vb b/instat/dlgRemoveUnusedLevels.vb index f3907e0467d..6009028e66c 100644 --- a/instat/dlgRemoveUnusedLevels.vb +++ b/instat/dlgRemoveUnusedLevels.vb @@ -46,8 +46,8 @@ Public Class dlgRemoveUnusedLevels ucrReceiverFactorColumn.SetIncludedDataTypes({"factor"}, bStrict:=True) ucrReceiverFactorColumn.strSelectorHeading = "Factors" - ucrRemoveUnusedFactorLevels.SetReceiver(ucrReceiverFactorColumn) - ucrRemoveUnusedFactorLevels.SetIncludeLevels(False) + ucrRemoveUnusedFactorLevels.SetAsNormalGridColumn(ucrReceiverFactorColumn, + hiddenColNames:={ucrFactor.DefaultColumnNames.Level}) 'Set selector data frame ucrSelectorFactorColumn.SetParameter(New RParameter("data_name", 0)) diff --git a/instat/dlgRenameDataFrame.vb b/instat/dlgRenameDataFrame.vb index a959abd5299..879ed4f98fa 100644 --- a/instat/dlgRenameDataFrame.vb +++ b/instat/dlgRenameDataFrame.vb @@ -15,6 +15,7 @@ ' along with this program. If not, see . Imports instat.Translations +Imports RDotNet Public Class dlgRenameDataFrame Public bFirstLoad As Boolean = True Dim strSelectedDataFrame As String = "" @@ -93,6 +94,23 @@ Public Class dlgRenameDataFrame CheckAutoName() End Sub + Private Function GetDataLabel() + Dim clsDataFrameLabelsRFunction = New RFunction + Dim expItems As SymbolicExpression + + clsDataFrameLabelsRFunction.SetRCommand(frmMain.clsRLink.strInstatDataObject & "$get_data_frame_label") + clsDataFrameLabelsRFunction.AddParameter("data_name", Chr(34) & ucrDataFrameToRename.strCurrDataFrame & Chr(34), iPosition:=0) + + expItems = frmMain.clsRLink.RunInternalScriptGetValue(clsDataFrameLabelsRFunction.ToScript(), bSilent:=True) + Return expItems.AsCharacter(0) + End Function + + Private Sub ucrInputNewName_ControlValueChanged(ucrChangedControl As ucrCore) Handles ucrInputNewName.ControlValueChanged + If ucrInputNewName.GetText <> "" Then + ucrInputLabel.SetName(GetDataLabel()) + End If + End Sub + Private Sub ucrInputNewName_ContentsChanged(ucrChangedControl As ucrCore) Handles ucrInputNewName.ControlContentsChanged, ucrDataFrameToRename.ControlContentsChanged TestOKEnabled() End Sub diff --git a/instat/dlgRestrict.vb b/instat/dlgRestrict.vb index adf324447a0..2342b49d5ed 100644 --- a/instat/dlgRestrict.vb +++ b/instat/dlgRestrict.vb @@ -18,10 +18,10 @@ Imports instat.Translations Imports RDotNet Public Class dlgRestrict Public bFirstLoad As Boolean - Private clsRemoveFilter As RFunction - Private clsSetCurrentFilter As RFunction - Private clsSubset As RFunction - Private clsFilterView As RFunction + Private clsRemoveFilter As New RFunction + Private clsSetCurrentFilter As New RFunction + Private clsSubset As New RFunction + Private clsFilterView As New RFunction Public bIsSubsetDialog As Boolean Public strDefaultDataframe As String = "" Public strDefaultColumn As String = "" diff --git a/instat/dlgRowSummary.Designer.vb b/instat/dlgRowSummary.Designer.vb index 2d4a1a98787..2d8b2bbb43e 100644 --- a/instat/dlgRowSummary.Designer.vb +++ b/instat/dlgRowSummary.Designer.vb @@ -15,95 +15,131 @@ ' along with this program. If not, see . -Partial Class dlgRowSummary - Inherits System.Windows.Forms.Form - - 'Form overrides dispose to clean up the component list. +Partial Class dlgRowSummary + 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 - components.Dispose() - End If - Finally - MyBase.Dispose(disposing) - End Try - End Sub - - 'Required by the Windows Form Designer - Private components As System.ComponentModel.IContainer - - '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. + Protected Overrides Sub Dispose(ByVal disposing As Boolean) + Try + If disposing AndAlso components IsNot Nothing Then + components.Dispose() + End If + Finally + MyBase.Dispose(disposing) + End Try + End Sub + + 'Required by the Windows Form Designer + Private components As System.ComponentModel.IContainer + + '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.lblSelected = New System.Windows.Forms.Label() - Me.cmdUserDefined = New System.Windows.Forms.Button() + Private Sub InitializeComponent() + Me.lblSelectedVariables = New System.Windows.Forms.Label() Me.grpStatistic = New System.Windows.Forms.GroupBox() + Me.lblTrim = New System.Windows.Forms.Label() + Me.rdoMore = New System.Windows.Forms.RadioButton() Me.rdoMinimum = New System.Windows.Forms.RadioButton() Me.rdoMaximum = New System.Windows.Forms.RadioButton() Me.rdoCount = New System.Windows.Forms.RadioButton() Me.rdoMean = New System.Windows.Forms.RadioButton() Me.rdoStandardDeviation = New System.Windows.Forms.RadioButton() - Me.rdoNumberofMissing = New System.Windows.Forms.RadioButton() + Me.rdoNumberMissing = New System.Windows.Forms.RadioButton() Me.rdoMedian = New System.Windows.Forms.RadioButton() Me.rdoSum = New System.Windows.Forms.RadioButton() - Me.ucrPanelStatistics = New instat.UcrPanel() + Me.lblProp = New System.Windows.Forms.Label() + Me.ucrInputUserDefined = New instat.ucrInputComboBox() + Me.ucrNudProp = New instat.ucrNud() + Me.ucrNudTrim = New instat.ucrNud() + Me.ucrPnlStatistics = New instat.UcrPanel() + Me.grpMultipleRowSummary = New System.Windows.Forms.GroupBox() + Me.ucrInputTiesMethod = New instat.ucrInputComboBox() + Me.ucrInputType = New instat.ucrInputComboBox() + Me.ucrChkType = New instat.ucrCheck() + Me.ucrChkTiesMethod = New instat.ucrCheck() + Me.ucrInputProbability = New instat.ucrInputComboBox() + Me.rdoRowRanks = New System.Windows.Forms.RadioButton() + Me.rdoRowQuantile = New System.Windows.Forms.RadioButton() + Me.rdoRowRange = New System.Windows.Forms.RadioButton() + Me.ucrPnlMultipleRowSummary = New instat.UcrPanel() + Me.rdoSingle = New System.Windows.Forms.RadioButton() + Me.rdoMultiple = New System.Windows.Forms.RadioButton() Me.ucrChkIgnoreMissingValues = New instat.ucrCheck() - Me.ucrSaveResults = New instat.ucrSave() Me.ucrSelectorForRowSummaries = New instat.ucrSelectorByDataFrameAddRemove() Me.ucrReceiverForRowSummaries = New instat.ucrReceiverMultiple() Me.ucrBase = New instat.ucrButtons() + Me.ucrPnlRowSummaries = New instat.UcrPanel() + Me.ucrSaveNewDataFrame = New instat.ucrSave() Me.grpStatistic.SuspendLayout() + Me.grpMultipleRowSummary.SuspendLayout() Me.SuspendLayout() ' - 'lblSelected - ' - Me.lblSelected.AutoSize = True - Me.lblSelected.ImeMode = System.Windows.Forms.ImeMode.NoControl - Me.lblSelected.Location = New System.Drawing.Point(250, 45) - Me.lblSelected.Name = "lblSelected" - Me.lblSelected.Size = New System.Drawing.Size(53, 13) - Me.lblSelected.TabIndex = 1 - Me.lblSelected.Tag = "Rows_to_Summarise:" - Me.lblSelected.Text = "Variables:" - ' - 'cmdUserDefined + 'lblSelectedVariables ' - Me.cmdUserDefined.ImeMode = System.Windows.Forms.ImeMode.NoControl - Me.cmdUserDefined.Location = New System.Drawing.Point(308, 271) - Me.cmdUserDefined.Name = "cmdUserDefined" - Me.cmdUserDefined.Size = New System.Drawing.Size(100, 23) - Me.cmdUserDefined.TabIndex = 6 - Me.cmdUserDefined.Tag = "User_Define" - Me.cmdUserDefined.Text = "User Define" - Me.cmdUserDefined.UseVisualStyleBackColor = True + Me.lblSelectedVariables.AutoSize = True + Me.lblSelectedVariables.ImeMode = System.Windows.Forms.ImeMode.NoControl + Me.lblSelectedVariables.Location = New System.Drawing.Point(276, 73) + Me.lblSelectedVariables.Name = "lblSelectedVariables" + Me.lblSelectedVariables.Size = New System.Drawing.Size(98, 13) + Me.lblSelectedVariables.TabIndex = 5 + Me.lblSelectedVariables.Tag = "Selected_Variables" + Me.lblSelectedVariables.Text = "Selected Variables:" ' 'grpStatistic ' + Me.grpStatistic.Controls.Add(Me.lblTrim) + Me.grpStatistic.Controls.Add(Me.rdoMore) Me.grpStatistic.Controls.Add(Me.rdoMinimum) Me.grpStatistic.Controls.Add(Me.rdoMaximum) Me.grpStatistic.Controls.Add(Me.rdoCount) Me.grpStatistic.Controls.Add(Me.rdoMean) Me.grpStatistic.Controls.Add(Me.rdoStandardDeviation) - Me.grpStatistic.Controls.Add(Me.rdoNumberofMissing) + Me.grpStatistic.Controls.Add(Me.rdoNumberMissing) Me.grpStatistic.Controls.Add(Me.rdoMedian) Me.grpStatistic.Controls.Add(Me.rdoSum) - Me.grpStatistic.Controls.Add(Me.ucrPanelStatistics) - Me.grpStatistic.Location = New System.Drawing.Point(10, 195) + Me.grpStatistic.Controls.Add(Me.lblProp) + Me.grpStatistic.Controls.Add(Me.ucrInputUserDefined) + Me.grpStatistic.Controls.Add(Me.ucrNudProp) + Me.grpStatistic.Controls.Add(Me.ucrNudTrim) + Me.grpStatistic.Controls.Add(Me.ucrPnlStatistics) + Me.grpStatistic.Location = New System.Drawing.Point(10, 238) Me.grpStatistic.Name = "grpStatistic" - Me.grpStatistic.Size = New System.Drawing.Size(398, 70) - Me.grpStatistic.TabIndex = 4 + Me.grpStatistic.Size = New System.Drawing.Size(435, 88) + Me.grpStatistic.TabIndex = 8 Me.grpStatistic.TabStop = False Me.grpStatistic.Tag = "Statistic" Me.grpStatistic.Text = "Row Statistic" ' + 'lblTrim + ' + Me.lblTrim.AutoSize = True + Me.lblTrim.Location = New System.Drawing.Point(353, 66) + Me.lblTrim.Name = "lblTrim" + Me.lblTrim.Size = New System.Drawing.Size(30, 13) + Me.lblTrim.TabIndex = 15 + Me.lblTrim.Text = "Trim:" + ' + 'rdoMore + ' + Me.rdoMore.AutoSize = True + Me.rdoMore.ImeMode = System.Windows.Forms.ImeMode.NoControl + Me.rdoMore.Location = New System.Drawing.Point(198, 63) + Me.rdoMore.Name = "rdoMore" + Me.rdoMore.Size = New System.Drawing.Size(49, 17) + Me.rdoMore.TabIndex = 9 + Me.rdoMore.TabStop = True + Me.rdoMore.Tag = "More" + Me.rdoMore.Text = "More" + Me.rdoMore.UseVisualStyleBackColor = True + ' 'rdoMinimum ' Me.rdoMinimum.AutoSize = True Me.rdoMinimum.ImeMode = System.Windows.Forms.ImeMode.NoControl - Me.rdoMinimum.Location = New System.Drawing.Point(327, 19) + Me.rdoMinimum.Location = New System.Drawing.Point(6, 42) Me.rdoMinimum.Name = "rdoMinimum" Me.rdoMinimum.Size = New System.Drawing.Size(66, 17) Me.rdoMinimum.TabIndex = 7 @@ -116,7 +152,7 @@ Partial Class dlgRowSummary ' Me.rdoMaximum.AutoSize = True Me.rdoMaximum.ImeMode = System.Windows.Forms.ImeMode.NoControl - Me.rdoMaximum.Location = New System.Drawing.Point(327, 42) + Me.rdoMaximum.Location = New System.Drawing.Point(91, 42) Me.rdoMaximum.Name = "rdoMaximum" Me.rdoMaximum.Size = New System.Drawing.Size(69, 17) Me.rdoMaximum.TabIndex = 8 @@ -129,10 +165,10 @@ Partial Class dlgRowSummary ' Me.rdoCount.AutoSize = True Me.rdoCount.ImeMode = System.Windows.Forms.ImeMode.NoControl - Me.rdoCount.Location = New System.Drawing.Point(197, 19) + Me.rdoCount.Location = New System.Drawing.Point(6, 63) Me.rdoCount.Name = "rdoCount" Me.rdoCount.Size = New System.Drawing.Size(53, 17) - Me.rdoCount.TabIndex = 5 + Me.rdoCount.TabIndex = 4 Me.rdoCount.TabStop = True Me.rdoCount.Tag = "Count" Me.rdoCount.Text = "Count" @@ -142,7 +178,7 @@ Partial Class dlgRowSummary ' Me.rdoMean.AutoSize = True Me.rdoMean.ImeMode = System.Windows.Forms.ImeMode.NoControl - Me.rdoMean.Location = New System.Drawing.Point(6, 19) + Me.rdoMean.Location = New System.Drawing.Point(6, 21) Me.rdoMean.Name = "rdoMean" Me.rdoMean.Size = New System.Drawing.Size(52, 17) Me.rdoMean.TabIndex = 1 @@ -155,33 +191,33 @@ Partial Class dlgRowSummary ' Me.rdoStandardDeviation.AutoSize = True Me.rdoStandardDeviation.ImeMode = System.Windows.Forms.ImeMode.NoControl - Me.rdoStandardDeviation.Location = New System.Drawing.Point(77, 42) + Me.rdoStandardDeviation.Location = New System.Drawing.Point(198, 19) Me.rdoStandardDeviation.Name = "rdoStandardDeviation" Me.rdoStandardDeviation.Size = New System.Drawing.Size(116, 17) - Me.rdoStandardDeviation.TabIndex = 4 + Me.rdoStandardDeviation.TabIndex = 5 Me.rdoStandardDeviation.TabStop = True Me.rdoStandardDeviation.Tag = "Standard_Deviation" Me.rdoStandardDeviation.Text = "Standard Deviation" Me.rdoStandardDeviation.UseVisualStyleBackColor = True ' - 'rdoNumberofMissing + 'rdoNumberMissing ' - Me.rdoNumberofMissing.AutoSize = True - Me.rdoNumberofMissing.ImeMode = System.Windows.Forms.ImeMode.NoControl - Me.rdoNumberofMissing.Location = New System.Drawing.Point(196, 42) - Me.rdoNumberofMissing.Name = "rdoNumberofMissing" - Me.rdoNumberofMissing.Size = New System.Drawing.Size(112, 17) - Me.rdoNumberofMissing.TabIndex = 6 - Me.rdoNumberofMissing.TabStop = True - Me.rdoNumberofMissing.Tag = "Number_of_Missing" - Me.rdoNumberofMissing.Text = "Number of Missing" - Me.rdoNumberofMissing.UseVisualStyleBackColor = True + Me.rdoNumberMissing.AutoSize = True + Me.rdoNumberMissing.ImeMode = System.Windows.Forms.ImeMode.NoControl + Me.rdoNumberMissing.Location = New System.Drawing.Point(91, 63) + Me.rdoNumberMissing.Name = "rdoNumberMissing" + Me.rdoNumberMissing.Size = New System.Drawing.Size(100, 17) + Me.rdoNumberMissing.TabIndex = 6 + Me.rdoNumberMissing.TabStop = True + Me.rdoNumberMissing.Tag = "Number_Missing" + Me.rdoNumberMissing.Text = "Number Missing" + Me.rdoNumberMissing.UseVisualStyleBackColor = True ' 'rdoMedian ' Me.rdoMedian.AutoSize = True Me.rdoMedian.ImeMode = System.Windows.Forms.ImeMode.NoControl - Me.rdoMedian.Location = New System.Drawing.Point(6, 42) + Me.rdoMedian.Location = New System.Drawing.Point(198, 42) Me.rdoMedian.Name = "rdoMedian" Me.rdoMedian.Size = New System.Drawing.Size(60, 17) Me.rdoMedian.TabIndex = 2 @@ -194,7 +230,7 @@ Partial Class dlgRowSummary ' Me.rdoSum.AutoSize = True Me.rdoSum.ImeMode = System.Windows.Forms.ImeMode.NoControl - Me.rdoSum.Location = New System.Drawing.Point(77, 19) + Me.rdoSum.Location = New System.Drawing.Point(91, 21) Me.rdoSum.Name = "rdoSum" Me.rdoSum.Size = New System.Drawing.Size(46, 17) Me.rdoSum.TabIndex = 3 @@ -203,31 +239,223 @@ Partial Class dlgRowSummary Me.rdoSum.Text = "Sum" Me.rdoSum.UseVisualStyleBackColor = True ' - 'ucrPanelStatistics - ' - Me.ucrPanelStatistics.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink - Me.ucrPanelStatistics.Location = New System.Drawing.Point(3, 12) - Me.ucrPanelStatistics.Name = "ucrPanelStatistics" - Me.ucrPanelStatistics.Size = New System.Drawing.Size(393, 56) - Me.ucrPanelStatistics.TabIndex = 0 + 'lblProp + ' + Me.lblProp.AutoSize = True + Me.lblProp.Location = New System.Drawing.Point(353, 66) + Me.lblProp.Name = "lblProp" + Me.lblProp.Size = New System.Drawing.Size(32, 13) + Me.lblProp.TabIndex = 13 + Me.lblProp.Text = "Prop:" + ' + 'ucrInputUserDefined + ' + Me.ucrInputUserDefined.AddQuotesIfUnrecognised = True + Me.ucrInputUserDefined.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink + Me.ucrInputUserDefined.GetSetSelectedIndex = -1 + Me.ucrInputUserDefined.IsReadOnly = False + Me.ucrInputUserDefined.Location = New System.Drawing.Point(247, 61) + Me.ucrInputUserDefined.Name = "ucrInputUserDefined" + Me.ucrInputUserDefined.Size = New System.Drawing.Size(104, 25) + Me.ucrInputUserDefined.TabIndex = 10 + ' + 'ucrNudProp + ' + Me.ucrNudProp.AutoSize = True + Me.ucrNudProp.DecimalPlaces = New Decimal(New Integer() {0, 0, 0, 0}) + Me.ucrNudProp.Increment = New Decimal(New Integer() {1, 0, 0, 0}) + Me.ucrNudProp.Location = New System.Drawing.Point(385, 62) + Me.ucrNudProp.Maximum = New Decimal(New Integer() {100, 0, 0, 0}) + Me.ucrNudProp.Minimum = New Decimal(New Integer() {0, 0, 0, 0}) + Me.ucrNudProp.Name = "ucrNudProp" + Me.ucrNudProp.Size = New System.Drawing.Size(42, 20) + Me.ucrNudProp.TabIndex = 14 + Me.ucrNudProp.Value = New Decimal(New Integer() {0, 0, 0, 0}) + ' + 'ucrNudTrim + ' + Me.ucrNudTrim.AutoSize = True + Me.ucrNudTrim.DecimalPlaces = New Decimal(New Integer() {0, 0, 0, 0}) + Me.ucrNudTrim.Increment = New Decimal(New Integer() {1, 0, 0, 0}) + Me.ucrNudTrim.Location = New System.Drawing.Point(387, 62) + Me.ucrNudTrim.Maximum = New Decimal(New Integer() {100, 0, 0, 0}) + Me.ucrNudTrim.Minimum = New Decimal(New Integer() {0, 0, 0, 0}) + Me.ucrNudTrim.Name = "ucrNudTrim" + Me.ucrNudTrim.Size = New System.Drawing.Size(42, 20) + Me.ucrNudTrim.TabIndex = 13 + Me.ucrNudTrim.Value = New Decimal(New Integer() {0, 0, 0, 0}) + ' + 'ucrPnlStatistics + ' + Me.ucrPnlStatistics.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink + Me.ucrPnlStatistics.Location = New System.Drawing.Point(4, 14) + Me.ucrPnlStatistics.Name = "ucrPnlStatistics" + Me.ucrPnlStatistics.Size = New System.Drawing.Size(425, 68) + Me.ucrPnlStatistics.TabIndex = 0 + ' + 'grpMultipleRowSummary + ' + Me.grpMultipleRowSummary.Controls.Add(Me.ucrInputTiesMethod) + Me.grpMultipleRowSummary.Controls.Add(Me.ucrInputType) + Me.grpMultipleRowSummary.Controls.Add(Me.ucrChkType) + Me.grpMultipleRowSummary.Controls.Add(Me.ucrChkTiesMethod) + Me.grpMultipleRowSummary.Controls.Add(Me.ucrInputProbability) + Me.grpMultipleRowSummary.Controls.Add(Me.rdoRowRanks) + Me.grpMultipleRowSummary.Controls.Add(Me.rdoRowQuantile) + Me.grpMultipleRowSummary.Controls.Add(Me.rdoRowRange) + Me.grpMultipleRowSummary.Controls.Add(Me.ucrPnlMultipleRowSummary) + Me.grpMultipleRowSummary.Location = New System.Drawing.Point(10, 238) + Me.grpMultipleRowSummary.Name = "grpMultipleRowSummary" + Me.grpMultipleRowSummary.Size = New System.Drawing.Size(385, 84) + Me.grpMultipleRowSummary.TabIndex = 11 + Me.grpMultipleRowSummary.TabStop = False + Me.grpMultipleRowSummary.Tag = "Statistic" + Me.grpMultipleRowSummary.Text = "Row Statistic" + ' + 'ucrInputTiesMethod + ' + Me.ucrInputTiesMethod.AddQuotesIfUnrecognised = True + Me.ucrInputTiesMethod.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink + Me.ucrInputTiesMethod.GetSetSelectedIndex = -1 + Me.ucrInputTiesMethod.IsReadOnly = False + Me.ucrInputTiesMethod.Location = New System.Drawing.Point(163, 21) + Me.ucrInputTiesMethod.Name = "ucrInputTiesMethod" + Me.ucrInputTiesMethod.Size = New System.Drawing.Size(98, 21) + Me.ucrInputTiesMethod.TabIndex = 15 + ' + 'ucrInputType + ' + Me.ucrInputType.AddQuotesIfUnrecognised = True + Me.ucrInputType.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink + Me.ucrInputType.GetSetSelectedIndex = -1 + Me.ucrInputType.IsReadOnly = False + Me.ucrInputType.Location = New System.Drawing.Point(277, 48) + Me.ucrInputType.Name = "ucrInputType" + Me.ucrInputType.Size = New System.Drawing.Size(35, 24) + Me.ucrInputType.TabIndex = 14 + ' + 'ucrChkType + ' + Me.ucrChkType.AutoSize = True + Me.ucrChkType.Checked = False + Me.ucrChkType.Location = New System.Drawing.Point(222, 49) + Me.ucrChkType.Name = "ucrChkType" + Me.ucrChkType.Size = New System.Drawing.Size(53, 23) + Me.ucrChkType.TabIndex = 13 + ' + 'ucrChkTiesMethod + ' + Me.ucrChkTiesMethod.AutoSize = True + Me.ucrChkTiesMethod.Checked = False + Me.ucrChkTiesMethod.Location = New System.Drawing.Point(73, 22) + Me.ucrChkTiesMethod.Name = "ucrChkTiesMethod" + Me.ucrChkTiesMethod.Size = New System.Drawing.Size(86, 23) + Me.ucrChkTiesMethod.TabIndex = 12 + ' + 'ucrInputProbability + ' + Me.ucrInputProbability.AddQuotesIfUnrecognised = True + Me.ucrInputProbability.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink + Me.ucrInputProbability.GetSetSelectedIndex = -1 + Me.ucrInputProbability.IsReadOnly = False + Me.ucrInputProbability.Location = New System.Drawing.Point(73, 47) + Me.ucrInputProbability.Name = "ucrInputProbability" + Me.ucrInputProbability.Size = New System.Drawing.Size(140, 21) + Me.ucrInputProbability.TabIndex = 10 + ' + 'rdoRowRanks + ' + Me.rdoRowRanks.AutoSize = True + Me.rdoRowRanks.ImeMode = System.Windows.Forms.ImeMode.NoControl + Me.rdoRowRanks.Location = New System.Drawing.Point(6, 21) + Me.rdoRowRanks.Name = "rdoRowRanks" + Me.rdoRowRanks.Size = New System.Drawing.Size(56, 17) + Me.rdoRowRanks.TabIndex = 1 + Me.rdoRowRanks.TabStop = True + Me.rdoRowRanks.Tag = "Ranks" + Me.rdoRowRanks.Text = "Ranks" + Me.rdoRowRanks.UseVisualStyleBackColor = True + ' + 'rdoRowQuantile + ' + Me.rdoRowQuantile.AutoSize = True + Me.rdoRowQuantile.ImeMode = System.Windows.Forms.ImeMode.NoControl + Me.rdoRowQuantile.Location = New System.Drawing.Point(6, 49) + Me.rdoRowQuantile.Name = "rdoRowQuantile" + Me.rdoRowQuantile.Size = New System.Drawing.Size(69, 17) + Me.rdoRowQuantile.TabIndex = 5 + Me.rdoRowQuantile.TabStop = True + Me.rdoRowQuantile.Tag = "Quantile" + Me.rdoRowQuantile.Text = "Quantiles" + Me.rdoRowQuantile.UseVisualStyleBackColor = True + ' + 'rdoRowRange + ' + Me.rdoRowRange.AutoSize = True + Me.rdoRowRange.ImeMode = System.Windows.Forms.ImeMode.NoControl + Me.rdoRowRange.Location = New System.Drawing.Point(280, 21) + Me.rdoRowRange.Name = "rdoRowRange" + Me.rdoRowRange.Size = New System.Drawing.Size(57, 17) + Me.rdoRowRange.TabIndex = 3 + Me.rdoRowRange.TabStop = True + Me.rdoRowRange.Tag = "Range" + Me.rdoRowRange.Text = "Range" + Me.rdoRowRange.UseVisualStyleBackColor = True + ' + 'ucrPnlMultipleRowSummary + ' + Me.ucrPnlMultipleRowSummary.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink + Me.ucrPnlMultipleRowSummary.Location = New System.Drawing.Point(4, 14) + Me.ucrPnlMultipleRowSummary.Name = "ucrPnlMultipleRowSummary" + Me.ucrPnlMultipleRowSummary.Size = New System.Drawing.Size(365, 64) + Me.ucrPnlMultipleRowSummary.TabIndex = 0 + ' + 'rdoSingle + ' + Me.rdoSingle.Appearance = System.Windows.Forms.Appearance.Button + Me.rdoSingle.BackColor = System.Drawing.SystemColors.Control + Me.rdoSingle.FlatAppearance.BorderColor = System.Drawing.SystemColors.ActiveCaption + Me.rdoSingle.FlatAppearance.BorderSize = 2 + Me.rdoSingle.FlatAppearance.CheckedBackColor = System.Drawing.SystemColors.ActiveCaption + Me.rdoSingle.FlatStyle = System.Windows.Forms.FlatStyle.Flat + Me.rdoSingle.ImeMode = System.Windows.Forms.ImeMode.NoControl + Me.rdoSingle.Location = New System.Drawing.Point(101, 8) + Me.rdoSingle.Name = "rdoSingle" + Me.rdoSingle.Size = New System.Drawing.Size(117, 28) + Me.rdoSingle.TabIndex = 2 + Me.rdoSingle.TabStop = True + Me.rdoSingle.Tag = "" + Me.rdoSingle.Text = "Single" + Me.rdoSingle.TextAlign = System.Drawing.ContentAlignment.MiddleCenter + Me.rdoSingle.UseVisualStyleBackColor = False + ' + 'rdoMultiple + ' + Me.rdoMultiple.Appearance = System.Windows.Forms.Appearance.Button + Me.rdoMultiple.BackColor = System.Drawing.SystemColors.Control + Me.rdoMultiple.FlatAppearance.BorderColor = System.Drawing.SystemColors.ActiveCaption + Me.rdoMultiple.FlatAppearance.BorderSize = 2 + Me.rdoMultiple.FlatAppearance.CheckedBackColor = System.Drawing.SystemColors.ActiveCaption + Me.rdoMultiple.FlatStyle = System.Windows.Forms.FlatStyle.Flat + Me.rdoMultiple.ImeMode = System.Windows.Forms.ImeMode.NoControl + Me.rdoMultiple.Location = New System.Drawing.Point(216, 8) + Me.rdoMultiple.Name = "rdoMultiple" + Me.rdoMultiple.Size = New System.Drawing.Size(117, 28) + Me.rdoMultiple.TabIndex = 3 + Me.rdoMultiple.TabStop = True + Me.rdoMultiple.Tag = "" + Me.rdoMultiple.Text = "Multiple" + Me.rdoMultiple.TextAlign = System.Drawing.ContentAlignment.MiddleCenter + Me.rdoMultiple.UseVisualStyleBackColor = False ' 'ucrChkIgnoreMissingValues ' Me.ucrChkIgnoreMissingValues.AutoSize = True Me.ucrChkIgnoreMissingValues.Checked = False - Me.ucrChkIgnoreMissingValues.Location = New System.Drawing.Point(230, 170) + Me.ucrChkIgnoreMissingValues.Location = New System.Drawing.Point(276, 199) Me.ucrChkIgnoreMissingValues.Name = "ucrChkIgnoreMissingValues" - Me.ucrChkIgnoreMissingValues.Size = New System.Drawing.Size(190, 23) - Me.ucrChkIgnoreMissingValues.TabIndex = 3 - ' - 'ucrSaveResults - ' - Me.ucrSaveResults.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink - Me.ucrSaveResults.Location = New System.Drawing.Point(10, 271) - Me.ucrSaveResults.Margin = New System.Windows.Forms.Padding(4, 5, 4, 5) - Me.ucrSaveResults.Name = "ucrSaveResults" - Me.ucrSaveResults.Size = New System.Drawing.Size(269, 22) - Me.ucrSaveResults.TabIndex = 5 + Me.ucrChkIgnoreMissingValues.Size = New System.Drawing.Size(140, 23) + Me.ucrChkIgnoreMissingValues.TabIndex = 7 ' 'ucrSelectorForRowSummaries ' @@ -235,48 +463,68 @@ Partial Class dlgRowSummary Me.ucrSelectorForRowSummaries.bDropUnusedFilterLevels = False Me.ucrSelectorForRowSummaries.bShowHiddenColumns = False Me.ucrSelectorForRowSummaries.bUseCurrentFilter = True - Me.ucrSelectorForRowSummaries.Location = New System.Drawing.Point(10, 10) + Me.ucrSelectorForRowSummaries.Location = New System.Drawing.Point(12, 45) Me.ucrSelectorForRowSummaries.Margin = New System.Windows.Forms.Padding(0) Me.ucrSelectorForRowSummaries.Name = "ucrSelectorForRowSummaries" Me.ucrSelectorForRowSummaries.Size = New System.Drawing.Size(213, 183) - Me.ucrSelectorForRowSummaries.TabIndex = 0 + Me.ucrSelectorForRowSummaries.TabIndex = 4 ' 'ucrReceiverForRowSummaries ' Me.ucrReceiverForRowSummaries.AutoSize = True Me.ucrReceiverForRowSummaries.frmParent = Me - Me.ucrReceiverForRowSummaries.Location = New System.Drawing.Point(250, 60) + Me.ucrReceiverForRowSummaries.Location = New System.Drawing.Point(276, 89) Me.ucrReceiverForRowSummaries.Margin = New System.Windows.Forms.Padding(0) Me.ucrReceiverForRowSummaries.Name = "ucrReceiverForRowSummaries" Me.ucrReceiverForRowSummaries.Selector = Nothing Me.ucrReceiverForRowSummaries.Size = New System.Drawing.Size(120, 100) Me.ucrReceiverForRowSummaries.strNcFilePath = "" - Me.ucrReceiverForRowSummaries.TabIndex = 2 + Me.ucrReceiverForRowSummaries.TabIndex = 6 Me.ucrReceiverForRowSummaries.ucrSelector = Nothing ' 'ucrBase ' Me.ucrBase.AutoSize = True Me.ucrBase.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink - Me.ucrBase.Location = New System.Drawing.Point(10, 300) + Me.ucrBase.Location = New System.Drawing.Point(12, 361) Me.ucrBase.Name = "ucrBase" Me.ucrBase.Size = New System.Drawing.Size(405, 52) - Me.ucrBase.TabIndex = 7 + Me.ucrBase.TabIndex = 10 + ' + 'ucrPnlRowSummaries + ' + Me.ucrPnlRowSummaries.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink + Me.ucrPnlRowSummaries.Location = New System.Drawing.Point(93, 3) + Me.ucrPnlRowSummaries.Name = "ucrPnlRowSummaries" + Me.ucrPnlRowSummaries.Size = New System.Drawing.Size(254, 39) + Me.ucrPnlRowSummaries.TabIndex = 1 + ' + 'ucrSaveNewDataFrame + ' + Me.ucrSaveNewDataFrame.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink + Me.ucrSaveNewDataFrame.Location = New System.Drawing.Point(13, 334) + Me.ucrSaveNewDataFrame.Margin = New System.Windows.Forms.Padding(4, 5, 4, 5) + Me.ucrSaveNewDataFrame.Name = "ucrSaveNewDataFrame" + Me.ucrSaveNewDataFrame.Size = New System.Drawing.Size(391, 22) + Me.ucrSaveNewDataFrame.TabIndex = 12 ' 'dlgRowSummary ' 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, 357) + Me.ClientSize = New System.Drawing.Size(453, 426) + Me.Controls.Add(Me.rdoMultiple) + Me.Controls.Add(Me.rdoSingle) Me.Controls.Add(Me.ucrChkIgnoreMissingValues) - Me.Controls.Add(Me.ucrSaveResults) - Me.Controls.Add(Me.grpStatistic) - Me.Controls.Add(Me.cmdUserDefined) Me.Controls.Add(Me.ucrSelectorForRowSummaries) - Me.Controls.Add(Me.lblSelected) + Me.Controls.Add(Me.lblSelectedVariables) Me.Controls.Add(Me.ucrReceiverForRowSummaries) Me.Controls.Add(Me.ucrBase) + Me.Controls.Add(Me.ucrPnlRowSummaries) + Me.Controls.Add(Me.ucrSaveNewDataFrame) + Me.Controls.Add(Me.grpMultipleRowSummary) + Me.Controls.Add(Me.grpStatistic) Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow Me.MaximizeBox = False Me.MinimizeBox = False @@ -286,26 +534,46 @@ Partial Class dlgRowSummary Me.Text = "Row Summaries" Me.grpStatistic.ResumeLayout(False) Me.grpStatistic.PerformLayout() + Me.grpMultipleRowSummary.ResumeLayout(False) + Me.grpMultipleRowSummary.PerformLayout() Me.ResumeLayout(False) Me.PerformLayout() - End Sub - + End Sub + Friend WithEvents ucrBase As ucrButtons Friend WithEvents ucrReceiverForRowSummaries As ucrReceiverMultiple - Friend WithEvents lblSelected As Label + Friend WithEvents lblSelectedVariables As Label Friend WithEvents ucrSelectorForRowSummaries As ucrSelectorByDataFrameAddRemove - Friend WithEvents cmdUserDefined As Button Friend WithEvents grpStatistic As GroupBox Friend WithEvents rdoMinimum As RadioButton Friend WithEvents rdoMaximum As RadioButton Friend WithEvents rdoCount As RadioButton Friend WithEvents rdoMean As RadioButton Friend WithEvents rdoStandardDeviation As RadioButton - Friend WithEvents rdoNumberofMissing As RadioButton + Friend WithEvents rdoNumberMissing As RadioButton Friend WithEvents rdoMedian As RadioButton Friend WithEvents rdoSum As RadioButton - Friend WithEvents ucrPanelStatistics As UcrPanel - Friend WithEvents ucrSaveResults As ucrSave + Friend WithEvents ucrPnlStatistics As UcrPanel Friend WithEvents ucrChkIgnoreMissingValues As ucrCheck -End Class + Friend WithEvents rdoMultiple As RadioButton + Friend WithEvents rdoSingle As RadioButton + Friend WithEvents ucrPnlRowSummaries As UcrPanel + Friend WithEvents rdoMore As RadioButton + Friend WithEvents ucrInputUserDefined As ucrInputComboBox + Friend WithEvents grpMultipleRowSummary As GroupBox + Friend WithEvents ucrInputProbability As ucrInputComboBox + Friend WithEvents rdoRowRanks As RadioButton + Friend WithEvents rdoRowQuantile As RadioButton + Friend WithEvents rdoRowRange As RadioButton + Friend WithEvents ucrPnlMultipleRowSummary As UcrPanel + Friend WithEvents ucrSaveNewDataFrame As ucrSave + Friend WithEvents ucrInputTiesMethod As ucrInputComboBox + Friend WithEvents ucrInputType As ucrInputComboBox + Friend WithEvents ucrChkType As ucrCheck + Friend WithEvents ucrChkTiesMethod As ucrCheck + Friend WithEvents lblProp As Label + Friend WithEvents ucrNudTrim As ucrNud + Friend WithEvents lblTrim As Label + Friend WithEvents ucrNudProp As ucrNud +End Class diff --git a/instat/dlgRowSummary.vb b/instat/dlgRowSummary.vb index 7f3c55dec7e..cfe6e2b6196 100644 --- a/instat/dlgRowSummary.vb +++ b/instat/dlgRowSummary.vb @@ -1,4 +1,5 @@ -' R- Instat +' +'R- Instat ' Copyright (C) 2015-2017 ' ' This program is free software: you can redistribute it and/or modify @@ -18,7 +19,19 @@ Imports instat.Translations Public Class dlgRowSummary Private bFirstLoad As Boolean = True Private bReset As Boolean = True - Private clsApplyFunction As New RFunction + Private clsDummyRowFunction As New RFunction + Private clsGetColumnsFunction As New RFunction + Private clsPipeOperator As New ROperator + Private clsRowWisePipeOperator As New ROperator + Private clsAddColumnsFunction As New RFunction + Private clsAssignOperator As New ROperator + Private clsRowWiseFunction, clsMutateFunction As New RFunction + Private clsMeanFunction, clsSumFunction, clsStandardDeviationFunction, clsMinimumFunction, clsMaximumFunction, + clsMedianFunction, clsIsNaFunction, clsIsNotNaFunction, clsAnyDuplicatedFunction, clsTrimmedMeanFunction, + clsAnyNaFuction, clsCvFunction, clsGmeanFunction, clsHmeanFunction, clsIQRFunction, clsKurtosisFunction, clsMadFunction, clsMcFunction, + clsMfv1Function, clsQuantileFunction, clsSkewnessFunction, clsRowRanksFunction, clsRowRangesFunction, clsSelectFunction, + clsRowQuantilesFunction, clsAsMatrixFunction, clsDimensionFunction, clsConcatenateFunction, clsColumnNamesFunction As New RFunction + Private clsListFunction As New RFunction Private Sub dlgRowSummary_Load(sender As Object, e As EventArgs) Handles MyBase.Load If bFirstLoad Then @@ -35,68 +48,363 @@ Public Class dlgRowSummary Private Sub InitialiseDialog() ucrBase.iHelpTopicID = 45 - cmdUserDefined.Enabled = False ' temporarily disabled - 'Setting receiver data types and parameters - ucrReceiverForRowSummaries.SetParameter(New RParameter("X", 0)) + Dim dctTiesValues As New Dictionary(Of String, String) + Dim dctProbabilityValues As New Dictionary(Of String, String) + Dim dctRangeValues As New Dictionary(Of String, String) + Dim dctTypeValues As New Dictionary(Of String, String) + + ucrReceiverForRowSummaries.SetParameter(New RParameter("x", 0, bNewIncludeArgumentName:=False)) ucrReceiverForRowSummaries.Selector = ucrSelectorForRowSummaries ucrReceiverForRowSummaries.SetMeAsReceiver() ucrReceiverForRowSummaries.strSelectorHeading = "Numerics" ucrReceiverForRowSummaries.SetIncludedDataTypes({"numeric"}) - ucrReceiverForRowSummaries.bUseFilteredData = False - ucrReceiverForRowSummaries.bForceAsDataFrame = True - ucrReceiverForRowSummaries.SetParameterIsRFunction() + ucrReceiverForRowSummaries.bUseFilteredData = True + ucrReceiverForRowSummaries.bForceAsDataFrame = False + ucrReceiverForRowSummaries.SetParameterIsString() + ucrReceiverForRowSummaries.bWithQuotes = False + + ucrChkTiesMethod.AddParameterPresentCondition(True, "ties.method", True) + ucrChkTiesMethod.AddParameterPresentCondition(False, "ties.method", False) + ucrChkTiesMethod.SetText("Ties method") + + ucrInputTiesMethod.SetParameter(New RParameter("ties.method", 2)) + dctTiesValues.Add("average", Chr(34) & "average" & Chr(34)) + dctTiesValues.Add("first", Chr(34) & "first" & Chr(34)) + dctTiesValues.Add("last", Chr(34) & "last" & Chr(34)) + dctTiesValues.Add("max", Chr(34) & "max" & Chr(34)) + dctTiesValues.Add("min", Chr(34) & "min" & Chr(34)) + ucrInputTiesMethod.SetItems(dctTiesValues) + ucrInputTiesMethod.bAllowNonConditionValues = True + ucrInputTiesMethod.SetDropDownStyleAsNonEditable() + + 'function ran here is probs = c(VALUES) + ucrInputProbability.SetParameter(New RParameter("p", 1, bNewIncludeArgumentName:=False)) + ucrInputProbability.AddQuotesIfUnrecognised = False + ucrInputProbability.SetValidationTypeAsNumericList() + + ucrChkType.SetText("Type") + ucrChkType.AddParameterPresentCondition(True, "type", True) + ucrChkType.AddParameterPresentCondition(False, "type", False) + + ucrInputType.SetParameter(New RParameter("type", 2)) + dctTypeValues.Add("1", "1") + dctTypeValues.Add("2", "2") + dctTypeValues.Add("3", "3") + dctTypeValues.Add("4", "4") + dctTypeValues.Add("5", "5") + dctTypeValues.Add("6", "6") + dctTypeValues.Add("7", "7") + dctTypeValues.Add("8", "8") + dctTypeValues.Add("9", "9") + ucrInputType.SetItems(dctTypeValues) + ucrInputType.AddQuotesIfUnrecognised = False + ucrInputType.SetDropDownStyleAsNonEditable() - ucrChkIgnoreMissingValues.AddParameterPresentCondition(True, "na.rm") - ucrChkIgnoreMissingValues.AddParameterPresentCondition(False, "na.rm", False) + ucrChkIgnoreMissingValues.SetParameter(New RParameter("na.rm", 2)) + ucrChkIgnoreMissingValues.SetRDefault("TRUE") + ucrChkIgnoreMissingValues.bAddRemoveParameter = True + ucrChkIgnoreMissingValues.bChangeParameterValue = False ucrChkIgnoreMissingValues.SetText("Ignore Missing Values") 'linking controls - ucrPanelStatistics.AddToLinkedControls(ucrChkIgnoreMissingValues, {rdoMean, rdoMinimum, rdoSum, rdoMedian, rdoStandardDeviation, rdoMaximum}, bNewLinkedAddRemoveParameter:=True, bNewLinkedHideIfParameterMissing:=True) - - ucrPanelStatistics.SetParameter(New RParameter("FUN", 2)) - ucrPanelStatistics.AddRadioButton(rdoMean, "mean") - ucrPanelStatistics.AddRadioButton(rdoMinimum, "min") - ucrPanelStatistics.AddRadioButton(rdoSum, "sum") - ucrPanelStatistics.AddRadioButton(rdoMedian, "median") - ucrPanelStatistics.AddRadioButton(rdoNumberofMissing, "function(z) sum(is.na(z))") - ucrPanelStatistics.AddRadioButton(rdoStandardDeviation, "sd") - ucrPanelStatistics.AddRadioButton(rdoMaximum, "max") - ucrPanelStatistics.AddRadioButton(rdoCount, "function(z) sum(!is.na(z))") - - ucrSaveResults.SetPrefix("row_summary") - ucrSaveResults.SetSaveTypeAsColumn() - ucrSaveResults.SetDataFrameSelector(ucrSelectorForRowSummaries.ucrAvailableDataFrames) - ucrSaveResults.SetLabelText("New Column Name:") - ucrSaveResults.SetIsComboBox() - ucrSaveResults.setLinkedReceiver(ucrReceiverForRowSummaries) + ucrPnlRowSummaries.AddRadioButton(rdoSingle) + ucrPnlRowSummaries.AddRadioButton(rdoMultiple) + + ucrPnlRowSummaries.AddFunctionNamesCondition(rdoSingle, {"rowwise"}, False) + ucrPnlRowSummaries.AddFunctionNamesCondition(rdoMultiple, {"rowRanks", "rowRanges", "rowQuantiles"}) + + ucrPnlStatistics.AddRadioButton(rdoMean) + ucrPnlStatistics.AddRadioButton(rdoMinimum) + ucrPnlStatistics.AddRadioButton(rdoSum) + ucrPnlStatistics.AddRadioButton(rdoMedian) + ucrPnlStatistics.AddRadioButton(rdoNumberMissing) + ucrPnlStatistics.AddRadioButton(rdoStandardDeviation) + ucrPnlStatistics.AddRadioButton(rdoMaximum) + ucrPnlStatistics.AddRadioButton(rdoCount) + ucrPnlStatistics.AddRadioButton(rdoMore) + + ucrPnlStatistics.AddFunctionNamesCondition(rdoMean, "Mean", False) + ucrPnlStatistics.AddFunctionNamesCondition(rdoMinimum, "Minimum") + ucrPnlStatistics.AddFunctionNamesCondition(rdoSum, "Sum") + ucrPnlStatistics.AddFunctionNamesCondition(rdoMedian, "Median") + ucrPnlStatistics.AddFunctionNamesCondition(rdoNumberMissing, "Number_missing") + ucrPnlStatistics.AddFunctionNamesCondition(rdoStandardDeviation, "Standard_deviation") + ucrPnlStatistics.AddFunctionNamesCondition(rdoMaximum, "Maximum") + ucrPnlStatistics.AddFunctionNamesCondition(rdoCount, "Count") + ucrPnlStatistics.AddFunctionNamesCondition(rdoMore, {"anyDuplicated", "anyNA", "cv", "Gmean", "Hmean", "IQR", "kurtosis", + "mad", "mc", "mean, trim=0.2", "mfv1", "quantile, probs=0.5", "skewness"}) + + ucrPnlMultipleRowSummary.AddRadioButton(rdoRowRanks) + ucrPnlMultipleRowSummary.AddRadioButton(rdoRowRange) + ucrPnlMultipleRowSummary.AddRadioButton(rdoRowQuantile) + ucrPnlMultipleRowSummary.AddParameterValuesCondition(rdoRowRanks, "check", "rowRanks") + ucrPnlMultipleRowSummary.AddParameterValuesCondition(rdoRowRange, "check", "rowRange") + ucrPnlMultipleRowSummary.AddParameterValuesCondition(rdoRowQuantile, "check", "rowQuantiles") + + ucrPnlStatistics.AddToLinkedControls(ucrChkIgnoreMissingValues, {rdoMean, rdoMinimum, rdoSum, rdoMedian, rdoStandardDeviation, rdoMaximum}, bNewLinkedHideIfParameterMissing:=True) + ucrPnlStatistics.AddToLinkedControls(ucrInputUserDefined, {rdoMore}, bNewLinkedHideIfParameterMissing:=True) + + ucrPnlMultipleRowSummary.AddToLinkedControls(ucrChkTiesMethod, {rdoRowRanks}, bNewLinkedHideIfParameterMissing:=True) + ucrPnlMultipleRowSummary.AddToLinkedControls({ucrInputProbability, ucrChkType}, {rdoRowQuantile}, bNewLinkedHideIfParameterMissing:=True) + + ucrPnlRowSummaries.AddToLinkedControls({ucrPnlStatistics, ucrSaveNewDataFrame}, {rdoSingle}, bNewLinkedHideIfParameterMissing:=True, bNewLinkedAddRemoveParameter:=True) + ucrPnlRowSummaries.AddToLinkedControls(ucrPnlMultipleRowSummary, {rdoMultiple}, bNewLinkedHideIfParameterMissing:=True, bNewLinkedAddRemoveParameter:=True) + + ucrPnlStatistics.SetLinkedDisplayControl(grpStatistic) + ucrPnlMultipleRowSummary.SetLinkedDisplayControl(grpMultipleRowSummary) + + ucrChkTiesMethod.AddToLinkedControls({ucrInputTiesMethod}, {True}, bNewLinkedHideIfParameterMissing:=True, bNewLinkedAddRemoveParameter:=True, + bNewLinkedUpdateFunction:=True, bNewLinkedChangeToDefaultState:=True, objNewDefaultState:="average") + ucrChkType.AddToLinkedControls({ucrInputType}, {True}, bNewLinkedHideIfParameterMissing:=True, bNewLinkedAddRemoveParameter:=True, + bNewLinkedUpdateFunction:=True, bNewLinkedChangeToDefaultState:=True, objNewDefaultState:="7") + 'ucrInputUserDefined + ucrInputUserDefined.SetItems({"anyDuplicated", "anyNA", "cv", "Gmean", "Hmean", "IQR", "kurtosis", "mad", "mc", "mean", + "mfv1", "quantile", "skewness"}) + ucrInputUserDefined.AddToLinkedControls(ucrNudProp, {"quantile"}, bNewLinkedHideIfParameterMissing:=True) + ucrInputUserDefined.AddToLinkedControls(ucrNudTrim, {"mean"}, bNewLinkedHideIfParameterMissing:=True) + + + ucrNudProp.SetParameter(New RParameter("probs", 1)) + ucrNudProp.SetMinMax(0.00, 1.0) + ucrNudProp.Increment = 0.01 + ucrNudProp.DecimalPlaces = 2 + ucrNudProp.SetLinkedDisplayControl(lblProp) + + ucrNudTrim.SetParameter(New RParameter("trim", 1)) + ucrNudTrim.Minimum = 0.0 + ucrNudTrim.Maximum = 0.5 + ucrNudTrim.DecimalPlaces = 2 + ucrNudTrim.Increment = 0.01 + ucrNudTrim.SetLinkedDisplayControl(lblTrim) + + ucrSaveNewDataFrame.SetLabelText("New Column Name:") + ucrSaveNewDataFrame.SetSaveTypeAsColumn() + ucrSaveNewDataFrame.SetIsComboBox() + ucrSaveNewDataFrame.SetPrefix("row_summary") + ucrSaveNewDataFrame.SetDataFrameSelector(ucrSelectorForRowSummaries.ucrAvailableDataFrames) End Sub Private Sub SetDefaults() - clsApplyFunction = New RFunction + clsPipeOperator = New ROperator + clsRowWisePipeOperator = New ROperator + clsAssignOperator = New ROperator + clsDummyRowFunction = New RFunction + clsGetColumnsFunction = New RFunction + clsRowWiseFunction = New RFunction + clsMutateFunction = New RFunction + clsListFunction = New RFunction + clsMeanFunction = New RFunction + clsSumFunction = New RFunction + clsStandardDeviationFunction = New RFunction + clsMinimumFunction = New RFunction + clsMaximumFunction = New RFunction + clsMedianFunction = New RFunction + clsIsNaFunction = New RFunction + clsIsNotNaFunction = New RFunction + clsAnyDuplicatedFunction = New RFunction + clsAnyNaFuction = New RFunction + clsCvFunction = New RFunction + clsGmeanFunction = New RFunction + clsHmeanFunction = New RFunction + clsIQRFunction = New RFunction + clsKurtosisFunction = New RFunction + clsMadFunction = New RFunction + clsMcFunction = New RFunction + clsMfv1Function = New RFunction + clsQuantileFunction = New RFunction + clsSkewnessFunction = New RFunction + clsRowRanksFunction = New RFunction + clsRowRangesFunction = New RFunction + clsRowQuantilesFunction = New RFunction + clsAsMatrixFunction = New RFunction + clsDimensionFunction = New RFunction + clsTrimmedMeanFunction = New RFunction + clsSelectFunction = New RFunction + clsConcatenateFunction = New RFunction + clsColumnNamesFunction = New RFunction + clsAddColumnsFunction = New RFunction 'reset ucrSelectorForRowSummaries.Reset() - ucrSaveResults.Reset() - - 'Defining the default RFunction - clsApplyFunction.SetPackageName("base") - clsApplyFunction.SetRCommand("apply") - clsApplyFunction.AddParameter("FUN", "mean") - clsApplyFunction.AddParameter("MARGIN", 1) - clsApplyFunction.SetAssignTo(ucrSaveResults.GetText, strTempDataframe:=ucrSelectorForRowSummaries.ucrAvailableDataFrames.cboAvailableDataFrames.Text) - ucrBase.clsRsyntax.SetBaseRFunction(clsApplyFunction) + ucrReceiverForRowSummaries.SetMeAsReceiver() + ucrSaveNewDataFrame.Reset() + ucrInputProbability.Reset() + ucrInputUserDefined.SetName("anyDuplicated") + + clsDummyRowFunction.AddParameter("check", "rowRanks", iPosition:=0) + + clsPipeOperator.SetOperation("%>%") + clsPipeOperator.AddParameter("left", clsRFunctionParameter:=ucrSelectorForRowSummaries.ucrAvailableDataFrames.clsCurrDataFrame, iPosition:=0) + clsPipeOperator.AddParameter("right", clsROperatorParameter:=clsRowWisePipeOperator, iPosition:=1) + + clsRowWiseFunction.SetPackageName("dplyr") + clsRowWiseFunction.SetRCommand("rowwise") + + clsMutateFunction.SetPackageName("dplyr") + clsMutateFunction.SetRCommand("mutate") + clsMutateFunction.AddParameter("Mean", clsRFunctionParameter:=clsMeanFunction, iPosition:=0) + + clsSelectFunction.SetPackageName("dplyr") + clsSelectFunction.SetRCommand("select") + + clsRowWisePipeOperator.SetOperation("%>%") + clsRowWisePipeOperator.AddParameter("left", clsRFunctionParameter:=clsRowWiseFunction, iPosition:=0) + clsRowWisePipeOperator.AddParameter("right", clsRFunctionParameter:=clsMutateFunction, iPosition:=1) + clsRowWisePipeOperator.AddParameter("select_function", clsRFunctionParameter:=clsSelectFunction, iPosition:=2) + + clsMeanFunction.SetRCommand("mean") + + clsTrimmedMeanFunction.SetRCommand("mean") + clsTrimmedMeanFunction.AddParameter("trim", "0.2", iPosition:=1) + + clsSumFunction.SetRCommand("sum") + + clsStandardDeviationFunction.SetRCommand("sd") + + clsMinimumFunction.SetRCommand("min") + + clsMaximumFunction.SetRCommand("max") + + clsMedianFunction.SetRCommand("median") + + clsAnyDuplicatedFunction.SetRCommand("anyDuplicated") + + clsAnyNaFuction.SetRCommand("anyNA") + + clsCvFunction.SetPackageName("raster") + clsCvFunction.SetRCommand("cv") + + clsGmeanFunction.SetPackageName("DescTools") + clsGmeanFunction.SetRCommand("Gmean" + ) + clsHmeanFunction.SetPackageName("DescTools") + clsHmeanFunction.SetRCommand("Hmean") + + clsIQRFunction.SetRCommand("IQR") + + clsKurtosisFunction.SetPackageName("e1071") + clsKurtosisFunction.SetRCommand("kurtosis") + + clsMadFunction.SetRCommand("mad") + + clsMcFunction.SetPackageName("robustbase") + clsMcFunction.SetRCommand("mc") + + clsMfv1Function.SetPackageName("statip") + clsMfv1Function.SetRCommand("mfv1") + + clsQuantileFunction.SetRCommand("quantile") + clsQuantileFunction.AddParameter("probs", "0.5", iPosition:=1) + + clsSkewnessFunction.SetPackageName("e1071") + clsSkewnessFunction.SetRCommand("skewness") + + clsIsNaFunction.SetRCommand("is.na") + clsIsNotNaFunction.SetRCommand("!is.na") + + clsListFunction.SetRCommand("list") + + clsRowRanksFunction.SetPackageName("matrixStats") + clsRowRanksFunction.SetRCommand("rowRanks") + clsRowRanksFunction.AddParameter("x", clsRFunctionParameter:=clsAsMatrixFunction, iPosition:=0, bIncludeArgumentName:=False) + clsRowRanksFunction.AddParameter("dim.", clsRFunctionParameter:=clsDimensionFunction, iPosition:=1) + clsRowRanksFunction.SetAssignTo("col") + + clsColumnNamesFunction.SetRCommand("colnames") + + clsConcatenateFunction.SetRCommand("c") + + clsAssignOperator.SetOperation("<-") + clsAssignOperator.AddParameter("left", clsRFunctionParameter:=clsColumnNamesFunction, iPosition:=0) + clsAssignOperator.AddParameter("right", clsRFunctionParameter:=clsConcatenateFunction, iPosition:=1) + + + clsRowRangesFunction.SetPackageName("matrixStats") + clsRowRangesFunction.SetRCommand("rowRanges") + clsRowRangesFunction.AddParameter("dim.", clsRFunctionParameter:=clsDimensionFunction, iPosition:=1) + clsRowRangesFunction.AddParameter("x", clsRFunctionParameter:=clsAsMatrixFunction, iPosition:=0, bIncludeArgumentName:=False) + clsRowRangesFunction.SetAssignTo("col") + + + clsDimensionFunction.SetRCommand("dim") + + clsRowQuantilesFunction.SetPackageName("matrixStats") + clsRowQuantilesFunction.SetRCommand("rowQuantiles") + clsRowQuantilesFunction.AddParameter("x", clsRFunctionParameter:=clsAsMatrixFunction, iPosition:=0, bIncludeArgumentName:=False) + clsRowQuantilesFunction.SetAssignTo("col") + + clsAddColumnsFunction.SetRCommand(frmMain.clsRLink.strInstatDataObject & "$add_columns_to_data") + clsAddColumnsFunction.AddParameter("data_name", Chr(34) & ucrSelectorForRowSummaries.ucrAvailableDataFrames.cboAvailableDataFrames.Text & Chr(34), iPosition:=0) + clsAddColumnsFunction.AddParameter("col_data", "col", iPosition:=1) + clsAddColumnsFunction.AddParameter("before", "FALSE", iPosition:=2) + + clsAsMatrixFunction.SetRCommand("as.matrix") + + ucrBase.clsRsyntax.SetBaseROperator(clsPipeOperator) End Sub Private Sub SetRCodeforControls(bReset As Boolean) - SetRCode(Me, ucrBase.clsRsyntax.clsBaseFunction, bReset) + ucrReceiverForRowSummaries.AddAdditionalCodeParameterPair(clsSumFunction, ucrReceiverForRowSummaries.GetParameter(), iAdditionalPairNo:=1) + ucrReceiverForRowSummaries.AddAdditionalCodeParameterPair(clsStandardDeviationFunction, ucrReceiverForRowSummaries.GetParameter(), iAdditionalPairNo:=2) + ucrReceiverForRowSummaries.AddAdditionalCodeParameterPair(clsMinimumFunction, ucrReceiverForRowSummaries.GetParameter(), iAdditionalPairNo:=3) + ucrReceiverForRowSummaries.AddAdditionalCodeParameterPair(clsMaximumFunction, ucrReceiverForRowSummaries.GetParameter(), iAdditionalPairNo:=4) + ucrReceiverForRowSummaries.AddAdditionalCodeParameterPair(clsMedianFunction, ucrReceiverForRowSummaries.GetParameter(), iAdditionalPairNo:=5) + ucrReceiverForRowSummaries.AddAdditionalCodeParameterPair(clsIsNotNaFunction, New RParameter("x", 0, bNewIncludeArgumentName:=False), iAdditionalPairNo:=6) + ucrReceiverForRowSummaries.AddAdditionalCodeParameterPair(clsIsNaFunction, New RParameter("x", 0, bNewIncludeArgumentName:=False), iAdditionalPairNo:=7) + ucrReceiverForRowSummaries.AddAdditionalCodeParameterPair(clsAnyDuplicatedFunction, New RParameter("anyDuplicated", 0, bNewIncludeArgumentName:=False), iAdditionalPairNo:=8) + ucrReceiverForRowSummaries.AddAdditionalCodeParameterPair(clsAnyNaFuction, New RParameter("anyNA", 0, bNewIncludeArgumentName:=False), iAdditionalPairNo:=9) + ucrReceiverForRowSummaries.AddAdditionalCodeParameterPair(clsCvFunction, New RParameter("cv", 0, bNewIncludeArgumentName:=False), iAdditionalPairNo:=10) + ucrReceiverForRowSummaries.AddAdditionalCodeParameterPair(clsGmeanFunction, New RParameter("Gmean", 0, bNewIncludeArgumentName:=False), iAdditionalPairNo:=11) + ucrReceiverForRowSummaries.AddAdditionalCodeParameterPair(clsHmeanFunction, New RParameter("Hmean", 0, bNewIncludeArgumentName:=False), iAdditionalPairNo:=12) + ucrReceiverForRowSummaries.AddAdditionalCodeParameterPair(clsIQRFunction, New RParameter("IQR", 0, bNewIncludeArgumentName:=False), iAdditionalPairNo:=13) + ucrReceiverForRowSummaries.AddAdditionalCodeParameterPair(clsKurtosisFunction, New RParameter("kurtosis", 0, bNewIncludeArgumentName:=False), iAdditionalPairNo:=14) + ucrReceiverForRowSummaries.AddAdditionalCodeParameterPair(clsMadFunction, New RParameter("mad", 0, bNewIncludeArgumentName:=False), iAdditionalPairNo:=15) + ucrReceiverForRowSummaries.AddAdditionalCodeParameterPair(clsMcFunction, New RParameter("mc", 0, bNewIncludeArgumentName:=False), iAdditionalPairNo:=16) + ucrReceiverForRowSummaries.AddAdditionalCodeParameterPair(clsMfv1Function, New RParameter("mfv1", 0, bNewIncludeArgumentName:=False), iAdditionalPairNo:=17) + ucrReceiverForRowSummaries.AddAdditionalCodeParameterPair(clsQuantileFunction, New RParameter("quantile", 0, bNewIncludeArgumentName:=False), iAdditionalPairNo:=18) + ucrReceiverForRowSummaries.AddAdditionalCodeParameterPair(clsSkewnessFunction, New RParameter("skewness", 0, bNewIncludeArgumentName:=False), iAdditionalPairNo:=19) + ucrReceiverForRowSummaries.AddAdditionalCodeParameterPair(clsTrimmedMeanFunction, New RParameter("mean", 0, bNewIncludeArgumentName:=False), iAdditionalPairNo:=20) + + ucrChkIgnoreMissingValues.AddAdditionalCodeParameterPair(clsSumFunction, ucrChkIgnoreMissingValues.GetParameter(), iAdditionalPairNo:=1) + ucrChkIgnoreMissingValues.AddAdditionalCodeParameterPair(clsStandardDeviationFunction, ucrChkIgnoreMissingValues.GetParameter(), iAdditionalPairNo:=2) + ucrChkIgnoreMissingValues.AddAdditionalCodeParameterPair(clsMinimumFunction, ucrChkIgnoreMissingValues.GetParameter(), iAdditionalPairNo:=3) + ucrChkIgnoreMissingValues.AddAdditionalCodeParameterPair(clsMaximumFunction, ucrChkIgnoreMissingValues.GetParameter(), iAdditionalPairNo:=4) + ucrChkIgnoreMissingValues.AddAdditionalCodeParameterPair(clsMedianFunction, ucrChkIgnoreMissingValues.GetParameter(), iAdditionalPairNo:=5) + ucrChkTiesMethod.SetRCode(clsRowRanksFunction, bReset) + ucrChkType.SetRCode(clsRowQuantilesFunction, bReset) + ucrChkIgnoreMissingValues.SetRCode(clsMeanFunction, bReset) + ucrReceiverForRowSummaries.SetRCode(clsMeanFunction, bReset) + ucrPnlMultipleRowSummary.SetRCode(clsDummyRowFunction, bReset) + ucrNudProp.SetRCode(clsQuantileFunction, bReset) + ucrNudTrim.SetRCode(clsTrimmedMeanFunction, bReset) + ucrSaveNewDataFrame.SetRCode(clsPipeOperator, bReset) + If bReset Then + ucrPnlStatistics.SetRCode(clsMeanFunction, bReset) + End If End Sub Private Sub TestOKEnabled() - If Not ucrReceiverForRowSummaries.IsEmpty AndAlso ucrSaveResults.IsComplete Then - ucrBase.OKEnabled(True) + If rdoSingle.Checked Then + If Not ucrReceiverForRowSummaries.IsEmpty AndAlso ucrSaveNewDataFrame.IsComplete AndAlso ucrInputUserDefined.GetText <> "" Then + ucrBase.OKEnabled(True) + Else + ucrBase.OKEnabled(False) + End If Else - ucrBase.OKEnabled(False) + If Not ucrReceiverForRowSummaries.IsEmpty Then + If rdoRowQuantile.Checked Then + If ucrInputProbability.GetText <> "" Then + ucrBase.OKEnabled(True) + Else + ucrBase.OKEnabled(False) + End If + Else + ucrBase.OKEnabled(True) + End If + Else + ucrBase.OKEnabled(False) + End If End If End Sub @@ -106,19 +414,221 @@ Public Class dlgRowSummary TestOKEnabled() End Sub - Private Sub Controls_ControlContentsChanged(ucrChangedControl As ucrCore) Handles ucrReceiverForRowSummaries.ControlContentsChanged, ucrSaveResults.ControlContentsChanged - TestOKEnabled() - End Sub + Private Sub ucrPnlRowSummaries_ControlValueChanged(ucrChangedControl As ucrCore) Handles ucrPnlRowSummaries.ControlValueChanged, ucrPnlStatistics.ControlValueChanged, ucrInputUserDefined.ControlValueChanged, ucrPnlMultipleRowSummary.ControlValueChanged + If rdoSingle.Checked Then + ucrReceiverForRowSummaries.SetMeAsReceiver() + clsMutateFunction.RemoveParameterByName("Mean") + clsMutateFunction.RemoveParameterByName("Sum") + clsMutateFunction.RemoveParameterByName("Standard_deviation") + clsMutateFunction.RemoveParameterByName("Minimum") + clsMutateFunction.RemoveParameterByName("Maximum") + clsMutateFunction.RemoveParameterByName("Median") + clsMutateFunction.RemoveParameterByName("Count") + clsMutateFunction.RemoveParameterByName("Number_missing") + clsMutateFunction.RemoveParameterByName("anyDuplicated") + clsMutateFunction.RemoveParameterByName("anyNA") + clsMutateFunction.RemoveParameterByName("cv") + clsMutateFunction.RemoveParameterByName("Gmean") + clsMutateFunction.RemoveParameterByName("Hmean") + clsMutateFunction.RemoveParameterByName("IQR") + clsMutateFunction.RemoveParameterByName("kurtosis") + clsMutateFunction.RemoveParameterByName("mad") + clsMutateFunction.RemoveParameterByName("mc") + clsMutateFunction.RemoveParameterByName("mean") + clsMutateFunction.RemoveParameterByName("mfv1") + clsMutateFunction.RemoveParameterByName("quantile") + clsMutateFunction.RemoveParameterByName("skewness") + clsSumFunction.RemoveParameterByName("x") + clsListFunction.ClearParameters() + If rdoMean.Checked Then + clsMutateFunction.AddParameter("Mean", clsRFunctionParameter:=clsMeanFunction, iPosition:=0) + clsSelectFunction.AddParameter("x", "Mean", iPosition:=0, bIncludeArgumentName:=False) + ucrSaveNewDataFrame.SetPrefix("Mean") + ElseIf rdoSum.Checked Then + clsSumFunction.AddParameter("x", ucrReceiverForRowSummaries.GetVariableNames("False"), bIncludeArgumentName:=False, iPosition:=0) + clsMutateFunction.AddParameter("Sum", clsRFunctionParameter:=clsSumFunction, iPosition:=0) + clsSelectFunction.AddParameter("x", "Sum", iPosition:=0, bIncludeArgumentName:=False) + ucrSaveNewDataFrame.SetPrefix("Sum") + ElseIf rdoStandardDeviation.Checked Then + clsMutateFunction.AddParameter("Standard_deviation", clsRFunctionParameter:=clsStandardDeviationFunction, iPosition:=0) + clsSelectFunction.AddParameter("x", "Standard_deviation", iPosition:=0, bIncludeArgumentName:=False) + ucrSaveNewDataFrame.SetPrefix("Standard_deviation") + ElseIf rdoMinimum.Checked Then + clsMutateFunction.AddParameter("Minimum", clsRFunctionParameter:=clsMinimumFunction, iPosition:=0) + clsSelectFunction.AddParameter("x", "Minimum", iPosition:=0, bIncludeArgumentName:=False) + ucrSaveNewDataFrame.SetPrefix("Minimum") + ElseIf rdoMaximum.Checked Then + clsMutateFunction.AddParameter("Maximum", clsRFunctionParameter:=clsMaximumFunction, iPosition:=0) + clsSelectFunction.AddParameter("x", "Maximum", iPosition:=0, bIncludeArgumentName:=False) + ucrSaveNewDataFrame.SetPrefix("Maximum") + ElseIf rdoMedian.Checked Then + clsMutateFunction.AddParameter("Median", clsRFunctionParameter:=clsMedianFunction, iPosition:=0) + clsSelectFunction.AddParameter("x", "Median", iPosition:=0, bIncludeArgumentName:=False) + ucrSaveNewDataFrame.SetPrefix("Median") + ElseIf rdoCount.Checked Then + clsSumFunction.AddParameter("x", clsRFunctionParameter:=clsIsNotNaFunction, iPosition:=0, bIncludeArgumentName:=False) + clsMutateFunction.AddParameter("Count", clsRFunctionParameter:=clsSumFunction, iPosition:=0) + clsSelectFunction.AddParameter("x", "Count", iPosition:=0, bIncludeArgumentName:=False) + ucrSaveNewDataFrame.SetPrefix("Count") + ElseIf rdoNumberMissing.Checked Then + clsSumFunction.AddParameter("x", clsRFunctionParameter:=clsIsNaFunction, iPosition:=0, bIncludeArgumentName:=False) + clsMutateFunction.AddParameter("Number_missing", clsRFunctionParameter:=clsSumFunction, iPosition:=0) + clsSelectFunction.AddParameter("x", "Number_missing", iPosition:=0, bIncludeArgumentName:=False) + ucrSaveNewDataFrame.SetPrefix("Number_missing") - Private Sub ucrChkIgnoreMissingValues_ControlValueChanged(ucrChangedControl As ucrCore) Handles ucrChkIgnoreMissingValues.ControlValueChanged, ucrPanelStatistics.ControlValueChanged - If ucrChkIgnoreMissingValues.Checked Then - If rdoMean.Checked OrElse rdoMedian.Checked OrElse rdoSum.Checked OrElse rdoStandardDeviation.Checked OrElse rdoMinimum.Checked OrElse rdoMaximum.Checked Then - clsApplyFunction.AddParameter("na.rm", "TRUE", iPosition:=3) - Else - clsApplyFunction.RemoveParameterByName("na.rm") + ElseIf rdoMore.Checked Then + Select Case ucrInputUserDefined.GetText() + Case "anyDuplicated" + clsMutateFunction.AddParameter("anyDuplicated", clsRFunctionParameter:=clsAnyDuplicatedFunction, iPosition:=0) + clsSelectFunction.AddParameter("x", "anyDuplicated", iPosition:=0, bIncludeArgumentName:=False) + ucrSaveNewDataFrame.SetPrefix("anyDuplicated") + Case "anyNA" + clsMutateFunction.AddParameter("anyNA", clsRFunctionParameter:=clsAnyNaFuction, iPosition:=0) + clsSelectFunction.AddParameter("x", "anyNA", iPosition:=0, bIncludeArgumentName:=False) + ucrSaveNewDataFrame.SetPrefix("anyNA") + Case "cv" + clsMutateFunction.AddParameter("cv", clsRFunctionParameter:=clsCvFunction, iPosition:=0) + clsSelectFunction.AddParameter("x", "cv", iPosition:=0, bIncludeArgumentName:=False) + ucrSaveNewDataFrame.SetPrefix("cv") + Case "Gmean" + clsMutateFunction.AddParameter("Gmean", clsRFunctionParameter:=clsGmeanFunction, iPosition:=0) + clsSelectFunction.AddParameter("x", "Gmean", iPosition:=0, bIncludeArgumentName:=False) + ucrSaveNewDataFrame.SetPrefix("Gmean") + Case "Hmean" + clsMutateFunction.AddParameter("Hmean", clsRFunctionParameter:=clsHmeanFunction, iPosition:=0) + clsSelectFunction.AddParameter("x", "Hmean", iPosition:=0, bIncludeArgumentName:=False) + ucrSaveNewDataFrame.SetPrefix("Hmean") + Case "IQR" + clsMutateFunction.AddParameter("IQR", clsRFunctionParameter:=clsIQRFunction, iPosition:=0) + clsSelectFunction.AddParameter("x", "IQR", iPosition:=0, bIncludeArgumentName:=False) + ucrSaveNewDataFrame.SetPrefix("IQR") + Case "kurtosis" + clsMutateFunction.AddParameter("kurtosis", clsRFunctionParameter:=clsKurtosisFunction, iPosition:=0) + clsSelectFunction.AddParameter("x", "kurtosis", iPosition:=0, bIncludeArgumentName:=False) + ucrSaveNewDataFrame.SetPrefix("kurtosis") + Case "mad" + clsMutateFunction.AddParameter("mad", clsRFunctionParameter:=clsMadFunction, iPosition:=0) + clsSelectFunction.AddParameter("x", "mad", iPosition:=0, bIncludeArgumentName:=False) + ucrSaveNewDataFrame.SetPrefix("mad") + Case "mc" + clsMutateFunction.AddParameter("mc", clsRFunctionParameter:=clsMcFunction, iPosition:=0) + clsSelectFunction.AddParameter("x", "mc", iPosition:=0, bIncludeArgumentName:=False) + ucrSaveNewDataFrame.SetPrefix("mc") + Case "mean" + clsMutateFunction.AddParameter("mean", clsRFunctionParameter:=clsTrimmedMeanFunction, iPosition:=0) + clsSelectFunction.AddParameter("x", "mean", iPosition:=0, bIncludeArgumentName:=False) + ucrSaveNewDataFrame.SetPrefix("trimmed_mean") + Case "mfv1" + clsMutateFunction.AddParameter("mfv1", clsRFunctionParameter:=clsMfv1Function, iPosition:=0) + clsSelectFunction.AddParameter("x", "mfv1", iPosition:=0, bIncludeArgumentName:=False) + ucrSaveNewDataFrame.SetPrefix("mfv1") + Case "quantile" + clsMutateFunction.AddParameter("quantile", clsRFunctionParameter:=clsQuantileFunction, iPosition:=0) + clsSelectFunction.AddParameter("x", "quantile", iPosition:=0, bIncludeArgumentName:=False) + ucrSaveNewDataFrame.SetPrefix("quantile") + Case "skewness" + clsMutateFunction.AddParameter("skewness", clsRFunctionParameter:=clsSkewnessFunction, iPosition:=0) + clsSelectFunction.AddParameter("x", "skewness", iPosition:=0, bIncludeArgumentName:=False) + ucrSaveNewDataFrame.SetPrefix("skewness") + End Select End If + ucrBase.clsRsyntax.SetBaseROperator(clsPipeOperator) Else - clsApplyFunction.RemoveParameterByName("na.rm") + If rdoMultiple.Checked Then + If rdoRowRange.Checked Then + clsDummyRowFunction.AddParameter("check", "rowRange", iPosition:=0) + clsColumnNamesFunction.AddParameter("x", clsRFunctionParameter:=clsRowRangesFunction, iPosition:=0, bIncludeArgumentName:=False) + ucrBase.clsRsyntax.SetBaseROperator(clsAssignOperator) + ElseIf rdoRowQuantile.Checked Then + clsDummyRowFunction.AddParameter("check", "rowQuantiles", iPosition:=0) + clsColumnNamesFunction.AddParameter("x", clsRFunctionParameter:=clsRowQuantilesFunction, iPosition:=0, bIncludeArgumentName:=False) + ucrBase.clsRsyntax.SetBaseROperator(clsAssignOperator) + Else + clsDummyRowFunction.AddParameter("check", "rowRanks", iPosition:=0) + clsColumnNamesFunction.AddParameter("x", clsRFunctionParameter:=clsRowRanksFunction, iPosition:=0, bIncludeArgumentName:=False) + ucrBase.clsRsyntax.SetBaseROperator(clsAssignOperator) + End If + End If + End If + + If rdoMultiple.Checked AndAlso rdoRowQuantile.Checked Then + clsDummyRowFunction.AddParameter("0", clsRFunctionParameter:=clsRowQuantilesFunction, iPosition:=0) + ucrInputProbability.SetName("0.25,0.5,0.75") + ucrInputProbability.SetItems({"0.25,0.5,0.75", "0, 0.2, 0.4, 0.6, 0.8, 1", "0.5, 0.8, 1"}) + End If + + If ucrChangedControl Is ucrPnlRowSummaries Then + If rdoMultiple.Checked Then + ucrBase.clsRsyntax.AddToAfterCodes(clsAddColumnsFunction) + Else + ucrBase.clsRsyntax.RemoveFromAfterCodes(clsAddColumnsFunction) + End If + End If + + If ucrChangedControl Is ucrPnlMultipleRowSummary Then + AddConcatenateParameters() + End If + End Sub + + Private Sub AddConcatenateParameters() + clsConcatenateFunction.ClearParameters() + If rdoRowRanks.Checked Then + Dim iPosition As Integer = 0 + For Each strVariable In ucrReceiverForRowSummaries.GetVariableNamesAsList + clsConcatenateFunction.AddParameter(strVariable, Chr(34) & strVariable & "_r" & Chr(34), bIncludeArgumentName:=False, iPosition:=iPosition) + iPosition += 1 + Next + ElseIf rdoRowRange.Checked Then + clsConcatenateFunction.AddParameter("r_min", Chr(34) & "r_min" & Chr(34), bIncludeArgumentName:=False, iPosition:=0) + clsConcatenateFunction.AddParameter("r_max", Chr(34) & "r_max" & Chr(34), bIncludeArgumentName:=False, iPosition:=1) + ElseIf rdoRowQuantile.Checked Then + Select Case ucrInputProbability.GetText + Case "0.25,0.5,0.75" + clsConcatenateFunction.AddParameter("q0.25", Chr(34) & "q0.25" & Chr(34), bIncludeArgumentName:=False, iPosition:=0) + clsConcatenateFunction.AddParameter("q0.5", Chr(34) & "q0.5" & Chr(34), bIncludeArgumentName:=False, iPosition:=1) + clsConcatenateFunction.AddParameter("q0.75", Chr(34) & "q0.75" & Chr(34), bIncludeArgumentName:=False, iPosition:=2) + Case "0, 0.2, 0.4, 0.6, 0.8, 1" + clsConcatenateFunction.AddParameter("q0", Chr(34) & "q0" & Chr(34), bIncludeArgumentName:=False, iPosition:=0) + clsConcatenateFunction.AddParameter("q0.2", Chr(34) & "q0.2" & Chr(34), bIncludeArgumentName:=False, iPosition:=1) + clsConcatenateFunction.AddParameter("q0.4", Chr(34) & "q0.4" & Chr(34), bIncludeArgumentName:=False, iPosition:=2) + clsConcatenateFunction.AddParameter("q0.6", Chr(34) & "q0.6" & Chr(34), bIncludeArgumentName:=False, iPosition:=3) + clsConcatenateFunction.AddParameter("q0.8", Chr(34) & "q0.8" & Chr(34), bIncludeArgumentName:=False, iPosition:=4) + clsConcatenateFunction.AddParameter("q1", Chr(34) & "q1" & Chr(34), bIncludeArgumentName:=False, iPosition:=5) + Case "0.5, 0.8, 1" + clsConcatenateFunction.AddParameter("q0.5", Chr(34) & "q0.5" & Chr(34), bIncludeArgumentName:=False, iPosition:=0) + clsConcatenateFunction.AddParameter("q0.8", Chr(34) & "q0.8" & Chr(34), bIncludeArgumentName:=False, iPosition:=1) + clsConcatenateFunction.AddParameter("q1", Chr(34) & "q1" & Chr(34), bIncludeArgumentName:=False, iPosition:=2) + Case Else + Dim iposition As Integer = 0 + For Each clsParameter In ucrInputProbability.clsRList.clsParameters + clsConcatenateFunction.AddParameter("q" & clsParameter.strArgumentValue, + Chr(34) & "q" & clsParameter.strArgumentValue & Chr(34), bIncludeArgumentName:=False, iPosition:=iposition) + iposition = iposition + 1 + Next + End Select End If End Sub + + Private Sub ucrReceiverForRowSummaries_ControlValueChanged(ucrChangedControl As ucrCore) Handles ucrReceiverForRowSummaries.ControlValueChanged + Dim clsGetColumnsFunction As New RFunction + clsGetColumnsFunction = ucrReceiverForRowSummaries.GetVariables() + clsGetColumnsFunction.SetAssignTo("columns") + clsAsMatrixFunction.AddParameter("columns", clsRFunctionParameter:=clsGetColumnsFunction, iPosition:=0, bIncludeArgumentName:=False) + clsDimensionFunction.AddParameter("columns", clsRFunctionParameter:=clsGetColumnsFunction, iPosition:=0, bIncludeArgumentName:=False) + AddConcatenateParameters() + End Sub + + Private Sub ucrInputProbability_ControlValueChanged(ucrChangedControl As ucrCore) Handles ucrInputProbability.ControlValueChanged + clsRowQuantilesFunction.AddParameter("probs", "c(" & ucrInputProbability.GetText & ")", iPosition:=1) + AddConcatenateParameters() + End Sub + + Private Sub ucrSelectorForRowSummaries_ControlValueChanged(ucrChangedControl As ucrCore) Handles ucrSelectorForRowSummaries.ControlValueChanged + clsAddColumnsFunction.AddParameter("data_name", Chr(34) & ucrSelectorForRowSummaries.ucrAvailableDataFrames.cboAvailableDataFrames.Text & Chr(34), iPosition:=0) + End Sub + + Private Sub Controls_ControlContentsChanged(ucrChangedControl As ucrCore) Handles ucrReceiverForRowSummaries.ControlContentsChanged, ucrPnlStatistics.ControlContentsChanged, + ucrSaveNewDataFrame.ControlContentsChanged, ucrInputProbability.ControlContentsChanged, ucrInputUserDefined.ControlContentsChanged, ucrPnlMultipleRowSummary.ControlContentsChanged, ucrPnlRowSummaries.ControlContentsChanged + TestOKEnabled() + End Sub End Class \ No newline at end of file diff --git a/instat/dlgRownamesOrNumbers.Designer.vb b/instat/dlgRownamesOrNumbers.Designer.vb index 0f39072eb90..00dcf9ebcfc 100644 --- a/instat/dlgRownamesOrNumbers.Designer.vb +++ b/instat/dlgRownamesOrNumbers.Designer.vb @@ -45,6 +45,7 @@ Partial Class dlgRowNamesOrNumbers Me.rdoSortDescending = New System.Windows.Forms.RadioButton() Me.rdoSortAscending = New System.Windows.Forms.RadioButton() Me.grpboxOptionsforRowNamesorNumbercols = New System.Windows.Forms.GroupBox() + Me.ucrChkMakeColumnIntoKey = New instat.ucrCheck() Me.ucrChkAsNumeric = New instat.ucrCheck() Me.ucrPnlSortOptions = New instat.UcrPanel() Me.ucrNewColumnName = New instat.ucrSave() @@ -63,13 +64,13 @@ Partial Class dlgRowNamesOrNumbers Me.rdoCopyRowNamesIntoFirstColumn.Size = New System.Drawing.Size(267, 17) Me.rdoCopyRowNamesIntoFirstColumn.TabIndex = 1 Me.rdoCopyRowNamesIntoFirstColumn.TabStop = True - Me.rdoCopyRowNamesIntoFirstColumn.Text = "Copy Row Names into Column" + Me.rdoCopyRowNamesIntoFirstColumn.Text = "Copy Row Numbers or Names into a Colum" Me.rdoCopyRowNamesIntoFirstColumn.UseVisualStyleBackColor = True ' 'rdoSetRowNamesFromColumn ' Me.rdoSetRowNamesFromColumn.ImeMode = System.Windows.Forms.ImeMode.NoControl - Me.rdoSetRowNamesFromColumn.Location = New System.Drawing.Point(9, 72) + Me.rdoSetRowNamesFromColumn.Location = New System.Drawing.Point(9, 88) Me.rdoSetRowNamesFromColumn.Name = "rdoSetRowNamesFromColumn" Me.rdoSetRowNamesFromColumn.Size = New System.Drawing.Size(267, 17) Me.rdoSetRowNamesFromColumn.TabIndex = 3 @@ -80,7 +81,7 @@ Partial Class dlgRowNamesOrNumbers 'rdoResetintoPositiveIntegers ' Me.rdoResetintoPositiveIntegers.ImeMode = System.Windows.Forms.ImeMode.NoControl - Me.rdoResetintoPositiveIntegers.Location = New System.Drawing.Point(9, 127) + Me.rdoResetintoPositiveIntegers.Location = New System.Drawing.Point(9, 136) Me.rdoResetintoPositiveIntegers.Name = "rdoResetintoPositiveIntegers" Me.rdoResetintoPositiveIntegers.Size = New System.Drawing.Size(267, 17) Me.rdoResetintoPositiveIntegers.TabIndex = 5 @@ -91,7 +92,7 @@ Partial Class dlgRowNamesOrNumbers 'rdoSortbyRowNames ' Me.rdoSortbyRowNames.ImeMode = System.Windows.Forms.ImeMode.NoControl - Me.rdoSortbyRowNames.Location = New System.Drawing.Point(9, 156) + Me.rdoSortbyRowNames.Location = New System.Drawing.Point(9, 158) Me.rdoSortbyRowNames.Name = "rdoSortbyRowNames" Me.rdoSortbyRowNames.Size = New System.Drawing.Size(267, 17) Me.rdoSortbyRowNames.TabIndex = 6 @@ -125,6 +126,7 @@ Partial Class dlgRowNamesOrNumbers ' 'grpboxOptionsforRowNamesorNumbercols ' + Me.grpboxOptionsforRowNamesorNumbercols.Controls.Add(Me.ucrChkMakeColumnIntoKey) Me.grpboxOptionsforRowNamesorNumbercols.Controls.Add(Me.ucrChkAsNumeric) Me.grpboxOptionsforRowNamesorNumbercols.Controls.Add(Me.rdoSortDescending) Me.grpboxOptionsforRowNamesorNumbercols.Controls.Add(Me.rdoSortAscending) @@ -143,6 +145,15 @@ Partial Class dlgRowNamesOrNumbers Me.grpboxOptionsforRowNamesorNumbercols.TabStop = False Me.grpboxOptionsforRowNamesorNumbercols.Text = "Options" ' + 'ucrChkMakeColumnIntoKey + ' + Me.ucrChkMakeColumnIntoKey.AutoSize = True + Me.ucrChkMakeColumnIntoKey.Checked = False + Me.ucrChkMakeColumnIntoKey.Location = New System.Drawing.Point(8, 64) + Me.ucrChkMakeColumnIntoKey.Name = "ucrChkMakeColumnIntoKey" + Me.ucrChkMakeColumnIntoKey.Size = New System.Drawing.Size(297, 23) + Me.ucrChkMakeColumnIntoKey.TabIndex = 10 + ' 'ucrChkAsNumeric ' Me.ucrChkAsNumeric.AutoSize = True @@ -155,15 +166,15 @@ Partial Class dlgRowNamesOrNumbers 'ucrPnlSortOptions ' Me.ucrPnlSortOptions.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink - Me.ucrPnlSortOptions.Location = New System.Drawing.Point(7, 171) + Me.ucrPnlSortOptions.Location = New System.Drawing.Point(7, 185) Me.ucrPnlSortOptions.Name = "ucrPnlSortOptions" - Me.ucrPnlSortOptions.Size = New System.Drawing.Size(206, 36) + Me.ucrPnlSortOptions.Size = New System.Drawing.Size(206, 22) Me.ucrPnlSortOptions.TabIndex = 7 ' 'ucrNewColumnName ' Me.ucrNewColumnName.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink - Me.ucrNewColumnName.Location = New System.Drawing.Point(9, 44) + Me.ucrNewColumnName.Location = New System.Drawing.Point(9, 39) Me.ucrNewColumnName.Margin = New System.Windows.Forms.Padding(4, 5, 4, 5) Me.ucrNewColumnName.Name = "ucrNewColumnName" Me.ucrNewColumnName.Size = New System.Drawing.Size(343, 21) @@ -173,7 +184,7 @@ Partial Class dlgRowNamesOrNumbers ' Me.ucrReceiverRowNames.AutoSize = True Me.ucrReceiverRowNames.frmParent = Me - Me.ucrReceiverRowNames.Location = New System.Drawing.Point(24, 92) + Me.ucrReceiverRowNames.Location = New System.Drawing.Point(24, 109) Me.ucrReceiverRowNames.Margin = New System.Windows.Forms.Padding(0) Me.ucrReceiverRowNames.Name = "ucrReceiverRowNames" Me.ucrReceiverRowNames.Selector = Nothing @@ -247,4 +258,5 @@ Partial Class dlgRowNamesOrNumbers Friend WithEvents rdoSetRowNamesFromColumn As RadioButton Friend WithEvents rdoCopyRowNamesIntoFirstColumn As RadioButton Friend WithEvents ucrPnlSortOptions As UcrPanel + Friend WithEvents ucrChkMakeColumnIntoKey As ucrCheck End Class diff --git a/instat/dlgRownamesOrNumbers.vb b/instat/dlgRownamesOrNumbers.vb index 4dd5bad596d..829e183c1ea 100644 --- a/instat/dlgRownamesOrNumbers.vb +++ b/instat/dlgRownamesOrNumbers.vb @@ -20,6 +20,8 @@ Public Class dlgRowNamesOrNumbers Public bFirstLoad As Boolean = True Private bReset As Boolean = True Private clsRowNamesFunction As New RFunction + Private clsAddKeyFunction As New RFunction + Private clsDummyFunction As New RFunction Private Sub dlgRowNamesOrNumbers_Load(sender As Object, e As EventArgs) Handles MyBase.Load If bFirstLoad Then @@ -56,17 +58,12 @@ Public Class dlgRowNamesOrNumbers ucrPnlOverallOptions.AddRadioButton(rdoResetintoPositiveIntegers) ucrPnlOverallOptions.AddRadioButton(rdoSortbyRowNames) - ucrPnlOverallOptions.AddFunctionNamesCondition(rdoCopyRowNamesIntoFirstColumn, frmMain.clsRLink.strInstatDataObject & "$get_row_names") + ucrPnlOverallOptions.AddParameterValuesCondition(rdoCopyRowNamesIntoFirstColumn, "checked_rdo", "copy_row") + ucrPnlOverallOptions.AddParameterValuesCondition(rdoSetRowNamesFromColumn, "checked_rdo", "set_row") + ucrPnlOverallOptions.AddParameterValuesCondition(rdoResetintoPositiveIntegers, "checked_rdo", "reset_row") + ucrPnlOverallOptions.AddParameterValuesCondition(rdoSortbyRowNames, "checked_rdo", "sort_row") - ucrPnlOverallOptions.AddFunctionNamesCondition(rdoSetRowNamesFromColumn, frmMain.clsRLink.strInstatDataObject & "$set_row_names") - ucrPnlOverallOptions.AddParameterPresentCondition(rdoSetRowNamesFromColumn, "row_names") - - ucrPnlOverallOptions.AddFunctionNamesCondition(rdoResetintoPositiveIntegers, frmMain.clsRLink.strInstatDataObject & "$set_row_names") - ucrPnlOverallOptions.AddParameterPresentCondition(rdoResetintoPositiveIntegers, "row_names", bNewIsPositive:=False) - - ucrPnlOverallOptions.AddFunctionNamesCondition(rdoSortbyRowNames, frmMain.clsRLink.strInstatDataObject & "$sort_dataframe") - - ucrPnlOverallOptions.AddToLinkedControls(ucrNewColumnName, {rdoCopyRowNamesIntoFirstColumn}, bNewLinkedAddRemoveParameter:=True, bNewLinkedHideIfParameterMissing:=True) + ucrPnlOverallOptions.AddToLinkedControls({ucrNewColumnName, ucrChkMakeColumnIntoKey}, {rdoCopyRowNamesIntoFirstColumn}, bNewLinkedAddRemoveParameter:=True, bNewLinkedHideIfParameterMissing:=True) ucrPnlOverallOptions.AddToLinkedControls(ucrReceiverRowNames, {rdoSetRowNamesFromColumn}, bNewLinkedAddRemoveParameter:=True, bNewLinkedHideIfParameterMissing:=True) ucrPnlOverallOptions.AddToLinkedControls(ucrPnlSortOptions, {rdoSortbyRowNames}, bNewLinkedAddRemoveParameter:=True, bNewLinkedHideIfParameterMissing:=True) ucrPnlOverallOptions.AddToLinkedControls(ucrChkAsNumeric, {rdoSortbyRowNames}, bNewLinkedAddRemoveParameter:=True, bNewLinkedHideIfParameterMissing:=True) @@ -88,28 +85,46 @@ Public Class dlgRowNamesOrNumbers ucrChkAsNumeric.SetValuesCheckedAndUnchecked("TRUE", "FALSE") ucrChkAsNumeric.SetRDefault("TRUE") + 'ucrChkMakeColumnIntoKey + ucrChkMakeColumnIntoKey.SetText("Make the Column a Key for the Data Frame") + ucrChkMakeColumnIntoKey.SetParameter(New RParameter("check", 0)) + ucrChkMakeColumnIntoKey.SetValuesCheckedAndUnchecked("TRUE", "FALSE") + ucrChkMakeColumnIntoKey.SetRDefault("TRUE") + 'ucrNewColumnName ucrNewColumnName.SetIsComboBox() ucrNewColumnName.SetPrefix("row") ucrNewColumnName.SetSaveTypeAsColumn() ucrNewColumnName.SetDataFrameSelector(ucrSelectorRowNames.ucrAvailableDataFrames) ucrNewColumnName.SetLabelText("Column Name:") - ucrNewColumnName.SetAssignToBooleans(bTempInsertColumnBefore:=True) End Sub Private Sub SetDefaults() clsRowNamesFunction = New RFunction + clsAddKeyFunction = New RFunction + clsDummyFunction = New RFunction ucrNewColumnName.Reset() ucrSelectorRowNames.Reset() + ucrBase.clsRsyntax.lstAfterCodes.Clear() + + clsDummyFunction.AddParameter("check", "TRUE", iPosition:=0) + clsDummyFunction.AddParameter("checked_rdo", "copy_row", iPosition:=1) + + clsAddKeyFunction.SetRCommand(frmMain.clsRLink.strInstatDataObject & "$add_key") clsRowNamesFunction.SetRCommand(frmMain.clsRLink.strInstatDataObject & "$get_row_names") - clsRowNamesFunction.SetAssignTo(strTemp:=ucrNewColumnName.GetText(), strTempDataframe:=ucrSelectorRowNames.ucrAvailableDataFrames.cboAvailableDataFrames.Text, strTempColumn:=ucrNewColumnName.GetText(), bInsertColumnBefore:=True) + clsRowNamesFunction.SetAssignTo(strTemp:=ucrNewColumnName.GetText(), strTempDataframe:=ucrSelectorRowNames.ucrAvailableDataFrames.cboAvailableDataFrames.Text, strTempColumn:=ucrNewColumnName.GetText()) ucrBase.clsRsyntax.SetBaseRFunction(clsRowNamesFunction) End Sub Private Sub SetRCodeForControls(bReset As Boolean) - SetRCode(Me, ucrBase.clsRsyntax.clsBaseFunction, bReset) + ucrChkAsNumeric.SetRCode(ucrBase.clsRsyntax.clsBaseFunction, bReset) + ucrSelectorRowNames.SetRCode(ucrBase.clsRsyntax.clsBaseFunction, bReset) + ucrReceiverRowNames.SetRCode(ucrBase.clsRsyntax.clsBaseFunction, bReset) + ucrPnlOverallOptions.SetRCode(clsDummyFunction, bReset) + ucrNewColumnName.SetRCode(ucrBase.clsRsyntax.clsBaseFunction, bReset) + ucrChkMakeColumnIntoKey.SetRCode(clsDummyFunction, bReset) End Sub Private Sub TestOKEnabled() @@ -126,20 +141,39 @@ Public Class dlgRowNamesOrNumbers TestOKEnabled() End Sub - Private Sub ucrPnl_ControlValueChanged(ucrChangedControl As ucrCore) Handles ucrPnlOverallOptions.ControlValueChanged + Private Sub ucrPnl_ControlValueChanged(ucrChangedControl As ucrCore) Handles ucrPnlOverallOptions.ControlValueChanged, ucrChkMakeColumnIntoKey.ControlValueChanged, ucrNewColumnName.ControlValueChanged + ucrNewColumnName.SetAssignToBooleans(bTempInsertColumnBefore:=True) If rdoSetRowNamesFromColumn.Checked Then ucrBase.clsRsyntax.SetFunction(frmMain.clsRLink.strInstatDataObject & "$set_row_names") + clsDummyFunction.AddParameter("checked_rdo", "set_row", iPosition:=1) ucrSelectorRowNames.SetVariablesVisible(True) Else ucrSelectorRowNames.SetVariablesVisible(False) If rdoCopyRowNamesIntoFirstColumn.Checked Then ucrBase.clsRsyntax.SetFunction(frmMain.clsRLink.strInstatDataObject & "$get_row_names") + clsDummyFunction.AddParameter("checked_rdo", "copy_row", iPosition:=1) + If ucrChkMakeColumnIntoKey.Checked Then + clsAddKeyFunction.AddParameter("col_names", Chr(34) & ucrNewColumnName.GetText & Chr(34), iPosition:=1) + ucrBase.clsRsyntax.AddToAfterCodes(clsAddKeyFunction, iPosition:=0) + Else + clsAddKeyFunction.RemoveParameterByName("col_names") + ucrBase.clsRsyntax.RemoveFromAfterCodes(clsAddKeyFunction) + End If ElseIf rdoResetintoPositiveIntegers.Checked Then ucrBase.clsRsyntax.SetFunction(frmMain.clsRLink.strInstatDataObject & "$set_row_names") + clsDummyFunction.AddParameter("checked_rdo", "reset_row", iPosition:=1) ElseIf rdoSortbyRowNames.Checked Then ucrBase.clsRsyntax.SetFunction(frmMain.clsRLink.strInstatDataObject & "$sort_dataframe") + clsDummyFunction.AddParameter("checked_rdo", "sort_row", iPosition:=1) End If End If + If Not rdoCopyRowNamesIntoFirstColumn.Checked Then + ucrBase.clsRsyntax.RemoveFromAfterCodes(clsAddKeyFunction) + End If + End Sub + + Private Sub ucrSelectorRowNames_ControlValueChanged(ucrChangedControl As ucrCore) Handles ucrSelectorRowNames.ControlValueChanged + clsAddKeyFunction.AddParameter("data_name", Chr(34) & ucrSelectorRowNames.strCurrentDataFrame & Chr(34), iPosition:=0) End Sub Private Sub CoreControls_ControlContentsChanged(ucrChangedControl As ucrCore) Handles ucrSelectorRowNames.ControlContentsChanged, ucrPnlOverallOptions.ControlContentsChanged, ucrReceiverRowNames.ControlContentsChanged, ucrNewColumnName.ControlContentsChanged diff --git a/instat/dlgSeasonalPlot.vb b/instat/dlgSeasonalPlot.vb index 5ba9cf126e6..fd0e869bd73 100644 --- a/instat/dlgSeasonalPlot.vb +++ b/instat/dlgSeasonalPlot.vb @@ -21,66 +21,66 @@ Public Class dlgSeasonalPlot Private bReset As Boolean = True 'summary functions + operators - Private clsPipeOperator As ROperator - Private clsAndOperator As ROperator - Private clsRefGreaterOperator As ROperator - Private clsEst1GreaterOperator As ROperator - Private clsRefLessOperator As ROperator - Private clsEst1LessOperator As ROperator - Private clsDivideOperator As ROperator - Private clsLessOperator As ROperator - Private clsGreaterOperator As ROperator - Private clsEst2GreaterOperator As ROperator - Private clsEst2LessOperator As ROperator + Private clsPipeOperator As New ROperator + Private clsAndOperator As New ROperator + Private clsRefGreaterOperator As New ROperator + Private clsEst1GreaterOperator As New ROperator + Private clsRefLessOperator As New ROperator + Private clsEst1LessOperator As New ROperator + Private clsDivideOperator As New ROperator + Private clsLessOperator As New ROperator + Private clsGreaterOperator As New ROperator + Private clsEst2GreaterOperator As New ROperator + Private clsEst2LessOperator As New ROperator ''' ''' Dummy ROperator set to either clsRefGreaterOperator or clsRefLessOperator depending on ''' summary option. This is used in SetRCode for ucrInputReferenceSummary. ''' - Private clsRefGreaterOrLessOperator As ROperator - - Private clsMissingFilterFunction As RFunction - Private clsRefIsNotNaFunction As RFunction - Private clsEstIsNotNaFunction As RFunction - Private clsMutateFunction As RFunction - Private clsPivotLongerFunction As RFunction - Private clsPivotCFunction As RFunction - Private clsPivotListFunction As RFunction - Private clsPivotFactorFunction As RFunction + Private clsRefGreaterOrLessOperator As New ROperator + + Private clsMissingFilterFunction As New RFunction + Private clsRefIsNotNaFunction As New RFunction + Private clsEstIsNotNaFunction As New RFunction + Private clsMutateFunction As New RFunction + Private clsPivotLongerFunction As New RFunction + Private clsPivotCFunction As New RFunction + Private clsPivotListFunction As New RFunction + Private clsPivotFactorFunction As New RFunction Private clsPivotFactorLevelsCFunction As New RFunction - Private clsGroupByFunction As RFunction - Private clsSummariseFunction As RFunction - Private clsMovingMutateFunction As RFunction - Private clsMovingFunction As RFunction - Private clsNSumFunction As RFunction - Private clsPropSumFunction As RFunction - Private clsNotIsNaThreshFunction As RFunction - Private clsMeanFunction As RFunction - Private clsMeanFilterFunction As RFunction - Private clsStdFunction As RFunction + Private clsGroupByFunction As New RFunction + Private clsSummariseFunction As New RFunction + Private clsMovingMutateFunction As New RFunction + Private clsMovingFunction As New RFunction + Private clsNSumFunction As New RFunction + Private clsPropSumFunction As New RFunction + Private clsNotIsNaThreshFunction As New RFunction + Private clsMeanFunction As New RFunction + Private clsMeanFilterFunction As New RFunction + Private clsStdFunction As New RFunction 'ggplot functions + operators - Private clsPlusOperator As ROperator - Private clsFacetWrapTildeOperator As ROperator - Private clsTildeOperator As ROperator + Private clsPlusOperator As New ROperator + Private clsFacetWrapTildeOperator As New ROperator + Private clsTildeOperator As New ROperator ''' Dummy RCodeStructure set to either clsAsFormulaFunction or clsTildeOperator depending on smoothing option. This is used in SetRCode for ucrInputSmoothing. Private clsFormulaRCode As RCodeStructure - Private clsGgplotFunction As RFunction - Private clsGeomPointFunction As RFunction - Private clsGeomLineFunction As RFunction - Private clsGeomSmoothFunction As RFunction - Private clsGgPlotAesFunction As RFunction - Private clsGeomLineAesFunction As RFunction - Private clsFacetWrapFunction As RFunction - Private clsAsFormulaFunction As RFunction - Private clsPasteFunction As RFunction - Private clsFourierSeriesFunction As RFunction - Private clsListFunction As RFunction - Private clsBinomialFunction As RFunction - Private clsPbsFunction As RFunction - Private clsNsFunction As RFunction - Private clsYlabFunction As RFunction + Private clsGgplotFunction As New RFunction + Private clsGeomPointFunction As New RFunction + Private clsGeomLineFunction As New RFunction + Private clsGeomSmoothFunction As New RFunction + Private clsGgPlotAesFunction As New RFunction + Private clsGeomLineAesFunction As New RFunction + Private clsFacetWrapFunction As New RFunction + Private clsAsFormulaFunction As New RFunction + Private clsPasteFunction As New RFunction + Private clsFourierSeriesFunction As New RFunction + Private clsListFunction As New RFunction + Private clsBinomialFunction As New RFunction + Private clsPbsFunction As New RFunction + Private clsNsFunction As New RFunction + Private clsYlabFunction As New RFunction Private Sub dlgSeasonalPlot_Load(sender As Object, e As EventArgs) Handles MyBase.Load If bFirstLoad Then @@ -515,7 +515,7 @@ Public Class dlgSeasonalPlot ''' True if the dialog is being reset. Private Sub ReferenceSummarySetRCode(bReset As Boolean) Dim clsTempParam As RParameter - Dim clsTempRFunc As RFunction + Dim clsTempRFunc As New RFunction Dim strReferenceName As String = "" Dim strEstimatesName As String = "" diff --git a/instat/dlgSelect.Designer.vb b/instat/dlgSelect.Designer.vb index b3cf0367122..c756851def3 100644 --- a/instat/dlgSelect.Designer.vb +++ b/instat/dlgSelect.Designer.vb @@ -45,11 +45,12 @@ Partial Class dlgSelect Me.lblSelection = New System.Windows.Forms.Label() Me.cmdDefineNewSelect = New System.Windows.Forms.Button() Me.lblFilterPreview = New System.Windows.Forms.Label() + Me.lblNewDataFrameName = New System.Windows.Forms.Label() + Me.ucrInputNewDataFrameName = New instat.ucrInputComboBox() Me.ucrInputSelectPreview = New instat.ucrInputTextBox() Me.ucrReceiverSelect = New instat.ucrReceiverSingle() Me.ucrSelectorForSelectColumns = New instat.ucrSelectorByDataFrameAddRemove() Me.ucrBase = New instat.ucrButtons() - Me.ucrNewDataFrameName = New instat.ucrSave() Me.grpApplyOptions.SuspendLayout() Me.SuspendLayout() ' @@ -75,7 +76,6 @@ Partial Class dlgSelect Me.rdoApplyAsSubset.TabStop = True Me.rdoApplyAsSubset.Text = "As Subset" Me.rdoApplyAsSubset.UseVisualStyleBackColor = True - Me.rdoApplyAsSubset.Visible = False ' 'rdoApplyAsSelect ' @@ -123,10 +123,30 @@ Partial Class dlgSelect Me.lblFilterPreview.Location = New System.Drawing.Point(11, 303) Me.lblFilterPreview.Name = "lblFilterPreview" Me.lblFilterPreview.Size = New System.Drawing.Size(143, 22) - Me.lblFilterPreview.TabIndex = 6 + Me.lblFilterPreview.TabIndex = 7 Me.lblFilterPreview.Text = "Selection Preview:" Me.lblFilterPreview.Visible = False ' + 'lblNewDataFrameName + ' + Me.lblNewDataFrameName.AutoSize = True + Me.lblNewDataFrameName.Location = New System.Drawing.Point(21, 266) + Me.lblNewDataFrameName.Name = "lblNewDataFrameName" + Me.lblNewDataFrameName.Size = New System.Drawing.Size(121, 13) + Me.lblNewDataFrameName.TabIndex = 5 + Me.lblNewDataFrameName.Text = "New Data Frame Name:" + ' + 'ucrInputNewDataFrameName + ' + Me.ucrInputNewDataFrameName.AddQuotesIfUnrecognised = True + Me.ucrInputNewDataFrameName.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink + Me.ucrInputNewDataFrameName.GetSetSelectedIndex = -1 + Me.ucrInputNewDataFrameName.IsReadOnly = False + Me.ucrInputNewDataFrameName.Location = New System.Drawing.Point(146, 261) + Me.ucrInputNewDataFrameName.Name = "ucrInputNewDataFrameName" + Me.ucrInputNewDataFrameName.Size = New System.Drawing.Size(137, 21) + Me.ucrInputNewDataFrameName.TabIndex = 6 + ' 'ucrInputSelectPreview ' Me.ucrInputSelectPreview.AddQuotesIfUnrecognised = True @@ -136,7 +156,7 @@ Partial Class dlgSelect Me.ucrInputSelectPreview.Location = New System.Drawing.Point(160, 294) Me.ucrInputSelectPreview.Name = "ucrInputSelectPreview" Me.ucrInputSelectPreview.Size = New System.Drawing.Size(255, 43) - Me.ucrInputSelectPreview.TabIndex = 7 + Me.ucrInputSelectPreview.TabIndex = 8 Me.ucrInputSelectPreview.Visible = False ' 'ucrReceiverSelect @@ -171,16 +191,7 @@ Partial Class dlgSelect Me.ucrBase.Location = New System.Drawing.Point(11, 343) Me.ucrBase.Name = "ucrBase" Me.ucrBase.Size = New System.Drawing.Size(405, 52) - Me.ucrBase.TabIndex = 8 - ' - 'ucrNewDataFrameName - ' - Me.ucrNewDataFrameName.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink - Me.ucrNewDataFrameName.Location = New System.Drawing.Point(11, 267) - Me.ucrNewDataFrameName.Margin = New System.Windows.Forms.Padding(4, 5, 4, 5) - Me.ucrNewDataFrameName.Name = "ucrNewDataFrameName" - Me.ucrNewDataFrameName.Size = New System.Drawing.Size(344, 24) - Me.ucrNewDataFrameName.TabIndex = 5 + Me.ucrBase.TabIndex = 9 ' 'dlgSelect ' @@ -188,6 +199,8 @@ Partial Class dlgSelect Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi Me.AutoSize = True Me.ClientSize = New System.Drawing.Size(429, 401) + Me.Controls.Add(Me.ucrInputNewDataFrameName) + Me.Controls.Add(Me.lblNewDataFrameName) Me.Controls.Add(Me.lblFilterPreview) Me.Controls.Add(Me.grpApplyOptions) Me.Controls.Add(Me.ucrInputSelectPreview) @@ -196,7 +209,6 @@ Partial Class dlgSelect Me.Controls.Add(Me.ucrSelectorForSelectColumns) Me.Controls.Add(Me.cmdDefineNewSelect) Me.Controls.Add(Me.ucrBase) - Me.Controls.Add(Me.ucrNewDataFrameName) Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow Me.MaximizeBox = False Me.MinimizeBox = False @@ -218,7 +230,8 @@ Partial Class dlgSelect Friend WithEvents ucrSelectorForSelectColumns As ucrSelectorByDataFrameAddRemove Friend WithEvents cmdDefineNewSelect As Button Friend WithEvents ucrBase As ucrButtons - Friend WithEvents ucrNewDataFrameName As ucrSave Friend WithEvents lblFilterPreview As Label Friend WithEvents ucrPnlApplyOptions As UcrPanel + Friend WithEvents ucrInputNewDataFrameName As ucrInputComboBox + Friend WithEvents lblNewDataFrameName As Label End Class diff --git a/instat/dlgSelect.vb b/instat/dlgSelect.vb index 77c24b2d15f..1d13ef8be6c 100644 --- a/instat/dlgSelect.vb +++ b/instat/dlgSelect.vb @@ -18,7 +18,9 @@ Imports instat.Translations Public Class dlgSelect Private bFirstLoad As Boolean = True Private bReset As Boolean = True - Private clsSetCurrentColumnSelection As RFunction + Private clsSetCurrentColumnSelection As New RFunction + Private clsApplyAsSubset As New RFunction + Private Sub dlgSelect_Load(sender As Object, e As EventArgs) Handles MyBase.Load If bFirstLoad Then InitialiseDialog() @@ -45,40 +47,51 @@ Public Class dlgSelect ucrSelectorForSelectColumns.SetParameter(New RParameter("data_name", 0)) ucrSelectorForSelectColumns.SetParameterIsString() - ucrSelectorForSelectColumns.HideShowAddOrDataOptionsButton(bDataOptionsVisible:=False) + ucrSelectorForSelectColumns.HideShowAddOrDataOptionsOrListView(bDataOptionsVisible:=False) ucrReceiverSelect.SetParameter(New RParameter("name", 1)) ucrReceiverSelect.SetParameterIsString() ucrPnlApplyOptions.AddRadioButton(rdoApplyAsSelect) ucrPnlApplyOptions.AddRadioButton(rdoApplyAsSubset) - rdoApplyAsSubset.Enabled = False + ucrPnlApplyOptions.AddFunctionNamesCondition(rdoApplyAsSelect, frmMain.clsRLink.strInstatDataObject & "$set_current_column_selection") + ucrPnlApplyOptions.AddFunctionNamesCondition(rdoApplyAsSubset, frmMain.clsRLink.strInstatDataObject & "$copy_data_object") - ucrPnlApplyOptions.AddToLinkedControls({ucrNewDataFrameName}, {rdoApplyAsSubset}, bNewLinkedHideIfParameterMissing:=True) + ucrInputNewDataFrameName.SetParameter(New RParameter("new_name", 1)) + ucrInputNewDataFrameName.SetDataFrameSelector(ucrSelectorForSelectColumns.ucrAvailableDataFrames) + ucrInputNewDataFrameName.bAllowNonConditionValues = True - ucrNewDataFrameName.SetIsTextBox() - ucrNewDataFrameName.SetSaveTypeAsDataFrame() - ucrNewDataFrameName.SetDataFrameSelector(ucrSelectorForSelectColumns.ucrAvailableDataFrames) - ucrNewDataFrameName.SetLabelText("New Data Frame Name:") + ucrPnlApplyOptions.AddToLinkedControls({ucrInputNewDataFrameName}, {rdoApplyAsSubset}, bNewLinkedHideIfParameterMissing:=True) + ucrInputNewDataFrameName.SetLinkedDisplayControl(lblNewDataFrameName) End Sub Private Sub SetDefaults() clsSetCurrentColumnSelection = New RFunction + clsApplyAsSubset = New RFunction ucrSelectorForSelectColumns.Reset() - rdoApplyAsSelect.Checked = True clsSetCurrentColumnSelection.SetRCommand(frmMain.clsRLink.strInstatDataObject & "$set_current_column_selection") + clsApplyAsSubset.SetRCommand(frmMain.clsRLink.strInstatDataObject & "$copy_data_object") + clsApplyAsSubset.AddParameter("data_name", Chr(34) & ucrSelectorForSelectColumns.strCurrentDataFrame & Chr(34), iPosition:=0) + ucrBase.clsRsyntax.SetBaseRFunction(clsSetCurrentColumnSelection) End Sub Private Sub SetRcodeForControls(bReset As Boolean) + ucrReceiverSelect.AddAdditionalCodeParameterPair(clsApplyAsSubset, New RParameter("column_selection_name", 2), iAdditionalPairNo:=1) ucrSelectorForSelectColumns.SetRCode(clsSetCurrentColumnSelection, bReset) ucrReceiverSelect.SetRCode(clsSetCurrentColumnSelection, bReset) + ucrInputNewDataFrameName.SetRCode(clsApplyAsSubset, bReset) + ucrPnlApplyOptions.SetRCode(ucrBase.clsRsyntax.clsBaseFunction, bReset) End Sub Private Sub TestOkEnabled() - ucrBase.OKEnabled(Not ucrReceiverSelect.IsEmpty) + If rdoApplyAsSubset.Checked Then + ucrBase.OKEnabled(Not ucrInputNewDataFrameName.IsEmpty AndAlso Not ucrReceiverSelect.IsEmpty) + Else + ucrBase.OKEnabled(Not ucrReceiverSelect.IsEmpty) + End If End Sub Private Sub ucrBase_ClickReset(sender As Object, e As EventArgs) Handles ucrBase.ClickReset @@ -99,7 +112,31 @@ Public Class dlgSelect ucrSelectorForSelectColumns.LoadList() End Sub - Private Sub ucrReceiverSelect_ControlContentsChanged(ucrChangedControl As ucrCore) Handles ucrReceiverSelect.ControlContentsChanged + Private Sub ucrPnlApplyOptions_ControlValueChanged(ucrChangedControl As ucrCore) Handles ucrPnlApplyOptions.ControlValueChanged + If rdoApplyAsSelect.Checked Then + ucrBase.clsRsyntax.SetBaseRFunction(clsSetCurrentColumnSelection) + Else + ucrBase.clsRsyntax.SetBaseRFunction(clsApplyAsSubset) + End If + End Sub + + Private Sub ucrSelectorForSelectColumns_DataFrameChanged() Handles ucrSelectorForSelectColumns.DataFrameChanged + If Not ucrSelectorForSelectColumns.IsEmpty() Then + clsApplyAsSubset.AddParameter("data_name", Chr(34) & ucrSelectorForSelectColumns.ucrAvailableDataFrames.cboAvailableDataFrames.Text & Chr(34), iPosition:=0) + Else + clsApplyAsSubset.RemoveParameterByName("data_name") + End If + End Sub + + Private Sub ucrReceiverSelect_ControlValueChanged(ucrChangedControl As ucrCore) Handles ucrReceiverSelect.ControlValueChanged + If Not ucrReceiverSelect.IsEmpty Then + ucrInputNewDataFrameName.SetName(ucrReceiverSelect.GetVariableNames.Trim(Chr(34))) + Else + ucrInputNewDataFrameName.SetName("") + End If + End Sub + + Private Sub ucrReceiverSelect_ControlContentsChanged(ucrChangedControl As ucrCore) Handles ucrReceiverSelect.ControlContentsChanged, ucrInputNewDataFrameName.ControlContentsChanged, ucrPnlApplyOptions.ControlContentsChanged TestOkEnabled() End Sub End Class \ No newline at end of file diff --git a/instat/dlgSelectColumns.vb b/instat/dlgSelectColumns.vb index d44c4894eb7..b252b4cfa90 100644 --- a/instat/dlgSelectColumns.vb +++ b/instat/dlgSelectColumns.vb @@ -20,8 +20,8 @@ Public Class dlgSelectColumns Private bReset As Boolean = True Private bFirstLoad As Boolean = True Public clsAddColumnSelection As New RFunction - Private clsConditionsList As RFunction - Private clsFromToOperation As ROperator + Private clsConditionsList As New RFunction + Private clsFromToOperation As New ROperator Private Sub dlgSelectColumns_Load(sender As Object, e As EventArgs) Handles MyBase.Load If bFirstLoad Then InitialiseDialog() @@ -37,9 +37,12 @@ Public Class dlgSelectColumns End Sub Private Sub InitialiseDialog() + + ucrBase.iHelpTopicID = 104 + ucrSelectorForColumnSelection.SetParameter(New RParameter("data_name", 0)) ucrSelectorForColumnSelection.SetParameterIsString() - ucrSelectorForColumnSelection.HideShowAddOrDataOptionsButton(bDataOptionsVisible:=False) + ucrSelectorForColumnSelection.HideShowAddOrDataOptionsOrListView(bDataOptionsVisible:=False) ucrReceiverMultipleVariables.Selector = ucrSelectorForColumnSelection ucrReceiverMultipleVariables.SetMeAsReceiver() @@ -50,7 +53,7 @@ Public Class dlgSelectColumns ucrInputSelectOperation.SetItems({"Columns", "Starts with", "Ends with", "Contains", "Matches", "Numeric range", "Last column", "Where"}) ucrInputSelectOperation.SetDropDownStyleAsNonEditable() - ucrInputColumnType.SetItems({"Numeric", "Factor", "Character", "Logical", "Variable label", "Empty columns", "NA columns"}) + ucrInputColumnType.SetItems({"Numeric", "Factor", "Character", "Logical", "Variable label", "Value label", "Empty columns", "NA columns"}) ucrInputColumnType.SetDropDownStyleAsNonEditable() ucrInputSelectOperation.AddToLinkedControls(ucrChkIgnoreCase, {"Starts with", "Ends with", "Contains", "Matches"}, bNewLinkedHideIfParameterMissing:=True) @@ -210,7 +213,9 @@ Public Class dlgSelectColumns ElseIf strValue = "Logical" Then clsParametersList.AddParameter("fn", "is.logical", iPosition:=0) ElseIf strValue = "Variable label" Then - clsParametersList.AddParameter("fn", "is.containlabel", iPosition:=0) + clsParametersList.AddParameter("fn", "is.containVariableLabel", iPosition:=0) + ElseIf strValue = "Value label" Then + clsParametersList.AddParameter("fn", "is.containValueLabel", iPosition:=0) ElseIf strValue = "Empty columns" Then clsParametersList.AddParameter("fn", "is.emptyvariable", iPosition:=0) ElseIf strValue = "NA columns" Then @@ -244,7 +249,7 @@ Public Class dlgSelectColumns Dim bEnableOrDisable As Boolean = True Dim strOperation As String strOperation = ucrInputSelectOperation.GetText - ucrSelectorForColumnSelection.HideShowAddOrDataOptionsButton(strOperation = "Columns", False) + ucrSelectorForColumnSelection.HideShowAddOrDataOptionsOrListView(strOperation = "Columns", False) Select Case strOperation Case "Columns" If ucrReceiverMultipleVariables.IsEmpty Then diff --git a/instat/dlgSetupForDataEntry.Designer.vb b/instat/dlgSetupForDataEntry.Designer.vb index 064862293e3..d83f37dd45a 100644 --- a/instat/dlgSetupForDataEntry.Designer.vb +++ b/instat/dlgSetupForDataEntry.Designer.vb @@ -94,7 +94,7 @@ Partial Class dlgSetupForDataEntry ' Me.lblStation.AutoSize = True Me.lblStation.ImeMode = System.Windows.Forms.ImeMode.NoControl - Me.lblStation.Location = New System.Drawing.Point(262, 55) + Me.lblStation.Location = New System.Drawing.Point(262, 56) Me.lblStation.Name = "lblStation" Me.lblStation.Size = New System.Drawing.Size(43, 13) Me.lblStation.TabIndex = 4 @@ -351,13 +351,12 @@ Partial Class dlgSetupForDataEntry 'ucrInputSelectStation ' Me.ucrInputSelectStation.AddQuotesIfUnrecognised = True - Me.ucrInputSelectStation.AutoSize = True Me.ucrInputSelectStation.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink Me.ucrInputSelectStation.GetSetSelectedIndex = -1 Me.ucrInputSelectStation.IsReadOnly = False - Me.ucrInputSelectStation.Location = New System.Drawing.Point(261, 112) + Me.ucrInputSelectStation.Location = New System.Drawing.Point(261, 111) Me.ucrInputSelectStation.Name = "ucrInputSelectStation" - Me.ucrInputSelectStation.Size = New System.Drawing.Size(0, 0) + Me.ucrInputSelectStation.Size = New System.Drawing.Size(120, 23) Me.ucrInputSelectStation.TabIndex = 5 ' 'ucrReceiverStation diff --git a/instat/dlgSpells.vb b/instat/dlgSpells.vb index b00bc6eb76c..d8db2c82eab 100644 --- a/instat/dlgSpells.vb +++ b/instat/dlgSpells.vb @@ -24,7 +24,7 @@ Public Class dlgSpells Private clsDayFromAndToOperator, clsDayFromOperator, clsDayToOperator As New ROperator Private clsApplyInstatFunction, clsSpellLogicalCalc, clsSpellsLogicalCalc, clsSpellsLogCalcFunc, clsDotSpellsFunction As New RFunction Private clsSpellsFunction, clsSpellsManipulationsFunc, clsSpellManipulationsFunc, clsSpellFunction, clsRSpellSubFunct, clsRSpellFilterSubFunct, clsSpellFilterFunction As New RFunction - Private clsCurrCalc As RFunction + Private clsCurrCalc As New RFunction Private clsRRaindayOperator, clsSpellLogicalAndOperator, clsSpellLogicalGreaterThanOperator, clsSpellLogicalLessThanOperator, clsAdditionalConditionReplaceOperator, clsAdditionalConditionReplaceOperator2, clsGreaterThanOperator, clsLessThanOperator As New ROperator Private clsAdditionalCondition, clsAdditionalConditionList, clsSubSpellLength2, clsAdditionalConditionReplaceFunction As New RFunction diff --git a/instat/dlgSplitText.vb b/instat/dlgSplitText.vb index 8ef13276916..2a416f3b347 100644 --- a/instat/dlgSplitText.vb +++ b/instat/dlgSplitText.vb @@ -54,7 +54,6 @@ Public Class dlgSplitText ucrPnlTextComponents.AddFunctionNamesCondition(rdoFixedNumberOfComponents, "str_split_fixed") ucrPnlTextComponents.AddToLinkedControls(ucrNudPieces, {rdoFixedNumberOfComponents}, bNewLinkedAddRemoveParameter:=True, bNewLinkedHideIfParameterMissing:=True, objNewDefaultState:=2, bNewLinkedChangeParameterValue:=True) - ucrPnlSplitText.AddToLinkedControls(ucrSaveColumn, {rdoTextComponents}, bNewLinkedAddRemoveParameter:=True, bNewLinkedHideIfParameterMissing:=True) ucrPnlSplitText.AddToLinkedControls(ucrChkIncludeRegularExpressions, {rdoTextComponents}, bNewLinkedHideIfParameterMissing:=True) ucrPnlSplitText.AddToLinkedControls(ucrPnlTextComponents, {rdoTextComponents}, bNewLinkedAddRemoveParameter:=True, bNewLinkedHideIfParameterMissing:=True, bNewLinkedChangeToDefaultState:=True, objNewDefaultState:=rdoFixedNumberOfComponents) ucrChkIncludeRegularExpressions.AddToLinkedControls(ucrInputRegexPattern, {True}, bNewLinkedHideIfParameterMissing:=True) @@ -85,7 +84,6 @@ Public Class dlgSplitText ucrChkIncludeRegularExpressions.SetValuesCheckedAndUnchecked(True, False) ucrChkIncludeRegularExpressions.SetRDefault("FALSE") - ucrSaveColumn.SetSaveTypeAsColumn() ucrSaveColumn.SetDataFrameSelector(ucrSelectorSplitTextColumn.ucrAvailableDataFrames) ucrSaveColumn.SetLabelText("Prefix for New Columns:") @@ -145,6 +143,7 @@ Public Class dlgSplitText ucrPnlSplitText.SetRCode(ucrBase.clsRsyntax.clsBaseFunction, bReset) ucrPnlTextComponents.SetRCode(ucrBase.clsRsyntax.clsBaseFunction, bReset) ucrSaveColumn.SetRCode(clsTextComponentsFixed, bReset) + ucrSaveColumn.AddAdditionalRCode(clsBinaryColumns, bReset) End Sub Private Sub TestOKEnabled() @@ -168,20 +167,14 @@ Public Class dlgSplitText End Sub Private Sub ucrPnlSplitText_ControlValueChanged(ucrChangedControl As ucrCore) Handles ucrPnlSplitText.ControlValueChanged - If rdoBinaryColumns.Checked Then - cmdAddkeyboard.Visible = False - ucrBase.clsRsyntax.SetBaseRFunction(clsBinaryColumns) - ElseIf rdoTextComponents.Checked Then - SplitTextOptions() - End If - SetVisibleAddKeyboardButton() ChangeParametersValues() + SetBaseFunction() End Sub Private Sub ucrPnlTextComponents_ControlValueChanged(ucrChangedControl As ucrCore) Handles ucrPnlTextComponents.ControlValueChanged - SplitTextOptions() ChangeParametersValues() + SetBaseFunction() End Sub Private Sub SetVisibleAddKeyboardButton() @@ -213,11 +206,16 @@ Public Class dlgSplitText End If End Sub - Private Sub SplitTextOptions() - If rdoFixedNumberOfComponents.Checked Then - ucrBase.clsRsyntax.SetBaseRFunction(clsTextComponentsFixed) - ElseIf rdoMaximumNumberOfComponents.Checked Then - ucrBase.clsRsyntax.SetBaseRFunction(clsTextComponentsMaximum) + Private Sub SetBaseFunction() + If rdoBinaryColumns.Checked Then + cmdAddkeyboard.Visible = False + ucrBase.clsRsyntax.SetBaseRFunction(clsBinaryColumns) + Else + If rdoFixedNumberOfComponents.Checked Then + ucrBase.clsRsyntax.SetBaseRFunction(clsTextComponentsFixed) + ElseIf rdoMaximumNumberOfComponents.Checked Then + ucrBase.clsRsyntax.SetBaseRFunction(clsTextComponentsMaximum) + End If End If End Sub diff --git a/instat/dlgStack.vb b/instat/dlgStack.vb index d51ca834d33..591b8eb7a32 100644 --- a/instat/dlgStack.vb +++ b/instat/dlgStack.vb @@ -17,12 +17,12 @@ Imports instat.Translations Public Class dlgStack - Private clsUnnestTokensFunction As RFunction - Private clsPivotLongerFunction As RFunction - Private clsSelectFunction As RFunction - Private clsReshapeFunction As RFunction - Private clsSplitColumnsFunction As RFunction - Private clsPipeOperator As ROperator + Private clsUnnestTokensFunction As New RFunction + Private clsPivotLongerFunction As New RFunction + Private clsSelectFunction As New RFunction + Private clsReshapeFunction As New RFunction + Private clsSplitColumnsFunction As New RFunction + Private clsPipeOperator As New ROperator Private bFirstLoad As Boolean = True Private bReset As Boolean = True diff --git a/instat/dlgSummaryTables.Designer.vb b/instat/dlgSummaryTables.Designer.vb index 8556898714c..7716c2d2e6d 100644 --- a/instat/dlgSummaryTables.Designer.vb +++ b/instat/dlgSummaryTables.Designer.vb @@ -19,7 +19,7 @@ Partial Class dlgSummaryTables 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,31 +36,41 @@ Partial Class dlgSummaryTables '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.lblFactors = New System.Windows.Forms.Label() Me.cmdSummaries = New System.Windows.Forms.Button() Me.lblSigFigs = New System.Windows.Forms.Label() Me.grpDisplay = New System.Windows.Forms.GroupBox() - Me.ucrNudColumnFactors = New instat.ucrNud() Me.lblColumnFactors = New System.Windows.Forms.Label() - Me.ucrChkDisplaySummaryVariablesAsRow = New instat.ucrCheck() - Me.ucrChkDisplayVariablesAsRows = New instat.ucrCheck() - Me.ucrChkDisplaySummariesAsRow = New instat.ucrCheck() - Me.ucrNudSigFigs = New instat.ucrNud() Me.grpMargin = New System.Windows.Forms.GroupBox() Me.rdoBoth = New System.Windows.Forms.RadioButton() Me.rdoSummary = New System.Windows.Forms.RadioButton() Me.rdoOuter = New System.Windows.Forms.RadioButton() - Me.ucrPnlMargin = New instat.UcrPanel() Me.lblMarginName = New System.Windows.Forms.Label() Me.lblVariables = New System.Windows.Forms.Label() + Me.cmdFormatTable = New System.Windows.Forms.Button() + Me.rdoFrequencyTable = New System.Windows.Forms.RadioButton() + Me.rdoSummaryTable = New System.Windows.Forms.RadioButton() + Me.grpPercentages = New System.Windows.Forms.GroupBox() + Me.lblFactorsAsPercentage = New System.Windows.Forms.Label() + Me.lblFrequencyMarginName = New System.Windows.Forms.Label() + Me.ucrChkFrequencyDisplayMargins = New instat.ucrCheck() + Me.ucrReceiverMultiplePercentages = New instat.ucrReceiverMultiple() + Me.ucrChkPercentageProportion = New instat.ucrCheck() + Me.ucrChkDisplayAsPercentage = New instat.ucrCheck() + Me.ucrPnlSummaryFrequencyTables = New instat.UcrPanel() Me.ucrReorderSummary = New instat.ucrReorder() Me.ucrInputMarginName = New instat.ucrInputTextBox() Me.ucrSaveTable = New instat.ucrSave() Me.ucrChkOmitMissing = New instat.ucrCheck() Me.ucrChkStoreResults = New instat.ucrCheck() Me.ucrChkDisplayMargins = New instat.ucrCheck() + Me.ucrNudColumnFactors = New instat.ucrNud() + Me.ucrChkDisplaySummaryVariablesAsRow = New instat.ucrCheck() + Me.ucrChkDisplayVariablesAsRows = New instat.ucrCheck() + Me.ucrChkDisplaySummariesAsRow = New instat.ucrCheck() + Me.ucrNudSigFigs = New instat.ucrNud() Me.ucrChkSummaries = New instat.ucrCheck() Me.ucrBase = New instat.ucrButtons() Me.ucrReceiverSummaryCols = New instat.ucrReceiverMultiple() @@ -68,16 +78,18 @@ Partial Class dlgSummaryTables Me.ucrReceiverWeights = New instat.ucrReceiverSingle() Me.ucrChkWeight = New instat.ucrCheck() Me.ucrSelectorSummaryTables = New instat.ucrSelectorByDataFrameAddRemove() - Me.cmdFormatTable = New System.Windows.Forms.Button() + Me.ucrPnlMargin = New instat.UcrPanel() + Me.ucrInputFrequencyMarginName = New instat.ucrInputTextBox() Me.grpDisplay.SuspendLayout() Me.grpMargin.SuspendLayout() + Me.grpPercentages.SuspendLayout() Me.SuspendLayout() ' 'lblFactors ' Me.lblFactors.AutoSize = True Me.lblFactors.ImeMode = System.Windows.Forms.ImeMode.NoControl - Me.lblFactors.Location = New System.Drawing.Point(286, 28) + Me.lblFactors.Location = New System.Drawing.Point(286, 43) Me.lblFactors.Name = "lblFactors" Me.lblFactors.Size = New System.Drawing.Size(48, 13) Me.lblFactors.TabIndex = 1 @@ -87,7 +99,7 @@ Partial Class dlgSummaryTables 'cmdSummaries ' Me.cmdSummaries.ImeMode = System.Windows.Forms.ImeMode.NoControl - Me.cmdSummaries.Location = New System.Drawing.Point(286, 269) + Me.cmdSummaries.Location = New System.Drawing.Point(286, 280) Me.cmdSummaries.Name = "cmdSummaries" Me.cmdSummaries.Size = New System.Drawing.Size(104, 23) Me.cmdSummaries.TabIndex = 13 @@ -114,26 +126,13 @@ Partial Class dlgSummaryTables Me.grpDisplay.Controls.Add(Me.ucrChkDisplaySummariesAsRow) Me.grpDisplay.Controls.Add(Me.ucrNudSigFigs) Me.grpDisplay.Controls.Add(Me.lblSigFigs) - Me.grpDisplay.Location = New System.Drawing.Point(10, 329) + Me.grpDisplay.Location = New System.Drawing.Point(10, 353) Me.grpDisplay.Name = "grpDisplay" Me.grpDisplay.Size = New System.Drawing.Size(259, 126) Me.grpDisplay.TabIndex = 11 Me.grpDisplay.TabStop = False Me.grpDisplay.Text = "Display" ' - 'ucrNudColumnFactors - ' - Me.ucrNudColumnFactors.AutoSize = True - Me.ucrNudColumnFactors.DecimalPlaces = New Decimal(New Integer() {0, 0, 0, 0}) - Me.ucrNudColumnFactors.Increment = New Decimal(New Integer() {1, 0, 0, 0}) - Me.ucrNudColumnFactors.Location = New System.Drawing.Point(111, 49) - Me.ucrNudColumnFactors.Maximum = New Decimal(New Integer() {100, 0, 0, 0}) - Me.ucrNudColumnFactors.Minimum = New Decimal(New Integer() {0, 0, 0, 0}) - Me.ucrNudColumnFactors.Name = "ucrNudColumnFactors" - Me.ucrNudColumnFactors.Size = New System.Drawing.Size(50, 20) - Me.ucrNudColumnFactors.TabIndex = 19 - Me.ucrNudColumnFactors.Value = New Decimal(New Integer() {0, 0, 0, 0}) - ' 'lblColumnFactors ' Me.lblColumnFactors.AutoSize = True @@ -145,53 +144,13 @@ Partial Class dlgSummaryTables Me.lblColumnFactors.Tag = "" Me.lblColumnFactors.Text = "Column Factors :" ' - 'ucrChkDisplaySummaryVariablesAsRow - ' - Me.ucrChkDisplaySummaryVariablesAsRow.AutoSize = True - Me.ucrChkDisplaySummaryVariablesAsRow.Checked = False - Me.ucrChkDisplaySummaryVariablesAsRow.Location = New System.Drawing.Point(11, 73) - Me.ucrChkDisplaySummaryVariablesAsRow.Name = "ucrChkDisplaySummaryVariablesAsRow" - Me.ucrChkDisplaySummaryVariablesAsRow.Size = New System.Drawing.Size(231, 23) - Me.ucrChkDisplaySummaryVariablesAsRow.TabIndex = 17 - ' - 'ucrChkDisplayVariablesAsRows - ' - Me.ucrChkDisplayVariablesAsRows.AutoSize = True - Me.ucrChkDisplayVariablesAsRows.Checked = False - Me.ucrChkDisplayVariablesAsRows.Location = New System.Drawing.Point(11, 97) - Me.ucrChkDisplayVariablesAsRows.Name = "ucrChkDisplayVariablesAsRows" - Me.ucrChkDisplayVariablesAsRows.Size = New System.Drawing.Size(186, 23) - Me.ucrChkDisplayVariablesAsRows.TabIndex = 11 - ' - 'ucrChkDisplaySummariesAsRow - ' - Me.ucrChkDisplaySummariesAsRow.AutoSize = True - Me.ucrChkDisplaySummariesAsRow.Checked = False - Me.ucrChkDisplaySummariesAsRow.Location = New System.Drawing.Point(11, 73) - Me.ucrChkDisplaySummariesAsRow.Name = "ucrChkDisplaySummariesAsRow" - Me.ucrChkDisplaySummariesAsRow.Size = New System.Drawing.Size(175, 23) - Me.ucrChkDisplaySummariesAsRow.TabIndex = 10 - ' - 'ucrNudSigFigs - ' - Me.ucrNudSigFigs.AutoSize = True - Me.ucrNudSigFigs.DecimalPlaces = New Decimal(New Integer() {0, 0, 0, 0}) - Me.ucrNudSigFigs.Increment = New Decimal(New Integer() {1, 0, 0, 0}) - Me.ucrNudSigFigs.Location = New System.Drawing.Point(111, 23) - Me.ucrNudSigFigs.Maximum = New Decimal(New Integer() {100, 0, 0, 0}) - Me.ucrNudSigFigs.Minimum = New Decimal(New Integer() {0, 0, 0, 0}) - Me.ucrNudSigFigs.Name = "ucrNudSigFigs" - Me.ucrNudSigFigs.Size = New System.Drawing.Size(50, 20) - Me.ucrNudSigFigs.TabIndex = 5 - Me.ucrNudSigFigs.Value = New Decimal(New Integer() {0, 0, 0, 0}) - ' 'grpMargin ' Me.grpMargin.Controls.Add(Me.rdoBoth) Me.grpMargin.Controls.Add(Me.rdoSummary) Me.grpMargin.Controls.Add(Me.rdoOuter) Me.grpMargin.Controls.Add(Me.ucrPnlMargin) - Me.grpMargin.Location = New System.Drawing.Point(10, 287) + Me.grpMargin.Location = New System.Drawing.Point(10, 311) Me.grpMargin.Name = "grpMargin" Me.grpMargin.Size = New System.Drawing.Size(203, 37) Me.grpMargin.TabIndex = 13 @@ -233,20 +192,11 @@ Partial Class dlgSummaryTables Me.rdoOuter.Text = "Outer" Me.rdoOuter.UseVisualStyleBackColor = True ' - 'ucrPnlMargin - ' - Me.ucrPnlMargin.AutoSize = True - Me.ucrPnlMargin.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink - Me.ucrPnlMargin.Location = New System.Drawing.Point(6, 14) - Me.ucrPnlMargin.Name = "ucrPnlMargin" - Me.ucrPnlMargin.Size = New System.Drawing.Size(0, 0) - Me.ucrPnlMargin.TabIndex = 13 - ' 'lblMarginName ' Me.lblMarginName.AutoSize = True Me.lblMarginName.ImeMode = System.Windows.Forms.ImeMode.NoControl - Me.lblMarginName.Location = New System.Drawing.Point(159, 261) + Me.lblMarginName.Location = New System.Drawing.Point(159, 287) Me.lblMarginName.Name = "lblMarginName" Me.lblMarginName.Size = New System.Drawing.Size(41, 13) Me.lblMarginName.TabIndex = 15 @@ -256,17 +206,143 @@ Partial Class dlgSummaryTables ' Me.lblVariables.AutoSize = True Me.lblVariables.ImeMode = System.Windows.Forms.ImeMode.NoControl - Me.lblVariables.Location = New System.Drawing.Point(285, 148) + Me.lblVariables.Location = New System.Drawing.Point(285, 162) Me.lblVariables.Name = "lblVariables" Me.lblVariables.Size = New System.Drawing.Size(56, 13) Me.lblVariables.TabIndex = 17 Me.lblVariables.Tag = "" Me.lblVariables.Text = "Variables :" ' + 'cmdFormatTable + ' + Me.cmdFormatTable.ImeMode = System.Windows.Forms.ImeMode.NoControl + Me.cmdFormatTable.Location = New System.Drawing.Point(286, 464) + Me.cmdFormatTable.Name = "cmdFormatTable" + Me.cmdFormatTable.Size = New System.Drawing.Size(104, 23) + Me.cmdFormatTable.TabIndex = 19 + Me.cmdFormatTable.Text = "Format Table..." + Me.cmdFormatTable.UseVisualStyleBackColor = True + ' + 'rdoFrequencyTable + ' + Me.rdoFrequencyTable.Appearance = System.Windows.Forms.Appearance.Button + Me.rdoFrequencyTable.FlatAppearance.BorderColor = System.Drawing.SystemColors.ActiveCaption + Me.rdoFrequencyTable.FlatAppearance.BorderSize = 2 + Me.rdoFrequencyTable.FlatAppearance.CheckedBackColor = System.Drawing.SystemColors.ActiveCaption + Me.rdoFrequencyTable.FlatStyle = System.Windows.Forms.FlatStyle.Flat + Me.rdoFrequencyTable.ImeMode = System.Windows.Forms.ImeMode.NoControl + Me.rdoFrequencyTable.Location = New System.Drawing.Point(107, 7) + Me.rdoFrequencyTable.Name = "rdoFrequencyTable" + Me.rdoFrequencyTable.Size = New System.Drawing.Size(129, 27) + Me.rdoFrequencyTable.TabIndex = 22 + Me.rdoFrequencyTable.TabStop = True + Me.rdoFrequencyTable.Text = "Frequency Table" + Me.rdoFrequencyTable.TextAlign = System.Drawing.ContentAlignment.MiddleCenter + Me.rdoFrequencyTable.UseVisualStyleBackColor = True + ' + 'rdoSummaryTable + ' + Me.rdoSummaryTable.Appearance = System.Windows.Forms.Appearance.Button + Me.rdoSummaryTable.FlatAppearance.BorderColor = System.Drawing.SystemColors.ActiveCaption + Me.rdoSummaryTable.FlatAppearance.BorderSize = 2 + Me.rdoSummaryTable.FlatAppearance.CheckedBackColor = System.Drawing.SystemColors.ActiveCaption + Me.rdoSummaryTable.FlatStyle = System.Windows.Forms.FlatStyle.Flat + Me.rdoSummaryTable.ImeMode = System.Windows.Forms.ImeMode.NoControl + Me.rdoSummaryTable.Location = New System.Drawing.Point(235, 7) + Me.rdoSummaryTable.Name = "rdoSummaryTable" + Me.rdoSummaryTable.Size = New System.Drawing.Size(133, 27) + Me.rdoSummaryTable.TabIndex = 21 + Me.rdoSummaryTable.TabStop = True + Me.rdoSummaryTable.Text = "Summary Table" + Me.rdoSummaryTable.TextAlign = System.Drawing.ContentAlignment.MiddleCenter + Me.rdoSummaryTable.UseVisualStyleBackColor = True + ' + 'grpPercentages + ' + Me.grpPercentages.Controls.Add(Me.lblFactorsAsPercentage) + Me.grpPercentages.Controls.Add(Me.ucrReceiverMultiplePercentages) + Me.grpPercentages.Controls.Add(Me.ucrChkPercentageProportion) + Me.grpPercentages.Controls.Add(Me.ucrChkDisplayAsPercentage) + Me.grpPercentages.Location = New System.Drawing.Point(286, 178) + Me.grpPercentages.Name = "grpPercentages" + Me.grpPercentages.Size = New System.Drawing.Size(174, 192) + Me.grpPercentages.TabIndex = 23 + Me.grpPercentages.TabStop = False + Me.grpPercentages.Text = "Percentages" + ' + 'lblFactorsAsPercentage + ' + Me.lblFactorsAsPercentage.AutoSize = True + Me.lblFactorsAsPercentage.ImeMode = System.Windows.Forms.ImeMode.NoControl + Me.lblFactorsAsPercentage.Location = New System.Drawing.Point(18, 44) + Me.lblFactorsAsPercentage.Name = "lblFactorsAsPercentage" + Me.lblFactorsAsPercentage.Size = New System.Drawing.Size(117, 13) + Me.lblFactorsAsPercentage.TabIndex = 1 + Me.lblFactorsAsPercentage.Tag = "Factors as Percentage:" + Me.lblFactorsAsPercentage.Text = "Factors as Percentage:" + ' + 'lblFrequencyMarginName + ' + Me.lblFrequencyMarginName.AutoSize = True + Me.lblFrequencyMarginName.ImeMode = System.Windows.Forms.ImeMode.NoControl + Me.lblFrequencyMarginName.Location = New System.Drawing.Point(7, 275) + Me.lblFrequencyMarginName.Name = "lblFrequencyMarginName" + Me.lblFrequencyMarginName.Size = New System.Drawing.Size(76, 13) + Me.lblFrequencyMarginName.TabIndex = 25 + Me.lblFrequencyMarginName.Text = "Margin Name :" + ' + 'ucrChkFrequencyDisplayMargins + ' + Me.ucrChkFrequencyDisplayMargins.AutoSize = True + Me.ucrChkFrequencyDisplayMargins.Checked = False + Me.ucrChkFrequencyDisplayMargins.Location = New System.Drawing.Point(10, 245) + Me.ucrChkFrequencyDisplayMargins.Name = "ucrChkFrequencyDisplayMargins" + Me.ucrChkFrequencyDisplayMargins.Size = New System.Drawing.Size(213, 23) + Me.ucrChkFrequencyDisplayMargins.TabIndex = 24 + ' + 'ucrReceiverMultiplePercentages + ' + Me.ucrReceiverMultiplePercentages.AutoSize = True + Me.ucrReceiverMultiplePercentages.frmParent = Nothing + Me.ucrReceiverMultiplePercentages.Location = New System.Drawing.Point(18, 59) + Me.ucrReceiverMultiplePercentages.Margin = New System.Windows.Forms.Padding(0) + Me.ucrReceiverMultiplePercentages.Name = "ucrReceiverMultiplePercentages" + Me.ucrReceiverMultiplePercentages.Selector = Nothing + Me.ucrReceiverMultiplePercentages.Size = New System.Drawing.Size(120, 100) + Me.ucrReceiverMultiplePercentages.strNcFilePath = "" + Me.ucrReceiverMultiplePercentages.TabIndex = 2 + Me.ucrReceiverMultiplePercentages.ucrSelector = Nothing + ' + 'ucrChkPercentageProportion + ' + Me.ucrChkPercentageProportion.AutoSize = True + Me.ucrChkPercentageProportion.Checked = False + Me.ucrChkPercentageProportion.Location = New System.Drawing.Point(5, 171) + Me.ucrChkPercentageProportion.Name = "ucrChkPercentageProportion" + Me.ucrChkPercentageProportion.Size = New System.Drawing.Size(160, 23) + Me.ucrChkPercentageProportion.TabIndex = 3 + ' + 'ucrChkDisplayAsPercentage + ' + Me.ucrChkDisplayAsPercentage.AutoSize = True + Me.ucrChkDisplayAsPercentage.Checked = False + Me.ucrChkDisplayAsPercentage.Location = New System.Drawing.Point(14, 19) + Me.ucrChkDisplayAsPercentage.Name = "ucrChkDisplayAsPercentage" + Me.ucrChkDisplayAsPercentage.Size = New System.Drawing.Size(135, 23) + Me.ucrChkDisplayAsPercentage.TabIndex = 0 + ' + 'ucrPnlSummaryFrequencyTables + ' + Me.ucrPnlSummaryFrequencyTables.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink + Me.ucrPnlSummaryFrequencyTables.Location = New System.Drawing.Point(107, 3) + Me.ucrPnlSummaryFrequencyTables.Name = "ucrPnlSummaryFrequencyTables" + Me.ucrPnlSummaryFrequencyTables.Size = New System.Drawing.Size(260, 33) + Me.ucrPnlSummaryFrequencyTables.TabIndex = 20 + ' 'ucrReorderSummary ' Me.ucrReorderSummary.AutoSize = True - Me.ucrReorderSummary.Location = New System.Drawing.Point(286, 294) + Me.ucrReorderSummary.Location = New System.Drawing.Point(286, 305) Me.ucrReorderSummary.Name = "ucrReorderSummary" Me.ucrReorderSummary.Size = New System.Drawing.Size(200, 156) Me.ucrReorderSummary.TabIndex = 18 @@ -279,7 +355,7 @@ Partial Class dlgSummaryTables Me.ucrInputMarginName.AutoSize = True Me.ucrInputMarginName.IsMultiline = False Me.ucrInputMarginName.IsReadOnly = False - Me.ucrInputMarginName.Location = New System.Drawing.Point(206, 258) + Me.ucrInputMarginName.Location = New System.Drawing.Point(206, 284) Me.ucrInputMarginName.Name = "ucrInputMarginName" Me.ucrInputMarginName.Size = New System.Drawing.Size(74, 21) Me.ucrInputMarginName.TabIndex = 16 @@ -287,7 +363,7 @@ Partial Class dlgSummaryTables 'ucrSaveTable ' Me.ucrSaveTable.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink - Me.ucrSaveTable.Location = New System.Drawing.Point(10, 481) + Me.ucrSaveTable.Location = New System.Drawing.Point(10, 490) Me.ucrSaveTable.Margin = New System.Windows.Forms.Padding(4, 5, 4, 5) Me.ucrSaveTable.Name = "ucrSaveTable" Me.ucrSaveTable.Size = New System.Drawing.Size(319, 24) @@ -297,7 +373,7 @@ Partial Class dlgSummaryTables ' Me.ucrChkOmitMissing.AutoSize = True Me.ucrChkOmitMissing.Checked = False - Me.ucrChkOmitMissing.Location = New System.Drawing.Point(10, 239) + Me.ucrChkOmitMissing.Location = New System.Drawing.Point(10, 266) Me.ucrChkOmitMissing.Name = "ucrChkOmitMissing" Me.ucrChkOmitMissing.Size = New System.Drawing.Size(271, 23) Me.ucrChkOmitMissing.TabIndex = 9 @@ -306,25 +382,78 @@ Partial Class dlgSummaryTables ' Me.ucrChkStoreResults.AutoSize = True Me.ucrChkStoreResults.Checked = False - Me.ucrChkStoreResults.Location = New System.Drawing.Point(336, 484) + Me.ucrChkStoreResults.Location = New System.Drawing.Point(10, 219) Me.ucrChkStoreResults.Name = "ucrChkStoreResults" - Me.ucrChkStoreResults.Size = New System.Drawing.Size(148, 23) + Me.ucrChkStoreResults.Size = New System.Drawing.Size(230, 23) Me.ucrChkStoreResults.TabIndex = 8 ' 'ucrChkDisplayMargins ' Me.ucrChkDisplayMargins.AutoSize = True Me.ucrChkDisplayMargins.Checked = False - Me.ucrChkDisplayMargins.Location = New System.Drawing.Point(10, 261) + Me.ucrChkDisplayMargins.Location = New System.Drawing.Point(10, 287) Me.ucrChkDisplayMargins.Name = "ucrChkDisplayMargins" Me.ucrChkDisplayMargins.Size = New System.Drawing.Size(150, 23) Me.ucrChkDisplayMargins.TabIndex = 10 ' + 'ucrNudColumnFactors + ' + Me.ucrNudColumnFactors.AutoSize = True + Me.ucrNudColumnFactors.DecimalPlaces = New Decimal(New Integer() {0, 0, 0, 0}) + Me.ucrNudColumnFactors.Increment = New Decimal(New Integer() {1, 0, 0, 0}) + Me.ucrNudColumnFactors.Location = New System.Drawing.Point(111, 49) + Me.ucrNudColumnFactors.Maximum = New Decimal(New Integer() {100, 0, 0, 0}) + Me.ucrNudColumnFactors.Minimum = New Decimal(New Integer() {0, 0, 0, 0}) + Me.ucrNudColumnFactors.Name = "ucrNudColumnFactors" + Me.ucrNudColumnFactors.Size = New System.Drawing.Size(50, 20) + Me.ucrNudColumnFactors.TabIndex = 19 + Me.ucrNudColumnFactors.Value = New Decimal(New Integer() {0, 0, 0, 0}) + ' + 'ucrChkDisplaySummaryVariablesAsRow + ' + Me.ucrChkDisplaySummaryVariablesAsRow.AutoSize = True + Me.ucrChkDisplaySummaryVariablesAsRow.Checked = False + Me.ucrChkDisplaySummaryVariablesAsRow.Location = New System.Drawing.Point(11, 73) + Me.ucrChkDisplaySummaryVariablesAsRow.Name = "ucrChkDisplaySummaryVariablesAsRow" + Me.ucrChkDisplaySummaryVariablesAsRow.Size = New System.Drawing.Size(231, 23) + Me.ucrChkDisplaySummaryVariablesAsRow.TabIndex = 17 + ' + 'ucrChkDisplayVariablesAsRows + ' + Me.ucrChkDisplayVariablesAsRows.AutoSize = True + Me.ucrChkDisplayVariablesAsRows.Checked = False + Me.ucrChkDisplayVariablesAsRows.Location = New System.Drawing.Point(11, 97) + Me.ucrChkDisplayVariablesAsRows.Name = "ucrChkDisplayVariablesAsRows" + Me.ucrChkDisplayVariablesAsRows.Size = New System.Drawing.Size(186, 23) + Me.ucrChkDisplayVariablesAsRows.TabIndex = 11 + ' + 'ucrChkDisplaySummariesAsRow + ' + Me.ucrChkDisplaySummariesAsRow.AutoSize = True + Me.ucrChkDisplaySummariesAsRow.Checked = False + Me.ucrChkDisplaySummariesAsRow.Location = New System.Drawing.Point(11, 73) + Me.ucrChkDisplaySummariesAsRow.Name = "ucrChkDisplaySummariesAsRow" + Me.ucrChkDisplaySummariesAsRow.Size = New System.Drawing.Size(175, 23) + Me.ucrChkDisplaySummariesAsRow.TabIndex = 10 + ' + 'ucrNudSigFigs + ' + Me.ucrNudSigFigs.AutoSize = True + Me.ucrNudSigFigs.DecimalPlaces = New Decimal(New Integer() {0, 0, 0, 0}) + Me.ucrNudSigFigs.Increment = New Decimal(New Integer() {1, 0, 0, 0}) + Me.ucrNudSigFigs.Location = New System.Drawing.Point(111, 23) + Me.ucrNudSigFigs.Maximum = New Decimal(New Integer() {100, 0, 0, 0}) + Me.ucrNudSigFigs.Minimum = New Decimal(New Integer() {0, 0, 0, 0}) + Me.ucrNudSigFigs.Name = "ucrNudSigFigs" + Me.ucrNudSigFigs.Size = New System.Drawing.Size(50, 20) + Me.ucrNudSigFigs.TabIndex = 5 + Me.ucrNudSigFigs.Value = New Decimal(New Integer() {0, 0, 0, 0}) + ' 'ucrChkSummaries ' Me.ucrChkSummaries.AutoSize = True Me.ucrChkSummaries.Checked = False - Me.ucrChkSummaries.Location = New System.Drawing.Point(10, 218) + Me.ucrChkSummaries.Location = New System.Drawing.Point(10, 244) Me.ucrChkSummaries.Name = "ucrChkSummaries" Me.ucrChkSummaries.Size = New System.Drawing.Size(242, 23) Me.ucrChkSummaries.TabIndex = 7 @@ -333,7 +462,7 @@ Partial Class dlgSummaryTables ' Me.ucrBase.AutoSize = True Me.ucrBase.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink - Me.ucrBase.Location = New System.Drawing.Point(10, 507) + Me.ucrBase.Location = New System.Drawing.Point(10, 517) Me.ucrBase.Name = "ucrBase" Me.ucrBase.Size = New System.Drawing.Size(405, 52) Me.ucrBase.TabIndex = 14 @@ -342,7 +471,7 @@ Partial Class dlgSummaryTables ' Me.ucrReceiverSummaryCols.AutoSize = True Me.ucrReceiverSummaryCols.frmParent = Me - Me.ucrReceiverSummaryCols.Location = New System.Drawing.Point(286, 163) + Me.ucrReceiverSummaryCols.Location = New System.Drawing.Point(286, 178) Me.ucrReceiverSummaryCols.Margin = New System.Windows.Forms.Padding(0) Me.ucrReceiverSummaryCols.Name = "ucrReceiverSummaryCols" Me.ucrReceiverSummaryCols.Selector = Nothing @@ -355,7 +484,7 @@ Partial Class dlgSummaryTables ' Me.ucrReceiverFactors.AutoSize = True Me.ucrReceiverFactors.frmParent = Me - Me.ucrReceiverFactors.Location = New System.Drawing.Point(286, 41) + Me.ucrReceiverFactors.Location = New System.Drawing.Point(286, 59) Me.ucrReceiverFactors.Margin = New System.Windows.Forms.Padding(0) Me.ucrReceiverFactors.Name = "ucrReceiverFactors" Me.ucrReceiverFactors.Selector = Nothing @@ -368,7 +497,7 @@ Partial Class dlgSummaryTables ' Me.ucrReceiverWeights.AutoSize = True Me.ucrReceiverWeights.frmParent = Me - Me.ucrReceiverWeights.Location = New System.Drawing.Point(109, 196) + Me.ucrReceiverWeights.Location = New System.Drawing.Point(109, 222) Me.ucrReceiverWeights.Margin = New System.Windows.Forms.Padding(0) Me.ucrReceiverWeights.Name = "ucrReceiverWeights" Me.ucrReceiverWeights.Selector = Nothing @@ -381,7 +510,7 @@ Partial Class dlgSummaryTables ' Me.ucrChkWeight.AutoSize = True Me.ucrChkWeight.Checked = False - Me.ucrChkWeight.Location = New System.Drawing.Point(10, 196) + Me.ucrChkWeight.Location = New System.Drawing.Point(10, 222) Me.ucrChkWeight.Name = "ucrChkWeight" Me.ucrChkWeight.Size = New System.Drawing.Size(84, 23) Me.ucrChkWeight.TabIndex = 5 @@ -392,28 +521,43 @@ Partial Class dlgSummaryTables Me.ucrSelectorSummaryTables.bDropUnusedFilterLevels = False Me.ucrSelectorSummaryTables.bShowHiddenColumns = False Me.ucrSelectorSummaryTables.bUseCurrentFilter = True - Me.ucrSelectorSummaryTables.Location = New System.Drawing.Point(10, 10) + Me.ucrSelectorSummaryTables.Location = New System.Drawing.Point(10, 30) Me.ucrSelectorSummaryTables.Margin = New System.Windows.Forms.Padding(0) Me.ucrSelectorSummaryTables.Name = "ucrSelectorSummaryTables" Me.ucrSelectorSummaryTables.Size = New System.Drawing.Size(213, 183) Me.ucrSelectorSummaryTables.TabIndex = 0 ' - 'cmdFormatTable + 'ucrPnlMargin ' - Me.cmdFormatTable.ImeMode = System.Windows.Forms.ImeMode.NoControl - Me.cmdFormatTable.Location = New System.Drawing.Point(286, 454) - Me.cmdFormatTable.Name = "cmdFormatTable" - Me.cmdFormatTable.Size = New System.Drawing.Size(104, 23) - Me.cmdFormatTable.TabIndex = 19 - Me.cmdFormatTable.Text = "Format Table..." - Me.cmdFormatTable.UseVisualStyleBackColor = True + Me.ucrPnlMargin.AutoSize = True + Me.ucrPnlMargin.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink + Me.ucrPnlMargin.Location = New System.Drawing.Point(6, 14) + Me.ucrPnlMargin.Name = "ucrPnlMargin" + Me.ucrPnlMargin.Size = New System.Drawing.Size(0, 0) + Me.ucrPnlMargin.TabIndex = 13 + ' + 'ucrInputFrequencyMarginName + ' + Me.ucrInputFrequencyMarginName.AddQuotesIfUnrecognised = True + Me.ucrInputFrequencyMarginName.AutoSize = True + Me.ucrInputFrequencyMarginName.IsMultiline = False + Me.ucrInputFrequencyMarginName.IsReadOnly = False + Me.ucrInputFrequencyMarginName.Location = New System.Drawing.Point(92, 271) + Me.ucrInputFrequencyMarginName.Name = "ucrInputFrequencyMarginName" + Me.ucrInputFrequencyMarginName.Size = New System.Drawing.Size(70, 21) + Me.ucrInputFrequencyMarginName.TabIndex = 26 ' 'dlgSummaryTables ' 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(489, 561) + Me.ClientSize = New System.Drawing.Size(489, 571) + Me.Controls.Add(Me.ucrChkFrequencyDisplayMargins) + Me.Controls.Add(Me.grpPercentages) + Me.Controls.Add(Me.rdoFrequencyTable) + Me.Controls.Add(Me.rdoSummaryTable) + Me.Controls.Add(Me.ucrPnlSummaryFrequencyTables) Me.Controls.Add(Me.cmdFormatTable) Me.Controls.Add(Me.ucrReorderSummary) Me.Controls.Add(Me.lblVariables) @@ -434,16 +578,20 @@ Partial Class dlgSummaryTables Me.Controls.Add(Me.lblFactors) Me.Controls.Add(Me.ucrSelectorSummaryTables) Me.Controls.Add(Me.grpMargin) + Me.Controls.Add(Me.lblFrequencyMarginName) + Me.Controls.Add(Me.ucrInputFrequencyMarginName) Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow Me.MaximizeBox = False Me.MinimizeBox = False Me.Name = "dlgSummaryTables" Me.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen - Me.Text = "Summary Tables" + Me.Text = "Summary\Frequency Tables" Me.grpDisplay.ResumeLayout(False) Me.grpDisplay.PerformLayout() Me.grpMargin.ResumeLayout(False) Me.grpMargin.PerformLayout() + Me.grpPercentages.ResumeLayout(False) + Me.grpPercentages.PerformLayout() Me.ResumeLayout(False) Me.PerformLayout() @@ -480,4 +628,15 @@ Partial Class dlgSummaryTables Friend WithEvents lblVariables As Label Friend WithEvents ucrReorderSummary As ucrReorder Friend WithEvents cmdFormatTable As Button -End Class + Friend WithEvents ucrPnlSummaryFrequencyTables As UcrPanel + Friend WithEvents rdoFrequencyTable As RadioButton + Friend WithEvents rdoSummaryTable As RadioButton + Friend WithEvents grpPercentages As GroupBox + Friend WithEvents lblFactorsAsPercentage As Label + Friend WithEvents ucrReceiverMultiplePercentages As ucrReceiverMultiple + Friend WithEvents ucrChkPercentageProportion As ucrCheck + Friend WithEvents ucrChkDisplayAsPercentage As ucrCheck + Friend WithEvents ucrInputFrequencyMarginName As ucrInputTextBox + Friend WithEvents lblFrequencyMarginName As Label + Friend WithEvents ucrChkFrequencyDisplayMargins As ucrCheck +End Class \ No newline at end of file diff --git a/instat/dlgSummaryTables.vb b/instat/dlgSummaryTables.vb index 0c57bf77b30..30a5e36beed 100644 --- a/instat/dlgSummaryTables.vb +++ b/instat/dlgSummaryTables.vb @@ -20,7 +20,8 @@ Public Class dlgSummaryTables Private bReset As Boolean = True Private clsSummariesList As New RFunction Private bResetSubdialog As Boolean = False - Private clsDefaultFunction, clsConcFunction, clsMutableFunction As New RFunction + Private clsSummaryDefaultFunction, clsFrequencyDefaultFunction, clsConcFunction, + clsMutableFunction As New RFunction Private clsSummariesHeaderLeftTopFunction, clsSummariesHeaderTopLeftFunction, clsVariableHeaderLeftTopFunction, clsVariableHeaderTopLeftFunction, clsStubHeadFunction, clsummaryVariableHeaderLeftTopFunction, clsSummaryVariableHeaderTopLeftFunction As New RFunction @@ -31,8 +32,9 @@ Public Class dlgSummaryTables clsTabFootnoteSubtitleFunction, clsStyleListFunction, clsFootnoteCellFunction, clsFootnoteCellBodyFunction, clsSecondFootnoteCellFunction, clsSecondFootnoteCellBodyFunction, clsTabStyleFunction, clsDummyFunction, clsTabStyleCellTextFunction, clsTabStylePxFunction, clsTabStyleCellTitleFunction As New RFunction - Private clsMutableOperator, clsColumnOperator, clsPipeOperator, clsJoiningPipeOperator, - clsTabFootnoteOperator As New ROperator + + Private clsMmtableOperator, clsSummaryOperator, clsFrequencyOperator, clsColumnOperator, + clsPipeOperator, clsJoiningPipeOperator, clsTabFootnoteOperator As New ROperator Private Sub dlgNewSummaryTables_Load(sender As Object, e As EventArgs) Handles MyBase.Load If bFirstload Then @@ -61,25 +63,50 @@ Public Class dlgSummaryTables ucrReceiverSummaryCols.Selector = ucrSelectorSummaryTables ucrReceiverSummaryCols.SetDataType("numeric") ucrReceiverSummaryCols.SetParameterIsString() - - ucrChkStoreResults.SetText("Store Output") - ucrChkStoreResults.SetParameter(New RParameter("store_table", 13)) - ucrChkStoreResults.SetValuesCheckedAndUnchecked("TRUE", "FALSE") - ucrChkStoreResults.SetRDefault("FALSE") + ucrReceiverSummaryCols.SetLinkedDisplayControl(lblVariables) ucrReceiverFactors.SetParameter(New RParameter("factors", 2)) ucrReceiverFactors.SetParameterIsString() ucrReceiverFactors.Selector = ucrSelectorSummaryTables ucrReceiverFactors.SetDataType("factor") - ucrChkOmitMissing.SetParameter(New RParameter("na.rm", 3)) + ucrReceiverWeights.SetParameter(New RParameter("weights", 3)) + ucrReceiverWeights.SetParameterIsString() + ucrReceiverWeights.Selector = ucrSelectorSummaryTables + ucrReceiverWeights.SetDataType("numeric") + + ucrReceiverMultiplePercentages.SetParameter(New RParameter("perc_total_factors", 1)) + ucrReceiverMultiplePercentages.SetParameterIsString() + ucrReceiverMultiplePercentages.Selector = ucrSelectorSummaryTables + ucrReceiverMultiplePercentages.SetDataType("factor") ' TODO data this accepts must be in the other receiver too + ucrReceiverMultiplePercentages.SetLinkedDisplayControl(lblFactorsAsPercentage) + + ucrChkStoreResults.SetText("Store Output") + ucrChkStoreResults.SetParameter(New RParameter("store_table", 4)) + ucrChkStoreResults.SetValuesCheckedAndUnchecked("TRUE", "FALSE") + ucrChkStoreResults.SetRDefault("FALSE") + + ucrChkOmitMissing.SetParameter(New RParameter("na.rm", 5)) ucrChkOmitMissing.SetText("Omit Missing Values") ucrChkOmitMissing.SetValuesCheckedAndUnchecked("TRUE", "FALSE") ucrChkOmitMissing.SetRDefault("FALSE") - ucrChkDisplayMargins.SetParameter(New RParameter("include_margins", 4)) + ucrChkDisplayMargins.SetParameter(New RParameter("include_margins", 6)) ucrChkDisplayMargins.SetText("Display Outer Margins") ucrChkDisplayMargins.SetRDefault("FALSE") + ucrChkDisplayMargins.AddToLinkedControls({ucrInputMarginName}, {True}, bNewLinkedAddRemoveParameter:=True, bNewLinkedUpdateFunction:=True, + bNewLinkedHideIfParameterMissing:=True, bNewLinkedChangeToDefaultState:=True, objNewDefaultState:="All") + ucrChkDisplayMargins.AddToLinkedControls({ucrPnlMargin}, {True}, bNewLinkedAddRemoveParameter:=True, bNewLinkedUpdateFunction:=True, + bNewLinkedHideIfParameterMissing:=True, bNewLinkedChangeToDefaultState:=True, objNewDefaultState:=rdoOuter) + + ucrChkFrequencyDisplayMargins.SetParameter(New RParameter("include_margins", 3)) + ucrChkFrequencyDisplayMargins.SetText("Display Margins") + ucrChkFrequencyDisplayMargins.SetRDefault("FALSE") + ucrChkFrequencyDisplayMargins.AddToLinkedControls(ucrInputFrequencyMarginName, {True}, bNewLinkedAddRemoveParameter:=True, bNewLinkedHideIfParameterMissing:=True, + bNewLinkedChangeToDefaultState:=True, objNewDefaultState:="All", bNewLinkedUpdateFunction:=True) + + ucrInputFrequencyMarginName.SetParameter(New RParameter("margin_name", iNewPosition:=5)) + ucrInputFrequencyMarginName.SetLinkedDisplayControl(lblFrequencyMarginName) ucrChkDisplaySummariesAsRow.SetText("Display Summaries As Rows") ucrChkDisplaySummariesAsRow.AddParameterPresentCondition(True, "summariesLeftTop") @@ -97,7 +124,7 @@ Public Class dlgSummaryTables ucrNudColumnFactors.SetMinMax(iNewMin:=0) ucrNudColumnFactors.Increment = 1 - ucrPnlMargin.SetParameter(New RParameter("margins", iNewPosition:=8)) + ucrPnlMargin.SetParameter(New RParameter("margins", iNewPosition:=7)) ucrPnlMargin.AddRadioButton(rdoOuter, Chr(34) & "outer" & Chr(34)) ucrPnlMargin.AddRadioButton(rdoSummary, Chr(34) & "summary" & Chr(34)) ucrPnlMargin.AddRadioButton(rdoBoth, "c(""outer"",""summary"")") @@ -106,24 +133,50 @@ Public Class dlgSummaryTables ucrInputMarginName.SetParameter(New RParameter("margin_name", iNewPosition:=5)) ucrInputMarginName.SetLinkedDisplayControl(lblMarginName) - ucrChkSummaries.SetParameter(New RParameter("treat_columns_as_factor", 9)) + ucrChkSummaries.SetParameter(New RParameter("treat_columns_as_factor", 8)) ucrChkSummaries.SetValuesCheckedAndUnchecked("TRUE", "FALSE") ucrChkSummaries.SetText("Treat Summaries as a Further Factor") + ucrChkSummaries.AddToLinkedControls({ucrChkDisplaySummariesAsRow, ucrChkDisplayVariablesAsRows}, {True}, + bNewLinkedAddRemoveParameter:=True, bNewLinkedHideIfParameterMissing:=True) + ucrChkSummaries.AddToLinkedControls(ucrChkDisplaySummaryVariablesAsRow, {False}, bNewLinkedAddRemoveParameter:=True, + bNewLinkedHideIfParameterMissing:=True) - ucrNudSigFigs.SetParameter(New RParameter("signif_fig", 6)) + ucrNudSigFigs.SetParameter(New RParameter("signif_fig", 9)) ucrNudSigFigs.SetMinMax(0, 22) ucrNudSigFigs.SetRDefault(2) - ucrReceiverWeights.SetParameter(New RParameter("weights", 7)) - ucrReceiverWeights.SetParameterIsString() - ucrReceiverWeights.Selector = ucrSelectorSummaryTables - ucrReceiverWeights.SetDataType("numeric") - ucrChkWeight.SetText("Weights") ucrChkWeight.SetParameter(ucrReceiverWeights.GetParameter(), bNewChangeParameterValue:=False, bNewAddRemoveParameter:=True) ucrChkWeight.AddToLinkedControls(ucrReceiverWeights, {True}, bNewLinkedAddRemoveParameter:=True, bNewLinkedHideIfParameterMissing:=True) 'Not yet implemented - ucrChkWeight.Enabled = False + ucrChkWeight.Visible = False + + ucrPnlSummaryFrequencyTables.AddRadioButton(rdoSummaryTable) + ucrPnlSummaryFrequencyTables.AddRadioButton(rdoFrequencyTable) + ucrPnlSummaryFrequencyTables.AddParameterValuesCondition(rdoSummaryTable, "rdo_checked", "rdoSummary") + ucrPnlSummaryFrequencyTables.AddParameterValuesCondition(rdoFrequencyTable, "rdo_checked", "rdoFrequency") + ucrPnlSummaryFrequencyTables.AddToLinkedControls({ucrReceiverSummaryCols}, {rdoSummaryTable}, bNewLinkedHideIfParameterMissing:=True) + ucrPnlSummaryFrequencyTables.AddToLinkedControls({ucrReorderSummary}, {rdoSummaryTable}, bNewLinkedHideIfParameterMissing:=True) + ucrPnlSummaryFrequencyTables.AddToLinkedControls({ucrChkDisplayAsPercentage}, {rdoFrequencyTable}, bNewLinkedHideIfParameterMissing:=True) + ucrPnlSummaryFrequencyTables.AddToLinkedControls({ucrChkSummaries}, {rdoSummaryTable}, bNewLinkedHideIfParameterMissing:=True) + ucrPnlSummaryFrequencyTables.AddToLinkedControls({ucrChkDisplayMargins}, {rdoSummaryTable}, bNewLinkedHideIfParameterMissing:=True) + ucrPnlSummaryFrequencyTables.AddToLinkedControls({ucrChkFrequencyDisplayMargins}, {rdoFrequencyTable}, bNewLinkedHideIfParameterMissing:=True) + ucrPnlSummaryFrequencyTables.AddToLinkedControls({ucrChkOmitMissing}, {rdoSummaryTable}, bNewLinkedHideIfParameterMissing:=True) + + ucrChkDisplayAsPercentage.SetParameter(New RParameter("percentage_type", 2)) + ucrChkDisplayAsPercentage.SetText("As Percentages") + ucrChkDisplayAsPercentage.SetValuesCheckedAndUnchecked(Chr(34) & "factors" & Chr(34), Chr(34) & "none" & Chr(34)) + ucrChkDisplayAsPercentage.SetRDefault(Chr(34) & "none" & Chr(34)) + + ucrChkDisplayAsPercentage.AddToLinkedControls(ucrReceiverMultiplePercentages, {True}, bNewLinkedHideIfParameterMissing:=True, + bNewLinkedAddRemoveParameter:=True, bNewLinkedUpdateFunction:=True) + ucrChkDisplayAsPercentage.AddToLinkedControls(ucrChkPercentageProportion, {True}, bNewLinkedAddRemoveParameter:=True, + bNewLinkedHideIfParameterMissing:=True, bNewLinkedUpdateFunction:=True) + ucrChkDisplayAsPercentage.SetLinkedDisplayControl(grpPercentages) + + ucrChkPercentageProportion.SetParameter(New RParameter("perc_decimal", 3)) + ucrChkPercentageProportion.SetText("Display as Decimal") + ucrChkPercentageProportion.SetRDefault("FALSE") ucrSaveTable.SetPrefix("summary_table") ucrSaveTable.SetSaveTypeAsTable() @@ -132,17 +185,12 @@ Public Class dlgSummaryTables ucrSaveTable.SetCheckBoxText("Save Table") ucrSaveTable.SetAssignToIfUncheckedValue("last_table") - ucrChkSummaries.AddToLinkedControls({ucrChkDisplaySummariesAsRow, ucrChkDisplayVariablesAsRows}, {True}, bNewLinkedAddRemoveParameter:=True, bNewLinkedHideIfParameterMissing:=True) - ucrChkSummaries.AddToLinkedControls(ucrChkDisplaySummaryVariablesAsRow, {False}, bNewLinkedAddRemoveParameter:=True, bNewLinkedHideIfParameterMissing:=True) - - ucrChkDisplayMargins.AddToLinkedControls({ucrInputMarginName}, {True}, bNewLinkedAddRemoveParameter:=True, bNewLinkedHideIfParameterMissing:=True, bNewLinkedChangeToDefaultState:=True, objNewDefaultState:="All") - ucrChkDisplayMargins.AddToLinkedControls({ucrPnlMargin}, {True}, bNewLinkedAddRemoveParameter:=True, bNewLinkedHideIfParameterMissing:=True, bNewLinkedChangeToDefaultState:=True, objNewDefaultState:=rdoOuter) - ucrReorderSummary.bDataIsSummaries = True End Sub Private Sub SetDefaults() - clsDefaultFunction = New RFunction + clsSummaryDefaultFunction = New RFunction + clsFrequencyDefaultFunction = New RFunction clsSummariesList = New RFunction clsConcFunction = New RFunction clsMutableFunction = New RFunction @@ -164,7 +212,7 @@ Public Class dlgSummaryTables clsFootnoteTitleLocationFunction = New RFunction clsFootnoteSubtitleLocationFunction = New RFunction clsStyleListFunction = New RFunction - clsMutableOperator = New ROperator + clsSummaryOperator = New ROperator clsColumnOperator = New ROperator clsPipeOperator = New ROperator clsTabFootnoteSubtitleFunction = New RFunction @@ -179,6 +227,8 @@ Public Class dlgSummaryTables clsTabStyleCellTitleFunction = New RFunction clsJoiningPipeOperator = New ROperator clsTabFootnoteOperator = New ROperator + clsFrequencyOperator = New ROperator + clsMmtableOperator = New ROperator clsDummyFunction = New RFunction ucrReceiverFactors.SetMeAsReceiver() @@ -188,10 +238,16 @@ Public Class dlgSummaryTables ucrBase.clsRsyntax.lstBeforeCodes.Clear() - clsMutableOperator.SetOperation("+") + clsDummyFunction.AddParameter("rdo_checked", "rdoFrequency", iPosition:=10) + + clsSummaryOperator.SetOperation("+") + + clsFrequencyOperator.SetOperation("+") clsColumnOperator.SetOperation("+") + clsMmtableOperator.SetOperation("+") + clsConcFunction.SetRCommand("c") clsPipeOperator.SetOperation("%>%") @@ -201,7 +257,7 @@ Public Class dlgSummaryTables clsTabFootnoteOperator.bBrackets = False clsJoiningPipeOperator.SetOperation("%>%") - clsJoiningPipeOperator.AddParameter("mutable", clsROperatorParameter:=clsMutableOperator, iPosition:=0) + clsJoiningPipeOperator.AddParameter("mutable", clsROperatorParameter:=clsSummaryOperator, iPosition:=0) clsStubHeadFunction.SetPackageName("gt") clsStubHeadFunction.SetRCommand("tab_stubhead") @@ -249,19 +305,28 @@ Public Class dlgSummaryTables clsMutableFunction.SetPackageName("mmtable2") clsMutableFunction.SetRCommand("mmtable") - clsMutableFunction.AddParameter("data", "summary_table", iPosition:=0) + clsMutableFunction.AddParameter("data", clsRFunctionParameter:=clsSummaryDefaultFunction, iPosition:=0) clsMutableFunction.AddParameter("cells", "value", iPosition:=1) - clsMutableOperator.AddParameter("mutableFunc", clsRFunctionParameter:=clsMutableFunction, iPosition:=0) - clsMutableOperator.AddParameter("summariesVariableTopLeft", clsRFunctionParameter:=clsSummaryVariableHeaderTopLeftFunction, iPosition:=1) + clsSummaryOperator.AddParameter("mutableFunc", clsRFunctionParameter:=clsMutableFunction, iPosition:=0) + clsSummaryOperator.AddParameter("summariesVariableTopLeft", clsRFunctionParameter:=clsSummaryVariableHeaderTopLeftFunction, iPosition:=1) + + clsFrequencyOperator.SetOperation("+") + clsFrequencyOperator.AddParameter("mmtable2", clsRFunctionParameter:=clsMutableFunction, iPosition:=0) clsSummariesList.SetRCommand("c") clsSummariesList.AddParameter("summary_mean", Chr(34) & "summary_mean" & Chr(34), bIncludeArgumentName:=False) ' TODO decide which default(s) to use? - clsDefaultFunction.SetRCommand(frmMain.clsRLink.strInstatDataObject & "$summary_table") - clsDefaultFunction.AddParameter("treat_columns_as_factor", "FALSE", iPosition:=9) - clsDefaultFunction.AddParameter("summaries", clsRFunctionParameter:=clsSummariesList, iPosition:=2) - clsDefaultFunction.SetAssignTo("summary_table") + clsSummaryDefaultFunction.SetRCommand(frmMain.clsRLink.strInstatDataObject & "$summary_table") + clsSummaryDefaultFunction.AddParameter("treat_columns_as_factor", "FALSE", iPosition:=8) + clsSummaryDefaultFunction.AddParameter("summaries", clsRFunctionParameter:=clsSummariesList, iPosition:=12) + clsSummaryDefaultFunction.SetAssignTo("summary_table") + + clsFrequencyDefaultFunction.SetRCommand(frmMain.clsRLink.strInstatDataObject & "$summary_table") + clsFrequencyDefaultFunction.AddParameter("store_results", "FALSE", iPosition:=2) + clsFrequencyDefaultFunction.AddParameter("treat_columns_as_factor", "FALSE", iPosition:=10) + clsFrequencyDefaultFunction.AddParameter("summaries", "count_label", iPosition:=11) + clsFrequencyDefaultFunction.SetAssignTo("frequency_table") clsTableTitleFunction.SetPackageName("gt") clsTableTitleFunction.SetRCommand("tab_header") @@ -317,38 +382,56 @@ Public Class dlgSummaryTables clsStyleListFunction.SetRCommand("list") - ucrBase.clsRsyntax.AddToBeforeCodes(clsDefaultFunction, iPosition:=0) + ucrBase.clsRsyntax.AddToBeforeCodes(clsFrequencyDefaultFunction, iPosition:=0) ucrBase.clsRsyntax.SetBaseROperator(clsJoiningPipeOperator) clsJoiningPipeOperator.SetAssignTo("last_table", strTempDataframe:=ucrSelectorSummaryTables.ucrAvailableDataFrames.cboAvailableDataFrames.Text, strTempTable:="last_table") bResetSubdialog = True End Sub Public Sub SetRCodeForControls(bReset As Boolean) - ucrSelectorSummaryTables.SetRCode(clsDefaultFunction, bReset) - ucrReceiverSummaryCols.SetRCode(clsDefaultFunction, bReset) - ucrReceiverFactors.SetRCode(clsDefaultFunction, bReset) - ucrChkOmitMissing.SetRCode(clsDefaultFunction, bReset) - ucrChkDisplayMargins.SetRCode(clsDefaultFunction, bReset) - ucrPnlMargin.SetRCode(clsDefaultFunction, bReset) - ucrInputMarginName.SetRCode(clsDefaultFunction, bReset) - ucrChkSummaries.SetRCode(clsDefaultFunction, bReset) - ucrNudSigFigs.SetRCode(clsDefaultFunction, bReset) - ucrReceiverWeights.SetRCode(clsDefaultFunction, bReset) - ucrChkWeight.SetRCode(clsDefaultFunction, bReset) - ucrChkDisplaySummariesAsRow.SetRCode(clsMutableOperator, bReset) - ucrChkDisplaySummaryVariablesAsRow.SetRCode(clsMutableOperator, bReset) - ucrChkDisplayVariablesAsRows.SetRCode(clsMutableOperator, bReset) - ucrChkStoreResults.SetRCode(clsDefaultFunction, bReset) + ucrSelectorSummaryTables.AddAdditionalCodeParameterPair(clsFrequencyDefaultFunction, ucrSelectorSummaryTables.GetParameter, iAdditionalPairNo:=1) + ucrChkStoreResults.AddAdditionalCodeParameterPair(clsFrequencyDefaultFunction, ucrChkStoreResults.GetParameter, iAdditionalPairNo:=1) + ucrNudSigFigs.AddAdditionalCodeParameterPair(clsFrequencyDefaultFunction, ucrNudSigFigs.GetParameter, iAdditionalPairNo:=1) + ucrNudColumnFactors.AddAdditionalCodeParameterPair(clsFrequencyDefaultFunction, ucrNudColumnFactors.GetParameter, iAdditionalPairNo:=1) + ucrReceiverFactors.AddAdditionalCodeParameterPair(clsFrequencyDefaultFunction, ucrReceiverFactors.GetParameter, iAdditionalPairNo:=1) + + ucrSelectorSummaryTables.SetRCode(clsSummaryDefaultFunction, bReset) + ucrReceiverSummaryCols.SetRCode(clsSummaryDefaultFunction, bReset) + ucrReceiverFactors.SetRCode(clsSummaryDefaultFunction, bReset) + ucrChkOmitMissing.SetRCode(clsSummaryDefaultFunction, bReset) + ucrChkDisplayMargins.SetRCode(clsSummaryDefaultFunction, bReset) + ucrChkFrequencyDisplayMargins.SetRCode(clsFrequencyDefaultFunction, bReset) + ucrNudSigFigs.SetRCode(clsSummaryDefaultFunction, bReset) + ucrReceiverWeights.SetRCode(clsSummaryDefaultFunction, bReset) + ucrChkSummaries.SetRCode(clsSummaryDefaultFunction, bReset) + ucrChkWeight.SetRCode(clsSummaryDefaultFunction, bReset) + ucrPnlSummaryFrequencyTables.SetRCode(clsDummyFunction, bReset) + ucrChkDisplaySummariesAsRow.SetRCode(clsSummaryOperator, bReset) + ucrChkDisplaySummaryVariablesAsRow.SetRCode(clsSummaryOperator, bReset) + ucrChkDisplayVariablesAsRows.SetRCode(clsSummaryOperator, bReset) + ucrChkStoreResults.SetRCode(clsSummaryDefaultFunction, bReset) + ucrChkDisplayAsPercentage.SetRCode(clsFrequencyDefaultFunction, bReset) ucrSaveTable.SetRCode(clsJoiningPipeOperator, bReset) FillListView() End Sub Private Sub TestOKEnabled() - If ucrSaveTable.IsComplete AndAlso ucrNudColumnFactors.GetText() <> "" AndAlso ucrNudSigFigs.GetText <> "" AndAlso (Not ucrChkWeight.Checked OrElse (ucrChkWeight.Checked AndAlso Not ucrReceiverWeights.IsEmpty)) AndAlso Not ucrReceiverSummaryCols.IsEmpty AndAlso Not clsSummariesList.clsParameters.Count = 0 Then - ucrBase.OKEnabled(True) + If rdoSummaryTable.Checked Then + If ucrSaveTable.IsComplete AndAlso ucrNudColumnFactors.GetText() <> "" AndAlso + ucrNudSigFigs.GetText <> "" AndAlso (Not ucrChkWeight.Checked OrElse (ucrChkWeight.Checked AndAlso Not ucrReceiverWeights.IsEmpty)) AndAlso + Not ucrReceiverSummaryCols.IsEmpty AndAlso Not clsSummariesList.clsParameters.Count = 0 Then + ucrBase.OKEnabled(True) + Else + ucrBase.OKEnabled(False) + End If Else - ucrBase.OKEnabled(False) + If Not ucrReceiverFactors.IsEmpty AndAlso ucrSaveTable.IsComplete Then + ucrBase.OKEnabled(True) + Else + ucrBase.OKEnabled(False) + End If End If + End Sub Private Sub ucrBase_ClickReset(sender As Object, e As EventArgs) Handles ucrBase.ClickReset @@ -358,7 +441,7 @@ Public Class dlgSummaryTables End Sub Private Sub cmdSummaries_Click(sender As Object, e As EventArgs) Handles cmdSummaries.Click - sdgSummaries.SetRFunction(clsSummariesList, clsDefaultFunction, clsConcFunction, ucrSelectorSummaryTables, bResetSubdialog) + sdgSummaries.SetRFunction(clsSummariesList, clsSummaryDefaultFunction, clsConcFunction, ucrSelectorSummaryTables, bResetSubdialog) bResetSubdialog = False sdgSummaries.bEnable2VariableTab = False sdgSummaries.ShowDialog() @@ -368,13 +451,24 @@ Public Class dlgSummaryTables End Sub Private Sub cmdFormatTable_Click(sender As Object, e As EventArgs) Handles cmdFormatTable.Click - sdgFormatSummaryTables.SetRCode(clsNewTableTitleFunction:=clsTableTitleFunction, clsNewTabFootnoteTitleFunction:=clsTabFootnoteTitleFunction, clsNewTableSourcenoteFunction:=clsTableSourcenoteFunction, clsNewDummyFunction:=clsDummyFunction, - clsNewCellTextFunction:=clsCellTextFunction, clsNewCellBorderFunction:=clsCellBorderFunction, clsNewCellFillFunction:=clsCellFillFunction, clsNewHeaderFormatFunction:=clsHeaderFormatFunction, - clsNewTabOptionsFunction:=clsTabOptionsFunction, clsNewFootnoteCellFunction:=clsFootnoteCellFunction, clsNewStubHeadFunction:=clsStubHeadFunction, clsNewSecondFootnoteCellBodyFunction:=clsSecondFootnoteCellBodyFunction, - clsNewPipeOperator:=clsPipeOperator, clsNewBorderWeightPxFunction:=clsBorderWeightPxFunction, clsNewFootnoteTitleLocationFunction:=clsFootnoteTitleLocationFunction, clsNewFootnoteCellBodyFunction:=clsFootnoteCellBodyFunction, - clsNewFootnoteSubtitleLocationFunction:=clsFootnoteSubtitleLocationFunction, clsNewTabFootnoteSubtitleFunction:=clsTabFootnoteSubtitleFunction, clsNewJoiningOperator:=clsJoiningPipeOperator, - clsNewStyleListFunction:=clsStyleListFunction, clsNewMutableOPerator:=clsMutableOperator, clsNewSecondFootnoteCellFunction:=clsSecondFootnoteCellFunction, clsNewTabFootnoteOperator:=clsTabFootnoteOperator, - clsNewTabStyleCellTextFunction:=clsTabStyleCellTextFunction, clsNewTabStyleFunction:=clsTabStyleFunction, clsNewTabStylePxFunction:=clsTabStylePxFunction, bReset:=bReset) + If rdoSummaryTable.Checked Then + sdgFormatSummaryTables.SetRCode(clsNewTableTitleFunction:=clsTableTitleFunction, clsNewTabFootnoteTitleFunction:=clsTabFootnoteTitleFunction, clsNewTableSourcenoteFunction:=clsTableSourcenoteFunction, clsNewDummyFunction:=clsDummyFunction, + clsNewCellTextFunction:=clsCellTextFunction, clsNewCellBorderFunction:=clsCellBorderFunction, clsNewCellFillFunction:=clsCellFillFunction, clsNewHeaderFormatFunction:=clsHeaderFormatFunction, + clsNewTabOptionsFunction:=clsTabOptionsFunction, clsNewFootnoteCellFunction:=clsFootnoteCellFunction, clsNewStubHeadFunction:=clsStubHeadFunction, clsNewSecondFootnoteCellBodyFunction:=clsSecondFootnoteCellBodyFunction, + clsNewPipeOperator:=clsPipeOperator, clsNewBorderWeightPxFunction:=clsBorderWeightPxFunction, clsNewFootnoteTitleLocationFunction:=clsFootnoteTitleLocationFunction, clsNewFootnoteCellBodyFunction:=clsFootnoteCellBodyFunction, + clsNewFootnoteSubtitleLocationFunction:=clsFootnoteSubtitleLocationFunction, clsNewTabFootnoteSubtitleFunction:=clsTabFootnoteSubtitleFunction, clsNewJoiningOperator:=clsJoiningPipeOperator, + clsNewStyleListFunction:=clsStyleListFunction, clsNewMutableOPerator:=clsSummaryOperator, clsNewSecondFootnoteCellFunction:=clsSecondFootnoteCellFunction, clsNewTabFootnoteOperator:=clsTabFootnoteOperator, + clsNewTabStyleCellTextFunction:=clsTabStyleCellTextFunction, clsNewTabStyleFunction:=clsTabStyleFunction, clsNewTabStylePxFunction:=clsTabStylePxFunction, bReset:=bReset) + Else + sdgFormatSummaryTables.SetRCode(clsNewTableTitleFunction:=clsTableTitleFunction, clsNewTabFootnoteTitleFunction:=clsTabFootnoteTitleFunction, clsNewTableSourcenoteFunction:=clsTableSourcenoteFunction, clsNewDummyFunction:=clsDummyFunction, + clsNewCellTextFunction:=clsCellTextFunction, clsNewCellBorderFunction:=clsCellBorderFunction, clsNewCellFillFunction:=clsCellFillFunction, clsNewHeaderFormatFunction:=clsHeaderFormatFunction, + clsNewTabOptionsFunction:=clsTabOptionsFunction, clsNewFootnoteCellFunction:=clsFootnoteCellFunction, clsNewStubHeadFunction:=clsStubHeadFunction, clsNewSecondFootnoteCellBodyFunction:=clsSecondFootnoteCellBodyFunction, + clsNewPipeOperator:=clsPipeOperator, clsNewBorderWeightPxFunction:=clsBorderWeightPxFunction, clsNewFootnoteTitleLocationFunction:=clsFootnoteTitleLocationFunction, clsNewFootnoteCellBodyFunction:=clsFootnoteCellBodyFunction, + clsNewFootnoteSubtitleLocationFunction:=clsFootnoteSubtitleLocationFunction, clsNewTabFootnoteSubtitleFunction:=clsTabFootnoteSubtitleFunction, clsNewJoiningOperator:=clsJoiningPipeOperator, + clsNewStyleListFunction:=clsStyleListFunction, clsNewMutableOPerator:=clsFrequencyOperator, clsNewSecondFootnoteCellFunction:=clsSecondFootnoteCellFunction, clsNewTabFootnoteOperator:=clsTabFootnoteOperator, + clsNewTabStyleCellTextFunction:=clsTabStyleCellTextFunction, clsNewTabStyleFunction:=clsTabStyleFunction, clsNewTabStylePxFunction:=clsTabStylePxFunction, bReset:=bReset) + End If + sdgFormatSummaryTables.ShowDialog() End Sub @@ -392,58 +486,90 @@ Public Class dlgSummaryTables End If End Sub - Private Sub ucrCoreControls_ControlContentsChanged(ucrChangedControl As ucrCore) Handles ucrReceiverFactors.ControlContentsChanged, ucrSaveTable.ControlContentsChanged, ucrChkWeight.ControlContentsChanged, ucrReceiverWeights.ControlContentsChanged, ucrNudSigFigs.ControlContentsChanged, ucrReceiverSummaryCols.ControlContentsChanged, ucrNudColumnFactors.ControlValueChanged + Private Sub ucrCoreControls_ControlContentsChanged(ucrChangedControl As ucrCore) Handles ucrReceiverFactors.ControlContentsChanged, ucrSaveTable.ControlContentsChanged, + ucrChkWeight.ControlContentsChanged, ucrReceiverWeights.ControlContentsChanged, ucrNudSigFigs.ControlContentsChanged, ucrReceiverSummaryCols.ControlContentsChanged, + ucrNudColumnFactors.ControlContentsChanged, ucrPnlSummaryFrequencyTables.ControlContentsChanged TestOKEnabled() End Sub Private Sub Display_ControlValueChanged(ucrChangedControl As ucrCore) Handles ucrChkDisplaySummariesAsRow.ControlValueChanged, ucrChkDisplayVariablesAsRows.ControlValueChanged, ucrChkDisplaySummaryVariablesAsRow.ControlValueChanged, ucrChkSummaries.ControlValueChanged - clsMutableOperator.RemoveParameterByName("summariesTopLeft") - clsMutableOperator.RemoveParameterByName("summariesLeftTop") - clsMutableOperator.RemoveParameterByName("variablesTopLeft") - clsMutableOperator.RemoveParameterByName("variablesLeftTop") - clsMutableOperator.RemoveParameterByName("summariesVariableTopLeft") - clsMutableOperator.RemoveParameterByName("summariesVariableLeftTop") + clsSummaryOperator.RemoveParameterByName("summariesTopLeft") + clsSummaryOperator.RemoveParameterByName("summariesLeftTop") + clsSummaryOperator.RemoveParameterByName("variablesTopLeft") + clsSummaryOperator.RemoveParameterByName("variablesLeftTop") + clsSummaryOperator.RemoveParameterByName("summariesVariableTopLeft") + clsSummaryOperator.RemoveParameterByName("summariesVariableLeftTop") If ucrChkSummaries.Checked Then If ucrChkDisplaySummariesAsRow.Checked Then - clsMutableOperator.AddParameter("summariesLeftTop", clsRFunctionParameter:=clsSummariesHeaderLeftTopFunction, iPosition:=1) + clsSummaryOperator.AddParameter("summariesLeftTop", clsRFunctionParameter:=clsSummariesHeaderLeftTopFunction, iPosition:=1) Else - clsMutableOperator.AddParameter("summariesTopLeft", clsRFunctionParameter:=clsSummariesHeaderTopLeftFunction, iPosition:=1) + clsSummaryOperator.AddParameter("summariesTopLeft", clsRFunctionParameter:=clsSummariesHeaderTopLeftFunction, iPosition:=1) End If If ucrChkDisplayVariablesAsRows.Checked Then - clsMutableOperator.AddParameter("variablesLeftTop", clsRFunctionParameter:=clsVariableHeaderLeftTopFunction, iPosition:=1) + clsSummaryOperator.AddParameter("variablesLeftTop", clsRFunctionParameter:=clsVariableHeaderLeftTopFunction, iPosition:=1) Else - clsMutableOperator.AddParameter("variablesTopLeft", clsRFunctionParameter:=clsVariableHeaderTopLeftFunction, iPosition:=1) + clsSummaryOperator.AddParameter("variablesTopLeft", clsRFunctionParameter:=clsVariableHeaderTopLeftFunction, iPosition:=1) End If Else If ucrChkDisplaySummaryVariablesAsRow.Checked Then - clsMutableOperator.AddParameter("summariesVariableLeftTop", clsRFunctionParameter:=clsummaryVariableHeaderLeftTopFunction, iPosition:=1) + clsSummaryOperator.AddParameter("summariesVariableLeftTop", clsRFunctionParameter:=clsummaryVariableHeaderLeftTopFunction, iPosition:=1) Else - clsMutableOperator.AddParameter("summariesVariableTopLeft", clsRFunctionParameter:=clsSummaryVariableHeaderTopLeftFunction, iPosition:=1) + clsSummaryOperator.AddParameter("summariesVariableTopLeft", clsRFunctionParameter:=clsSummaryVariableHeaderTopLeftFunction, iPosition:=1) End If End If End Sub Private Sub ucrReceiverFactors_ControlValueChanged(ucrChangedControl As ucrCore) Handles ucrReceiverFactors.ControlValueChanged, ucrNudColumnFactors.ControlValueChanged - Dim iColumn As Integer = 0 - Dim iNumberOfColumns As Integer + If ucrReceiverFactors.IsEmpty OrElse String.IsNullOrEmpty(ucrNudColumnFactors.GetText()) Then + Exit Sub + End If - clsColumnOperator.ClearParameters() - clsMutableOperator.RemoveParameterByName("columnOp") + If rdoSummaryTable.Checked Then + Dim iColumn As Integer = 0 + Dim iNumberOfColumns As Integer + + clsColumnOperator.ClearParameters() + clsSummaryOperator.RemoveParameterByName("columnOp") + + If Not ucrReceiverFactors.IsEmpty AndAlso ucrNudColumnFactors.GetText() <> "" Then + iNumberOfColumns = ucrNudColumnFactors.GetText() + For Each strColumn As String In ucrReceiverFactors.GetVariableNamesAsList + Dim clsHeaderFunction As New RFunction + clsHeaderFunction.SetPackageName("mmtable2") + clsHeaderFunction.SetRCommand(If(iColumn < iNumberOfColumns, "header_top_left", "header_left_top")) + clsHeaderFunction.AddParameter("variable", strColumn, iPosition:=0) + clsColumnOperator.AddParameter(strColumn, clsRFunctionParameter:=clsHeaderFunction, iPosition:=iColumn) + iColumn += 1 + Next + clsSummaryOperator.AddParameter("columnOp", clsROperatorParameter:=clsColumnOperator, iPosition:=3) + End If + Else + Dim iColumn As Integer = 1 + Dim iNumberOfColumns As Integer + clsMmtableOperator.ClearParameters() - If Not ucrReceiverFactors.IsEmpty AndAlso ucrNudColumnFactors.GetText() <> "" Then iNumberOfColumns = ucrNudColumnFactors.GetText() - For Each strColumn As String In ucrReceiverFactors.GetVariableNamesAsList - Dim clsHeaderFunction As New RFunction - clsHeaderFunction.SetPackageName("mmtable2") - clsHeaderFunction.SetRCommand(If(iColumn < iNumberOfColumns, "header_top_left", "header_left_top")) - clsHeaderFunction.AddParameter("variable", strColumn, iPosition:=0) - clsColumnOperator.AddParameter(strColumn, clsRFunctionParameter:=clsHeaderFunction, iPosition:=iColumn) + For Each strcolumn As String In ucrReceiverFactors.GetVariableNamesAsList + If iColumn <= iNumberOfColumns Then + Dim clsHeaderLeftFunction As New RFunction + clsHeaderLeftFunction.SetPackageName("mmtable2") + clsHeaderLeftFunction.SetRCommand("header_top_left") + clsHeaderLeftFunction.AddParameter("variable", strcolumn, iPosition:=0) + clsMmtableOperator.AddParameter(strcolumn, clsRFunctionParameter:=clsHeaderLeftFunction, iPosition:=iColumn) + Else + Dim clsHeaderTopFunction As New RFunction + clsHeaderTopFunction.SetPackageName("mmtable2") + clsHeaderTopFunction.SetRCommand("header_left_top") + clsHeaderTopFunction.AddParameter("variable", strcolumn, iPosition:=0) + clsMmtableOperator.AddParameter(strcolumn, clsRFunctionParameter:=clsHeaderTopFunction, iPosition:=iColumn) + End If iColumn += 1 Next - clsMutableOperator.AddParameter("columnOp", clsROperatorParameter:=clsColumnOperator, iPosition:=3) + clsFrequencyOperator.AddParameter("columnOp", clsROperatorParameter:=clsMmtableOperator, iPosition:=1) End If + End Sub Private Sub FillListView() @@ -475,4 +601,34 @@ Public Class dlgSummaryTables iPosition += 1 Next End Sub + + Private Sub ucrPnlSummaryFrequencyTables_ControlValueChanged(ucrChangedControl As ucrCore) Handles ucrPnlSummaryFrequencyTables.ControlValueChanged + If rdoSummaryTable.Checked Then + clsDummyFunction.AddParameter("rdo_checked", "rdoSummary", iPosition:=10) + clsMutableFunction.AddParameter("data", clsRFunctionParameter:=clsSummaryDefaultFunction, iPosition:=0) + clsJoiningPipeOperator.AddParameter("mutable", clsROperatorParameter:=clsSummaryOperator, iPosition:=0) + ucrBase.clsRsyntax.RemoveFromBeforeCodes(clsFrequencyDefaultFunction) + ucrBase.clsRsyntax.AddToBeforeCodes(clsSummaryDefaultFunction, iPosition:=0) + ucrSaveTable.SetPrefix("summary_table") + cmdFormatTable.Location = New Point(286, 464) + cmdSummaries.Visible = True + Else + clsDummyFunction.AddParameter("rdo_checked", "rdoFrequency", iPosition:=10) + clsMutableFunction.AddParameter("data", clsRFunctionParameter:=clsFrequencyDefaultFunction, iPosition:=0) + clsJoiningPipeOperator.AddParameter("mutable", clsROperatorParameter:=clsFrequencyOperator, iPosition:=0) + ucrBase.clsRsyntax.RemoveFromBeforeCodes(clsSummaryDefaultFunction) + ucrBase.clsRsyntax.AddToBeforeCodes(clsFrequencyDefaultFunction, iPosition:=0) + ucrSaveTable.SetPrefix("frequency_table") + cmdSummaries.Visible = False + cmdFormatTable.Location = New Point(286, 379) + End If + End Sub + + Private Sub ucrChkDisplayAsPercentage_ControlValueChanged(ucrChangedControl As ucrCore) Handles ucrChkDisplayAsPercentage.ControlValueChanged + If ucrChkDisplayAsPercentage.Checked Then + ucrReceiverMultiplePercentages.SetMeAsReceiver() + Else + ucrReceiverFactors.SetMeAsReceiver() + End If + End Sub End Class \ No newline at end of file diff --git a/instat/dlgSurvivalObject.Designer.vb b/instat/dlgSurvivalObject.Designer.vb index e7f673fe727..90f1ae123a1 100644 --- a/instat/dlgSurvivalObject.Designer.vb +++ b/instat/dlgSurvivalObject.Designer.vb @@ -209,13 +209,10 @@ Partial Class dlgSurvivalObject ' Me.ucrModifyEventFactor.AutoSize = True Me.ucrModifyEventFactor.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle - Me.ucrModifyEventFactor.clsReceiver = Nothing Me.ucrModifyEventFactor.Location = New System.Drawing.Point(425, 194) Me.ucrModifyEventFactor.Name = "ucrModifyEventFactor" - Me.ucrModifyEventFactor.shtCurrSheet = Nothing Me.ucrModifyEventFactor.Size = New System.Drawing.Size(211, 135) Me.ucrModifyEventFactor.TabIndex = 18 - Me.ucrModifyEventFactor.ucrChkLevels = Nothing ' 'ucrInputOrigin ' diff --git a/instat/dlgSurvivalObject.vb b/instat/dlgSurvivalObject.vb index c6a719958cb..ef05cd9101a 100644 --- a/instat/dlgSurvivalObject.vb +++ b/instat/dlgSurvivalObject.vb @@ -121,11 +121,10 @@ Public Class dlgSurvivalObject ucrModifyEventLogical.SetRDefault("TRUE") ucrModifyEventLogical.SetDropDownStyleAsNonEditable() - 'ucrFactorLevels - ucrModifyEventFactor.strSelectorColumnName = "Event Occurs" - ucrModifyEventFactor.SetReceiver(ucrReceiverEvent) - ucrModifyEventFactor.SetAsMultipleSelector() - ucrModifyEventFactor.SetIncludeLevels(False) + 'ucrFactorLevels + ucrModifyEventFactor.SetAsMultipleSelectorGrid(ucrReceiverEvent, + hiddenColNames:={ucrFactor.DefaultColumnNames.Level}, + bIncludeNALevel:=True) ucrSaveObject.SetPrefix("surv") ucrSaveObject.SetSaveTypeAsSurv() @@ -211,7 +210,11 @@ Public Class dlgSurvivalObject ucrBase.OKEnabled(False) Else If (rdoRight.Checked OrElse rdoLeft.Checked OrElse rdoCounting.Checked OrElse rdoMstate.Checked) Then - If ucrReceiverEvent.IsEmpty() OrElse ((ucrReceiverEvent.strCurrDataType = "numeric" OrElse ucrReceiverEvent.strCurrDataType = "integer") AndAlso ucrChkModifyEvent.Checked AndAlso ucrModifyEventNumeric.GetText = "") OrElse (ucrReceiverEvent.strCurrDataType = "factor" AndAlso ucrChkModifyEvent.Checked AndAlso ucrModifyEventFactor.GetSelectedLevels = "") Then + If ucrReceiverEvent.IsEmpty() _ + OrElse ((ucrReceiverEvent.strCurrDataType = "numeric" OrElse ucrReceiverEvent.strCurrDataType = "integer") _ + AndAlso ucrChkModifyEvent.Checked AndAlso ucrModifyEventNumeric.GetText = "") _ + OrElse (ucrReceiverEvent.strCurrDataType = "factor" AndAlso ucrChkModifyEvent.Checked _ + AndAlso ucrModifyEventFactor.IsAnyGridRowSelected) Then ucrBase.OKEnabled(False) Else If (rdoRight.Checked OrElse rdoLeft.Checked OrElse rdoMstate.Checked) Then @@ -292,13 +295,15 @@ Public Class dlgSurvivalObject If ucrReceiverEvent.strCurrDataType = "factor" Then Me.Size = New System.Drawing.Size(662, Me.Height) - clsModifyOperation.RemoveParameterByName("c_function") - clsModifyOperation.AddParameter("factor_value", ucrModifyEventFactor.GetSelectedLevels(), bIncludeArgumentName:=False, iPosition:=1) - ucrModifyEventNumeric.Visible = False ucrModifyEventFactor.Visible = True ucrModifyEventLogical.Visible = False + clsModifyOperation.RemoveParameterByName("c_function") + clsModifyOperation.AddParameter("factor_value", + mdlCoreControl.GetRVector(ucrModifyEventFactor.GetSelectedCellValues(ucrFactor.DefaultColumnNames.Label, True)), + bIncludeArgumentName:=False, iPosition:=1) + Else Me.Size = New System.Drawing.Size(523, Me.Height) clsModifyOperation.RemoveParameterByName("factor_value") diff --git a/instat/dlgThreeVariableFrequencies.vb b/instat/dlgThreeVariableFrequencies.vb index a3b85f08e12..dff94c7331f 100644 --- a/instat/dlgThreeVariableFrequencies.vb +++ b/instat/dlgThreeVariableFrequencies.vb @@ -21,7 +21,7 @@ Public Class dlgThreeVariableFrequencies Private bResetSubdialog As Boolean = False Private clsSjTab, clsSelect, clsSjPlot, clsGroupBy, clsGridArrange As New RFunction Private clsTableBaseOperator, clsGraphBaseOperator As New ROperator - Private clsCurrBaseCode As RCodeStructure + Private clsCurrBaseCode As New RCodeStructure Private iMaxGraphGroupX As Integer Private Sub dlgThreeVariableFrequencies_Load(sender As Object, e As EventArgs) Handles MyBase.Load diff --git a/instat/dlgThreeVariablePivotTable.Designer.vb b/instat/dlgThreeVariablePivotTable.Designer.vb index 5c74ce7eb82..6495f13a3f5 100644 --- a/instat/dlgThreeVariablePivotTable.Designer.vb +++ b/instat/dlgThreeVariablePivotTable.Designer.vb @@ -1,9 +1,9 @@ - _ + Partial Class dlgThreeVariablePivotTable 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 @@ -20,14 +20,16 @@ Partial Class dlgThreeVariablePivotTable '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.lblAdditionalRowFactor = New System.Windows.Forms.Label() Me.lblInitialColumnFactor = New System.Windows.Forms.Label() Me.lblInitialRowFactor = New System.Windows.Forms.Label() Me.ttSelectedVariable = New System.Windows.Forms.ToolTip(Me.components) Me.lblTableChart = New System.Windows.Forms.Label() + Me.lblSummary = New System.Windows.Forms.Label() + Me.ucrChkNumericVariable = New instat.ucrCheck() + Me.ucrInputSummary = New instat.ucrInputComboBox() Me.ucrInputTableChart = New instat.ucrInputComboBox() Me.ucrReceiverInitialRowFactors = New instat.ucrReceiverMultiple() Me.ucrReceiverAdditionalRowFactor = New instat.ucrReceiverSingle() @@ -38,26 +40,13 @@ Partial Class dlgThreeVariablePivotTable Me.ucrReceiverInitialColumnFactor = New instat.ucrReceiverSingle() Me.ucrBase = New instat.ucrButtons() Me.ucrSelectorPivot = New instat.ucrSelectorByDataFrameAddRemove() - Me.ucrInputSummary = New instat.ucrInputComboBox() - Me.lblSummary = New System.Windows.Forms.Label() Me.SuspendLayout() ' - 'lblAdditionalRowFactor - ' - Me.lblAdditionalRowFactor.AutoSize = True - Me.lblAdditionalRowFactor.ImeMode = System.Windows.Forms.ImeMode.NoControl - Me.lblAdditionalRowFactor.Location = New System.Drawing.Point(258, 187) - Me.lblAdditionalRowFactor.Name = "lblAdditionalRowFactor" - Me.lblAdditionalRowFactor.Size = New System.Drawing.Size(51, 13) - Me.lblAdditionalRowFactor.TabIndex = 60 - Me.lblAdditionalRowFactor.Tag = "Initial Column Factor:" - Me.lblAdditionalRowFactor.Text = "Variable :" - ' 'lblInitialColumnFactor ' Me.lblInitialColumnFactor.AutoSize = True Me.lblInitialColumnFactor.ImeMode = System.Windows.Forms.ImeMode.NoControl - Me.lblInitialColumnFactor.Location = New System.Drawing.Point(260, 142) + Me.lblInitialColumnFactor.Location = New System.Drawing.Point(244, 134) Me.lblInitialColumnFactor.Name = "lblInitialColumnFactor" Me.lblInitialColumnFactor.Size = New System.Drawing.Size(105, 13) Me.lblInitialColumnFactor.TabIndex = 54 @@ -68,7 +57,7 @@ Partial Class dlgThreeVariablePivotTable ' Me.lblInitialRowFactor.AutoSize = True Me.lblInitialRowFactor.ImeMode = System.Windows.Forms.ImeMode.NoControl - Me.lblInitialRowFactor.Location = New System.Drawing.Point(260, 42) + Me.lblInitialRowFactor.Location = New System.Drawing.Point(244, 31) Me.lblInitialRowFactor.Name = "lblInitialRowFactor" Me.lblInitialRowFactor.Size = New System.Drawing.Size(106, 13) Me.lblInitialRowFactor.TabIndex = 52 @@ -85,13 +74,43 @@ Partial Class dlgThreeVariablePivotTable Me.lblTableChart.TabIndex = 63 Me.lblTableChart.Text = "Table/Chart :" ' + 'lblSummary + ' + Me.lblSummary.AutoSize = True + Me.lblSummary.ImeMode = System.Windows.Forms.ImeMode.NoControl + Me.lblSummary.Location = New System.Drawing.Point(6, 265) + Me.lblSummary.Name = "lblSummary" + Me.lblSummary.Size = New System.Drawing.Size(59, 13) + Me.lblSummary.TabIndex = 65 + Me.lblSummary.Text = "Summary : " + ' + 'ucrChkNumericVariable + ' + Me.ucrChkNumericVariable.AutoSize = True + Me.ucrChkNumericVariable.Checked = False + Me.ucrChkNumericVariable.Location = New System.Drawing.Point(244, 179) + Me.ucrChkNumericVariable.Name = "ucrChkNumericVariable" + Me.ucrChkNumericVariable.Size = New System.Drawing.Size(170, 23) + Me.ucrChkNumericVariable.TabIndex = 67 + ' + 'ucrInputSummary + ' + Me.ucrInputSummary.AddQuotesIfUnrecognised = True + Me.ucrInputSummary.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink + Me.ucrInputSummary.GetSetSelectedIndex = -1 + Me.ucrInputSummary.IsReadOnly = False + Me.ucrInputSummary.Location = New System.Drawing.Point(82, 265) + Me.ucrInputSummary.Name = "ucrInputSummary" + Me.ucrInputSummary.Size = New System.Drawing.Size(104, 21) + Me.ucrInputSummary.TabIndex = 66 + ' 'ucrInputTableChart ' Me.ucrInputTableChart.AddQuotesIfUnrecognised = True Me.ucrInputTableChart.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink Me.ucrInputTableChart.GetSetSelectedIndex = -1 Me.ucrInputTableChart.IsReadOnly = False - Me.ucrInputTableChart.Location = New System.Drawing.Point(78, 227) + Me.ucrInputTableChart.Location = New System.Drawing.Point(82, 228) Me.ucrInputTableChart.Name = "ucrInputTableChart" Me.ucrInputTableChart.Size = New System.Drawing.Size(104, 21) Me.ucrInputTableChart.TabIndex = 64 @@ -100,7 +119,7 @@ Partial Class dlgThreeVariablePivotTable ' Me.ucrReceiverInitialRowFactors.AutoSize = True Me.ucrReceiverInitialRowFactors.frmParent = Me - Me.ucrReceiverInitialRowFactors.Location = New System.Drawing.Point(260, 55) + Me.ucrReceiverInitialRowFactors.Location = New System.Drawing.Point(244, 46) Me.ucrReceiverInitialRowFactors.Margin = New System.Windows.Forms.Padding(0) Me.ucrReceiverInitialRowFactors.Name = "ucrReceiverInitialRowFactors" Me.ucrReceiverInitialRowFactors.Selector = Nothing @@ -113,7 +132,7 @@ Partial Class dlgThreeVariablePivotTable ' Me.ucrReceiverAdditionalRowFactor.AutoSize = True Me.ucrReceiverAdditionalRowFactor.frmParent = Me - Me.ucrReceiverAdditionalRowFactor.Location = New System.Drawing.Point(260, 201) + Me.ucrReceiverAdditionalRowFactor.Location = New System.Drawing.Point(244, 208) Me.ucrReceiverAdditionalRowFactor.Margin = New System.Windows.Forms.Padding(0) Me.ucrReceiverAdditionalRowFactor.Name = "ucrReceiverAdditionalRowFactor" Me.ucrReceiverAdditionalRowFactor.Selector = Nothing @@ -125,7 +144,7 @@ Partial Class dlgThreeVariablePivotTable 'ucrSavePivot ' Me.ucrSavePivot.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink - Me.ucrSavePivot.Location = New System.Drawing.Point(9, 361) + Me.ucrSavePivot.Location = New System.Drawing.Point(9, 366) Me.ucrSavePivot.Margin = New System.Windows.Forms.Padding(4, 5, 4, 5) Me.ucrSavePivot.Name = "ucrSavePivot" Me.ucrSavePivot.Size = New System.Drawing.Size(382, 23) @@ -144,7 +163,7 @@ Partial Class dlgThreeVariablePivotTable ' Me.ucrReceiverSelectedVariable.AutoSize = True Me.ucrReceiverSelectedVariable.frmParent = Me - Me.ucrReceiverSelectedVariable.Location = New System.Drawing.Point(260, 253) + Me.ucrReceiverSelectedVariable.Location = New System.Drawing.Point(244, 257) Me.ucrReceiverSelectedVariable.Margin = New System.Windows.Forms.Padding(0) Me.ucrReceiverSelectedVariable.Name = "ucrReceiverSelectedVariable" Me.ucrReceiverSelectedVariable.Selector = Nothing @@ -157,7 +176,7 @@ Partial Class dlgThreeVariablePivotTable ' Me.ucrChkSelectedVariable.AutoSize = True Me.ucrChkSelectedVariable.Checked = False - Me.ucrChkSelectedVariable.Location = New System.Drawing.Point(260, 233) + Me.ucrChkSelectedVariable.Location = New System.Drawing.Point(244, 237) Me.ucrChkSelectedVariable.Name = "ucrChkSelectedVariable" Me.ucrChkSelectedVariable.Size = New System.Drawing.Size(135, 23) Me.ucrChkSelectedVariable.TabIndex = 56 @@ -166,7 +185,7 @@ Partial Class dlgThreeVariablePivotTable ' Me.ucrReceiverInitialColumnFactor.AutoSize = True Me.ucrReceiverInitialColumnFactor.frmParent = Me - Me.ucrReceiverInitialColumnFactor.Location = New System.Drawing.Point(260, 157) + Me.ucrReceiverInitialColumnFactor.Location = New System.Drawing.Point(244, 149) Me.ucrReceiverInitialColumnFactor.Margin = New System.Windows.Forms.Padding(0) Me.ucrReceiverInitialColumnFactor.Name = "ucrReceiverInitialColumnFactor" Me.ucrReceiverInitialColumnFactor.Selector = Nothing @@ -179,7 +198,7 @@ Partial Class dlgThreeVariablePivotTable ' Me.ucrBase.AutoSize = True Me.ucrBase.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink - Me.ucrBase.Location = New System.Drawing.Point(9, 392) + Me.ucrBase.Location = New System.Drawing.Point(9, 397) Me.ucrBase.Name = "ucrBase" Me.ucrBase.Size = New System.Drawing.Size(405, 52) Me.ucrBase.TabIndex = 51 @@ -196,39 +215,18 @@ Partial Class dlgThreeVariablePivotTable Me.ucrSelectorPivot.Size = New System.Drawing.Size(213, 183) Me.ucrSelectorPivot.TabIndex = 50 ' - 'ucrInputSummary - ' - Me.ucrInputSummary.AddQuotesIfUnrecognised = True - Me.ucrInputSummary.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink - Me.ucrInputSummary.GetSetSelectedIndex = -1 - Me.ucrInputSummary.IsReadOnly = False - Me.ucrInputSummary.Location = New System.Drawing.Point(78, 262) - Me.ucrInputSummary.Name = "ucrInputSummary" - Me.ucrInputSummary.Size = New System.Drawing.Size(104, 21) - Me.ucrInputSummary.TabIndex = 66 - ' - 'lblSummary - ' - Me.lblSummary.AutoSize = True - Me.lblSummary.ImeMode = System.Windows.Forms.ImeMode.NoControl - Me.lblSummary.Location = New System.Drawing.Point(6, 265) - Me.lblSummary.Name = "lblSummary" - Me.lblSummary.Size = New System.Drawing.Size(59, 13) - Me.lblSummary.TabIndex = 65 - Me.lblSummary.Text = "Summary : " - ' 'dlgThreeVariablePivotTable ' 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(417, 456) + Me.Controls.Add(Me.ucrChkNumericVariable) Me.Controls.Add(Me.ucrInputSummary) Me.Controls.Add(Me.lblSummary) Me.Controls.Add(Me.ucrInputTableChart) Me.Controls.Add(Me.lblTableChart) Me.Controls.Add(Me.ucrReceiverInitialRowFactors) - Me.Controls.Add(Me.lblAdditionalRowFactor) Me.Controls.Add(Me.lblInitialColumnFactor) Me.Controls.Add(Me.lblInitialRowFactor) Me.Controls.Add(Me.ucrReceiverAdditionalRowFactor) @@ -249,8 +247,6 @@ Partial Class dlgThreeVariablePivotTable Me.PerformLayout() End Sub - - Friend WithEvents lblAdditionalRowFactor As Label Friend WithEvents lblInitialColumnFactor As Label Friend WithEvents lblInitialRowFactor As Label Friend WithEvents ttSelectedVariable As ToolTip @@ -267,4 +263,5 @@ Partial Class dlgThreeVariablePivotTable Friend WithEvents lblTableChart As Label Friend WithEvents ucrInputSummary As ucrInputComboBox Friend WithEvents lblSummary As Label -End Class + Friend WithEvents ucrChkNumericVariable As ucrCheck +End Class \ No newline at end of file diff --git a/instat/dlgThreeVariablePivotTable.vb b/instat/dlgThreeVariablePivotTable.vb index 9fa1822eb11..c0b48b9b2e5 100644 --- a/instat/dlgThreeVariablePivotTable.vb +++ b/instat/dlgThreeVariablePivotTable.vb @@ -56,6 +56,7 @@ Public Class dlgThreeVariablePivotTable ucrReceiverAdditionalRowFactor.SetParameter(New RParameter("val", iNewPosition:=4)) ucrReceiverAdditionalRowFactor.SetParameterIsString() + ucrReceiverAdditionalRowFactor.SetIncludedDataTypes({"numeric", "Date", "logical"}) ucrReceiverAdditionalRowFactor.Selector = ucrSelectorPivot ucrChkSelectedVariable.AddParameterIsRFunctionCondition(False, "data", True) @@ -70,17 +71,31 @@ Public Class dlgThreeVariablePivotTable ucrChkIncludeSubTotals.SetValuesCheckedAndUnchecked("TRUE", "FALSE") ucrChkIncludeSubTotals.SetRDefault("FALSE") + ucrChkNumericVariable.SetText("Numeric Variable (Optional):") + ucrChkNumericVariable.AddParameterPresentCondition(True, "rendererName") + ucrChkNumericVariable.AddParameterPresentCondition(False, "rendererName", False) + ucrChkNumericVariable.AddToLinkedControls({ucrReceiverAdditionalRowFactor}, {True}, bNewLinkedHideIfParameterMissing:=True, + bNewLinkedAddRemoveParameter:=True, bNewLinkedUpdateFunction:=True) + ucrChkNumericVariable.AddToLinkedControls({ucrInputTableChart}, {True}, bNewLinkedHideIfParameterMissing:=True, + bNewLinkedAddRemoveParameter:=True, bNewLinkedUpdateFunction:=True, + objNewDefaultState:="Table", bNewLinkedChangeToDefaultState:=True) + ucrChkNumericVariable.AddToLinkedControls({ucrInputSummary}, {True}, bNewLinkedHideIfParameterMissing:=True, + bNewLinkedAddRemoveParameter:=True, bNewLinkedUpdateFunction:=True, + objNewDefaultState:="Average", bNewLinkedChangeToDefaultState:=True) + ucrInputTableChart.SetParameter(New RParameter("rendererName", iNewPosition:=5)) ucrInputTableChart.SetItems({"Table", "Table Barchart", "Heatmap", "Row Heatmap", "Col Heatmap", "Treemap", "Horizontal Bar Chart", "Horizontal Stacked Barchart", "Bar Chart", "Stacked Bar Chart", "Line Chart", "Area chart", "Scatter Chart"}, bAddConditions:=True) + ucrInputTableChart.SetLinkedDisplayControl(lblTableChart) ucrInputSummary.SetParameter(New RParameter("aggregatorName", iNewPosition:=6)) - ucrInputSummary.SetItems({"Count", "Count Unique Values", "List Unique Values", "Sum", "Integer Sum", - "Average", "Median", "Sample Variance", "Sample Standard Deviation", "Minimum", + ucrInputSummary.SetItems({"Average", "Count Unique Values", "List Unique Values", "Sum", "Integer Sum", + "Count", "Median", "Sample Variance", "Sample Standard Deviation", "Minimum", "Maximum", "First", "Last", "Sum over Sum", "80% Upper Bound", "80% Lower Bound", "Sum as Fraction of Totals", "Sum as Fraction of Rows", "Sum as Fraction of Columns", "Count as Fraction of Total", "Count as Fraction of Rows", "Count as Fraction of Columns"}, bAddConditions:=True) + ucrInputSummary.SetLinkedDisplayControl(lblSummary) ucrSavePivot.SetPrefix("pivot_table") ucrSavePivot.SetSaveTypeAsTable() @@ -112,8 +127,6 @@ Public Class dlgThreeVariablePivotTable clsRPivotTableFunction.SetPackageName("rpivotTable") clsRPivotTableFunction.SetRCommand("rpivotTable") clsRPivotTableFunction.AddParameter("data", clsRFunctionParameter:=ucrSelectorPivot.ucrAvailableDataFrames.clsCurrDataFrame, iPosition:=0) - clsRPivotTableFunction.AddParameter("rendererName", Chr(34) & "Table" & Chr(34), iPosition:=5) - clsRPivotTableFunction.AddParameter("aggregatorName", Chr(34) & "Count" & Chr(34), iPosition:=6) clsSelectFunction.SetPackageName("dplyr") clsSelectFunction.SetRCommand("select") @@ -129,9 +142,7 @@ Public Class dlgThreeVariablePivotTable bRcodeSet = False ucrSelectorPivot.SetRCode(clsPipeOperator, bReset) ucrReceiverInitialColumnFactor.SetRCode(clsRPivotTableFunction, bReset) - ucrReceiverAdditionalRowFactor.SetRCode(clsRPivotTableFunction, bReset) - ucrInputTableChart.SetRCode(clsRPivotTableFunction, bReset) - ucrInputSummary.SetRCode(clsRPivotTableFunction, bReset) + ucrChkNumericVariable.SetRCode(clsRPivotTableFunction, bReset) ucrReceiverInitialRowFactors.SetRCode(clsRPivotTableFunction, bReset) ucrSavePivot.SetRCode(clsRPivotTableFunction, bReset) ucrChkSelectedVariable.SetRCode(clsRPivotTableFunction, bReset) @@ -159,6 +170,11 @@ Public Class dlgThreeVariablePivotTable ucrBase.clsRsyntax.AddToBeforeCodes(clsPipeOperator, iPosition:=0) Else ucrBase.clsRsyntax.RemoveFromBeforeCodes(clsPipeOperator) + If ucrChkNumericVariable.Checked Then + ucrReceiverAdditionalRowFactor.SetMeAsReceiver() + Else + ucrReceiverInitialRowFactors.SetMeAsReceiver() + End If End If ChangeDataParameterValue() End Sub @@ -202,7 +218,8 @@ Public Class dlgThreeVariablePivotTable iPosition = iPosition + 1 End If - If Not ucrReceiverAdditionalRowFactor.IsEmpty AndAlso Not lstColumns.Contains(strRowVariableName) Then + If Not ucrReceiverAdditionalRowFactor.IsEmpty AndAlso + Not lstColumns.Contains(strRowVariableName) AndAlso ucrChkNumericVariable.Checked Then clsConcatenateFunction.AddParameter("col" & iPosition, strRowVariableName, iPosition:=iPosition, bIncludeArgumentName:=False) iPosition = iPosition + 1 End If @@ -225,6 +242,21 @@ Public Class dlgThreeVariablePivotTable End Sub Private Sub ucrSavePivot_ControlValueChanged(ucrChangedControl As ucrCore) Handles ucrSavePivot.ControlValueChanged - clsGetObjectFunction.AddParameter("object_name", Chr(34) & ucrSavePivot.ucrInputComboSave.GetText & Chr(34), iPosition:=1) + If ucrSavePivot.ucrChkSave.Checked Then + clsGetObjectFunction.AddParameter("object_name", Chr(34) & ucrSavePivot.ucrInputComboSave.GetText & Chr(34), iPosition:=1) + Else + clsGetObjectFunction.AddParameter("object_name", Chr(34) & "last_table" & Chr(34), iPosition:=1) + End If + + End Sub + + Private Sub ucrChkNumericVariable_ControlValueChanged(ucrChangedControl As ucrCore) Handles ucrChkNumericVariable.ControlValueChanged + If ucrChkNumericVariable.Checked Then + ucrReceiverAdditionalRowFactor.SetMeAsReceiver() + ElseIf Not ucrChkNumericVariable.Checked AndAlso ucrChkSelectedVariable.Checked Then + ucrReceiverSelectedVariable.SetMeAsReceiver() + Else + ucrReceiverInitialRowFactors.SetMeAsReceiver() + End If End Sub End Class \ No newline at end of file diff --git a/instat/dlgThreeVariablesModelling.vb b/instat/dlgThreeVariablesModelling.vb index cd0951d5264..8f0c8e9c686 100644 --- a/instat/dlgThreeVariablesModelling.vb +++ b/instat/dlgThreeVariablesModelling.vb @@ -25,18 +25,18 @@ Public Class dlgThreeVariableModelling Public bResetSecondFunction As Boolean = False Public bRCodeSet As Boolean = False Public clsFamilyFunction, clsVisReg As New RFunction - Public clsRSingleModelFunction, clsFormulaFunction, clsAnovaFunction, clsSummaryFunction, clsConfint As RFunction - Public clsFormulaOperator As ROperator - Public clsGLM, clsLM, clsLMOrGLM, clsAsNumeric As RFunction + Public clsRSingleModelFunction, clsFormulaFunction, clsAnovaFunction, clsSummaryFunction, clsConfint As New RFunction + Public clsFormulaOperator As New ROperator + Public clsGLM, clsLM, clsLMOrGLM, clsAsNumeric As New RFunction 'Saving Operators/Functions Private clsRstandardFunction, clsHatvaluesFunction, clsResidualFunction, clsFittedValuesFunction As New RFunction Private clsExplanatoryOperator As New ROperator - Private clsFirstTransformFunction As RFunction - Private clsFirstPowerOperator As ROperator - Private clsSecondTransformFunction As RFunction - Private clsSecondPowerOperator As ROperator + Private clsFirstTransformFunction As New RFunction + Private clsFirstPowerOperator As New ROperator + Private clsSecondTransformFunction As New RFunction + Private clsSecondPowerOperator As New ROperator Private dctPlotFunctions As New Dictionary(Of String, RFunction) Private Sub dlgThreeVariableModelling_Load(sender As Object, e As EventArgs) Handles MyBase.Load diff --git a/instat/dlgTimeSeriesPlot.vb b/instat/dlgTimeSeriesPlot.vb index 5c117062252..ced2eb9dd41 100644 --- a/instat/dlgTimeSeriesPlot.vb +++ b/instat/dlgTimeSeriesPlot.vb @@ -42,24 +42,24 @@ Public Class dlgTimeSeriesPlot ' df <- df %>% ' mutate(gauge = ifelse(is.na(estimate), NA, gauge), ' estimate = ifelse(is.na(gauge), NA, estimate)) - Private clsAdjustNAOperator As ROperator - Private clsAdjustNAMutateParameter As RParameter - Private clsAdjustNAMutate As RFunction - Private clsIfElseReference As RFunction - Private clsIsNaReference As RFunction - Private clsIfElseEstimates As RFunction - Private clsIsNaEstimates As RFunction + Private clsAdjustNAOperator As New ROperator + Private clsAdjustNAMutateParameter As New RParameter + Private clsAdjustNAMutate As New RFunction + Private clsIfElseReference As New RFunction + Private clsIsNaReference As New RFunction + Private clsIfElseEstimates As New RFunction + Private clsIsNaEstimates As New RFunction ' Stack data ' These functions construct the R code below. This stacks the two columns which is needed for plotting. ' df_stack <- df %>% ' pivot_longer(cols = c(gauge, estimate), names_to = "data", values_to = "value", names_ptypes = list(data = factor(levels = c("gauge", "estimates")))) - Private clsStackOperator As ROperator - Private clsPivotLonger As RFunction - Private clsPivotCFunction As RFunction - Private clsPivotListFunction As RFunction - Private clsPivotFactorFunction As RFunction - Private clsPivotFactorLevelsCFunction As RFunction + Private clsStackOperator As New ROperator + Private clsPivotLonger As New RFunction + Private clsPivotCFunction As New RFunction + Private clsPivotListFunction As New RFunction + Private clsPivotFactorFunction As New RFunction + Private clsPivotFactorLevelsCFunction As New RFunction ' Calculate Individual Summaries. ' These functions construct the R code below if mean lines and/or if annotated individual summaries are added. @@ -67,20 +67,20 @@ Public Class dlgTimeSeriesPlot ' group_by(station, data) %>% ' summarise(mean = mean(value, na.rm = TRUE) ' sd = sd(value, na.rm = TRUE)) - Private clsIndividualSummariesOperator As ROperator - Private clsIndividualSummariesGroupBy As RFunction - Private clsIndividualSummariesSummarise As RFunction - Private clsNIndividual As RFunction - Private clsMean As RFunction - Private clsSd As RFunction - Private clsSlope As RFunction - Private clsPasteNIndividual As RFunction - Private clsPasteMean As RFunction - Private clsPasteSd As RFunction - Private clsPasteSlope As RFunction - Private clsSignifMean As RFunction - Private clsRoundSd As RFunction - Private clsSignifSlope As RFunction + Private clsIndividualSummariesOperator As New ROperator + Private clsIndividualSummariesGroupBy As New RFunction + Private clsIndividualSummariesSummarise As New RFunction + Private clsNIndividual As New RFunction + Private clsMean As New RFunction + Private clsSd As New RFunction + Private clsSlope As New RFunction + Private clsPasteNIndividual As New RFunction + Private clsPasteMean As New RFunction + Private clsPasteSd As New RFunction + Private clsPasteSlope As New RFunction + Private clsSignifMean As New RFunction + Private clsRoundSd As New RFunction + Private clsSignifSlope As New RFunction ' Calculate Comparison Summaries ' These functions construct the R code below if annotated comparison summaries are added. @@ -90,32 +90,32 @@ Public Class dlgTimeSeriesPlot ' cor = cor(estimate, gauge, use = "na.or.complete"), ' me = hydroGOF : Me(estimate, gauge), ' mae = hydroGOF:mae(estimate, gauge)) - Private clsComparisonSummariesOperator As ROperator - Private clsComparisonSummariesGroupBy As RFunction - Private clsComparisonSummariesSummarise As RFunction - Private clsNComparison As RFunction - Private clsCor As RFunction - Private clsMe As RFunction - Private clsMae As RFunction - Private clsRmse As RFunction - Private clsPbias As RFunction - Private clsRSd As RFunction - Private clsKge As RFunction - Private clsPasteN As RFunction - Private clsPasteCor As RFunction - Private clsPasteMe As RFunction - Private clsPasteMae As RFunction - Private clsPasteRmse As RFunction - Private clsPastePbias As RFunction - Private clsPasteRSd As RFunction - Private clsPasteKge As RFunction - Private clsRoundCor As RFunction - Private clsSignifMe As RFunction - Private clsSignifMae As RFunction - Private clsSignifRmse As RFunction - Private clsRoundPbias As RFunction - Private clsRoundRSd As RFunction - Private clsRoundKge As RFunction + Private clsComparisonSummariesOperator As New ROperator + Private clsComparisonSummariesGroupBy As New RFunction + Private clsComparisonSummariesSummarise As New RFunction + Private clsNComparison As New RFunction + Private clsCor As New RFunction + Private clsMe As New RFunction + Private clsMae As New RFunction + Private clsRmse As New RFunction + Private clsPbias As New RFunction + Private clsRSd As New RFunction + Private clsKge As New RFunction + Private clsPasteN As New RFunction + Private clsPasteCor As New RFunction + Private clsPasteMe As New RFunction + Private clsPasteMae As New RFunction + Private clsPasteRmse As New RFunction + Private clsPastePbias As New RFunction + Private clsPasteRSd As New RFunction + Private clsPasteKge As New RFunction + Private clsRoundCor As New RFunction + Private clsSignifMe As New RFunction + Private clsSignifMae As New RFunction + Private clsSignifRmse As New RFunction + Private clsRoundPbias As New RFunction + Private clsRoundRSd As New RFunction + Private clsRoundKge As New RFunction ' Dictionaries of the comparison/individual summary functions above. ' The key is the summary name in lower case e.g. "bias" @@ -133,29 +133,29 @@ Public Class dlgTimeSeriesPlot Private dctIndividualSummaries As Dictionary(Of String, Tuple(Of RFunction, RFunction)) ' ggplot functions - Private clsGgplotOperator As ROperator - Private clsGgplotFunction As RFunction - Private clsGgplotAes As RFunction - Private clsGeomLine As RFunction - Private clsGeomPointParameter As RParameter - Private clsGeomPoint As RFunction - Private clsGeomHLineParameter As RParameter - Private clsGeomHLine As RFunction - Private clsGeomHLineAes As RFunction - Private clsComparisonGeomText As RFunction - Private clsComparisonGeomTextAes As RFunction - Private clsComparisonPasteLabel As RFunction - Private clsGeomSmoothParameter As RParameter - Private clsGeomSmooth As RFunction - - Private clsReferenceGeomText As RFunction - Private clsReferenceGeomTextAes As RFunction - Private clsReferencePasteLabel As RFunction - Private clsReferenceFilter As RFunction - Private clsEstimatesGeomText As RFunction - Private clsEstimatesGeomTextAes As RFunction - Private clsEstimatesPasteLabel As RFunction - Private clsEstimatesFilter As RFunction + Private clsGgplotOperator As New ROperator + Private clsGgplotFunction As New RFunction + Private clsGgplotAes As New RFunction + Private clsGeomLine As New RFunction + Private clsGeomPointParameter As New RParameter + Private clsGeomPoint As New RFunction + Private clsGeomHLineParameter As New RParameter + Private clsGeomHLine As New RFunction + Private clsGeomHLineAes As New RFunction + Private clsComparisonGeomText As New RFunction + Private clsComparisonGeomTextAes As New RFunction + Private clsComparisonPasteLabel As New RFunction + Private clsGeomSmoothParameter As New RParameter + Private clsGeomSmooth As New RFunction + + Private clsReferenceGeomText As New RFunction + Private clsReferenceGeomTextAes As New RFunction + Private clsReferencePasteLabel As New RFunction + Private clsReferenceFilter As New RFunction + Private clsEstimatesGeomText As New RFunction + Private clsEstimatesGeomTextAes As New RFunction + Private clsEstimatesPasteLabel As New RFunction + Private clsEstimatesFilter As New RFunction ' These will be needed when the dialog implements the Plot Options subdialog 'Private clsLabsFunction As New RFunction diff --git a/instat/dlgTransform.vb b/instat/dlgTransform.vb index d70d5efca1a..e81ca5dccb9 100644 --- a/instat/dlgTransform.vb +++ b/instat/dlgTransform.vb @@ -36,6 +36,7 @@ Public Class dlgTransform Private clsAddConstantOperator As New ROperator Private clsNaturalLogFunction As New RFunction Private clsLogBase10Function As New RFunction + Private clsRemoveLabelsFunction As New RFunction Private clsPowerOperator As New ROperator Private clsScaleSubtractOperator As New ROperator Private clsScaleMultiplyOperator As New ROperator @@ -331,6 +332,7 @@ Public Class dlgTransform clsPreviewTextFunction = New RCodeStructure clsBooleanOperator = New ROperator clsIsNAFunction = New RFunction + clsRemoveLabelsFunction = New RFunction ucrSelectorForRank.Reset() ucrReceiverRank.SetMeAsReceiver() @@ -423,6 +425,11 @@ Public Class dlgTransform clsBooleanOperator.SetOperation("==") clsIsNAFunction.SetRCommand("is.na") + + clsRemoveLabelsFunction.SetRCommand(frmMain.clsRLink.strInstatDataObject & "$append_to_variables_metadata") + clsRemoveLabelsFunction.AddParameter("property", Chr(34) & "labels" & Chr(34), iPosition:=2) + clsRemoveLabelsFunction.AddParameter("new_val", Chr(34) & Chr(34), iPosition:=3) + clsDummyTransformFunction.AddParameter("check", "numeric", iPosition:=0) clsNumericDummyFunction.AddParameter("check", "round", iPosition:=0) clsNonNegativeDummyFunction.AddParameter("check", "sqrt", iPosition:=0) @@ -528,10 +535,12 @@ Public Class dlgTransform clsPreviewTextFunction = clsRankFunction.Clone clsDummyTransformFunction.AddParameter("check", "rank", iPosition:=0) ucrBase.clsRsyntax.SetBaseRFunction(clsRankFunction) + ucrBase.clsRsyntax.RemoveFromAfterCodes(clsRemoveLabelsFunction) ElseIf rdoSort.Checked Then clsPreviewTextFunction = clsSortFunction.Clone clsDummyTransformFunction.AddParameter("check", "sort", iPosition:=0) ucrBase.clsRsyntax.SetBaseRFunction(clsSortFunction) + ucrBase.clsRsyntax.RemoveFromAfterCodes(clsRemoveLabelsFunction) ElseIf rdoNumeric.Checked Then clsDummyTransformFunction.AddParameter("check", "numeric", iPosition:=0) If rdoRoundOf.Checked Then @@ -587,6 +596,7 @@ Public Class dlgTransform ucrBase.clsRsyntax.SetBaseRFunction(clsIsNAFunction) End Select End If + ucrBase.clsRsyntax.AddToAfterCodes(clsRemoveLabelsFunction) ElseIf rdoNonNegative.Checked Then UpdateConstantParameter() clsDummyTransformFunction.AddParameter("check", "non-negative", iPosition:=0) @@ -607,10 +617,12 @@ Public Class dlgTransform clsNonNegativeDummyFunction.AddParameter("check", "log", iPosition:=0) ucrBase.clsRsyntax.SetBaseRFunction(clsNaturalLogFunction) End If + ucrBase.clsRsyntax.AddToAfterCodes(clsRemoveLabelsFunction) ElseIf rdoScale.Checked Then clsDummyTransformFunction.AddParameter("check", "scale", iPosition:=0) clsPreviewTextFunction = clsScaleAddOperator.Clone ucrBase.clsRsyntax.SetBaseROperator(clsScaleAddOperator) + ucrBase.clsRsyntax.AddToAfterCodes(clsRemoveLabelsFunction) End If End If SetPreviewText() @@ -699,6 +711,16 @@ Public Class dlgTransform End If End Sub + Private Sub ucrSelectorForRank_DataFrameChanged() Handles ucrSelectorForRank.DataFrameChanged + clsRemoveLabelsFunction.AddParameter("data_name", Chr(34) & ucrSelectorForRank.strCurrentDataFrame & Chr(34), iPosition:=0) + End Sub + + Private Sub ucrSaveNew_ControlValueChanged(ucrChangedControl As ucrCore) Handles ucrSaveNew.ControlValueChanged + If ucrSaveNew.GetText <> "" AndAlso ucrSaveNew.IsComplete() Then + clsRemoveLabelsFunction.AddParameter("col_names", Chr(34) & ucrSaveNew.GetText & Chr(34), iPosition:=1) + 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, diff --git a/instat/dlgTransformText.Designer.vb b/instat/dlgTransformText.Designer.vb index 20e66ce3440..c0a569195c0 100644 --- a/instat/dlgTransformText.Designer.vb +++ b/instat/dlgTransformText.Designer.vb @@ -592,7 +592,7 @@ Partial Class dlgTransformText Me.rdoCase.FlatAppearance.CheckedBackColor = System.Drawing.SystemColors.ActiveCaption Me.rdoCase.FlatStyle = System.Windows.Forms.FlatStyle.Flat Me.rdoCase.ImeMode = System.Windows.Forms.ImeMode.NoControl - Me.rdoCase.Location = New System.Drawing.Point(11, 8) + Me.rdoCase.Location = New System.Drawing.Point(71, 8) Me.rdoCase.Name = "rdoCase" Me.rdoCase.Size = New System.Drawing.Size(65, 34) Me.rdoCase.TabIndex = 1 @@ -609,9 +609,9 @@ Partial Class dlgTransformText Me.rdoLength.FlatAppearance.CheckedBackColor = System.Drawing.SystemColors.ActiveCaption Me.rdoLength.FlatStyle = System.Windows.Forms.FlatStyle.Flat Me.rdoLength.ImeMode = System.Windows.Forms.ImeMode.NoControl - Me.rdoLength.Location = New System.Drawing.Point(74, 8) + Me.rdoLength.Location = New System.Drawing.Point(135, 8) Me.rdoLength.Name = "rdoLength" - Me.rdoLength.Size = New System.Drawing.Size(65, 34) + Me.rdoLength.Size = New System.Drawing.Size(54, 34) Me.rdoLength.TabIndex = 2 Me.rdoLength.TabStop = True Me.rdoLength.Text = "Length" @@ -626,9 +626,9 @@ Partial Class dlgTransformText Me.rdoPad.FlatAppearance.CheckedBackColor = System.Drawing.SystemColors.ActiveCaption Me.rdoPad.FlatStyle = System.Windows.Forms.FlatStyle.Flat Me.rdoPad.ImeMode = System.Windows.Forms.ImeMode.NoControl - Me.rdoPad.Location = New System.Drawing.Point(137, 8) + Me.rdoPad.Location = New System.Drawing.Point(188, 8) Me.rdoPad.Name = "rdoPad" - Me.rdoPad.Size = New System.Drawing.Size(65, 34) + Me.rdoPad.Size = New System.Drawing.Size(44, 34) Me.rdoPad.TabIndex = 3 Me.rdoPad.TabStop = True Me.rdoPad.Text = "Pad" @@ -643,7 +643,7 @@ Partial Class dlgTransformText Me.rdoSubstring.FlatAppearance.CheckedBackColor = System.Drawing.SystemColors.ActiveCaption Me.rdoSubstring.FlatStyle = System.Windows.Forms.FlatStyle.Flat Me.rdoSubstring.ImeMode = System.Windows.Forms.ImeMode.NoControl - Me.rdoSubstring.Location = New System.Drawing.Point(452, 8) + Me.rdoSubstring.Location = New System.Drawing.Point(7, 8) Me.rdoSubstring.Name = "rdoSubstring" Me.rdoSubstring.Size = New System.Drawing.Size(65, 34) Me.rdoSubstring.TabIndex = 8 @@ -660,9 +660,9 @@ Partial Class dlgTransformText Me.rdoWords.FlatAppearance.CheckedBackColor = System.Drawing.SystemColors.ActiveCaption Me.rdoWords.FlatStyle = System.Windows.Forms.FlatStyle.Flat Me.rdoWords.ImeMode = System.Windows.Forms.ImeMode.NoControl - Me.rdoWords.Location = New System.Drawing.Point(389, 8) + Me.rdoWords.Location = New System.Drawing.Point(395, 8) Me.rdoWords.Name = "rdoWords" - Me.rdoWords.Size = New System.Drawing.Size(65, 34) + Me.rdoWords.Size = New System.Drawing.Size(57, 34) Me.rdoWords.TabIndex = 7 Me.rdoWords.TabStop = True Me.rdoWords.Text = "Words" @@ -677,9 +677,9 @@ Partial Class dlgTransformText Me.rdoTrim.FlatAppearance.CheckedBackColor = System.Drawing.SystemColors.ActiveCaption Me.rdoTrim.FlatStyle = System.Windows.Forms.FlatStyle.Flat Me.rdoTrim.ImeMode = System.Windows.Forms.ImeMode.NoControl - Me.rdoTrim.Location = New System.Drawing.Point(263, 8) + Me.rdoTrim.Location = New System.Drawing.Point(292, 8) Me.rdoTrim.Name = "rdoTrim" - Me.rdoTrim.Size = New System.Drawing.Size(65, 34) + Me.rdoTrim.Size = New System.Drawing.Size(57, 34) Me.rdoTrim.TabIndex = 5 Me.rdoTrim.TabStop = True Me.rdoTrim.Text = "Trim" @@ -694,9 +694,9 @@ Partial Class dlgTransformText Me.rdoWrap.FlatAppearance.CheckedBackColor = System.Drawing.SystemColors.ActiveCaption Me.rdoWrap.FlatStyle = System.Windows.Forms.FlatStyle.Flat Me.rdoWrap.ImeMode = System.Windows.Forms.ImeMode.NoControl - Me.rdoWrap.Location = New System.Drawing.Point(326, 8) + Me.rdoWrap.Location = New System.Drawing.Point(348, 8) Me.rdoWrap.Name = "rdoWrap" - Me.rdoWrap.Size = New System.Drawing.Size(65, 34) + Me.rdoWrap.Size = New System.Drawing.Size(48, 34) Me.rdoWrap.TabIndex = 6 Me.rdoWrap.TabStop = True Me.rdoWrap.Text = "Wrap" @@ -711,9 +711,9 @@ Partial Class dlgTransformText Me.rdoTruncate.FlatAppearance.CheckedBackColor = System.Drawing.SystemColors.ActiveCaption Me.rdoTruncate.FlatStyle = System.Windows.Forms.FlatStyle.Flat Me.rdoTruncate.ImeMode = System.Windows.Forms.ImeMode.NoControl - Me.rdoTruncate.Location = New System.Drawing.Point(200, 8) + Me.rdoTruncate.Location = New System.Drawing.Point(230, 8) Me.rdoTruncate.Name = "rdoTruncate" - Me.rdoTruncate.Size = New System.Drawing.Size(65, 34) + Me.rdoTruncate.Size = New System.Drawing.Size(63, 34) Me.rdoTruncate.TabIndex = 4 Me.rdoTruncate.TabStop = True Me.rdoTruncate.Text = "Truncate" @@ -775,8 +775,7 @@ Partial Class dlgTransformText ' 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(530, 498) + Me.ClientSize = New System.Drawing.Size(466, 498) Me.Controls.Add(Me.grpParameters) Me.Controls.Add(Me.rdoTruncate) Me.Controls.Add(Me.rdoWrap) diff --git a/instat/dlgTransformText.vb b/instat/dlgTransformText.vb index acdd82b67ee..a9441cc6040 100644 --- a/instat/dlgTransformText.vb +++ b/instat/dlgTransformText.vb @@ -270,7 +270,7 @@ Public Class dlgTransformText clsSubstringFunction.AddParameter("start", 1, iPosition:=1) clsSubstringFunction.AddParameter("end", 2, iPosition:=2) - ucrBase.clsRsyntax.SetBaseRFunction(clsConvertFunction) + ucrBase.clsRsyntax.SetBaseRFunction(clsSubstringFunction) End Sub Private Sub SetRCodeForControls(bReset As Boolean) diff --git a/instat/dlgTransposeColumns.Designer.vb b/instat/dlgTransposeColumns.Designer.vb index 0507934efd8..15ab1524212 100644 --- a/instat/dlgTransposeColumns.Designer.vb +++ b/instat/dlgTransposeColumns.Designer.vb @@ -39,11 +39,15 @@ Partial Class dlgTransposeColumns Private Sub InitializeComponent() Me.lblColumnsToTranspose = New System.Windows.Forms.Label() - Me.ucrReceiverColumsToTranspose = New instat.ucrReceiverMultiple() - Me.ucrBase = New instat.ucrButtons() - Me.ucrSelectorTransposeColumns = New instat.ucrSelectorByDataFrameAddRemove() - Me.ucrNewDataframe = New instat.ucrSave() + Me.lblVariableNames = New System.Windows.Forms.Label() + Me.ucrInputDisplayVariableNames = New instat.ucrInputTextBox() + Me.ucrChkDisplayVariableNames = New instat.ucrCheck() + Me.ucrReceiverVariableNames = New instat.ucrReceiverSingle() Me.ucrChkNameNewColumns = New instat.ucrCheck() + Me.ucrNewDataframe = New instat.ucrSave() + Me.ucrReceiverColumnsToTranspose = New instat.ucrReceiverMultiple() + Me.ucrSelectorTransposeColumns = New instat.ucrSelectorByDataFrameAddRemove() + Me.ucrBase = New instat.ucrButtons() Me.SuspendLayout() ' 'lblColumnsToTranspose @@ -55,27 +59,78 @@ Partial Class dlgTransposeColumns Me.lblColumnsToTranspose.Tag = "Columns_to_Transpose" Me.lblColumnsToTranspose.Text = "Columns to Transpose:" ' - 'ucrReceiverColumsToTranspose + 'lblVariableNames ' - Me.ucrReceiverColumsToTranspose.AutoSize = True - Me.ucrReceiverColumsToTranspose.frmParent = Me - Me.ucrReceiverColumsToTranspose.Location = New System.Drawing.Point(263, 60) - Me.ucrReceiverColumsToTranspose.Margin = New System.Windows.Forms.Padding(0) - Me.ucrReceiverColumsToTranspose.Name = "ucrReceiverColumsToTranspose" - Me.ucrReceiverColumsToTranspose.Selector = Nothing - Me.ucrReceiverColumsToTranspose.Size = New System.Drawing.Size(120, 100) - Me.ucrReceiverColumsToTranspose.strNcFilePath = "" - Me.ucrReceiverColumsToTranspose.TabIndex = 2 - Me.ucrReceiverColumsToTranspose.ucrSelector = Nothing + Me.lblVariableNames.AutoSize = True + Me.lblVariableNames.Location = New System.Drawing.Point(261, 174) + Me.lblVariableNames.Name = "lblVariableNames" + Me.lblVariableNames.Size = New System.Drawing.Size(116, 13) + Me.lblVariableNames.TabIndex = 3 + Me.lblVariableNames.Text = "New Names (Optional):" ' - 'ucrBase + 'ucrInputDisplayVariableNames ' - Me.ucrBase.AutoSize = True - Me.ucrBase.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink - Me.ucrBase.Location = New System.Drawing.Point(10, 247) - Me.ucrBase.Name = "ucrBase" - Me.ucrBase.Size = New System.Drawing.Size(405, 52) - Me.ucrBase.TabIndex = 5 + Me.ucrInputDisplayVariableNames.AddQuotesIfUnrecognised = True + Me.ucrInputDisplayVariableNames.AutoSize = True + Me.ucrInputDisplayVariableNames.IsMultiline = False + Me.ucrInputDisplayVariableNames.IsReadOnly = False + Me.ucrInputDisplayVariableNames.Location = New System.Drawing.Point(138, 235) + Me.ucrInputDisplayVariableNames.Name = "ucrInputDisplayVariableNames" + Me.ucrInputDisplayVariableNames.Size = New System.Drawing.Size(120, 21) + Me.ucrInputDisplayVariableNames.TabIndex = 7 + ' + 'ucrChkDisplayVariableNames + ' + Me.ucrChkDisplayVariableNames.AutoSize = True + Me.ucrChkDisplayVariableNames.Checked = False + Me.ucrChkDisplayVariableNames.Location = New System.Drawing.Point(10, 233) + Me.ucrChkDisplayVariableNames.Name = "ucrChkDisplayVariableNames" + Me.ucrChkDisplayVariableNames.Size = New System.Drawing.Size(125, 23) + Me.ucrChkDisplayVariableNames.TabIndex = 6 + ' + 'ucrReceiverVariableNames + ' + Me.ucrReceiverVariableNames.AutoSize = True + Me.ucrReceiverVariableNames.frmParent = Me + Me.ucrReceiverVariableNames.Location = New System.Drawing.Point(263, 190) + Me.ucrReceiverVariableNames.Margin = New System.Windows.Forms.Padding(0) + Me.ucrReceiverVariableNames.Name = "ucrReceiverVariableNames" + Me.ucrReceiverVariableNames.Selector = Nothing + Me.ucrReceiverVariableNames.Size = New System.Drawing.Size(120, 20) + Me.ucrReceiverVariableNames.strNcFilePath = "" + Me.ucrReceiverVariableNames.TabIndex = 4 + Me.ucrReceiverVariableNames.ucrSelector = Nothing + ' + 'ucrChkNameNewColumns + ' + Me.ucrChkNameNewColumns.AutoSize = True + Me.ucrChkNameNewColumns.Checked = False + Me.ucrChkNameNewColumns.Location = New System.Drawing.Point(10, 208) + Me.ucrChkNameNewColumns.Name = "ucrChkNameNewColumns" + Me.ucrChkNameNewColumns.Size = New System.Drawing.Size(210, 23) + Me.ucrChkNameNewColumns.TabIndex = 5 + ' + 'ucrNewDataframe + ' + Me.ucrNewDataframe.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink + Me.ucrNewDataframe.Location = New System.Drawing.Point(10, 263) + Me.ucrNewDataframe.Margin = New System.Windows.Forms.Padding(4, 5, 4, 5) + Me.ucrNewDataframe.Name = "ucrNewDataframe" + Me.ucrNewDataframe.Size = New System.Drawing.Size(360, 24) + Me.ucrNewDataframe.TabIndex = 8 + ' + 'ucrReceiverColumnsToTranspose + ' + Me.ucrReceiverColumnsToTranspose.AutoSize = True + Me.ucrReceiverColumnsToTranspose.frmParent = Me + Me.ucrReceiverColumnsToTranspose.Location = New System.Drawing.Point(263, 60) + Me.ucrReceiverColumnsToTranspose.Margin = New System.Windows.Forms.Padding(0) + Me.ucrReceiverColumnsToTranspose.Name = "ucrReceiverColumnsToTranspose" + Me.ucrReceiverColumnsToTranspose.Selector = Nothing + Me.ucrReceiverColumnsToTranspose.Size = New System.Drawing.Size(120, 100) + Me.ucrReceiverColumnsToTranspose.strNcFilePath = "" + Me.ucrReceiverColumnsToTranspose.TabIndex = 2 + Me.ucrReceiverColumnsToTranspose.ucrSelector = Nothing ' 'ucrSelectorTransposeColumns ' @@ -89,33 +144,28 @@ Partial Class dlgTransposeColumns Me.ucrSelectorTransposeColumns.Size = New System.Drawing.Size(213, 183) Me.ucrSelectorTransposeColumns.TabIndex = 0 ' - 'ucrNewDataframe - ' - Me.ucrNewDataframe.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink - Me.ucrNewDataframe.Location = New System.Drawing.Point(10, 223) - Me.ucrNewDataframe.Margin = New System.Windows.Forms.Padding(4, 5, 4, 5) - Me.ucrNewDataframe.Name = "ucrNewDataframe" - Me.ucrNewDataframe.Size = New System.Drawing.Size(360, 24) - Me.ucrNewDataframe.TabIndex = 4 - ' - 'ucrChkNameNewColumns + 'ucrBase ' - Me.ucrChkNameNewColumns.AutoSize = True - Me.ucrChkNameNewColumns.Checked = False - Me.ucrChkNameNewColumns.Location = New System.Drawing.Point(10, 197) - Me.ucrChkNameNewColumns.Name = "ucrChkNameNewColumns" - Me.ucrChkNameNewColumns.Size = New System.Drawing.Size(210, 23) - Me.ucrChkNameNewColumns.TabIndex = 3 + Me.ucrBase.AutoSize = True + Me.ucrBase.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink + Me.ucrBase.Location = New System.Drawing.Point(10, 289) + Me.ucrBase.Name = "ucrBase" + Me.ucrBase.Size = New System.Drawing.Size(405, 52) + Me.ucrBase.TabIndex = 9 ' 'dlgTransposeColumns ' 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(417, 304) + Me.ClientSize = New System.Drawing.Size(417, 343) + Me.Controls.Add(Me.ucrInputDisplayVariableNames) + Me.Controls.Add(Me.ucrChkDisplayVariableNames) + Me.Controls.Add(Me.lblVariableNames) + Me.Controls.Add(Me.ucrReceiverVariableNames) Me.Controls.Add(Me.ucrChkNameNewColumns) Me.Controls.Add(Me.ucrNewDataframe) - Me.Controls.Add(Me.ucrReceiverColumsToTranspose) + Me.Controls.Add(Me.ucrReceiverColumnsToTranspose) Me.Controls.Add(Me.ucrSelectorTransposeColumns) Me.Controls.Add(Me.ucrBase) Me.Controls.Add(Me.lblColumnsToTranspose) @@ -133,8 +183,12 @@ Partial Class dlgTransposeColumns Friend WithEvents ucrBase As ucrButtons Friend WithEvents ucrSelectorTransposeColumns As ucrSelectorByDataFrameAddRemove - Friend WithEvents ucrReceiverColumsToTranspose As ucrReceiverMultiple + Friend WithEvents ucrReceiverColumnsToTranspose As ucrReceiverMultiple Friend WithEvents lblColumnsToTranspose As Label Friend WithEvents ucrNewDataframe As ucrSave Friend WithEvents ucrChkNameNewColumns As ucrCheck + Friend WithEvents lblVariableNames As Label + Friend WithEvents ucrReceiverVariableNames As ucrReceiverSingle + Friend WithEvents ucrChkDisplayVariableNames As ucrCheck + Friend WithEvents ucrInputDisplayVariableNames As ucrInputTextBox End Class diff --git a/instat/dlgTransposeColumns.vb b/instat/dlgTransposeColumns.vb index a23c15019dd..a5b04a50f6a 100644 --- a/instat/dlgTransposeColumns.vb +++ b/instat/dlgTransposeColumns.vb @@ -11,15 +11,15 @@ ' MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ' GNU General Public License for more details. ' -' You should have received a copy of the GNU General Public License +' You should have received a copy of the GNU General Public License ' along with this program. If not, see . - Imports instat.Translations Public Class dlgTransposeColumns Private bFirstLoad As Boolean = True Private bReset As Boolean = True - Private clsOverallFunction, clsTFunction As New RFunction - + Private bResettingDialogue As Boolean = False + Private clsOverallFunction, clsTransposeFunction, clsGetColumnNamesFunction As New RFunction + Private lstEditedVariables, lstAllVariables As New List(Of String) Private Sub dlgTransposeColumns_Load(sender As Object, e As EventArgs) Handles MyBase.Load If bFirstLoad Then InitialiseDialog() @@ -28,78 +28,154 @@ Public Class dlgTransposeColumns If bReset Then SetDefaults() End If - SetRCodeForControls(bReset) + SetRCodeforControls(bReset) bReset = False autoTranslate(Me) End Sub - Private Sub InitialiseDialog() ucrBase.iHelpTopicID = 277 - - ' ucrReceiver - ucrReceiverColumsToTranspose.SetParameter(New RParameter("x", 0)) - ucrReceiverColumsToTranspose.SetParameterIsRFunction() - ucrReceiverColumsToTranspose.Selector = ucrSelectorTransposeColumns - ucrReceiverColumsToTranspose.SetMeAsReceiver() - ucrReceiverColumsToTranspose.bForceAsDataFrame = True - + ucrReceiverColumnsToTranspose.SetParameterIsRFunction() + ucrReceiverColumnsToTranspose.Selector = ucrSelectorTransposeColumns + ucrReceiverColumnsToTranspose.SetMeAsReceiver() + ucrReceiverVariableNames.SetParameter(New RParameter("make.names", 1)) + ucrReceiverVariableNames.SetParameterIsString() + ucrReceiverVariableNames.Selector = ucrSelectorTransposeColumns 'The checkbox is not yet implemented in the updated code as it was not implemented in pre-updated code ucrChkNameNewColumns.SetText("Name New Columns") ucrChkNameNewColumns.Enabled = False ' temporary - + ucrChkDisplayVariableNames.SetText("Include Old Names") + ucrChkDisplayVariableNames.AddParameterPresentCondition(True, "keep.names") + ucrChkDisplayVariableNames.AddParameterPresentCondition(False, "keep.names", False) + ucrInputDisplayVariableNames.SetParameter(New RParameter("keep.names", 2)) 'ucrNewDF ucrNewDataframe.SetIsTextBox() ucrNewDataframe.SetSaveTypeAsDataFrame() ucrNewDataframe.SetDataFrameSelector(ucrSelectorTransposeColumns.ucrAvailableDataFrames) ucrNewDataframe.SetLabelText("New Data Frame Name:") + ucrChkDisplayVariableNames.AddToLinkedControls({ucrInputDisplayVariableNames}, {True}, bNewLinkedAddRemoveParameter:=True, bNewLinkedHideIfParameterMissing:=True, bNewLinkedUpdateFunction:=True, objNewDefaultState:="old name", bNewLinkedChangeToDefaultState:=True) End Sub - Private Sub SetDefaults() - clsTFunction = New RFunction + clsTransposeFunction = New RFunction clsOverallFunction = New RFunction - + clsGetColumnNamesFunction = New RFunction ucrSelectorTransposeColumns.Reset() ucrNewDataframe.Reset() + 'ucrReceiverColumnsToTranspose.SetMeAsReceiver() NewDefaultName() - clsOverallFunction.SetRCommand("as.data.frame") clsOverallFunction.SetAssignTo(ucrNewDataframe.GetText(), strTempDataframe:=ucrNewDataframe.GetText()) - clsOverallFunction.AddParameter("x", clsRFunctionParameter:=clsTFunction) - clsTFunction.SetRCommand("t") - + clsOverallFunction.AddParameter("x", clsRFunctionParameter:=clsTransposeFunction) + clsTransposeFunction.SetPackageName("data.table") + clsTransposeFunction.SetRCommand("transpose") + clsTransposeFunction.AddParameter("l", "columns", iPosition:=0) ucrBase.clsRsyntax.SetBaseRFunction(clsOverallFunction) End Sub - Private Sub SetRCodeforControls(bReset As Boolean) - ucrReceiverColumsToTranspose.SetRCode(clsTFunction, bReset) + ucrReceiverVariableNames.SetRCode(clsTransposeFunction, bReset) + ucrChkDisplayVariableNames.SetRCode(clsTransposeFunction, bReset) ucrNewDataframe.SetRCode(clsOverallFunction, bReset) End Sub - Private Sub TestOkEnabled() - If Not ucrReceiverColumsToTranspose.IsEmpty AndAlso ucrNewDataframe.IsComplete() Then - ucrBase.OKEnabled(True) + If Not ucrReceiverColumnsToTranspose.IsEmpty AndAlso ucrNewDataframe.IsComplete() Then + If ucrChkDisplayVariableNames.Checked AndAlso (Not ucrInputDisplayVariableNames.IsEmpty) Then + ucrBase.OKEnabled(True) + ElseIf ucrChkDisplayVariableNames.Checked AndAlso ucrInputDisplayVariableNames.IsEmpty Then + ucrBase.OKEnabled(False) + Else + ucrBase.OKEnabled(True) + End If Else ucrBase.OKEnabled(False) End If End Sub - Private Sub ucrBase_ClickReset(sender As Object, e As EventArgs) Handles ucrBase.ClickReset + bResettingDialogue = True SetDefaults() SetRCodeforControls(True) + UpdateSelector() TestOkEnabled() + bResettingDialogue = False End Sub - Private Sub NewDefaultName() If (Not ucrNewDataframe.bUserTyped) AndAlso ucrSelectorTransposeColumns.ucrAvailableDataFrames.cboAvailableDataFrames.Text <> "" Then ucrNewDataframe.SetName(ucrSelectorTransposeColumns.ucrAvailableDataFrames.cboAvailableDataFrames.Text & "_transposed") End If End Sub - Private Sub CoreName_ControlValueChanged(ucrChangedControl As ucrCore) Handles ucrSelectorTransposeColumns.ControlValueChanged NewDefaultName() End Sub - - Private Sub CoreControls_ControlContentsChanged(ucrChangedControl As ucrCore) Handles ucrReceiverColumsToTranspose.ControlContentsChanged, ucrNewDataframe.ControlContentsChanged + Private Sub ucrReceiverColumnsToTranspose_ControlValueChanged(ucrChangedControl As ucrCore) Handles ucrReceiverColumnsToTranspose.ControlValueChanged + ucrBase.clsRsyntax.lstBeforeCodes.Clear() + clsGetColumnNamesFunction = ucrReceiverColumnsToTranspose.GetVariables(True).Clone + clsGetColumnNamesFunction.SetAssignTo("columns") + ucrBase.clsRsyntax.AddToBeforeCodes(clsGetColumnNamesFunction) + If ucrReceiverColumnsToTranspose.IsEmpty AndAlso lstEditedVariables.Count > 0 Then + UpdateSelector() + ucrReceiverColumnsToTranspose.SetMeAsReceiver() + End If + If ucrReceiverColumnsToTranspose.IsEmpty Then + ucrReceiverVariableNames.Clear() + End If + End Sub + Private Sub UpdateSelector() + ClearSelector() + If bResettingDialogue Then + For i = 0 To lstAllVariables.Count - 1 + ucrSelectorTransposeColumns.lstAvailableVariable.Items.Add(lstAllVariables.Item(i)) + ucrSelectorTransposeColumns.lstAvailableVariable.Items(i).Tag = ucrSelectorTransposeColumns.ucrAvailableDataFrames.cboAvailableDataFrames.Text + Next + Else + For i = 0 To lstEditedVariables.Count - 1 + ucrSelectorTransposeColumns.lstAvailableVariable.Items.Add(lstEditedVariables.Item(i)) + ucrSelectorTransposeColumns.lstAvailableVariable.Items(i).Tag = ucrSelectorTransposeColumns.ucrAvailableDataFrames.cboAvailableDataFrames.Text + Next + End If + End Sub + Private Sub ClearSelector() + ucrSelectorTransposeColumns.lstAvailableVariable.Clear() + ucrSelectorTransposeColumns.lstAvailableVariable.Groups.Clear() + ucrSelectorTransposeColumns.lstAvailableVariable.Columns.Add("Variables") + End Sub + Private Sub ucrReceiverVariableNames_Enter(sender As Object, e As EventArgs) Handles ucrReceiverVariableNames.Enter + Dim grps As New ListViewGroup + ClearSelector() + If Not ucrReceiverColumnsToTranspose.IsEmpty Then + If ucrReceiverColumnsToTranspose.GetVariableNamesList(False).Count > 1 Then + grps = New ListViewGroup(key:=ucrSelectorTransposeColumns.ucrAvailableDataFrames.cboAvailableDataFrames.Text, + headerText:=ucrSelectorTransposeColumns.ucrAvailableDataFrames.cboAvailableDataFrames.Text) + ucrSelectorTransposeColumns.lstAvailableVariable.Groups.Add(grps) + End If + For j = 0 To ucrReceiverColumnsToTranspose.GetVariableNamesList(False).Count - 1 + ucrSelectorTransposeColumns.lstAvailableVariable.Items.Add(ucrReceiverColumnsToTranspose.GetVariableNamesList(False)(j)) + ucrSelectorTransposeColumns.lstAvailableVariable.Items(j).Tag = ucrSelectorTransposeColumns.ucrAvailableDataFrames.cboAvailableDataFrames.Text + ucrSelectorTransposeColumns.lstAvailableVariable.Items(j).ToolTipText = ucrReceiverColumnsToTranspose.GetVariableNamesList(False)(0) + Next + End If + End Sub + Private Sub ucrSelectorTransposeColumns_DataFrameChanged() Handles ucrSelectorTransposeColumns.DataFrameChanged + If Not bResettingDialogue Then + If ucrSelectorTransposeColumns.lstAvailableVariable.Items.Count > 0 Then + lstEditedVariables.Clear() + lstAllVariables.Clear() + For Each lstv As ListViewItem In ucrSelectorTransposeColumns.lstAvailableVariable.Items + lstAllVariables.Add(lstv.Text) + lstEditedVariables.Add(lstv.Text) + Next + End If + End If + End Sub + Private Sub ucrReceiverColumnsToTranspose_Enter(sender As Object, e As EventArgs) Handles ucrReceiverColumnsToTranspose.Enter + bResettingDialogue = True + UpdateSelector() + bResettingDialogue = False + 'If Not ucrReceiverColumnsToTranspose.IsEmpty AndAlso + ' ucrSelectorTransposeColumns.lstAvailableVariable.Items.Count > 0 Then + ' UpdateSelector() + 'End If + End Sub + Private Sub CoreControls_ControlContentsChanged(ucrChangedControl As ucrCore) Handles ucrReceiverColumnsToTranspose.ControlContentsChanged, + ucrNewDataframe.ControlContentsChanged, ucrReceiverVariableNames.ControlContentsChanged, ucrChkDisplayVariableNames.ControlContentsChanged, + ucrInputDisplayVariableNames.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 7c70f2d0d38..de09ec0bda9 100644 --- a/instat/dlgViewLabelsAndLevels.Designer.vb +++ b/instat/dlgViewLabelsAndLevels.Designer.vb @@ -40,20 +40,28 @@ 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.ucrChkMaxLabels = New instat.ucrCheck() + 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.rdoDeleteValueLabels = New System.Windows.Forms.RadioButton() + Me.rdoViewLabels = New System.Windows.Forms.RadioButton() + Me.rdoSelectedColumn = New System.Windows.Forms.RadioButton() + Me.rdoWholeDataFrame = New System.Windows.Forms.RadioButton() + Me.ucrPnlSelectData = New instat.UcrPanel() + Me.ucrPnlOptions = New instat.UcrPanel() Me.ucrBase = New instat.ucrButtons() Me.ucrReceiverVariables = New instat.ucrReceiverMultiple() Me.ucrSelectorViewLabelsAndLevels = New instat.ucrSelectorByDataFrameAddRemove() + Me.ucrNudMaxLength = New instat.ucrNud() Me.grpSummaryStatistics.SuspendLayout() Me.grpDisplayOptions.SuspendLayout() Me.grpLabels.SuspendLayout() @@ -63,7 +71,7 @@ Partial Class dlgViewFactorLabels ' Me.lblFactorColumns.AutoSize = True Me.lblFactorColumns.ImeMode = System.Windows.Forms.ImeMode.NoControl - Me.lblFactorColumns.Location = New System.Drawing.Point(303, 45) + Me.lblFactorColumns.Location = New System.Drawing.Point(295, 67) Me.lblFactorColumns.Name = "lblFactorColumns" Me.lblFactorColumns.Size = New System.Drawing.Size(97, 13) Me.lblFactorColumns.TabIndex = 1 @@ -74,33 +82,98 @@ Partial Class dlgViewFactorLabels Me.grpSummaryStatistics.Controls.Add(Me.ucrChkShowPercentage) Me.grpSummaryStatistics.Controls.Add(Me.ucrChkShowFrequencies) Me.grpSummaryStatistics.Controls.Add(Me.ucrChkShowMissingValues) - Me.grpSummaryStatistics.Location = New System.Drawing.Point(202, 199) + Me.grpSummaryStatistics.Location = New System.Drawing.Point(202, 242) Me.grpSummaryStatistics.Name = "grpSummaryStatistics" - Me.grpSummaryStatistics.Size = New System.Drawing.Size(166, 90) + Me.grpSummaryStatistics.Size = New System.Drawing.Size(166, 95) Me.grpSummaryStatistics.TabIndex = 4 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, 42) + 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, 18) + 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, 66) + Me.ucrChkShowMissingValues.Name = "ucrChkShowMissingValues" + Me.ucrChkShowMissingValues.Size = New System.Drawing.Size(143, 23) + Me.ucrChkShowMissingValues.TabIndex = 2 + ' 'grpDisplayOptions ' + Me.grpDisplayOptions.Controls.Add(Me.ucrNudMaxLength) + Me.grpDisplayOptions.Controls.Add(Me.ucrChkMaxLabels) Me.grpDisplayOptions.Controls.Add(Me.ucrChkSortByName) Me.grpDisplayOptions.Controls.Add(Me.ucrChkAlternateColour) Me.grpDisplayOptions.Controls.Add(Me.ucrChkShowId) - Me.grpDisplayOptions.Location = New System.Drawing.Point(374, 199) + Me.grpDisplayOptions.Location = New System.Drawing.Point(374, 220) Me.grpDisplayOptions.Name = "grpDisplayOptions" - Me.grpDisplayOptions.Size = New System.Drawing.Size(152, 90) + Me.grpDisplayOptions.Size = New System.Drawing.Size(152, 117) Me.grpDisplayOptions.TabIndex = 5 Me.grpDisplayOptions.TabStop = False Me.grpDisplayOptions.Text = "Display Options" ' + 'ucrChkMaxLabels + ' + Me.ucrChkMaxLabels.AutoSize = True + Me.ucrChkMaxLabels.Checked = False + Me.ucrChkMaxLabels.Location = New System.Drawing.Point(4, 88) + Me.ucrChkMaxLabels.Name = "ucrChkMaxLabels" + Me.ucrChkMaxLabels.Size = New System.Drawing.Size(84, 23) + Me.ucrChkMaxLabels.TabIndex = 13 + ' + 'ucrChkSortByName + ' + Me.ucrChkSortByName.AutoSize = True + Me.ucrChkSortByName.Checked = False + Me.ucrChkSortByName.Location = New System.Drawing.Point(4, 40) + 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, 64) + 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, 16) + Me.ucrChkShowId.Name = "ucrChkShowId" + Me.ucrChkShowId.Size = New System.Drawing.Size(133, 23) + Me.ucrChkShowId.TabIndex = 0 + ' 'grpLabels ' Me.grpLabels.Controls.Add(Me.ucrChkShowType) Me.grpLabels.Controls.Add(Me.ucrChkShowValues) Me.grpLabels.Controls.Add(Me.ucrChkShowLabels) - Me.grpLabels.Location = New System.Drawing.Point(2, 199) + Me.grpLabels.Location = New System.Drawing.Point(2, 242) Me.grpLabels.Name = "grpLabels" - Me.grpLabels.Size = New System.Drawing.Size(194, 90) + Me.grpLabels.Size = New System.Drawing.Size(194, 95) Me.grpLabels.TabIndex = 3 Me.grpLabels.TabStop = False Me.grpLabels.Text = "Variable Options" @@ -127,70 +200,85 @@ Partial Class dlgViewFactorLabels ' Me.ucrChkShowLabels.AutoSize = True Me.ucrChkShowLabels.Checked = False - Me.ucrChkShowLabels.Location = New System.Drawing.Point(3, 42) + Me.ucrChkShowLabels.Location = New System.Drawing.Point(4, 42) Me.ucrChkShowLabels.Name = "ucrChkShowLabels" - Me.ucrChkShowLabels.Size = New System.Drawing.Size(190, 23) + Me.ucrChkShowLabels.Size = New System.Drawing.Size(174, 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 + 'rdoDeleteValueLabels + ' + Me.rdoDeleteValueLabels.Appearance = System.Windows.Forms.Appearance.Button + Me.rdoDeleteValueLabels.FlatAppearance.BorderColor = System.Drawing.SystemColors.ActiveCaption + Me.rdoDeleteValueLabels.FlatAppearance.BorderSize = 2 + Me.rdoDeleteValueLabels.FlatAppearance.CheckedBackColor = System.Drawing.SystemColors.ActiveCaption + Me.rdoDeleteValueLabels.FlatStyle = System.Windows.Forms.FlatStyle.Flat + Me.rdoDeleteValueLabels.Location = New System.Drawing.Point(267, 12) + Me.rdoDeleteValueLabels.Name = "rdoDeleteValueLabels" + Me.rdoDeleteValueLabels.Size = New System.Drawing.Size(121, 28) + Me.rdoDeleteValueLabels.TabIndex = 9 + Me.rdoDeleteValueLabels.TabStop = True + Me.rdoDeleteValueLabels.Text = "Delete Value Labels" + Me.rdoDeleteValueLabels.TextAlign = System.Drawing.ContentAlignment.MiddleCenter + Me.rdoDeleteValueLabels.UseVisualStyleBackColor = True + ' + 'rdoViewLabels + ' + Me.rdoViewLabels.Appearance = System.Windows.Forms.Appearance.Button + Me.rdoViewLabels.FlatAppearance.BorderColor = System.Drawing.SystemColors.ActiveCaption + Me.rdoViewLabels.FlatAppearance.BorderSize = 2 + Me.rdoViewLabels.FlatAppearance.CheckedBackColor = System.Drawing.SystemColors.ActiveCaption + Me.rdoViewLabels.FlatStyle = System.Windows.Forms.FlatStyle.Flat + Me.rdoViewLabels.Location = New System.Drawing.Point(151, 12) + Me.rdoViewLabels.Name = "rdoViewLabels" + Me.rdoViewLabels.Size = New System.Drawing.Size(121, 28) + Me.rdoViewLabels.TabIndex = 8 + Me.rdoViewLabels.TabStop = True + Me.rdoViewLabels.Text = "View Labels/Levels" + Me.rdoViewLabels.TextAlign = System.Drawing.ContentAlignment.MiddleCenter + Me.rdoViewLabels.UseVisualStyleBackColor = True + ' + 'rdoSelectedColumn + ' + Me.rdoSelectedColumn.Location = New System.Drawing.Point(302, 82) + Me.rdoSelectedColumn.Name = "rdoSelectedColumn" + Me.rdoSelectedColumn.Size = New System.Drawing.Size(174, 24) + Me.rdoSelectedColumn.TabIndex = 12 + Me.rdoSelectedColumn.TabStop = True + Me.rdoSelectedColumn.Text = "Selected Variables:" + Me.rdoSelectedColumn.UseVisualStyleBackColor = True + ' + 'rdoWholeDataFrame + ' + Me.rdoWholeDataFrame.AutoSize = True + Me.rdoWholeDataFrame.Location = New System.Drawing.Point(302, 59) + Me.rdoWholeDataFrame.Name = "rdoWholeDataFrame" + Me.rdoWholeDataFrame.Size = New System.Drawing.Size(80, 17) + Me.rdoWholeDataFrame.TabIndex = 11 + Me.rdoWholeDataFrame.TabStop = True + Me.rdoWholeDataFrame.Text = "Data Frame" + Me.rdoWholeDataFrame.UseVisualStyleBackColor = True + ' + 'ucrPnlSelectData + ' + Me.ucrPnlSelectData.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink + Me.ucrPnlSelectData.Location = New System.Drawing.Point(300, 59) + Me.ucrPnlSelectData.Name = "ucrPnlSelectData" + Me.ucrPnlSelectData.Size = New System.Drawing.Size(142, 49) + Me.ucrPnlSelectData.TabIndex = 10 + ' + 'ucrPnlOptions + ' + Me.ucrPnlOptions.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink + Me.ucrPnlOptions.Location = New System.Drawing.Point(145, 2) + Me.ucrPnlOptions.Name = "ucrPnlOptions" + Me.ucrPnlOptions.Size = New System.Drawing.Size(250, 46) + Me.ucrPnlOptions.TabIndex = 7 ' 'ucrBase ' Me.ucrBase.AutoSize = True Me.ucrBase.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink - Me.ucrBase.Location = New System.Drawing.Point(10, 295) + Me.ucrBase.Location = New System.Drawing.Point(10, 345) Me.ucrBase.Name = "ucrBase" Me.ucrBase.Size = New System.Drawing.Size(405, 52) Me.ucrBase.TabIndex = 6 @@ -199,7 +287,7 @@ Partial Class dlgViewFactorLabels ' Me.ucrReceiverVariables.AutoSize = True Me.ucrReceiverVariables.frmParent = Me - Me.ucrReceiverVariables.Location = New System.Drawing.Point(300, 60) + Me.ucrReceiverVariables.Location = New System.Drawing.Point(295, 84) Me.ucrReceiverVariables.Margin = New System.Windows.Forms.Padding(0) Me.ucrReceiverVariables.Name = "ucrReceiverVariables" Me.ucrReceiverVariables.Selector = Nothing @@ -214,18 +302,37 @@ Partial Class dlgViewFactorLabels Me.ucrSelectorViewLabelsAndLevels.bDropUnusedFilterLevels = False Me.ucrSelectorViewLabelsAndLevels.bShowHiddenColumns = False Me.ucrSelectorViewLabelsAndLevels.bUseCurrentFilter = True - Me.ucrSelectorViewLabelsAndLevels.Location = New System.Drawing.Point(10, 10) + Me.ucrSelectorViewLabelsAndLevels.Location = New System.Drawing.Point(10, 52) Me.ucrSelectorViewLabelsAndLevels.Margin = New System.Windows.Forms.Padding(0) Me.ucrSelectorViewLabelsAndLevels.Name = "ucrSelectorViewLabelsAndLevels" Me.ucrSelectorViewLabelsAndLevels.Size = New System.Drawing.Size(213, 183) Me.ucrSelectorViewLabelsAndLevels.TabIndex = 0 ' + 'ucrNudMaxLength + ' + Me.ucrNudMaxLength.AutoSize = True + Me.ucrNudMaxLength.DecimalPlaces = New Decimal(New Integer() {0, 0, 0, 0}) + Me.ucrNudMaxLength.Increment = New Decimal(New Integer() {1, 0, 0, 0}) + Me.ucrNudMaxLength.Location = New System.Drawing.Point(94, 88) + Me.ucrNudMaxLength.Maximum = New Decimal(New Integer() {100, 0, 0, 0}) + Me.ucrNudMaxLength.Minimum = New Decimal(New Integer() {0, 0, 0, 0}) + Me.ucrNudMaxLength.Name = "ucrNudMaxLength" + Me.ucrNudMaxLength.Size = New System.Drawing.Size(50, 20) + Me.ucrNudMaxLength.TabIndex = 13 + Me.ucrNudMaxLength.Value = New Decimal(New Integer() {0, 0, 0, 0}) + ' 'dlgViewFactorLabels ' 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(528, 351) + Me.ClientSize = New System.Drawing.Size(528, 401) + Me.Controls.Add(Me.rdoSelectedColumn) + Me.Controls.Add(Me.rdoWholeDataFrame) + Me.Controls.Add(Me.ucrPnlSelectData) + Me.Controls.Add(Me.rdoDeleteValueLabels) + Me.Controls.Add(Me.rdoViewLabels) + Me.Controls.Add(Me.ucrPnlOptions) Me.Controls.Add(Me.grpLabels) Me.Controls.Add(Me.grpDisplayOptions) Me.Controls.Add(Me.grpSummaryStatistics) @@ -266,4 +373,12 @@ Partial Class dlgViewFactorLabels Friend WithEvents ucrChkAlternateColour As ucrCheck Friend WithEvents grpLabels As GroupBox Friend WithEvents grpDisplayOptions As GroupBox + Friend WithEvents rdoDeleteValueLabels As RadioButton + Friend WithEvents rdoViewLabels As RadioButton + Friend WithEvents ucrPnlOptions As UcrPanel + Friend WithEvents rdoSelectedColumn As RadioButton + Friend WithEvents rdoWholeDataFrame As RadioButton + Friend WithEvents ucrPnlSelectData As UcrPanel + Friend WithEvents ucrChkMaxLabels As ucrCheck + Friend WithEvents ucrNudMaxLength As ucrNud End Class diff --git a/instat/dlgViewLabelsAndLevels.vb b/instat/dlgViewLabelsAndLevels.vb index 7e188bb647d..3c3844415db 100644 --- a/instat/dlgViewLabelsAndLevels.vb +++ b/instat/dlgViewLabelsAndLevels.vb @@ -14,11 +14,14 @@ ' You should have received a copy of the GNU General Public License ' along with this program. If not, see . +Imports RDotNet Imports instat.Translations Public Class dlgViewFactorLabels Private bFirstLoad As Boolean = True Private bReset As Boolean = True - Private clsViewFunction, clsSelect As RFunction + Private strCurrDataFrame As String + Private clsViewFunction, clsSelectFunction, clsDeleteLabelsFunction As New RFunction + Private clsDummyDataFunction As New RFunction Private Sub dlgLabelAndLevels_Load(sender As Object, e As EventArgs) Handles MyBase.Load If bFirstLoad Then @@ -30,22 +33,24 @@ Public Class dlgViewFactorLabels End If SetRCodeForControls(bReset) bReset = False + SetReceiverVariableVisible() TestOkEnabled() autoTranslate(Me) End Sub Private Sub InitialiseDialog() + Dim lstOfControls As New List(Of Control) + ucrBase.iHelpTopicID = 517 ucrBase.clsRsyntax.iCallType = 2 - ucrReceiverVariables.SetParameter(New RParameter("x", 1)) + ucrReceiverVariables.SetParameter(New RParameter("col_names", 1)) ucrReceiverVariables.SetParameterIsString() ucrReceiverVariables.SetParameterIncludeArgumentName(False) - ucrReceiverVariables.bWithQuotes = False ucrReceiverVariables.SetIncludedDataTypes({"factor", "numeric"}) ucrReceiverVariables.Selector = ucrSelectorViewLabelsAndLevels ucrReceiverVariables.SetMeAsReceiver() - ucrSelectorViewLabelsAndLevels.SetParameter(New RParameter(".data", 0)) + ucrSelectorViewLabelsAndLevels.SetParameter(New RParameter("data_name", 0)) ucrSelectorViewLabelsAndLevels.SetParameterIsrfunction() ucrChkShowLabels.SetParameter(New RParameter("show.labels", 1)) @@ -83,11 +88,36 @@ Public Class dlgViewFactorLabels ucrChkSortByName.SetParameter(New RParameter("sort.by.name", 9)) ucrChkSortByName.SetText("Sort by Name") ucrChkSortByName.SetRDefault("FALSE") + + ucrChkMaxLabels.SetText("Max Labels") + ucrChkMaxLabels.SetParameter(New RParameter("check", 1)) + ucrChkMaxLabels.SetValuesCheckedAndUnchecked("TRUE", "FALSE") + ucrChkMaxLabels.AddToLinkedControls({ucrNudMaxLength}, {True}, bNewLinkedAddRemoveParameter:=True, bNewLinkedHideIfParameterMissing:=True, bNewLinkedChangeToDefaultState:=True, objNewDefaultState:="15") + + ucrNudMaxLength.SetParameter(New RParameter("max.len", 10)) + ucrNudMaxLength.Increment = 1 + ucrNudMaxLength.Minimum = 1 + + ucrPnlSelectData.SetParameter(New RParameter("checked", 0)) + ucrPnlSelectData.AddRadioButton(rdoWholeDataFrame, "data") + ucrPnlSelectData.AddRadioButton(rdoSelectedColumn, "column") + + ucrPnlOptions.AddRadioButton(rdoViewLabels) + ucrPnlOptions.AddRadioButton(rdoDeleteValueLabels) + ucrPnlOptions.AddFunctionNamesCondition(rdoViewLabels, "view_df") + ucrPnlOptions.AddFunctionNamesCondition(rdoDeleteValueLabels, frmMain.clsRLink.strInstatDataObject & "$append_to_variables_metadata") + ucrPnlOptions.AddToLinkedControls(ucrChkShowValues, {rdoViewLabels}, bNewLinkedHideIfParameterMissing:=True) + ucrPnlOptions.AddToLinkedControls(ucrReceiverVariables, {rdoViewLabels, rdoDeleteValueLabels}, bNewLinkedHideIfParameterMissing:=True) + ucrPnlOptions.AddToLinkedControls(ucrPnlSelectData, {rdoDeleteValueLabels}, bNewLinkedHideIfParameterMissing:=True) + lstOfControls.AddRange({grpDisplayOptions, grpLabels, grpSummaryStatistics, lblFactorColumns}) + ucrChkShowValues.SetLinkedDisplayControl(lstOfControls) End Sub Private Sub SetDefaults() clsViewFunction = New RFunction - clsSelect = New RFunction + clsSelectFunction = New RFunction + clsDeleteLabelsFunction = New RFunction + clsDummyDataFunction = New RFunction 'Reset ucrSelectorViewLabelsAndLevels.Reset() @@ -95,16 +125,25 @@ Public Class dlgViewFactorLabels clsViewFunction.SetPackageName("sjPlot") clsViewFunction.SetRCommand("view_df") - clsSelect.SetPackageName("dplyr") - clsSelect.SetRCommand("select") + clsDummyDataFunction.AddParameter("checked", "data", iPosition:=0) + clsDummyDataFunction.AddParameter("check", "FALSE", iPosition:=1) + + clsSelectFunction.SetAssignTo("selected_variables") - clsViewFunction.AddParameter("x", clsRFunctionParameter:=clsSelect) + clsDeleteLabelsFunction.SetRCommand(frmMain.clsRLink.strInstatDataObject & "$append_to_variables_metadata") + clsDeleteLabelsFunction.AddParameter("property", Chr(34) & "labels" & Chr(34), iPosition:=2) + clsDeleteLabelsFunction.AddParameter("new_val", Chr(34) & Chr(34), iPosition:=3) + + clsViewFunction.AddParameter("x", "selected_variables", iPosition:=0) clsViewFunction.AddParameter("show.frq", "TRUE") clsViewFunction.AddParameter("show.id", "FALSE") ucrBase.clsRsyntax.SetBaseRFunction(clsViewFunction) End Sub Private Sub SetRCodeForControls(bReset As Boolean) + ucrPnlOptions.SetRCode(ucrBase.clsRsyntax.clsBaseFunction, bReset) + ucrReceiverVariables.AddAdditionalCodeParameterPair(clsDeleteLabelsFunction, New RParameter("col_names", 1), iAdditionalPairNo:=1) + ucrChkAlternateColour.SetRCode(clsViewFunction, bReset) ucrChkShowFrequencies.SetRCode(clsViewFunction, bReset) ucrChkShowId.SetRCode(clsViewFunction, bReset) @@ -114,15 +153,28 @@ Public Class dlgViewFactorLabels ucrChkShowPercentage.SetRCode(clsViewFunction, bReset) ucrChkShowType.SetRCode(clsViewFunction, bReset) ucrChkShowValues.SetRCode(clsViewFunction, bReset) - ucrReceiverVariables.SetRCode(clsSelect, bReset) - ucrSelectorViewLabelsAndLevels.SetRCode(clsSelect, bReset) + ucrChkMaxLabels.SetRCode(clsDummyDataFunction, bReset) + ucrNudMaxLength.SetRCode(clsViewFunction, bReset) + ucrReceiverVariables.SetRCode(clsSelectFunction, bReset) + ucrPnlSelectData.SetRCode(clsDummyDataFunction, bReset) End Sub Private Sub TestOkEnabled() - If (Not (ucrReceiverVariables.IsEmpty) AndAlso (ucrChkShowLabels.Checked OrElse ucrChkShowType.Checked OrElse ucrChkShowValues.Checked OrElse ucrChkShowFrequencies.Checked OrElse ucrChkShowPercentage.Checked)) Then - ucrBase.OKEnabled(True) + If rdoViewLabels.Checked Then + If Not ucrReceiverVariables.IsEmpty AndAlso (ucrChkShowLabels.Checked OrElse ucrChkShowType.Checked OrElse + ucrChkShowValues.Checked OrElse ucrChkShowFrequencies.Checked OrElse ucrChkShowPercentage.Checked) Then + ucrBase.OKEnabled(True) + Else + ucrBase.OKEnabled(False) + End If Else - ucrBase.OKEnabled(False) + If rdoWholeDataFrame.Checked Then + ucrBase.OKEnabled(True) + ElseIf rdoSelectedColumn.Checked AndAlso Not ucrReceiverVariables.IsEmpty Then + ucrBase.OKEnabled(True) + Else + ucrBase.OKEnabled(False) + End If End If End Sub @@ -132,7 +184,41 @@ Public Class dlgViewFactorLabels TestOkEnabled() End Sub - Private Sub ucrReceiverFactorColumns_ControlContentsChanged(ucrChangedControl As ucrCore) Handles ucrReceiverVariables.ControlContentsChanged, ucrChkShowFrequencies.ControlContentsChanged, ucrChkShowLabels.ControlContentsChanged, ucrChkShowPercentage.ControlContentsChanged, ucrChkShowType.ControlContentsChanged, ucrChkShowValues.ControlContentsChanged + Private Sub SetReceiverVariableVisible() + If rdoDeleteValueLabels.Checked Then + ucrReceiverVariables.Visible = rdoSelectedColumn.Checked + End If + End Sub + + Private Sub ucrPnlSelectData_ControlValueChanged(ucrChangedControl As ucrCore) Handles ucrPnlSelectData.ControlValueChanged, ucrPnlOptions.ControlValueChanged, ucrReceiverVariables.ControlValueChanged + SetReceiverVariableVisible() + If rdoViewLabels.Checked Then + ucrReceiverVariables.SetParameterIsRFunction() + ucrReceiverVariables.Location = New System.Drawing.Point(295, 84) + ucrSelectorViewLabelsAndLevels.HideShowAddOrDataOptionsOrListView(True, True, True) + ucrReceiverVariables.bWithQuotes = False + ucrBase.clsRsyntax.AddToBeforeCodes(clsSelectFunction) + ucrBase.clsRsyntax.SetBaseRFunction(clsViewFunction) + Else + ucrBase.clsRsyntax.RemoveFromBeforeCodes(clsSelectFunction) + ucrReceiverVariables.Location = New System.Drawing.Point(302, 109) + ucrReceiverVariables.bWithQuotes = True + strCurrDataFrame = ucrSelectorViewLabelsAndLevels.ucrAvailableDataFrames.strCurrDataFrame + clsDeleteLabelsFunction.AddParameter("data_name", Chr(34) & strCurrDataFrame & Chr(34), iPosition:=0) + ucrBase.clsRsyntax.SetBaseRFunction(clsDeleteLabelsFunction) + If rdoWholeDataFrame.Checked Then + ucrSelectorViewLabelsAndLevels.HideShowAddOrDataOptionsOrListView(False, False, False) + clsDeleteLabelsFunction.RemoveParameterByName("col_names") + ElseIf rdoSelectedColumn.Checked Then + ucrSelectorViewLabelsAndLevels.HideShowAddOrDataOptionsOrListView(True, True, True) + clsDeleteLabelsFunction.AddParameter("col_names", ucrReceiverVariables.GetVariableNames(bWithQuotes:=True), iPosition:=1) + End If + End If + End Sub + + Private Sub ucrReceiverFactorColumns_ControlContentsChanged(ucrChangedControl As ucrCore) Handles ucrReceiverVariables.ControlContentsChanged, + ucrChkShowFrequencies.ControlContentsChanged, ucrChkShowLabels.ControlContentsChanged, ucrChkShowPercentage.ControlContentsChanged, + ucrChkShowType.ControlContentsChanged, ucrChkShowValues.ControlContentsChanged, ucrPnlSelectData.ControlContentsChanged, ucrPnlOptions.ControlContentsChanged TestOkEnabled() End Sub End Class \ No newline at end of file diff --git a/instat/dlgViewObjects.vb b/instat/dlgViewObjects.vb index e62558ca124..73b2b928fd4 100644 --- a/instat/dlgViewObjects.vb +++ b/instat/dlgViewObjects.vb @@ -20,8 +20,8 @@ Imports RDotNet Public Class dlgViewObjects Private bFirstLoad As Boolean = True Private bReset As Boolean = True - Private clsGetObjectsFunction As RFunction - Private clsShowObjectStructureFunction As RFunction + Private clsGetObjectsFunction As New RFunction + Private clsShowObjectStructureFunction As New RFunction Private Sub dlgViewObjects_Load(sender As Object, e As EventArgs) Handles MyBase.Load If bFirstLoad Then diff --git a/instat/dlgWindPollutionRose.vb b/instat/dlgWindPollutionRose.vb index bfc9e1c92ce..c34d8af07ce 100644 --- a/instat/dlgWindPollutionRose.vb +++ b/instat/dlgWindPollutionRose.vb @@ -20,7 +20,7 @@ Public Class dlgWindPollutionRose Private bFirstLoad As Boolean = True Private bReset As Boolean = True 'Functions - Private clsPollutionRoseFunction As RFunction + Private clsPollutionRoseFunction As New RFunction Private Sub dlgPollutionRose_Load(sender As Object, e As EventArgs) Handles MyBase.Load If bFirstLoad Then diff --git a/instat/frmConvertToNumeric.Designer.vb b/instat/frmConvertToNumeric.Designer.vb index 3f239221a08..2bee26b9df8 100644 --- a/instat/frmConvertToNumeric.Designer.vb +++ b/instat/frmConvertToNumeric.Designer.vb @@ -33,6 +33,7 @@ Partial Class frmConvertToNumeric Me.lblColumnName = New System.Windows.Forms.Label() Me.lblNumber = New System.Windows.Forms.Label() Me.cmdInspectValues = New System.Windows.Forms.Button() + Me.lblOrdinal = New System.Windows.Forms.Label() Me.SuspendLayout() ' 'lblPossibleSolutions @@ -58,7 +59,7 @@ Partial Class frmConvertToNumeric Me.cmdLabelledConvert.Name = "cmdLabelledConvert" Me.cmdLabelledConvert.Size = New System.Drawing.Size(96, 23) Me.cmdLabelledConvert.TabIndex = 7 - Me.cmdLabelledConvert.Text = "Labelled Convert" + Me.cmdLabelledConvert.Text = "Lebelled Convert" Me.cmdLabelledConvert.UseVisualStyleBackColor = True ' 'cmdHelp @@ -124,11 +125,22 @@ Partial Class frmConvertToNumeric Me.cmdInspectValues.Text = "Inspect Values" Me.cmdInspectValues.UseVisualStyleBackColor = True ' + 'lblOrdinal + ' + Me.lblOrdinal.AutoSize = True + Me.lblOrdinal.ForeColor = System.Drawing.Color.Red + Me.lblOrdinal.Location = New System.Drawing.Point(65, 95) + Me.lblOrdinal.Name = "lblOrdinal" + Me.lblOrdinal.Size = New System.Drawing.Size(43, 13) + Me.lblOrdinal.TabIndex = 10 + Me.lblOrdinal.Text = "Ordinal " + ' 'frmConvertToNumeric ' Me.AutoScaleDimensions = New System.Drawing.SizeF(96.0!, 96.0!) Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi Me.ClientSize = New System.Drawing.Size(440, 171) + Me.Controls.Add(Me.lblOrdinal) Me.Controls.Add(Me.cmdInspectValues) Me.Controls.Add(Me.lblNumber) Me.Controls.Add(Me.lblColumnName) @@ -159,4 +171,5 @@ Partial Class frmConvertToNumeric Friend WithEvents lblColumnName As Label Friend WithEvents lblNumber As Label Friend WithEvents cmdInspectValues As Button + Friend WithEvents lblOrdinal As Label End Class diff --git a/instat/frmConvertToNumeric.vb b/instat/frmConvertToNumeric.vb index 13d16619745..c3c5f3bfd47 100644 --- a/instat/frmConvertToNumeric.vb +++ b/instat/frmConvertToNumeric.vb @@ -30,6 +30,15 @@ strDataFrameName = strDataFrame End Sub + Public Sub CheckLabels(bCheck As Boolean) + If bCheck Then + cmdLabelledConvert.Text = "Labelled Convert" + Else + cmdLabelledConvert.Text = "Ordinal Convert" + End If + lblOrdinal.Visible = Not bCheck + End Sub + Private Sub frmConvertToNumeric_FormClosing(sender As Object, e As FormClosingEventArgs) Handles Me.FormClosing If e.CloseReason = CloseReason.UserClosing Then Me.DialogResult = DialogResult.Cancel diff --git a/instat/frmEditor.vb b/instat/frmEditor.vb index e950eaf3330..00fddc70d7d 100644 --- a/instat/frmEditor.vb +++ b/instat/frmEditor.vb @@ -21,6 +21,10 @@ Imports System.Threading Imports instat.Translations Imports unvell.ReoGrid.Events +''' +''' todo. As of 22/04/2022 this form is not used anywhere in R-instat +''' Should it be deleted? +''' Public Class frmEditor 'Public clearFilter As unvell.ReoGrid.Data.AutoColumnFilter Public WithEvents grdCurrSheet As unvell.ReoGrid.Worksheet @@ -326,7 +330,6 @@ Public Class frmEditor grdCurrSheet = grdData.CurrentWorksheet If grdCurrSheet IsNot Nothing AndAlso frmMain.clsRLink.GetDataFrameNames().Contains(grdCurrSheet.Name) Then UpdateRFunctionDataFrameParameters() - frmMain.strCurrentDataFrame = grdCurrSheet.Name frmMain.tstatus.Text = grdCurrSheet.Name grdCurrSheet.SelectionForwardDirection = unvell.ReoGrid.SelectionForwardDirection.Down grdCurrSheet.SetSettings(unvell.ReoGrid.WorksheetSettings.Edit_DragSelectionToMoveCells, False) diff --git a/instat/frmMain.Designer.vb b/instat/frmMain.Designer.vb index ed33c843f6d..807c7e5c1ea 100644 --- a/instat/frmMain.Designer.vb +++ b/instat/frmMain.Designer.vb @@ -48,20 +48,16 @@ Partial Class frmMain Me.ToolStripSeparator33 = New System.Windows.Forms.ToolStripSeparator() Me.mnuDescribeOneVariableFrequencies = New System.Windows.Forms.ToolStripMenuItem() Me.mnuDescribeOneVariableRatingData = New System.Windows.Forms.ToolStripMenuItem() - Me.mnuDescribeTwoVariables = New System.Windows.Forms.ToolStripMenuItem() + Me.mnuDescribeTwoThreeVariables = New System.Windows.Forms.ToolStripMenuItem() Me.mnuDescribeTwoVariablesSummarise = New System.Windows.Forms.ToolStripMenuItem() Me.mnuDescribeTwoVariablesGraph = New System.Windows.Forms.ToolStripMenuItem() Me.ToolStripSeparator34 = New System.Windows.Forms.ToolStripSeparator() - Me.mnuDescribeTwoVariablesFrequencies = New System.Windows.Forms.ToolStripMenuItem() - Me.mnuDescribeTwoVariablesPivotTable = New System.Windows.Forms.ToolStripMenuItem() - Me.mnuDescribeThreeVariable = New System.Windows.Forms.ToolStripMenuItem() - Me.mnuDescribeThreeVariableSummarise = New System.Windows.Forms.ToolStripMenuItem() - Me.mnuDescribeThreeVariableGraph = New System.Windows.Forms.ToolStripMenuItem() + Me.mnuDescribeTwoThreeVariablesCorrelations = New System.Windows.Forms.ToolStripMenuItem() + Me.mnuDescribeTwoThreeVariablesTwoWayFrequencies = New System.Windows.Forms.ToolStripMenuItem() + Me.mnuDescribeTwoThreeVariablesThreeWayFrequencies = New System.Windows.Forms.ToolStripMenuItem() Me.ToolStripSeparator36 = New System.Windows.Forms.ToolStripSeparator() - Me.mnuDescribeThreeVariableFrequencies = New System.Windows.Forms.ToolStripMenuItem() - Me.mnuDescribeThreeVariablePivotTable = New System.Windows.Forms.ToolStripMenuItem() + Me.mnuDescribeTwoThreeVariablesPivotTable = New System.Windows.Forms.ToolStripMenuItem() Me.mnuDescribeSpecificTablesGraphs = New System.Windows.Forms.ToolStripMenuItem() - Me.mnuDescribeSpecificFrequency = New System.Windows.Forms.ToolStripMenuItem() Me.mnuDescribeSpecificSummary = New System.Windows.Forms.ToolStripMenuItem() Me.mnuDescribeSpecificMultipleResponse = New System.Windows.Forms.ToolStripMenuItem() Me.ToolStripSeparator26 = New System.Windows.Forms.ToolStripSeparator() @@ -208,7 +204,7 @@ Partial Class frmMain Me.mnuClimaticTidyandExamineTidyDailyData = New System.Windows.Forms.ToolStripMenuItem() Me.mnuClimaticTidyandExamineNonNumericCases = New System.Windows.Forms.ToolStripMenuItem() Me.mnuClimaticTidyandExamineReplaceValues = New System.Windows.Forms.ToolStripMenuItem() - Me.mnuClimaticTidyandExamineDuplicates = New System.Windows.Forms.ToolStripMenuItem() + Me.mnuClimaticTidyandExamineDuplicateRows = New System.Windows.Forms.ToolStripMenuItem() Me.ToolStripSeparator54 = New System.Windows.Forms.ToolStripSeparator() Me.mnuClimaticTidyandExamineStack = New System.Windows.Forms.ToolStripMenuItem() Me.mnuClimaticTidyandExamineUnstack = New System.Windows.Forms.ToolStripMenuItem() @@ -439,12 +435,13 @@ Partial Class frmMain Me.mnuPrepareDataFrameRowNumbersNames = New System.Windows.Forms.ToolStripMenuItem() Me.ToolStripSeparator1 = New System.Windows.Forms.ToolStripSeparator() Me.mnuPrepareDataFrameSort = New System.Windows.Forms.ToolStripMenuItem() - Me.mnuPrepareDataFrameFilter = New System.Windows.Forms.ToolStripMenuItem() + Me.mnuPrepareDataFrameFilterRows = New System.Windows.Forms.ToolStripMenuItem() Me.mnuPrepareDataFrameSelectColumns = New System.Windows.Forms.ToolStripMenuItem() Me.mnuPrepareDataFrameReplaceValues = New System.Windows.Forms.ToolStripMenuItem() Me.mnuPrepareDataFrameConvertColumns = New System.Windows.Forms.ToolStripMenuItem() Me.ToolStripSeparator2 = New System.Windows.Forms.ToolStripSeparator() Me.mnuPrepareDataFrameReorderColumns = New System.Windows.Forms.ToolStripMenuItem() + Me.mnuPrepareDataFrameAddMergeColumns = New System.Windows.Forms.ToolStripMenuItem() Me.mnuPrepareDataFrameInsertColumnsRows = New System.Windows.Forms.ToolStripMenuItem() Me.mnuPrepareDataFrameDeleteColumnsRows = New System.Windows.Forms.ToolStripMenuItem() Me.mnuPrepareDataFrameProtectColumn = New System.Windows.Forms.ToolStripMenuItem() @@ -461,6 +458,7 @@ Partial Class frmMain Me.mnuPrepareCheckDataOneVariableSummarise = New System.Windows.Forms.ToolStripMenuItem() Me.mnuPrepareCheckDataOneVariableGraph = New System.Windows.Forms.ToolStripMenuItem() Me.mnuPrepareCheckDataOneWayFrequencies = New System.Windows.Forms.ToolStripMenuItem() + Me.mnuPrepareCheckDataViewDeleteLabels = New System.Windows.Forms.ToolStripMenuItem() Me.ToolStripSeparator41 = New System.Windows.Forms.ToolStripSeparator() Me.mnuPrepareCheckDataExportOpenRefine = New System.Windows.Forms.ToolStripMenuItem() Me.mnuPrepareCheckDataImportOpenRefine = New System.Windows.Forms.ToolStripMenuItem() @@ -490,7 +488,6 @@ Partial Class frmMain Me.mnuPrepareColumnFactorDummyVariables = New System.Windows.Forms.ToolStripMenuItem() Me.ToolStripSeparator14 = New System.Windows.Forms.ToolStripSeparator() Me.mnuPrepareColumnFactorLevelsLabels = New System.Windows.Forms.ToolStripMenuItem() - Me.mnuPrepareFactorViewLabels = New System.Windows.Forms.ToolStripMenuItem() Me.mnuPrepareColumnFactorReorderLevels = New System.Windows.Forms.ToolStripMenuItem() Me.mnuPrepareColumnFactorReferenceLevel = New System.Windows.Forms.ToolStripMenuItem() Me.mnuPrepareColumnFactorUnusedLevels = New System.Windows.Forms.ToolStripMenuItem() @@ -529,6 +526,7 @@ Partial Class frmMain Me.mnuPrepareColumnReshapeRandomSubset = New System.Windows.Forms.ToolStripMenuItem() Me.mnuPrepareColumnReshapeTranspose = New System.Windows.Forms.ToolStripMenuItem() Me.mnuPrepareDataReshapeScaleOrDistance = New System.Windows.Forms.ToolStripMenuItem() + Me.mnuPrepareDataReshapeRandomSplit = New System.Windows.Forms.ToolStripMenuItem() Me.ToolStripSeparator7 = New System.Windows.Forms.ToolStripSeparator() Me.mnuPrepareKeysAndLinks = New System.Windows.Forms.ToolStripMenuItem() Me.mnuPrepareKeysAndLinksAddKey = New System.Windows.Forms.ToolStripMenuItem() @@ -536,7 +534,7 @@ Partial Class frmMain Me.mnuPrepareKeysAndLinksAddLink = New System.Windows.Forms.ToolStripMenuItem() Me.mnuPrepareKeysAndLinksViewAndRemoveKeys = New System.Windows.Forms.ToolStripMenuItem() Me.mnuPrepareKeysAndLinksAddComment = New System.Windows.Forms.ToolStripMenuItem() - Me.mnuPrepareDataObject = New System.Windows.Forms.ToolStripMenuItem() + Me.mnuPrepareDataBook = New System.Windows.Forms.ToolStripMenuItem() Me.mnuPrepareDataObjectDataFrameMetadata = New System.Windows.Forms.ToolStripMenuItem() Me.mnuPrepareDataObjectRenameDataFrame = New System.Windows.Forms.ToolStripMenuItem() Me.mnuPrepareDataObjectReorderDataFrames = New System.Windows.Forms.ToolStripMenuItem() @@ -628,7 +626,7 @@ Partial Class frmMain Me.mnuProcurementUseCRISummariseCRIbyCountry = New System.Windows.Forms.ToolStripMenuItem() Me.mnuOptionsByContext = New System.Windows.Forms.ToolStripMenuItem() Me.mnuOptionsByContextCheckData = New System.Windows.Forms.ToolStripMenuItem() - Me.mnuOptionsByContextCheckDataDuplicates = New System.Windows.Forms.ToolStripMenuItem() + Me.mnuOptionsByContextCheckDataDuplicateRows = New System.Windows.Forms.ToolStripMenuItem() Me.mnuOptionsByContextCheckDataCompareColumns = New System.Windows.Forms.ToolStripMenuItem() Me.ToolStripSeparator47 = New System.Windows.Forms.ToolStripSeparator() Me.mnuOptionsByContextCheckDataOneVariableSummarise = New System.Windows.Forms.ToolStripMenuItem() @@ -705,7 +703,7 @@ Partial Class frmMain ' 'mnuDescribe ' - Me.mnuDescribe.DropDownItems.AddRange(New System.Windows.Forms.ToolStripItem() {Me.mnuDescribeOneVariable, Me.mnuDescribeTwoVariables, Me.mnuDescribeThreeVariable, Me.mnuDescribeSpecificTablesGraphs, Me.mnuDescribeGeneral, Me.ToolStripSeparator9, Me.mnuDescribeMultivariate, Me.ToolStripSeparator13, Me.mnuDescribeUseGraph, Me.mnuDescribeCombineGraph, Me.mnuDescribeThemes, Me.mnuDescribeViewGraph}) + Me.mnuDescribe.DropDownItems.AddRange(New System.Windows.Forms.ToolStripItem() {Me.mnuDescribeOneVariable, Me.mnuDescribeTwoThreeVariables, Me.mnuDescribeSpecificTablesGraphs, Me.mnuDescribeGeneral, Me.ToolStripSeparator9, Me.mnuDescribeMultivariate, Me.ToolStripSeparator13, Me.mnuDescribeUseGraph, Me.mnuDescribeCombineGraph, Me.mnuDescribeThemes, Me.mnuDescribeViewGraph}) Me.mnuDescribe.Name = "mnuDescribe" Me.mnuDescribe.Size = New System.Drawing.Size(64, 20) Me.mnuDescribe.Tag = "Describe" @@ -761,100 +759,72 @@ Partial Class frmMain Me.mnuDescribeOneVariableRatingData.Size = New System.Drawing.Size(155, 22) Me.mnuDescribeOneVariableRatingData.Text = "Rating Data..." ' - 'mnuDescribeTwoVariables + 'mnuDescribeTwoThreeVariables ' - Me.mnuDescribeTwoVariables.DropDownItems.AddRange(New System.Windows.Forms.ToolStripItem() {Me.mnuDescribeTwoVariablesSummarise, Me.mnuDescribeTwoVariablesGraph, Me.ToolStripSeparator34, Me.mnuDescribeTwoVariablesFrequencies, Me.mnuDescribeTwoVariablesPivotTable}) - Me.mnuDescribeTwoVariables.Name = "mnuDescribeTwoVariables" - Me.mnuDescribeTwoVariables.Size = New System.Drawing.Size(192, 22) - Me.mnuDescribeTwoVariables.Tag = "Two_Variables" - Me.mnuDescribeTwoVariables.Text = "Two Variables" + Me.mnuDescribeTwoThreeVariables.DropDownItems.AddRange(New System.Windows.Forms.ToolStripItem() {Me.mnuDescribeTwoVariablesSummarise, Me.mnuDescribeTwoVariablesGraph, Me.ToolStripSeparator34, Me.mnuDescribeTwoThreeVariablesCorrelations, Me.mnuDescribeTwoThreeVariablesTwoWayFrequencies, Me.mnuDescribeTwoThreeVariablesThreeWayFrequencies, Me.ToolStripSeparator36, Me.mnuDescribeTwoThreeVariablesPivotTable}) + Me.mnuDescribeTwoThreeVariables.Name = "mnuDescribeTwoThreeVariables" + Me.mnuDescribeTwoThreeVariables.Size = New System.Drawing.Size(192, 22) + Me.mnuDescribeTwoThreeVariables.Tag = "Two_Variables" + Me.mnuDescribeTwoThreeVariables.Text = "Two/Three Variables" ' 'mnuDescribeTwoVariablesSummarise ' Me.mnuDescribeTwoVariablesSummarise.DoubleClickEnabled = True Me.mnuDescribeTwoVariablesSummarise.Name = "mnuDescribeTwoVariablesSummarise" - Me.mnuDescribeTwoVariablesSummarise.Size = New System.Drawing.Size(146, 22) + Me.mnuDescribeTwoVariablesSummarise.Size = New System.Drawing.Size(206, 22) Me.mnuDescribeTwoVariablesSummarise.Tag = "Summarise..." Me.mnuDescribeTwoVariablesSummarise.Text = "Summarise..." ' 'mnuDescribeTwoVariablesGraph ' Me.mnuDescribeTwoVariablesGraph.Name = "mnuDescribeTwoVariablesGraph" - Me.mnuDescribeTwoVariablesGraph.Size = New System.Drawing.Size(146, 22) + Me.mnuDescribeTwoVariablesGraph.Size = New System.Drawing.Size(206, 22) Me.mnuDescribeTwoVariablesGraph.Tag = "Graph..." Me.mnuDescribeTwoVariablesGraph.Text = "Graph..." ' 'ToolStripSeparator34 ' Me.ToolStripSeparator34.Name = "ToolStripSeparator34" - Me.ToolStripSeparator34.Size = New System.Drawing.Size(143, 6) + Me.ToolStripSeparator34.Size = New System.Drawing.Size(203, 6) ' - 'mnuDescribeTwoVariablesFrequencies + 'mnuDescribeTwoThreeVariablesCorrelations ' - Me.mnuDescribeTwoVariablesFrequencies.DoubleClickEnabled = True - Me.mnuDescribeTwoVariablesFrequencies.Name = "mnuDescribeTwoVariablesFrequencies" - Me.mnuDescribeTwoVariablesFrequencies.Size = New System.Drawing.Size(146, 22) - Me.mnuDescribeTwoVariablesFrequencies.Text = "Frequencies..." + Me.mnuDescribeTwoThreeVariablesCorrelations.Name = "mnuDescribeTwoThreeVariablesCorrelations" + Me.mnuDescribeTwoThreeVariablesCorrelations.Size = New System.Drawing.Size(206, 22) + Me.mnuDescribeTwoThreeVariablesCorrelations.Text = "Correlations..." ' - 'mnuDescribeTwoVariablesPivotTable + 'mnuDescribeTwoThreeVariablesTwoWayFrequencies ' - Me.mnuDescribeTwoVariablesPivotTable.Name = "mnuDescribeTwoVariablesPivotTable" - Me.mnuDescribeTwoVariablesPivotTable.Size = New System.Drawing.Size(146, 22) - Me.mnuDescribeTwoVariablesPivotTable.Text = "Pivot Table..." + Me.mnuDescribeTwoThreeVariablesTwoWayFrequencies.DoubleClickEnabled = True + Me.mnuDescribeTwoThreeVariablesTwoWayFrequencies.Name = "mnuDescribeTwoThreeVariablesTwoWayFrequencies" + Me.mnuDescribeTwoThreeVariablesTwoWayFrequencies.Size = New System.Drawing.Size(206, 22) + Me.mnuDescribeTwoThreeVariablesTwoWayFrequencies.Text = "Two-Way Frequencies..." ' - 'mnuDescribeThreeVariable + 'mnuDescribeTwoThreeVariablesThreeWayFrequencies ' - Me.mnuDescribeThreeVariable.DropDownItems.AddRange(New System.Windows.Forms.ToolStripItem() {Me.mnuDescribeThreeVariableSummarise, Me.mnuDescribeThreeVariableGraph, Me.ToolStripSeparator36, Me.mnuDescribeThreeVariableFrequencies, Me.mnuDescribeThreeVariablePivotTable}) - Me.mnuDescribeThreeVariable.Name = "mnuDescribeThreeVariable" - Me.mnuDescribeThreeVariable.Size = New System.Drawing.Size(192, 22) - Me.mnuDescribeThreeVariable.Text = "Three Variables" - ' - 'mnuDescribeThreeVariableSummarise - ' - Me.mnuDescribeThreeVariableSummarise.Enabled = False - Me.mnuDescribeThreeVariableSummarise.Name = "mnuDescribeThreeVariableSummarise" - Me.mnuDescribeThreeVariableSummarise.Size = New System.Drawing.Size(146, 22) - Me.mnuDescribeThreeVariableSummarise.Text = "Summarise..." - ' - 'mnuDescribeThreeVariableGraph - ' - Me.mnuDescribeThreeVariableGraph.Enabled = False - Me.mnuDescribeThreeVariableGraph.Name = "mnuDescribeThreeVariableGraph" - Me.mnuDescribeThreeVariableGraph.Size = New System.Drawing.Size(146, 22) - Me.mnuDescribeThreeVariableGraph.Text = "Graph..." + Me.mnuDescribeTwoThreeVariablesThreeWayFrequencies.Name = "mnuDescribeTwoThreeVariablesThreeWayFrequencies" + Me.mnuDescribeTwoThreeVariablesThreeWayFrequencies.Size = New System.Drawing.Size(206, 22) + Me.mnuDescribeTwoThreeVariablesThreeWayFrequencies.Text = "Three-Way Frequencies..." ' 'ToolStripSeparator36 ' Me.ToolStripSeparator36.Name = "ToolStripSeparator36" - Me.ToolStripSeparator36.Size = New System.Drawing.Size(143, 6) - ' - 'mnuDescribeThreeVariableFrequencies + Me.ToolStripSeparator36.Size = New System.Drawing.Size(203, 6) ' - Me.mnuDescribeThreeVariableFrequencies.Name = "mnuDescribeThreeVariableFrequencies" - Me.mnuDescribeThreeVariableFrequencies.Size = New System.Drawing.Size(146, 22) - Me.mnuDescribeThreeVariableFrequencies.Text = "Frequencies..." + 'mnuDescribeTwoThreeVariablesPivotTable ' - 'mnuDescribeThreeVariablePivotTable - ' - Me.mnuDescribeThreeVariablePivotTable.Name = "mnuDescribeThreeVariablePivotTable" - Me.mnuDescribeThreeVariablePivotTable.Size = New System.Drawing.Size(146, 22) - Me.mnuDescribeThreeVariablePivotTable.Text = "Pivot Table..." + Me.mnuDescribeTwoThreeVariablesPivotTable.Name = "mnuDescribeTwoThreeVariablesPivotTable" + Me.mnuDescribeTwoThreeVariablesPivotTable.Size = New System.Drawing.Size(206, 22) + Me.mnuDescribeTwoThreeVariablesPivotTable.Text = "Pivot Table..." ' 'mnuDescribeSpecificTablesGraphs ' - Me.mnuDescribeSpecificTablesGraphs.DropDownItems.AddRange(New System.Windows.Forms.ToolStripItem() {Me.mnuDescribeSpecificFrequency, Me.mnuDescribeSpecificSummary, Me.mnuDescribeSpecificMultipleResponse, Me.ToolStripSeparator26, Me.mnuDescribeSpecificBarPieChart, Me.mnuDescribeSpecificBoxplotJitterViolinPlot, Me.mnuDescribeSpecificHistogramDensityFrequencyPlot, Me.mnuDescribeSpecificPointPlot, Me.mnuDescribeSpecificLineSmoothPlot, Me.mnuDescribeSpecificMapPlot, Me.mnuDescribeSpecificDotPlot, Me.ToolStripSeparator27, Me.mnuDescribeSpecificMosaic, Me.mnuDescribeSpecificCummulativeDistribution, Me.mnuDescribeSpecificParallelCoordinatePlot}) + Me.mnuDescribeSpecificTablesGraphs.DropDownItems.AddRange(New System.Windows.Forms.ToolStripItem() {Me.mnuDescribeSpecificSummary, Me.mnuDescribeSpecificMultipleResponse, Me.ToolStripSeparator26, Me.mnuDescribeSpecificBarPieChart, Me.mnuDescribeSpecificBoxplotJitterViolinPlot, Me.mnuDescribeSpecificHistogramDensityFrequencyPlot, Me.mnuDescribeSpecificPointPlot, Me.mnuDescribeSpecificLineSmoothPlot, Me.mnuDescribeSpecificMapPlot, Me.mnuDescribeSpecificDotPlot, Me.ToolStripSeparator27, Me.mnuDescribeSpecificMosaic, Me.mnuDescribeSpecificCummulativeDistribution, Me.mnuDescribeSpecificParallelCoordinatePlot}) Me.mnuDescribeSpecificTablesGraphs.Name = "mnuDescribeSpecificTablesGraphs" Me.mnuDescribeSpecificTablesGraphs.Size = New System.Drawing.Size(192, 22) Me.mnuDescribeSpecificTablesGraphs.Tag = "Table_Dialogs" Me.mnuDescribeSpecificTablesGraphs.Text = "Specific Tables/Graphs" ' - 'mnuDescribeSpecificFrequency - ' - Me.mnuDescribeSpecificFrequency.Name = "mnuDescribeSpecificFrequency" - Me.mnuDescribeSpecificFrequency.Size = New System.Drawing.Size(299, 22) - Me.mnuDescribeSpecificFrequency.Tag = "Frequency..." - Me.mnuDescribeSpecificFrequency.Text = "Frequency Tables..." - ' 'mnuDescribeSpecificSummary ' Me.mnuDescribeSpecificSummary.Name = "mnuDescribeSpecificSummary" @@ -1247,7 +1217,7 @@ Partial Class frmMain 'mnuModelOtherOneVariableExactResults ' Me.mnuModelOtherOneVariableExactResults.Name = "mnuModelOtherOneVariableExactResults" - Me.mnuModelOtherOneVariableExactResults.Size = New System.Drawing.Size(166, 22) + Me.mnuModelOtherOneVariableExactResults.Size = New System.Drawing.Size(180, 22) Me.mnuModelOtherOneVariableExactResults.Tag = "Exact_Results..." Me.mnuModelOtherOneVariableExactResults.Text = "Exact Results..." ' @@ -1255,7 +1225,7 @@ Partial Class frmMain ' Me.mnuModelOtherOneVariableSampleSummaryData.Enabled = False Me.mnuModelOtherOneVariableSampleSummaryData.Name = "mnuModelOtherOneVariableSampleSummaryData" - Me.mnuModelOtherOneVariableSampleSummaryData.Size = New System.Drawing.Size(166, 22) + Me.mnuModelOtherOneVariableSampleSummaryData.Size = New System.Drawing.Size(180, 22) Me.mnuModelOtherOneVariableSampleSummaryData.Tag = "Summary_Data..." Me.mnuModelOtherOneVariableSampleSummaryData.Text = "Summary Data..." ' @@ -1263,7 +1233,7 @@ Partial Class frmMain ' Me.mnuModelOtherOneVariableNonParametric.Enabled = False Me.mnuModelOtherOneVariableNonParametric.Name = "mnuModelOtherOneVariableNonParametric" - Me.mnuModelOtherOneVariableNonParametric.Size = New System.Drawing.Size(166, 22) + Me.mnuModelOtherOneVariableNonParametric.Size = New System.Drawing.Size(180, 22) Me.mnuModelOtherOneVariableNonParametric.Tag = "Non_Parametric..." Me.mnuModelOtherOneVariableNonParametric.Text = "Non Parametric..." ' @@ -1271,7 +1241,7 @@ Partial Class frmMain ' Me.mnuModelOtherOneVariableGoodnessofFit.Enabled = False Me.mnuModelOtherOneVariableGoodnessofFit.Name = "mnuModelOtherOneVariableGoodnessofFit" - Me.mnuModelOtherOneVariableGoodnessofFit.Size = New System.Drawing.Size(166, 22) + Me.mnuModelOtherOneVariableGoodnessofFit.Size = New System.Drawing.Size(180, 22) Me.mnuModelOtherOneVariableGoodnessofFit.Tag = "Goodness_of_Fit" Me.mnuModelOtherOneVariableGoodnessofFit.Text = "Goodness of Fit..." ' @@ -1792,7 +1762,7 @@ Partial Class frmMain ' 'mnuClimaticTidyandExamine ' - Me.mnuClimaticTidyandExamine.DropDownItems.AddRange(New System.Windows.Forms.ToolStripItem() {Me.mnuClimaticTidyandExamineVisualiseData, Me.mnuClimaticTidyandExamineTidyDailyData, Me.mnuClimaticTidyandExamineNonNumericCases, Me.mnuClimaticTidyandExamineReplaceValues, Me.mnuClimaticTidyandExamineDuplicates, Me.ToolStripSeparator54, Me.mnuClimaticTidyandExamineStack, Me.mnuClimaticTidyandExamineUnstack, Me.mnuClimaticTidyandExamineMerge, Me.mnuClimaticTidyandExamineAppend, Me.ToolStripSeparator69, Me.mnuSetupForDataEntry, Me.mnuTidyandExamineClimaticDataEntry, Me.mnuClimaticTidyandExamineCompareColumns, Me.ToolStripSeparator50, Me.mnuClimaticTidyandExamineOneVariableSummarize, Me.mnuClimaticTidyandExamineOneVariableGraph, Me.mnuClimaticTidyandExamineOneVariableFrequencies}) + Me.mnuClimaticTidyandExamine.DropDownItems.AddRange(New System.Windows.Forms.ToolStripItem() {Me.mnuClimaticTidyandExamineVisualiseData, Me.mnuClimaticTidyandExamineTidyDailyData, Me.mnuClimaticTidyandExamineNonNumericCases, Me.mnuClimaticTidyandExamineReplaceValues, Me.mnuClimaticTidyandExamineDuplicateRows, Me.ToolStripSeparator54, Me.mnuClimaticTidyandExamineStack, Me.mnuClimaticTidyandExamineUnstack, Me.mnuClimaticTidyandExamineMerge, Me.mnuClimaticTidyandExamineAppend, Me.ToolStripSeparator69, Me.mnuSetupForDataEntry, Me.mnuTidyandExamineClimaticDataEntry, Me.mnuClimaticTidyandExamineCompareColumns, Me.ToolStripSeparator50, Me.mnuClimaticTidyandExamineOneVariableSummarize, Me.mnuClimaticTidyandExamineOneVariableGraph, Me.mnuClimaticTidyandExamineOneVariableFrequencies}) Me.mnuClimaticTidyandExamine.Name = "mnuClimaticTidyandExamine" Me.mnuClimaticTidyandExamine.Size = New System.Drawing.Size(212, 22) Me.mnuClimaticTidyandExamine.Text = "Tidy and Examine" @@ -1821,11 +1791,11 @@ Partial Class frmMain Me.mnuClimaticTidyandExamineReplaceValues.Size = New System.Drawing.Size(215, 22) Me.mnuClimaticTidyandExamineReplaceValues.Text = "Replace Values..." ' - 'mnuClimaticTidyandExamineDuplicates + 'mnuClimaticTidyandExamineDuplicateRows ' - Me.mnuClimaticTidyandExamineDuplicates.Name = "mnuClimaticTidyandExamineDuplicates" - Me.mnuClimaticTidyandExamineDuplicates.Size = New System.Drawing.Size(215, 22) - Me.mnuClimaticTidyandExamineDuplicates.Text = "Duplicates..." + Me.mnuClimaticTidyandExamineDuplicateRows.Name = "mnuClimaticTidyandExamineDuplicateRows" + Me.mnuClimaticTidyandExamineDuplicateRows.Size = New System.Drawing.Size(215, 22) + Me.mnuClimaticTidyandExamineDuplicateRows.Text = "Duplicate Rows..." ' 'ToolStripSeparator54 ' @@ -1871,7 +1841,7 @@ Partial Class frmMain ' Me.mnuTidyandExamineClimaticDataEntry.Name = "mnuTidyandExamineClimaticDataEntry" Me.mnuTidyandExamineClimaticDataEntry.Size = New System.Drawing.Size(215, 22) - Me.mnuTidyandExamineClimaticDataEntry.Text = "Daily Data Entry..." + Me.mnuTidyandExamineClimaticDataEntry.Text = "Daily Data Editing/Entry..." ' 'mnuClimaticTidyandExamineCompareColumns ' @@ -3399,7 +3369,7 @@ Partial Class frmMain ' 'mnuPrepare ' - Me.mnuPrepare.DropDownItems.AddRange(New System.Windows.Forms.ToolStripItem() {Me.mnuPrepareDataFrame, Me.mnuPrepareCheckData, Me.ToolStripSeparator6, Me.mnuPrepareCalculator, Me.mnuPrepareColumnCalculate, Me.mnuPrepareColumnFactor, Me.mnuPrepareColumnText, Me.mnuPrepareColumnDate, Me.mnuPrepareColumnDefine, Me.ToolStripSeparator4, Me.mnuPrepareDataReshape, Me.ToolStripSeparator7, Me.mnuPrepareKeysAndLinks, Me.mnuPrepareDataObject, Me.mnuPrepareRObjects}) + Me.mnuPrepare.DropDownItems.AddRange(New System.Windows.Forms.ToolStripItem() {Me.mnuPrepareDataFrame, Me.mnuPrepareCheckData, Me.ToolStripSeparator6, Me.mnuPrepareCalculator, Me.mnuPrepareColumnCalculate, Me.mnuPrepareColumnFactor, Me.mnuPrepareColumnText, Me.mnuPrepareColumnDate, Me.mnuPrepareColumnDefine, Me.ToolStripSeparator4, Me.mnuPrepareDataReshape, Me.ToolStripSeparator7, Me.mnuPrepareKeysAndLinks, Me.mnuPrepareDataBook, Me.mnuPrepareRObjects}) Me.mnuPrepare.Name = "mnuPrepare" Me.mnuPrepare.Size = New System.Drawing.Size(59, 20) Me.mnuPrepare.Tag = "Prepare" @@ -3407,7 +3377,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.mnuPrepareDataframeColourByProperty}) + Me.mnuPrepareDataFrame.DropDownItems.AddRange(New System.Windows.Forms.ToolStripItem() {Me.mnuPrepareDataFrameViewData, Me.mnuPrepareDataFrameRenameColumn, Me.mnuPrepareDataFrameDuplicateColumn, Me.mnuPrepareDataFrameRowNumbersNames, Me.ToolStripSeparator1, Me.mnuPrepareDataFrameSort, Me.mnuPrepareDataFrameFilterRows, Me.mnuPrepareDataFrameSelectColumns, Me.mnuPrepareDataFrameReplaceValues, Me.mnuPrepareDataFrameConvertColumns, Me.ToolStripSeparator2, Me.mnuPrepareDataFrameReorderColumns, Me.mnuPrepareDataFrameAddMergeColumns, 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" @@ -3416,92 +3386,98 @@ Partial Class frmMain 'mnuPrepareDataFrameViewData ' Me.mnuPrepareDataFrameViewData.Name = "mnuPrepareDataFrameViewData" - Me.mnuPrepareDataFrameViewData.Size = New System.Drawing.Size(200, 22) + Me.mnuPrepareDataFrameViewData.Size = New System.Drawing.Size(201, 22) Me.mnuPrepareDataFrameViewData.Tag = "View_Data..." Me.mnuPrepareDataFrameViewData.Text = "View Data..." ' 'mnuPrepareDataFrameRenameColumn ' Me.mnuPrepareDataFrameRenameColumn.Name = "mnuPrepareDataFrameRenameColumn" - Me.mnuPrepareDataFrameRenameColumn.Size = New System.Drawing.Size(200, 22) + Me.mnuPrepareDataFrameRenameColumn.Size = New System.Drawing.Size(201, 22) Me.mnuPrepareDataFrameRenameColumn.Tag = "Rename_Column..." Me.mnuPrepareDataFrameRenameColumn.Text = "Rename Columns..." ' 'mnuPrepareDataFrameDuplicateColumn ' Me.mnuPrepareDataFrameDuplicateColumn.Name = "mnuPrepareDataFrameDuplicateColumn" - Me.mnuPrepareDataFrameDuplicateColumn.Size = New System.Drawing.Size(200, 22) + Me.mnuPrepareDataFrameDuplicateColumn.Size = New System.Drawing.Size(201, 22) Me.mnuPrepareDataFrameDuplicateColumn.Text = "Duplicate Column..." ' 'mnuPrepareDataFrameRowNumbersNames ' Me.mnuPrepareDataFrameRowNumbersNames.Name = "mnuPrepareDataFrameRowNumbersNames" - Me.mnuPrepareDataFrameRowNumbersNames.Size = New System.Drawing.Size(200, 22) + Me.mnuPrepareDataFrameRowNumbersNames.Size = New System.Drawing.Size(201, 22) Me.mnuPrepareDataFrameRowNumbersNames.Tag = "Row_Numbers/Names..." Me.mnuPrepareDataFrameRowNumbersNames.Text = "Row Numbers/Names..." ' 'ToolStripSeparator1 ' Me.ToolStripSeparator1.Name = "ToolStripSeparator1" - Me.ToolStripSeparator1.Size = New System.Drawing.Size(197, 6) + Me.ToolStripSeparator1.Size = New System.Drawing.Size(198, 6) ' 'mnuPrepareDataFrameSort ' Me.mnuPrepareDataFrameSort.Name = "mnuPrepareDataFrameSort" - Me.mnuPrepareDataFrameSort.Size = New System.Drawing.Size(200, 22) + Me.mnuPrepareDataFrameSort.Size = New System.Drawing.Size(201, 22) Me.mnuPrepareDataFrameSort.Tag = "Sort..." Me.mnuPrepareDataFrameSort.Text = "Sort..." ' - 'mnuPrepareDataFrameFilter + 'mnuPrepareDataFrameFilterRows ' - Me.mnuPrepareDataFrameFilter.Name = "mnuPrepareDataFrameFilter" - Me.mnuPrepareDataFrameFilter.Size = New System.Drawing.Size(200, 22) - Me.mnuPrepareDataFrameFilter.Tag = "Filter..." - Me.mnuPrepareDataFrameFilter.Text = "Filter..." + Me.mnuPrepareDataFrameFilterRows.Name = "mnuPrepareDataFrameFilterRows" + Me.mnuPrepareDataFrameFilterRows.Size = New System.Drawing.Size(201, 22) + Me.mnuPrepareDataFrameFilterRows.Tag = "Filter..." + Me.mnuPrepareDataFrameFilterRows.Text = "Filter Rows..." ' 'mnuPrepareDataFrameSelectColumns ' Me.mnuPrepareDataFrameSelectColumns.Name = "mnuPrepareDataFrameSelectColumns" - Me.mnuPrepareDataFrameSelectColumns.Size = New System.Drawing.Size(200, 22) - Me.mnuPrepareDataFrameSelectColumns.Text = "Column Selection..." + Me.mnuPrepareDataFrameSelectColumns.Size = New System.Drawing.Size(201, 22) + Me.mnuPrepareDataFrameSelectColumns.Text = "Select Columns..." ' 'mnuPrepareDataFrameReplaceValues ' Me.mnuPrepareDataFrameReplaceValues.Name = "mnuPrepareDataFrameReplaceValues" - Me.mnuPrepareDataFrameReplaceValues.Size = New System.Drawing.Size(200, 22) + Me.mnuPrepareDataFrameReplaceValues.Size = New System.Drawing.Size(201, 22) Me.mnuPrepareDataFrameReplaceValues.Tag = "Replace_Values..." Me.mnuPrepareDataFrameReplaceValues.Text = "Replace Values..." ' 'mnuPrepareDataFrameConvertColumns ' Me.mnuPrepareDataFrameConvertColumns.Name = "mnuPrepareDataFrameConvertColumns" - Me.mnuPrepareDataFrameConvertColumns.Size = New System.Drawing.Size(200, 22) + Me.mnuPrepareDataFrameConvertColumns.Size = New System.Drawing.Size(201, 22) Me.mnuPrepareDataFrameConvertColumns.Tag = "Convert_Columns..." Me.mnuPrepareDataFrameConvertColumns.Text = "Convert Columns..." ' 'ToolStripSeparator2 ' Me.ToolStripSeparator2.Name = "ToolStripSeparator2" - Me.ToolStripSeparator2.Size = New System.Drawing.Size(197, 6) + Me.ToolStripSeparator2.Size = New System.Drawing.Size(198, 6) ' 'mnuPrepareDataFrameReorderColumns ' Me.mnuPrepareDataFrameReorderColumns.Name = "mnuPrepareDataFrameReorderColumns" - Me.mnuPrepareDataFrameReorderColumns.Size = New System.Drawing.Size(200, 22) + Me.mnuPrepareDataFrameReorderColumns.Size = New System.Drawing.Size(201, 22) Me.mnuPrepareDataFrameReorderColumns.Tag = "Reorder_Columns..." Me.mnuPrepareDataFrameReorderColumns.Text = "Reorder Columns..." ' + 'mnuPrepareDataFrameAddMergeColumns + ' + Me.mnuPrepareDataFrameAddMergeColumns.Name = "mnuPrepareDataFrameAddMergeColumns" + Me.mnuPrepareDataFrameAddMergeColumns.Size = New System.Drawing.Size(201, 22) + Me.mnuPrepareDataFrameAddMergeColumns.Text = "Add (Merge) Columns..." + ' 'mnuPrepareDataFrameInsertColumnsRows ' Me.mnuPrepareDataFrameInsertColumnsRows.Name = "mnuPrepareDataFrameInsertColumnsRows" - Me.mnuPrepareDataFrameInsertColumnsRows.Size = New System.Drawing.Size(200, 22) + Me.mnuPrepareDataFrameInsertColumnsRows.Size = New System.Drawing.Size(201, 22) Me.mnuPrepareDataFrameInsertColumnsRows.Tag = "Insert_Columns/Rows..." Me.mnuPrepareDataFrameInsertColumnsRows.Text = "Insert Columns/Rows..." ' 'mnuPrepareDataFrameDeleteColumnsRows ' Me.mnuPrepareDataFrameDeleteColumnsRows.Name = "mnuPrepareDataFrameDeleteColumnsRows" - Me.mnuPrepareDataFrameDeleteColumnsRows.Size = New System.Drawing.Size(200, 22) + Me.mnuPrepareDataFrameDeleteColumnsRows.Size = New System.Drawing.Size(201, 22) Me.mnuPrepareDataFrameDeleteColumnsRows.Tag = "Delete_Columns/Rows..." Me.mnuPrepareDataFrameDeleteColumnsRows.Text = "Delete Columns/Rows..." ' @@ -3509,7 +3485,7 @@ Partial Class frmMain ' Me.mnuPrepareDataFrameProtectColumn.Enabled = False Me.mnuPrepareDataFrameProtectColumn.Name = "mnuPrepareDataFrameProtectColumn" - Me.mnuPrepareDataFrameProtectColumn.Size = New System.Drawing.Size(200, 22) + Me.mnuPrepareDataFrameProtectColumn.Size = New System.Drawing.Size(201, 22) Me.mnuPrepareDataFrameProtectColumn.Tag = "..." Me.mnuPrepareDataFrameProtectColumn.Text = "Protect Column..." Me.mnuPrepareDataFrameProtectColumn.Visible = False @@ -3517,7 +3493,7 @@ Partial Class frmMain 'mnuPrepareDataFrameHideColumns ' Me.mnuPrepareDataFrameHideColumns.Name = "mnuPrepareDataFrameHideColumns" - Me.mnuPrepareDataFrameHideColumns.Size = New System.Drawing.Size(200, 22) + Me.mnuPrepareDataFrameHideColumns.Size = New System.Drawing.Size(201, 22) Me.mnuPrepareDataFrameHideColumns.Tag = "Hide_Columns..." Me.mnuPrepareDataFrameHideColumns.Text = "Hide/Show Columns..." ' @@ -3525,7 +3501,7 @@ Partial Class frmMain ' Me.mnuPrepareDataFrameFreezeColumns.Enabled = False Me.mnuPrepareDataFrameFreezeColumns.Name = "mnuPrepareDataFrameFreezeColumns" - Me.mnuPrepareDataFrameFreezeColumns.Size = New System.Drawing.Size(200, 22) + Me.mnuPrepareDataFrameFreezeColumns.Size = New System.Drawing.Size(201, 22) Me.mnuPrepareDataFrameFreezeColumns.Tag = "Freeze_Columns..." Me.mnuPrepareDataFrameFreezeColumns.Text = "Freeze Columns..." Me.mnuPrepareDataFrameFreezeColumns.Visible = False @@ -3533,13 +3509,13 @@ Partial Class frmMain 'mnuPrepareDataframeColourByProperty ' Me.mnuPrepareDataframeColourByProperty.Name = "mnuPrepareDataframeColourByProperty" - Me.mnuPrepareDataframeColourByProperty.Size = New System.Drawing.Size(200, 22) + Me.mnuPrepareDataframeColourByProperty.Size = New System.Drawing.Size(201, 22) Me.mnuPrepareDataframeColourByProperty.Text = "Colour by Property..." ' 'mnuPrepareCheckData ' Me.mnuPrepareCheckData.Alignment = System.Windows.Forms.ToolStripItemAlignment.Right - Me.mnuPrepareCheckData.DropDownItems.AddRange(New System.Windows.Forms.ToolStripItem() {Me.mnuPrepareCheckDataVisualiseData, Me.mnuPrepareCheckDataDuplicates, Me.mnuPrepareCheckDataCompareColumns, Me.mnuPrepareCheckDataNonNumericCases, Me.ToolStripSeparator49, Me.mnuPrepareCheckDataBoxplot, Me.mnuPrepareCheckDataOneVariableSummarise, Me.mnuPrepareCheckDataOneVariableGraph, Me.mnuPrepareCheckDataOneWayFrequencies, Me.ToolStripSeparator41, Me.mnuPrepareCheckDataExportOpenRefine, Me.mnuPrepareCheckDataImportOpenRefine, Me.ToolStripSeparator40, Me.mnuPreparePrepareToShareJitter, Me.mnuPrepareCheckDataPrePareToShareSdcPackage, Me.mnuPrepareCheckDataAnonymiseIDColumn}) + Me.mnuPrepareCheckData.DropDownItems.AddRange(New System.Windows.Forms.ToolStripItem() {Me.mnuPrepareCheckDataVisualiseData, Me.mnuPrepareCheckDataDuplicates, Me.mnuPrepareCheckDataCompareColumns, Me.mnuPrepareCheckDataNonNumericCases, Me.ToolStripSeparator49, Me.mnuPrepareCheckDataBoxplot, Me.mnuPrepareCheckDataOneVariableSummarise, Me.mnuPrepareCheckDataOneVariableGraph, Me.mnuPrepareCheckDataOneWayFrequencies, Me.mnuPrepareCheckDataViewDeleteLabels, Me.ToolStripSeparator41, Me.mnuPrepareCheckDataExportOpenRefine, Me.mnuPrepareCheckDataImportOpenRefine, Me.ToolStripSeparator40, Me.mnuPreparePrepareToShareJitter, Me.mnuPrepareCheckDataPrePareToShareSdcPackage, Me.mnuPrepareCheckDataAnonymiseIDColumn}) Me.mnuPrepareCheckData.Name = "mnuPrepareCheckData" Me.mnuPrepareCheckData.Size = New System.Drawing.Size(186, 22) Me.mnuPrepareCheckData.Text = "Check Data" @@ -3554,7 +3530,7 @@ Partial Class frmMain ' Me.mnuPrepareCheckDataDuplicates.Name = "mnuPrepareCheckDataDuplicates" Me.mnuPrepareCheckDataDuplicates.Size = New System.Drawing.Size(245, 22) - Me.mnuPrepareCheckDataDuplicates.Text = "Duplicates..." + Me.mnuPrepareCheckDataDuplicates.Text = "Duplicate Rows..." ' 'mnuPrepareCheckDataCompareColumns ' @@ -3597,6 +3573,12 @@ Partial Class frmMain Me.mnuPrepareCheckDataOneWayFrequencies.Size = New System.Drawing.Size(245, 22) Me.mnuPrepareCheckDataOneWayFrequencies.Text = "One Variable Frequencies..." ' + 'mnuPrepareCheckDataViewDeleteLabels + ' + Me.mnuPrepareCheckDataViewDeleteLabels.Name = "mnuPrepareCheckDataViewDeleteLabels" + Me.mnuPrepareCheckDataViewDeleteLabels.Size = New System.Drawing.Size(245, 22) + Me.mnuPrepareCheckDataViewDeleteLabels.Text = "View/Delete Labels..." + ' 'ToolStripSeparator41 ' Me.ToolStripSeparator41.Name = "ToolStripSeparator41" @@ -3613,6 +3595,7 @@ Partial Class frmMain Me.mnuPrepareCheckDataImportOpenRefine.Name = "mnuPrepareCheckDataImportOpenRefine" Me.mnuPrepareCheckDataImportOpenRefine.Size = New System.Drawing.Size(245, 22) Me.mnuPrepareCheckDataImportOpenRefine.Text = "Import From OpenRefine..." + Me.mnuPrepareCheckDataImportOpenRefine.Visible = False ' 'ToolStripSeparator40 ' @@ -3720,7 +3703,7 @@ Partial Class frmMain ' 'mnuPrepareColumnFactor ' - Me.mnuPrepareColumnFactor.DropDownItems.AddRange(New System.Windows.Forms.ToolStripItem() {Me.mnuPrepareColumnFactorConvertToFactor, Me.mnuPrepareColumnFactorRecodeNumeric, Me.mnuPrepareColumnFactorCountInFactor, Me.ToolStripSeparator12, Me.mnuPrepareColumnFactorRecodeFactor, Me.mnuPrepareColumnFactorCombineFactors, Me.mnuPrepareColumnFactorDummyVariables, Me.ToolStripSeparator14, Me.mnuPrepareColumnFactorLevelsLabels, Me.mnuPrepareFactorViewLabels, Me.mnuPrepareColumnFactorReorderLevels, Me.mnuPrepareColumnFactorReferenceLevel, Me.mnuPrepareColumnFactorUnusedLevels, Me.mnuPrepareColumnFactorContrasts, Me.ToolStripSeparator19, Me.mnuPrepareColumnFactorFactorDataFrame}) + Me.mnuPrepareColumnFactor.DropDownItems.AddRange(New System.Windows.Forms.ToolStripItem() {Me.mnuPrepareColumnFactorConvertToFactor, Me.mnuPrepareColumnFactorRecodeNumeric, Me.mnuPrepareColumnFactorCountInFactor, Me.ToolStripSeparator12, Me.mnuPrepareColumnFactorRecodeFactor, Me.mnuPrepareColumnFactorCombineFactors, Me.mnuPrepareColumnFactorDummyVariables, Me.ToolStripSeparator14, Me.mnuPrepareColumnFactorLevelsLabels, Me.mnuPrepareColumnFactorReorderLevels, Me.mnuPrepareColumnFactorReferenceLevel, Me.mnuPrepareColumnFactorUnusedLevels, Me.mnuPrepareColumnFactorContrasts, Me.ToolStripSeparator19, Me.mnuPrepareColumnFactorFactorDataFrame}) Me.mnuPrepareColumnFactor.Name = "mnuPrepareColumnFactor" Me.mnuPrepareColumnFactor.Size = New System.Drawing.Size(186, 22) Me.mnuPrepareColumnFactor.Tag = "Column:_Factor" @@ -3729,104 +3712,98 @@ Partial Class frmMain 'mnuPrepareColumnFactorConvertToFactor ' Me.mnuPrepareColumnFactorConvertToFactor.Name = "mnuPrepareColumnFactorConvertToFactor" - Me.mnuPrepareColumnFactorConvertToFactor.Size = New System.Drawing.Size(182, 22) + Me.mnuPrepareColumnFactorConvertToFactor.Size = New System.Drawing.Size(179, 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(182, 22) + Me.mnuPrepareColumnFactorRecodeNumeric.Size = New System.Drawing.Size(179, 22) Me.mnuPrepareColumnFactorRecodeNumeric.Tag = "Recode_Numeric..." Me.mnuPrepareColumnFactorRecodeNumeric.Text = "Recode Numeric..." ' 'mnuPrepareColumnFactorCountInFactor ' Me.mnuPrepareColumnFactorCountInFactor.Name = "mnuPrepareColumnFactorCountInFactor" - Me.mnuPrepareColumnFactorCountInFactor.Size = New System.Drawing.Size(182, 22) + Me.mnuPrepareColumnFactorCountInFactor.Size = New System.Drawing.Size(179, 22) Me.mnuPrepareColumnFactorCountInFactor.Text = "Count in Factor..." ' 'ToolStripSeparator12 ' Me.ToolStripSeparator12.Name = "ToolStripSeparator12" - Me.ToolStripSeparator12.Size = New System.Drawing.Size(179, 6) + Me.ToolStripSeparator12.Size = New System.Drawing.Size(176, 6) ' 'mnuPrepareColumnFactorRecodeFactor ' Me.mnuPrepareColumnFactorRecodeFactor.Name = "mnuPrepareColumnFactorRecodeFactor" - Me.mnuPrepareColumnFactorRecodeFactor.Size = New System.Drawing.Size(182, 22) + Me.mnuPrepareColumnFactorRecodeFactor.Size = New System.Drawing.Size(179, 22) Me.mnuPrepareColumnFactorRecodeFactor.Tag = "Recode_Factor..." Me.mnuPrepareColumnFactorRecodeFactor.Text = "Recode Factor..." ' 'mnuPrepareColumnFactorCombineFactors ' Me.mnuPrepareColumnFactorCombineFactors.Name = "mnuPrepareColumnFactorCombineFactors" - Me.mnuPrepareColumnFactorCombineFactors.Size = New System.Drawing.Size(182, 22) + Me.mnuPrepareColumnFactorCombineFactors.Size = New System.Drawing.Size(179, 22) Me.mnuPrepareColumnFactorCombineFactors.Tag = "Combine_Factors..." Me.mnuPrepareColumnFactorCombineFactors.Text = "Combine Factors..." ' 'mnuPrepareColumnFactorDummyVariables ' Me.mnuPrepareColumnFactorDummyVariables.Name = "mnuPrepareColumnFactorDummyVariables" - Me.mnuPrepareColumnFactorDummyVariables.Size = New System.Drawing.Size(182, 22) + Me.mnuPrepareColumnFactorDummyVariables.Size = New System.Drawing.Size(179, 22) Me.mnuPrepareColumnFactorDummyVariables.Tag = "Dummy_Variables..." Me.mnuPrepareColumnFactorDummyVariables.Text = "Dummy Variables..." ' 'ToolStripSeparator14 ' Me.ToolStripSeparator14.Name = "ToolStripSeparator14" - Me.ToolStripSeparator14.Size = New System.Drawing.Size(179, 6) + Me.ToolStripSeparator14.Size = New System.Drawing.Size(176, 6) ' 'mnuPrepareColumnFactorLevelsLabels ' Me.mnuPrepareColumnFactorLevelsLabels.Name = "mnuPrepareColumnFactorLevelsLabels" - Me.mnuPrepareColumnFactorLevelsLabels.Size = New System.Drawing.Size(182, 22) + Me.mnuPrepareColumnFactorLevelsLabels.Size = New System.Drawing.Size(179, 22) Me.mnuPrepareColumnFactorLevelsLabels.Tag = "Levels/Labels..." Me.mnuPrepareColumnFactorLevelsLabels.Text = "Levels/Labels..." ' - 'mnuPrepareFactorViewLabels - ' - Me.mnuPrepareFactorViewLabels.Name = "mnuPrepareFactorViewLabels" - 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(182, 22) + Me.mnuPrepareColumnFactorReorderLevels.Size = New System.Drawing.Size(179, 22) Me.mnuPrepareColumnFactorReorderLevels.Tag = "Reorder_Levels..." Me.mnuPrepareColumnFactorReorderLevels.Text = "Reorder Levels..." ' 'mnuPrepareColumnFactorReferenceLevel ' Me.mnuPrepareColumnFactorReferenceLevel.Name = "mnuPrepareColumnFactorReferenceLevel" - Me.mnuPrepareColumnFactorReferenceLevel.Size = New System.Drawing.Size(182, 22) + Me.mnuPrepareColumnFactorReferenceLevel.Size = New System.Drawing.Size(179, 22) Me.mnuPrepareColumnFactorReferenceLevel.Tag = "Reference_Level..." Me.mnuPrepareColumnFactorReferenceLevel.Text = "Reference Level..." ' 'mnuPrepareColumnFactorUnusedLevels ' Me.mnuPrepareColumnFactorUnusedLevels.Name = "mnuPrepareColumnFactorUnusedLevels" - Me.mnuPrepareColumnFactorUnusedLevels.Size = New System.Drawing.Size(182, 22) + Me.mnuPrepareColumnFactorUnusedLevels.Size = New System.Drawing.Size(179, 22) Me.mnuPrepareColumnFactorUnusedLevels.Tag = "Unused_Levels..." Me.mnuPrepareColumnFactorUnusedLevels.Text = "Unused Levels..." ' 'mnuPrepareColumnFactorContrasts ' Me.mnuPrepareColumnFactorContrasts.Name = "mnuPrepareColumnFactorContrasts" - Me.mnuPrepareColumnFactorContrasts.Size = New System.Drawing.Size(182, 22) + Me.mnuPrepareColumnFactorContrasts.Size = New System.Drawing.Size(179, 22) Me.mnuPrepareColumnFactorContrasts.Tag = "Contrasts..." Me.mnuPrepareColumnFactorContrasts.Text = "Contrasts..." ' 'ToolStripSeparator19 ' Me.ToolStripSeparator19.Name = "ToolStripSeparator19" - Me.ToolStripSeparator19.Size = New System.Drawing.Size(179, 6) + Me.ToolStripSeparator19.Size = New System.Drawing.Size(176, 6) ' 'mnuPrepareColumnFactorFactorDataFrame ' Me.mnuPrepareColumnFactorFactorDataFrame.Name = "mnuPrepareColumnFactorFactorDataFrame" - Me.mnuPrepareColumnFactorFactorDataFrame.Size = New System.Drawing.Size(182, 22) + Me.mnuPrepareColumnFactorFactorDataFrame.Size = New System.Drawing.Size(179, 22) Me.mnuPrepareColumnFactorFactorDataFrame.Tag = "Factor_Data_Frame" Me.mnuPrepareColumnFactorFactorDataFrame.Text = "Factor Data Frame..." ' @@ -3960,7 +3937,7 @@ Partial Class frmMain ' 'mnuPrepareDataReshape ' - Me.mnuPrepareDataReshape.DropDownItems.AddRange(New System.Windows.Forms.ToolStripItem() {Me.mnuPrepareColumnReshapeColumnSummaries, Me.mnuPrepareColumnReshapeGeneralSummaries, Me.ToolStripSeparator10, Me.mnuPrepareColumnReshapeStack, Me.mnuPrepareColumnReshapeUnstack, Me.mnuPrepareColumnReshapeMerge, Me.ToolStripSeparator11, Me.mnuPrepareAppendDataFrame, Me.mnuPrepareColumnReshapeSubset, Me.mnuPrepareColumnReshapeRandomSubset, Me.mnuPrepareColumnReshapeTranspose, Me.mnuPrepareDataReshapeScaleOrDistance}) + Me.mnuPrepareDataReshape.DropDownItems.AddRange(New System.Windows.Forms.ToolStripItem() {Me.mnuPrepareColumnReshapeColumnSummaries, Me.mnuPrepareColumnReshapeGeneralSummaries, Me.ToolStripSeparator10, Me.mnuPrepareColumnReshapeStack, Me.mnuPrepareColumnReshapeUnstack, Me.mnuPrepareColumnReshapeMerge, Me.ToolStripSeparator11, Me.mnuPrepareAppendDataFrame, Me.mnuPrepareColumnReshapeSubset, Me.mnuPrepareColumnReshapeRandomSubset, Me.mnuPrepareColumnReshapeTranspose, Me.mnuPrepareDataReshapeScaleOrDistance, Me.mnuPrepareDataReshapeRandomSplit}) Me.mnuPrepareDataReshape.Name = "mnuPrepareDataReshape" Me.mnuPrepareDataReshape.Size = New System.Drawing.Size(186, 22) Me.mnuPrepareDataReshape.Tag = "" @@ -4043,6 +4020,13 @@ Partial Class frmMain Me.mnuPrepareDataReshapeScaleOrDistance.Size = New System.Drawing.Size(197, 22) Me.mnuPrepareDataReshapeScaleOrDistance.Text = "Scale/Distance..." ' + 'mnuPrepareDataReshapeRandomSplit + ' + Me.mnuPrepareDataReshapeRandomSplit.Enabled = False + Me.mnuPrepareDataReshapeRandomSplit.Name = "mnuPrepareDataReshapeRandomSplit" + Me.mnuPrepareDataReshapeRandomSplit.Size = New System.Drawing.Size(197, 22) + Me.mnuPrepareDataReshapeRandomSplit.Text = "Random Split..." + ' 'ToolStripSeparator7 ' Me.ToolStripSeparator7.Name = "ToolStripSeparator7" @@ -4085,13 +4069,13 @@ Partial Class frmMain Me.mnuPrepareKeysAndLinksAddComment.Size = New System.Drawing.Size(207, 22) Me.mnuPrepareKeysAndLinksAddComment.Text = "Add Comment..." ' - 'mnuPrepareDataObject + 'mnuPrepareDataBook ' - Me.mnuPrepareDataObject.DropDownItems.AddRange(New System.Windows.Forms.ToolStripItem() {Me.mnuPrepareDataObjectDataFrameMetadata, Me.mnuPrepareDataObjectRenameDataFrame, Me.mnuPrepareDataObjectReorderDataFrames, Me.mnuPrepareDataObjectCopyDataFrame, Me.mnuPrepareDataObjectDeleteDataFrame, Me.ToolStripSeparator21, Me.mnuPrepareDataObjectHideDataframes, Me.mnuPrepareDataObjectMetadata, Me.mnuPrepareDataObjectRenameMetadata, Me.mnuPrepareDataObjectReorderMetadata, Me.mnuPrepareDataObjectDeleteMetadata}) - Me.mnuPrepareDataObject.Name = "mnuPrepareDataObject" - Me.mnuPrepareDataObject.Size = New System.Drawing.Size(186, 22) - Me.mnuPrepareDataObject.Tag = "Data_Object" - Me.mnuPrepareDataObject.Text = "Data Object" + Me.mnuPrepareDataBook.DropDownItems.AddRange(New System.Windows.Forms.ToolStripItem() {Me.mnuPrepareDataObjectDataFrameMetadata, Me.mnuPrepareDataObjectRenameDataFrame, Me.mnuPrepareDataObjectReorderDataFrames, Me.mnuPrepareDataObjectCopyDataFrame, Me.mnuPrepareDataObjectDeleteDataFrame, Me.ToolStripSeparator21, Me.mnuPrepareDataObjectHideDataframes, Me.mnuPrepareDataObjectMetadata, Me.mnuPrepareDataObjectRenameMetadata, Me.mnuPrepareDataObjectReorderMetadata, Me.mnuPrepareDataObjectDeleteMetadata}) + Me.mnuPrepareDataBook.Name = "mnuPrepareDataBook" + Me.mnuPrepareDataBook.Size = New System.Drawing.Size(186, 22) + Me.mnuPrepareDataBook.Tag = "Data_Object" + Me.mnuPrepareDataBook.Text = "Data Book" ' 'mnuPrepareDataObjectDataFrameMetadata ' @@ -4662,16 +4646,16 @@ Partial Class frmMain ' 'mnuOptionsByContextCheckData ' - Me.mnuOptionsByContextCheckData.DropDownItems.AddRange(New System.Windows.Forms.ToolStripItem() {Me.mnuOptionsByContextCheckDataDuplicates, Me.mnuOptionsByContextCheckDataCompareColumns, Me.ToolStripSeparator47, Me.mnuOptionsByContextCheckDataOneVariableSummarise, Me.mnuOptionsByContextCheckDataOneVariableGraph, Me.mnuOptionsByContextCheckDataOneVariableFrequencies}) + Me.mnuOptionsByContextCheckData.DropDownItems.AddRange(New System.Windows.Forms.ToolStripItem() {Me.mnuOptionsByContextCheckDataDuplicateRows, Me.mnuOptionsByContextCheckDataCompareColumns, Me.ToolStripSeparator47, Me.mnuOptionsByContextCheckDataOneVariableSummarise, Me.mnuOptionsByContextCheckDataOneVariableGraph, Me.mnuOptionsByContextCheckDataOneVariableFrequencies}) Me.mnuOptionsByContextCheckData.Name = "mnuOptionsByContextCheckData" Me.mnuOptionsByContextCheckData.Size = New System.Drawing.Size(134, 22) Me.mnuOptionsByContextCheckData.Text = "Check Data" ' - 'mnuOptionsByContextCheckDataDuplicates + 'mnuOptionsByContextCheckDataDuplicateRows ' - Me.mnuOptionsByContextCheckDataDuplicates.Name = "mnuOptionsByContextCheckDataDuplicates" - Me.mnuOptionsByContextCheckDataDuplicates.Size = New System.Drawing.Size(215, 22) - Me.mnuOptionsByContextCheckDataDuplicates.Text = "Duplicates..." + Me.mnuOptionsByContextCheckDataDuplicateRows.Name = "mnuOptionsByContextCheckDataDuplicateRows" + Me.mnuOptionsByContextCheckDataDuplicateRows.Size = New System.Drawing.Size(215, 22) + Me.mnuOptionsByContextCheckDataDuplicateRows.Text = "Duplicate Rows..." ' 'mnuOptionsByContextCheckDataCompareColumns ' @@ -5037,7 +5021,6 @@ Partial Class frmMain Me.ucrDataViewer.BackColor = System.Drawing.SystemColors.Control Me.ucrDataViewer.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle Me.ucrDataViewer.Dock = System.Windows.Forms.DockStyle.Fill - Me.ucrDataViewer.grdCurrSheet = Nothing Me.ucrDataViewer.Location = New System.Drawing.Point(0, 0) Me.ucrDataViewer.Margin = New System.Windows.Forms.Padding(4, 5, 4, 5) Me.ucrDataViewer.Name = "ucrDataViewer" @@ -5216,7 +5199,7 @@ Partial Class frmMain Friend WithEvents mnuViewDataFrameMetadata As ToolStripMenuItem Friend WithEvents mnuViewLog As ToolStripMenuItem Friend WithEvents mnuViewScriptWindow As ToolStripMenuItem - Friend WithEvents mnuPrepareDataObject As ToolStripMenuItem + Friend WithEvents mnuPrepareDataBook As ToolStripMenuItem Friend WithEvents mnuPrepareDataObjectDeleteDataFrame As ToolStripMenuItem Friend WithEvents mnuPrepareDataObjectRenameDataFrame As ToolStripMenuItem Friend WithEvents mnuPrepareDataObjectReorderDataFrames As ToolStripMenuItem @@ -5252,7 +5235,7 @@ Partial Class frmMain Friend WithEvents mnuPrepareColumnTextMatch As ToolStripMenuItem Friend WithEvents mnuPrepareColumnTextDistance As ToolStripMenuItem Friend WithEvents ToolStripSeparator7 As ToolStripSeparator - Friend WithEvents mnuPrepareDataFrameFilter As ToolStripMenuItem + Friend WithEvents mnuPrepareDataFrameFilterRows As ToolStripMenuItem Friend WithEvents ToolStripSeparator10 As ToolStripSeparator Friend WithEvents ToolStripSeparator11 As ToolStripSeparator Friend WithEvents mnuPrepareColumnReshapeTranspose As ToolStripMenuItem @@ -5287,7 +5270,7 @@ Partial Class frmMain Friend WithEvents mnuDescribeOneVariable As ToolStripMenuItem Friend WithEvents mnuDescribeOneVariableSummarise As ToolStripMenuItem Friend WithEvents mnuDescribeOneVariableGraph As ToolStripMenuItem - Friend WithEvents mnuDescribeTwoVariables As ToolStripMenuItem + Friend WithEvents mnuDescribeTwoThreeVariables As ToolStripMenuItem Friend WithEvents mnuDescribeTwoVariablesSummarise As ToolStripMenuItem Friend WithEvents mnuDescribeTwoVariablesTabulate As ToolStripMenuItem Friend WithEvents mnuDescribeTwoVariablesGraph As ToolStripMenuItem @@ -5296,7 +5279,6 @@ Partial Class frmMain Friend WithEvents mnuDescribeGeneralTabulation As ToolStripMenuItem Friend WithEvents mnuDescribeGeneralGraphics As ToolStripMenuItem Friend WithEvents mnuDescribeSpecificTablesGraphs As ToolStripMenuItem - Friend WithEvents mnuDescribeSpecificFrequency As ToolStripMenuItem Friend WithEvents mnuDescribeSpecificSummary As ToolStripMenuItem Friend WithEvents mnuDescribeSpecificMultipleResponse As ToolStripMenuItem Friend WithEvents mnuModelProbabilityDistributions As ToolStripMenuItem @@ -5493,16 +5475,11 @@ Partial Class frmMain Friend WithEvents mnuDescribeOneVariableFrequencies As ToolStripMenuItem Friend WithEvents ToolStripSeparator34 As ToolStripSeparator Friend WithEvents ToolStripMenuItem1 As ToolStripMenuItem - Friend WithEvents mnuDescribeTwoVariablesFrequencies As ToolStripMenuItem + Friend WithEvents mnuDescribeTwoThreeVariablesTwoWayFrequencies As ToolStripMenuItem Friend WithEvents mnuFileImportFromCSPRO As ToolStripMenuItem Friend WithEvents mnuFileImportFromDatabases As ToolStripMenuItem Friend WithEvents mnuClimaticFileImportandTidyNetCDF As ToolStripMenuItem Friend WithEvents mnuProcurementPrepareRecodeNumericIntoQuantiles As ToolStripMenuItem - Friend WithEvents mnuDescribeThreeVariable As ToolStripMenuItem - Friend WithEvents mnuDescribeThreeVariableSummarise As ToolStripMenuItem - Friend WithEvents mnuDescribeThreeVariableGraph As ToolStripMenuItem - Friend WithEvents ToolStripSeparator36 As ToolStripSeparator - Friend WithEvents mnuDescribeThreeVariableFrequencies As ToolStripMenuItem Friend WithEvents ToolStripSeparator35 As ToolStripSeparator Friend WithEvents splOverall As SplitContainer Friend WithEvents splDataOutput As SplitContainer @@ -5518,7 +5495,6 @@ Partial Class frmMain Friend WithEvents ucrScriptWindow As ucrScript Friend WithEvents mnuClimaticFileImportfromIRIDataLibrary As ToolStripMenuItem Friend WithEvents mnuDescribeOneVariableRatingData As ToolStripMenuItem - Friend WithEvents mnuPrepareFactorViewLabels As ToolStripMenuItem Friend WithEvents mnuDescribeViewGraph As ToolStripMenuItem Friend WithEvents mnuClimaticDates As ToolStripMenuItem Friend WithEvents mnuClimaticDatesGenerateDates As ToolStripMenuItem @@ -5587,7 +5563,7 @@ Partial Class frmMain Friend WithEvents mnuOptionsByContextDescribe As ToolStripMenuItem Friend WithEvents mnuOptionsByContextDescribeCompareTwoTreatments As ToolStripMenuItem Friend WithEvents mnuOptionsByContextDescribeCompareMultipleTreatments As ToolStripMenuItem - Friend WithEvents mnuOptionsByContextCheckDataDuplicates As ToolStripMenuItem + Friend WithEvents mnuOptionsByContextCheckDataDuplicateRows As ToolStripMenuItem Friend WithEvents mnuOptionsByContextCheckDataCompareColumns As ToolStripMenuItem Friend WithEvents mnuOptionsByContextModel As ToolStripMenuItem Friend WithEvents mnuOptionsByContextModelFitModel As ToolStripMenuItem @@ -5639,7 +5615,7 @@ Partial Class frmMain Friend WithEvents mnuClimaticMapping As ToolStripMenuItem Friend WithEvents mnuHelpWindows As ToolStripMenuItem Friend WithEvents mnuHelpDataViewSpreadsheet As ToolStripMenuItem - Friend WithEvents mnuClimaticTidyandExamineDuplicates As ToolStripMenuItem + Friend WithEvents mnuClimaticTidyandExamineDuplicateRows As ToolStripMenuItem Friend WithEvents mnuClimaticTidyandExamineOneVariableGraph As ToolStripMenuItem Friend WithEvents mnuClimaticTidyandExamineOneVariableFrequencies As ToolStripMenuItem Friend WithEvents mnuModelUseModel As ToolStripMenuItem @@ -5774,12 +5750,10 @@ Partial Class frmMain Friend WithEvents mnuLastGraph As ToolStripSplitButton Friend WithEvents mnuViewer As ToolStripMenuItem Friend WithEvents mnuploty As ToolStripMenuItem - Friend WithEvents mnuDescribeTwoVariablesPivotTable As ToolStripMenuItem Friend WithEvents ToolStripSeparator27 As ToolStripSeparator Friend WithEvents ToolStripSeparator71 As ToolStripSeparator Friend WithEvents mnuEditScript As ToolStripMenuItem Friend WithEvents mnuPrepareDataFrameSelectColumns As ToolStripMenuItem - Friend WithEvents mnuDescribeThreeVariablePivotTable As ToolStripMenuItem Friend WithEvents mnuClimaticFileExportToClimsoft As ToolStripMenuItem Friend WithEvents mnuClimaticTidyandExamineCompareColumns As ToolStripMenuItem Friend WithEvents mnuPrepareDataFrameDuplicateColumn As ToolStripMenuItem @@ -5791,4 +5765,11 @@ Partial Class frmMain Friend WithEvents mnuOptionsByContextDefine As ToolStripMenuItem Friend WithEvents mnuOptionsByContextDefineOnStation As ToolStripMenuItem Friend WithEvents mnuOptionsByContextDefineOnFarm As ToolStripMenuItem + Friend WithEvents mnuDescribeTwoThreeVariablesCorrelations As ToolStripMenuItem + Friend WithEvents mnuDescribeTwoThreeVariablesThreeWayFrequencies As ToolStripMenuItem + Friend WithEvents mnuDescribeTwoThreeVariablesPivotTable As ToolStripMenuItem + Friend WithEvents ToolStripSeparator36 As ToolStripSeparator + Friend WithEvents mnuPrepareDataFrameAddMergeColumns As ToolStripMenuItem + Friend WithEvents mnuPrepareCheckDataViewDeleteLabels As ToolStripMenuItem + Friend WithEvents mnuPrepareDataReshapeRandomSplit As ToolStripMenuItem End Class diff --git a/instat/frmMain.vb b/instat/frmMain.vb index bc81ce1a85f..de2fb1634a7 100644 --- a/instat/frmMain.vb +++ b/instat/frmMain.vb @@ -31,7 +31,7 @@ Public Class frmMain Public strInstatOptionsFile As String = "Options.bin" Public clsInstatOptions As InstatOptions Public clsRecentItems As clsRecentFiles - Public strCurrentDataFrame As String + 'Public strCurrentDataFrame As String Public dlgLastDialog As Form Public strSaveFilePath As String = "" Public clsOutputLogger As clsOutputLogger @@ -40,6 +40,11 @@ Public Class frmMain Private WithEvents timer As New System.Windows.Forms.Timer Private iAutoSaveDataMilliseconds As Integer Private clsDataBook As clsDataBook + Public ReadOnly Property DataBook As clsDataBook + Get + Return clsDataBook + End Get + End Property Public strAutoSaveDataFolderPath As String = Path.Combine(Path.GetTempPath, "R-Instat_data_auto_save") Public strAutoSaveLogFolderPath As String = Path.Combine(Path.GetTempPath, "R-Instat_log_auto_save") @@ -398,14 +403,10 @@ Public Class frmMain End Sub Private Sub mnuPrepareColumnNumericRegularSequence_Click(sender As Object, e As EventArgs) Handles mnuPrepareColumnNumericRegularSequence.Click - dlgRegularSequence.bNumericIsDefault = True + dlgRegularSequence.SetNumericSequenceAsDefaultOption() dlgRegularSequence.ShowDialog() End Sub - Private Sub FrequencyToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles mnuDescribeSpecificFrequency.Click - dlgFrequency.ShowDialog() - End Sub - Private Sub SummaryToolStripMenuItem1_Click(sender As Object, e As EventArgs) Handles mnuDescribeSpecificSummary.Click dlgSummaryTables.ShowDialog() End Sub @@ -650,10 +651,6 @@ Public Class frmMain dlgLabelsLevels.ShowDialog() End Sub - Private Sub mnuPrepareFactorViewLabels_Click(sender As Object, e As EventArgs) Handles mnuPrepareFactorViewLabels.Click - dlgViewFactorLabels.ShowDialog() - End Sub - Private Sub mnuPrepareFactorConvertToFactor_Click(sender As Object, e As EventArgs) Handles mnuPrepareColumnFactorConvertToFactor.Click dlgConvertColumns.bToFactorOnly = True dlgConvertColumns.ShowDialog() @@ -702,7 +699,7 @@ Public Class frmMain dlgCombineText.ShowDialog() End Sub - Private Sub mnuPrepareDataFilter_Click(sender As Object, e As EventArgs) Handles mnuPrepareDataFrameFilter.Click + Private Sub mnuPrepareDataFilter_Click(sender As Object, e As EventArgs) Handles mnuPrepareDataFrameFilterRows.Click dlgRestrict.bIsSubsetDialog = False dlgRestrict.strDefaultDataframe = "" dlgRestrict.ShowDialog() @@ -1332,7 +1329,7 @@ Public Class frmMain dlgDefineRedFlags.ShowDialog() End Sub - Private Sub mnuDescribeTwoVariablesFrequencies_Click(sender As Object, e As EventArgs) Handles mnuDescribeTwoVariablesFrequencies.Click + Private Sub mnuDescribeTwoVariablesFrequencies_Click(sender As Object, e As EventArgs) Handles mnuDescribeTwoThreeVariablesTwoWayFrequencies.Click dlgTwoWayFrequencies.ShowDialog() End Sub @@ -1456,10 +1453,6 @@ Public Class frmMain dlgStringDistance.ShowDialog() End Sub - Private Sub mnuDescribeThreeVariableFrequencies_Click(sender As Object, e As EventArgs) Handles mnuDescribeThreeVariableFrequencies.Click - dlgThreeVariableFrequencies.ShowDialog() - End Sub - Private Sub mnuDescribeViewGraph_Click(sender As Object, e As EventArgs) Handles mnuDescribeViewGraph.Click dlgViewGraph.ShowDialog() End Sub @@ -1584,7 +1577,7 @@ Public Class frmMain End Sub Private Sub mnuPrepareCheckDataDuplicates_Click(sender As Object, e As EventArgs) Handles mnuPrepareCheckDataDuplicates.Click - dlgDuplicates.ShowDialog() + dlgDuplicateRows.ShowDialog() End Sub Private Sub mnuClimaticCheckDataBoxplot_Click_1(sender As Object, e As EventArgs) Handles mnuClimaticCheckDataBoxplot.Click @@ -1817,12 +1810,12 @@ Public Class frmMain End Sub Private Sub mnuPrepareColumnGenerateDate_Click(sender As Object, e As EventArgs) Handles mnuPrepareColumnDateGenerateDate.Click - dlgRegularSequence.bNumericIsDefault = False + dlgRegularSequence.SetDateSequenceAsDefaultOption() dlgRegularSequence.ShowDialog() End Sub Private Sub mnuClimaticDatesGenerateDates_Click(sender As Object, e As EventArgs) Handles mnuClimaticDatesGenerateDates.Click - dlgRegularSequence.bNumericIsDefault = False + dlgRegularSequence.SetDateSequenceAsDefaultOption() dlgRegularSequence.ShowDialog() End Sub @@ -1838,8 +1831,8 @@ Public Class frmMain dlgMergeAdditionalData.ShowDialog() End Sub - Private Sub mnuOptionsByContextsCheckDataDuplicates_Click(sender As Object, e As EventArgs) Handles mnuOptionsByContextCheckDataDuplicates.Click - dlgDuplicates.ShowDialog() + Private Sub mnuOptionsByContextsCheckDataDuplicates_Click(sender As Object, e As EventArgs) Handles mnuOptionsByContextCheckDataDuplicateRows.Click + dlgDuplicateRows.ShowDialog() End Sub Private Sub mnuOptionsByContextsCheckDataCompareColumns_Click(sender As Object, e As EventArgs) Handles mnuOptionsByContextCheckDataCompareColumns.Click @@ -2001,8 +1994,8 @@ Public Class frmMain dlgOneWayFrequencies.ShowDialog() End Sub - Private Sub mnuClimaticTidyandExamineDuplicates_Click(sender As Object, e As EventArgs) Handles mnuClimaticTidyandExamineDuplicates.Click - dlgDuplicates.ShowDialog() + Private Sub mnuClimaticTidyandExamineDuplicates_Click(sender As Object, e As EventArgs) Handles mnuClimaticTidyandExamineDuplicateRows.Click + dlgDuplicateRows.ShowDialog() End Sub Private Sub mnuCumExeedenceGraph_Click(sender As Object, e As EventArgs) Handles mnuClimaticPICSACumExeedenceGraph.Click @@ -2384,10 +2377,6 @@ Public Class frmMain dlgPasteNewColumns.ShowDialog() End Sub - Private Sub mnuDescribeTwoVariablesPivotTable_Click(sender As Object, e As EventArgs) Handles mnuDescribeTwoVariablesPivotTable.Click - dlgPivotTable.ShowDialog() - End Sub - Private Sub mnuEditScript_Click(sender As Object, e As EventArgs) Handles mnuEditScript.Click dlgScript.ShowDialog() End Sub @@ -2396,10 +2385,6 @@ Public Class frmMain dlgSelect.ShowDialog() End Sub - Private Sub mnuDescribeThreeVariablePivotTable_Click(sender As Object, e As EventArgs) Handles mnuDescribeThreeVariablePivotTable.Click - dlgThreeVariablePivotTable.ShowDialog() - End Sub - Private Sub mnuClimaticFileExportToClimsoft_Click(sender As Object, e As EventArgs) Handles mnuClimaticFileExportToClimsoft.Click dlgExportToClimsoft.ShowDialog() End Sub @@ -2431,4 +2416,28 @@ Public Class frmMain Private Sub mnuOptionsByContextDefineOnFarm_Click(sender As Object, e As EventArgs) Handles mnuOptionsByContextDefineOnFarm.Click dlgDefineOptionsByContext.ShowDialog() End Sub + + Private Sub mnuDescribeTwoThreeVariablesCorrelations_Click(sender As Object, e As EventArgs) Handles mnuDescribeTwoThreeVariablesCorrelations.Click + dlgCorrelation.ShowDialog() + End Sub + + Private Sub mnuDescribeTwoThreeVariablesThreeWayFrequencies_Click(sender As Object, e As EventArgs) Handles mnuDescribeTwoThreeVariablesThreeWayFrequencies.Click + dlgThreeVariableFrequencies.ShowDialog() + End Sub + + Private Sub mnuDescribeTwoThreeVariablesPivotTableSummaries_Click(sender As Object, e As EventArgs) Handles mnuDescribeTwoThreeVariablesPivotTable.Click + dlgThreeVariablePivotTable.ShowDialog() + End Sub + + Private Sub mnuPrepareDataFrameAddMergeColumns_Click(sender As Object, e As EventArgs) Handles mnuPrepareDataFrameAddMergeColumns.Click + dlgMergeAdditionalData.ShowDialog() + End Sub + + Private Sub mnuPrepareCheckDataViewDeleteLabels_Click(sender As Object, e As EventArgs) Handles mnuPrepareCheckDataViewDeleteLabels.Click + dlgViewFactorLabels.ShowDialog() + End Sub + + Private Sub RandomSplitToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles mnuPrepareDataReshapeRandomSplit.Click + dlgRandomSplit.ShowDialog() + End Sub End Class diff --git a/instat/instat.vbproj b/instat/instat.vbproj index e29e912c3d3..a94538d14b0 100644 --- a/instat/instat.vbproj +++ b/instat/instat.vbproj @@ -134,8 +134,8 @@ ..\packages\R.NET.1.8.2\lib\netstandard2.0\RDotNet.dll - - ..\packages\RScript.1.0.4\lib\net461\RScript.dll + + ..\packages\RScript.1.0.6\lib\net461\RScript.dll @@ -1022,12 +1022,6 @@ Form - - dlgFrequency.vb - - - Form - dlgImportFromCSPRO.vb @@ -1707,12 +1701,6 @@ Form - - dlgPopulationPyramids.vb - - - Form - dlgPrincipalComponentAnalysis.vb @@ -2755,12 +2743,6 @@ UserControl - - ucrSaveGraph.vb - - - UserControl - ucrSaveModel.vb @@ -2809,6 +2791,9 @@ UserControl + + Component + ucrTry.vb @@ -3411,9 +3396,6 @@ dlgFreezeColumns.vb - - dlgFrequency.vb - dlgHelpVignettes.vb @@ -3687,9 +3669,6 @@ dlgFreezeColumns.vb - - dlgFrequency.vb - dlgFromLibrary.vb Designer @@ -3820,12 +3799,6 @@ dlgPICSATemperature.vb - - dlgPopulationPyramids.vb - - - dlgPopulationPyramids.vb - dlgPrincipalComponentAnalysis.vb @@ -5091,12 +5064,6 @@ ucrSave.vb - - ucrSaveGraph.vb - - - ucrSaveGraph.vb - ucrSaveModel.vb @@ -5175,6 +5142,7 @@ PreserveNewest + diff --git a/instat/mdlCoreControl.vb b/instat/mdlCoreControl.vb index 5288cfa2a56..6caea0fb73b 100644 --- a/instat/mdlCoreControl.vb +++ b/instat/mdlCoreControl.vb @@ -113,4 +113,27 @@ Module mdlCoreControl Next Return lstVariables End Function + + + ''' + ''' returns an R vector string command in a string object. + ''' for instance, an enumerable that contains "1","2" will be returned as string c("1","2") + ''' + ''' list of items to be returned as R vector command + ''' Default is False. + ''' If set as true and enumerable has only 1 element + ''' then the element will be returned without the c() command. + ''' for instance, an enumerable that contains "1" will be returned as string "1" + ''' If contains at least one element, then returns an + ''' R vector string command, else returns "". + Public Function GetRVector(enumerable As IEnumerable(Of String), Optional bOnlyIfMultipleElement As Boolean = False) As String + If enumerable Is Nothing OrElse enumerable.Count = 0 Then + Return "" + ElseIf bOnlyIfMultipleElement AndAlso enumerable.Count = 1 Then + Return enumerable(0) + Else + Return "c(" & String.Join(",", enumerable.ToArray()) & ")" + End If + End Function + End Module \ No newline at end of file diff --git a/instat/packages.config b/instat/packages.config index 7e3acf8c959..525d2b4fd10 100644 --- a/instat/packages.config +++ b/instat/packages.config @@ -5,7 +5,7 @@ - + diff --git a/instat/sdgCombineGraphOptions.vb b/instat/sdgCombineGraphOptions.vb index 79862f5cf2a..3ccd51837f5 100644 --- a/instat/sdgCombineGraphOptions.vb +++ b/instat/sdgCombineGraphOptions.vb @@ -43,6 +43,8 @@ Public Class sdgCombineGraphOptions grdCurrSheet.Rows = ucrNudRows.Value grdCurrSheet.Columns = ucrNudColumns.Value + ucrsdgLayoutBase.iHelpTopicID = 261 + ucrNudColumns.SetParameter(New RParameter("ncol", 1)) ucrNudRows.SetParameter(New RParameter("nrow", 2)) diff --git a/instat/sdgCorrPlot.vb b/instat/sdgCorrPlot.vb index bc2370c32c6..2316c176524 100644 --- a/instat/sdgCorrPlot.vb +++ b/instat/sdgCorrPlot.vb @@ -33,6 +33,8 @@ Public Class sdgCorrPlot Public Sub InitialiseControls() Dim dctGeom As New Dictionary(Of String, String) + ucrBaseSdgCorrPlot.iHelpTopicID = 266 + ucrNudMaximumSize.SetParameter(New RParameter("max_size", 1)) ucrNudMaximumSize.SetMinMax(1, 10) ucrNudMaximumSize.SetRDefault("6") diff --git a/instat/sdgCountryColouredMapOptions.vb b/instat/sdgCountryColouredMapOptions.vb index 6d80121db3d..41ce5077006 100644 --- a/instat/sdgCountryColouredMapOptions.vb +++ b/instat/sdgCountryColouredMapOptions.vb @@ -49,7 +49,9 @@ Public Class sdgCountryColouredMapOptions ucrInputLongMin.SetLinkedDisplayControl(lblLongMin) ucrInputLongMax.SetLinkedDisplayControl(lblLongMax) ucrInputLatMin.SetLinkedDisplayControl(lblLatMin) - ucrInputLatMax.SetLinkedDisplayControl(lblLatMax) + ucrInputLatMax.SetLinkedDisplayControl(lblLatMax) + + ucrBase.iHelpTopicID = 650 lstRegionInputControls = New List(Of ucrInputTextBox) lstRegionInputControls.AddRange({ucrInputLatMin, ucrInputLatMax, ucrInputLongMin, ucrInputLongMax}) diff --git a/instat/sdgDataOptions.vb b/instat/sdgDataOptions.vb index 831681b7a87..cc48fa0f01a 100644 --- a/instat/sdgDataOptions.vb +++ b/instat/sdgDataOptions.vb @@ -58,9 +58,9 @@ Public Class sdgDataOptions ucrReceiverFilter.SetMeAsReceiver() ucrReceiverFilter.strSelectorHeading = "Filters" - ucrSelectorFilters.HideShowAddOrDataOptionsButton(bDataOptionsVisible:=False) + ucrSelectorFilters.HideShowAddOrDataOptionsOrListView(bDataOptionsVisible:=False) - ucrSelectorForSelectColumns.HideShowAddOrDataOptionsButton(bDataOptionsVisible:=False) + ucrSelectorForSelectColumns.HideShowAddOrDataOptionsOrListView(bDataOptionsVisible:=False) ucrReceiverSelect.Selector = ucrSelectorForSelectColumns ucrReceiverSelect.SetMeAsReceiver() diff --git a/instat/sdgDistributionOptions.vb b/instat/sdgDistributionOptions.vb index 52b797ac815..2f621c913d2 100644 --- a/instat/sdgDistributionOptions.vb +++ b/instat/sdgDistributionOptions.vb @@ -27,6 +27,8 @@ Public Class sdgDistributionOptions Dim dctThemes As New Dictionary(Of String, String) Dim strThemes As String() + ucrBase.iHelpTopicID = 262 + ucrInputGraphTitle.SetParameter(New RParameter("title", 0)) ucrInputGraphSubTitle.SetParameter(New RParameter("subtitle", 1)) diff --git a/instat/sdgFiltersFromFactor.Designer.vb b/instat/sdgFiltersFromFactor.Designer.vb index abeeebe78b1..4808c1f4fd3 100644 --- a/instat/sdgFiltersFromFactor.Designer.vb +++ b/instat/sdgFiltersFromFactor.Designer.vb @@ -75,13 +75,10 @@ Partial Class sdgFiltersFromFactor ' Me.ucrFactorLevels.AutoSize = True Me.ucrFactorLevels.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle - Me.ucrFactorLevels.clsReceiver = Nothing Me.ucrFactorLevels.Location = New System.Drawing.Point(267, 57) Me.ucrFactorLevels.Name = "ucrFactorLevels" - Me.ucrFactorLevels.shtCurrSheet = Nothing Me.ucrFactorLevels.Size = New System.Drawing.Size(270, 208) Me.ucrFactorLevels.TabIndex = 1 - Me.ucrFactorLevels.ucrChkLevels = Nothing ' 'cmdSelectAll ' diff --git a/instat/sdgFiltersFromFactor.vb b/instat/sdgFiltersFromFactor.vb index 2bf0cf35f4d..d667caff668 100644 --- a/instat/sdgFiltersFromFactor.vb +++ b/instat/sdgFiltersFromFactor.vb @@ -41,18 +41,20 @@ Public Class sdgFiltersFromFactor Private Sub InitialiseControls() ucrSelectorFiltersFromFactors.SetParameterIsString() - ucrFactorLevels.SetParameter(New RParameter("filter_levels", 1)) - ucrFactorLevels.strSelectorColumnName = "Select Level" - ucrFactorLevels.SetAsMultipleSelector() - ucrFactorLevels.SetReceiver(ucrReceiverFactor) - ucrFactorLevels.SetIncludeLevels(False) - ucrReceiverFactor.SetParameter(New RParameter("column", 2)) ucrReceiverFactor.Selector = ucrSelectorFiltersFromFactors ucrReceiverFactor.SetParameterIsString() ucrReceiverFactor.SetMeAsReceiver() ucrReceiverFactor.SetDataType("factor", bStrict:=True) + Dim dctParamAndColNames As New Dictionary(Of String, String) + dctParamAndColNames.Add("filter_levels", ucrFactor.DefaultColumnNames.Label) + + ucrFactorLevels.SetParameter(New RParameter("filter_levels", 1)) + ucrFactorLevels.SetAsMultipleSelectorGrid(ucrReceiverFactor, + dctParamAndColNames:=dctParamAndColNames, + hiddenColNames:={ucrFactor.DefaultColumnNames.Level}, + bIncludeNALevel:=False) cmdSelectAll.Enabled = False End Sub @@ -69,18 +71,18 @@ Public Class sdgFiltersFromFactor End Sub Private Sub ucrBase_ClickReturn(sender As Object, e As EventArgs) Handles ucrBase.ClickReturn - 'TODO: check how to get count of selected items from reogrid, then remove bSilent:=False to avoid errors when no level is selected. - If Not ucrReceiverFactor.IsEmpty Then - frmMain.clsRLink.RunScript(clsAddFilterFromFactors.ToScript, strComment:="Filter From Factors subdialog: Created new filter", bSilent:=True) + If ucrFactorLevels.IsAnyGridRowSelected Then + frmMain.clsRLink.RunScript(clsAddFilterFromFactors.ToScript, strComment:="Filter From Factors subdialog: Created new filter", bSilent:=False) End If End Sub Private Sub cmdSelectAll_Click(sender As Object, e As EventArgs) Handles cmdSelectAll.Click - ucrFactorLevels.SetSelectionAllLevels(Not ucrFactorLevels.IsAllSelected()) + ucrFactorLevels.SelectAllGridRows(Not ucrFactorLevels.IsAllGridRowsSelected()) End Sub - Private Sub ucrFactorLevels_SelectedLevelChanged() Handles ucrFactorLevels.SelectedLevelChanged - If ucrFactorLevels.IsAllSelected() Then + Private Sub ucrReceiverFactor_ControlValueChanged(ucrChangedControl As ucrCore) Handles ucrReceiverFactor.ControlValueChanged + cmdSelectAll.Enabled = Not ucrReceiverFactor.IsEmpty + If ucrFactorLevels.IsAllGridRowsSelected() Then cmdSelectAll.Text = "Deselect All Levels" cmdSelectAll.FlatStyle = FlatStyle.Flat Else @@ -90,10 +92,6 @@ Public Class sdgFiltersFromFactor autoTranslate(Me) End Sub - Private Sub ucrReceiverFactor_ControlValueChanged(ucrChangedControl As ucrCore) Handles ucrReceiverFactor.ControlValueChanged - cmdSelectAll.Enabled = Not ucrReceiverFactor.IsEmpty - End Sub - Private Sub ucrSelectorFiltersFromFactors_DataFrameChanged() Handles ucrSelectorFiltersFromFactors.DataFrameChanged clsAddFilterFromFactors.AddParameter("data_name", Chr(34) & ucrSelectorFiltersFromFactors.ucrAvailableDataFrames.cboAvailableDataFrames.Text & Chr(34), iPosition:=0) End Sub diff --git a/instat/sdgMapOption.vb b/instat/sdgMapOption.vb index 905eb582def..f573120f5d4 100644 --- a/instat/sdgMapOption.vb +++ b/instat/sdgMapOption.vb @@ -33,6 +33,7 @@ Public Class sdgMapOption ucrInputLongMin.SetValidationTypeAsNumeric(dcmMin:=-180, dcmMax:=180) ucrInputLongMin.AddQuotesIfUnrecognised = False + ucrBase.iHelpTopicID = 645 ucrInputLongMax.SetParameter(New RParameter("longmax", bNewIncludeArgumentName:=False)) ucrInputLongMax.SetValidationTypeAsNumeric(dcmMin:=-180, dcmMax:=180) ucrInputLongMax.AddQuotesIfUnrecognised = False diff --git a/instat/sdgOneVarFitModDisplay.vb b/instat/sdgOneVarFitModDisplay.vb index 7188770350e..a8f0c0ee9a6 100644 --- a/instat/sdgOneVarFitModDisplay.vb +++ b/instat/sdgOneVarFitModDisplay.vb @@ -35,6 +35,9 @@ Public Class sdgOneVarFitModDisplay ucrPnlLikelihood.AddRadioButton(rdoLik, "FALSE") ucrPnlLikelihood.SetRDefault("TRUE") + ucrBase.iHelpTopicID = 114 + + ucrChkPLotLogLik.AddToLinkedControls(ucrPnlLikelihood, {True}, bNewLinkedAddRemoveParameter:=True, bNewLinkedHideIfParameterMissing:=True) ucrChkPLotLogLik.AddToLinkedControls(ucrSaveLikelihood, {True}, bNewLinkedAddRemoveParameter:=True, bNewLinkedHideIfParameterMissing:=True) ucrChkPLotLogLik.AddRSyntaxContainsFunctionNamesCondition(True, {"llplot"}) diff --git a/instat/sdgOneVarFitModel.vb b/instat/sdgOneVarFitModel.vb index b1faa654017..f33a03116a7 100644 --- a/instat/sdgOneVarFitModel.vb +++ b/instat/sdgOneVarFitModel.vb @@ -38,6 +38,8 @@ Public Class sdgOneVarFitModel ucrPnlFitMethod.AddRadioButton(rdoQme, Chr(34) & "qme" & Chr(34)) ucrPnlFitMethod.AddRadioButton(rdoMge, Chr(34) & "mge" & Chr(34)) + ucrBase.iHelpTopicID = 113 + ucrPnlOptimisation.SetParameter(New RParameter("optim.method")) ucrPnlOptimisation.AddRadioButton(rdoDefault, Chr(34) & "default" & Chr(34)) ucrPnlOptimisation.AddRadioButton(rdoNelderMead, Chr(34) & "Nelder-Mead" & Chr(34)) diff --git a/instat/sdgOneVarGraph.vb b/instat/sdgOneVarGraph.vb index 0596812b8c1..b1ebc508417 100644 --- a/instat/sdgOneVarGraph.vb +++ b/instat/sdgOneVarGraph.vb @@ -27,6 +27,8 @@ Public Class sdgOneVarGraph Dim dctNumericPairs As New Dictionary(Of String, String) Dim dctCategoricalPairs As New Dictionary(Of String, String) + ucrButtonsOneVarGraph.iHelpTopicID = 170 + ucrInputNumeric.SetParameter(New RParameter("numeric", 2)) dctNumericPairs.Add("Boxplot", Chr(34) & "geom_boxplot" & Chr(34)) dctNumericPairs.Add("Histogram", Chr(34) & "geom_histogram" & Chr(34)) diff --git a/instat/sdgOneVarUseModFit.vb b/instat/sdgOneVarUseModFit.vb index 6001d4ca8f9..da27589168f 100644 --- a/instat/sdgOneVarUseModFit.vb +++ b/instat/sdgOneVarUseModFit.vb @@ -28,6 +28,8 @@ Public Class sdgOneVarUseModFit Public Sub InitialiseControls() Dim dctQuantileValues As New Dictionary(Of String, String) + ucrBase.iHelpTopicID = 115 + ucrNudIterations.SetParameter(New RParameter("niter", 1)) ucrNudIterations.SetMinMax(1, 10001) ucrNudIterations.SetRDefault(1001) diff --git a/instat/sdgOpenNetCDF.vb b/instat/sdgOpenNetCDF.vb index 2eab5b293ff..61e6d01aa6a 100644 --- a/instat/sdgOpenNetCDF.vb +++ b/instat/sdgOpenNetCDF.vb @@ -52,6 +52,8 @@ Public Class sdgOpenNetCDF clsAsDateMin.SetRCommand("as.Date") clsAsDateMax.SetRCommand("as.Date") + ucrBase.iHelpTopicID = 117 + ucrInputFileDetails.txtInput.ScrollBars = ScrollBars.Vertical ucrInputMinX.SetParameter(New RParameter("min", 0, bNewIncludeArgumentName:=False)) diff --git a/instat/sdgSelectMonth.Designer.vb b/instat/sdgSelectMonth.Designer.vb index 7fdf6af82e9..4c70c167533 100644 --- a/instat/sdgSelectMonth.Designer.vb +++ b/instat/sdgSelectMonth.Designer.vb @@ -41,13 +41,10 @@ Partial Class sdgSelectMonth ' Me.ucrMonthAsFactor.AutoSize = True Me.ucrMonthAsFactor.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle - Me.ucrMonthAsFactor.clsReceiver = Nothing Me.ucrMonthAsFactor.Location = New System.Drawing.Point(14, 40) Me.ucrMonthAsFactor.Name = "ucrMonthAsFactor" - Me.ucrMonthAsFactor.shtCurrSheet = Nothing Me.ucrMonthAsFactor.Size = New System.Drawing.Size(231, 219) Me.ucrMonthAsFactor.TabIndex = 3 - Me.ucrMonthAsFactor.ucrChkLevels = Nothing ' 'ucrBaseSdg ' diff --git a/instat/sdgSelectMonth.vb b/instat/sdgSelectMonth.vb index dee2633af26..63c4f6209eb 100644 --- a/instat/sdgSelectMonth.vb +++ b/instat/sdgSelectMonth.vb @@ -27,11 +27,9 @@ Public Class sdgSelectMonth End Sub Private Sub InitialiseControls() - ucrMonthAsFactor.strSelectorColumnName = "Omit Level" - ucrMonthAsFactor.SetAsMultipleSelector() - ucrMonthAsFactor.SetReceiver(ucrReceiverMonth) - ucrMonthAsFactor.SetIncludeLevels(False) - ucrMonthAsFactor.bIncludeNA = False + ucrMonthAsFactor.SetAsMultipleSelectorGrid(ucrReceiverMonth, + hiddenColNames:={ucrFactor.DefaultColumnNames.Level}, + bIncludeNALevel:=False) End Sub Public Sub SetRCode(Optional clsNewInOperator As ROperator = Nothing, Optional clsNewListCalcFunction As RFunction = Nothing, Optional clsNewFilterMonthFunction As RFunction = Nothing, Optional ucrNewReceiverMonth As ucrReceiverSingle = Nothing, Optional bReset As Boolean = False) @@ -42,8 +40,10 @@ Public Class sdgSelectMonth End Sub Private Sub ucrMonthAsFactor_ControlValueChanged(ucrChangedControl As ucrCore) Handles ucrMonthAsFactor.ControlValueChanged - clsInOperator.AddParameter("months", ucrMonthAsFactor.GetSelectedLevels(), iPosition:=1) - If ucrMonthAsFactor.GetSelectedLevels.Count > 0 Then + clsInOperator.AddParameter("months", + mdlCoreControl.GetRVector(ucrMonthAsFactor.GetSelectedCellValues(ucrFactor.DefaultColumnNames.Label, True)), + iPosition:=1) + If ucrMonthAsFactor.IsAnyGridRowSelected Then clsListCalcFunction.AddParameter("month_filter", clsRFunctionParameter:=clsFilterMonthFunction, bIncludeArgumentName:=False, iPosition:=0) Else clsListCalcFunction.RemoveParameterByName("month_filter") diff --git a/instat/sdgTwoWayFrequencies.vb b/instat/sdgTwoWayFrequencies.vb index dbd58d47209..8ae70eee2f8 100644 --- a/instat/sdgTwoWayFrequencies.vb +++ b/instat/sdgTwoWayFrequencies.vb @@ -29,6 +29,8 @@ Public Class sdgTwoWayFrequencies Dim dctVerticalPositionLabel As New Dictionary(Of String, String) Dim dctHorizontalPositionLabel As New Dictionary(Of String, String) + ucrBaseSubDialogue.iHelpTopicID = 415 + 'Setting Table parameter ucrInputHorizontalLabels.SetParameter(New RParameter("hjust", 13)) dctHorizontalPositionLabel.Add("Left", Chr(34) & "left" & Chr(34)) diff --git a/instat/sdgWindrose.vb b/instat/sdgWindrose.vb index 603e2e6bea2..0b214ee5132 100644 --- a/instat/sdgWindrose.vb +++ b/instat/sdgWindrose.vb @@ -36,6 +36,8 @@ Public Class sdgWindrose ucrPnlColourPalette.AddRadioButton(rdoQualitative) ucrPnlColourPalette.SetParameter(New RParameter("col_pal")) + ucrButtonsSdgWindrose.iHelpTopicID = 116 + ucrNudNoOfDirections.SetParameter(New RParameter("n_directions", 3)) ucrNudNoOfDirections.SetRDefault(12) diff --git a/instat/static/Help/R-Instat.chm b/instat/static/Help/R-Instat.chm index da02eefbe75..6c74efaee63 100644 Binary files a/instat/static/Help/R-Instat.chm and b/instat/static/Help/R-Instat.chm differ diff --git a/instat/static/InstatObject/R/Backend_Components/calculations.R b/instat/static/InstatObject/R/Backend_Components/calculations.R index 94b3dc47071..c1f3f6c8fe8 100644 --- a/instat/static/InstatObject/R/Backend_Components/calculations.R +++ b/instat/static/InstatObject/R/Backend_Components/calculations.R @@ -1,41 +1,41 @@ calculation <- R6::R6Class("calculation", - public = list( - initialize = function(function_name = "", parameters = list(), - calculated_from = c(), is_recalculable = TRUE, - sub_calculations = list(), type = "", filter_conditions = list(), - filters = list(), name = "") { - self$function_name = function_name - self$parameters = parameters - self$calculated_from = c() - self$is_recalculable = is_recalculable - self$sub_calculations = sub_calculations - self$type = type - self$name = name - self$filter_conditions = filter_conditions - self$filters = filters - }, - function_name = "", - parameters = list(), - calculated_from = c(), - is_recalculable = TRUE, - sub_calculations = list(), - filter_conditions = list(), - filters = list(), - name = "", - type = "" - ) - # , - # Removed because filter_conditions can be public - # private = list( - # .filter_conditions = list() - # ) - # , - # active = list( - # filter_conditions = function(new_filter_conditions) { - # if(missing(new_filter_conditions)) return(private$.filter_conditions) - # else private$.filter_conditions <- new_filter_conditions - # } - # ) + public = list( + initialize = function(function_name = "", parameters = list(), + calculated_from = c(), is_recalculable = TRUE, + sub_calculations = list(), type = "", filter_conditions = list(), + filters = list(), name = "") { + self$function_name = function_name + self$parameters = parameters + self$calculated_from = c() + self$is_recalculable = is_recalculable + self$sub_calculations = sub_calculations + self$type = type + self$name = name + self$filter_conditions = filter_conditions + self$filters = filters + }, + function_name = "", + parameters = list(), + calculated_from = c(), + is_recalculable = TRUE, + sub_calculations = list(), + filter_conditions = list(), + filters = list(), + name = "", + type = "" + ) + # , + # Removed because filter_conditions can be public + # private = list( + # .filter_conditions = list() + # ) + # , + # active = list( + # filter_conditions = function(new_filter_conditions) { + # if(missing(new_filter_conditions)) return(private$.filter_conditions) + # else private$.filter_conditions <- new_filter_conditions + # } + # ) ) calculation$set("public", "add_sub_calculation", function(sub_calculation, name) { @@ -122,47 +122,47 @@ DataSheet$set("public", "save_calculation", function(calc) { # saving calculation only is useful to reproduce results in output window without needing to save in a data frame e.g. single value summaries) instat_calculation <- R6::R6Class("instat_calculation", - public = list( - initialize = function(function_exp = "", type = "", name = "", result_name = "", result_data_frame = "", manipulations = list(), - sub_calculations = list(), calculated_from = list(), save = 0, before = FALSE, adjacent_column = "") { - if((type == "calculation" || type == "summary") && missing(result_name)) stop("result_name must be provided for calculation and summary types") - if(type == "combination" && save > 0) { - warning("combination types do not have a main calculation which can be saved. save_output will be stored as FALSE") - save <- 0 - #TODO Should this do something else like set save_output = TRUE for all sub_calculations? - } - self$function_exp <- function_exp - self$type <- type - self$name <- name - self$result_name <- result_name - self$result_data_frame <- result_data_frame - self$manipulations <- manipulations - self$sub_calculations <- sub_calculations - self$calculated_from <- calculated_from - self$save <- save - self$before <- before - self$adjacent_column <- adjacent_column - }, - name = "", - result_name = "", - result_data_frame = "", - type = "", - manipulations = list(), - sub_calculations = list(), - function_exp = "", - calculated_from = list(), - save = 0, - before = FALSE, - adjacent_column = "" - ) + public = list( + initialize = function(function_exp = "", type = "", name = "", result_name = "", result_data_frame = "", manipulations = list(), + sub_calculations = list(), calculated_from = list(), save = 0, before = FALSE, adjacent_column = "") { + if((type == "calculation" || type == "summary") && missing(result_name)) stop("result_name must be provided for calculation and summary types") + if(type == "combination" && save > 0) { + warning("combination types do not have a main calculation which can be saved. save_output will be stored as FALSE") + save <- 0 + #TODO Should this do something else like set save_output = TRUE for all sub_calculations? + } + self$function_exp <- function_exp + self$type <- type + self$name <- name + self$result_name <- result_name + self$result_data_frame <- result_data_frame + self$manipulations <- manipulations + self$sub_calculations <- sub_calculations + self$calculated_from <- calculated_from + self$save <- save + self$before <- before + self$adjacent_column <- adjacent_column + }, + name = "", + result_name = "", + result_data_frame = "", + type = "", + manipulations = list(), + sub_calculations = list(), + function_exp = "", + calculated_from = list(), + save = 0, + before = FALSE, + adjacent_column = "" + ) ) instat_calculation$set("public", "data_clone", function(...) { ret <- instat_calculation$new(function_exp = self$function_exp, type = self$type, - name = self$name, result_name = self$result_name, - manipulations = lapply(self$manipulations, function(x) x$data_clone()), - sub_calculations = lapply(self$sub_calculations, function(x) x$data_clone()), - calculated_from = self$calculated_from, save = self$save) + name = self$name, result_name = self$result_name, + manipulations = lapply(self$manipulations, function(x) x$data_clone()), + sub_calculations = lapply(self$sub_calculations, function(x) x$data_clone()), + calculated_from = self$calculated_from, save = self$save) return(ret) } ) @@ -184,7 +184,7 @@ c_has_filter_label <- "has_filter" # This method is called recursively, and it would not be called by a user, another function would always handle the output and display # results to the user (usually only the $data part of the list) DataBook$set("public", "apply_instat_calculation", function(calc, curr_data_list, previous_manipulations = list()) { - + # apply each manipulation first, and recursively store the output and pass to the next manipulation # because of this, manipulations are dependant on each other for(manipulation in calc$manipulations) { @@ -220,7 +220,7 @@ DataBook$set("public", "apply_instat_calculation", function(calc, curr_data_list # A merge is required if a merge was already required, or if the current sub_calculation requires a merge #sub_calc_results[[c_require_merge_label]] <- overall_merge_required || current_calc_merge_required # TODO how to set new values for has summary/filter - + #### Set the data and link # Defined as variables as these are used throughout curr_calc_link_cols <- curr_sub_calc[[c_link_label]][["link_cols"]] @@ -355,7 +355,7 @@ DataBook$set("public", "apply_instat_calculation", function(calc, curr_data_list } } } - + # If there were any sub_calculations then the input for the main calculation should be the output from the last sub_calculation # Otherwise it is the output from the mainipulations if(!first_sub_calc) curr_data_list <- sub_calc_results @@ -366,7 +366,7 @@ DataBook$set("public", "apply_instat_calculation", function(calc, curr_data_list curr_data_list[[c_data_label]] <- curr_data_list[[c_data_label]] %>% group_by_(var, add = TRUE) } - + # Names of the data frames required for the calculation data_names <- unique(as.vector(names(calc$calculated_from))) # If argument was missing and there were no manipulations or sub_calculations then it should be created. @@ -471,7 +471,45 @@ DataBook$set("public", "apply_instat_calculation", function(calc, curr_data_list # A merge is now required because the data is at a different "level" else if(calc$type == "summary") { curr_data_list[[c_link_label]][["link_cols"]] <- as.character(dplyr::groups(curr_data_list[[c_data_label]])) - curr_data_list[[c_data_label]] <- curr_data_list[[c_data_label]] %>% dplyr::summarise_(.dots = setNames(list(as.formula(paste0("~", calc$function_exp))), calc$result_name)) + calc_from_data_name <- curr_data_list[[c_link_label]][["from_data_frame"]] + formula_fn_exp <- as.formula(paste0("~", calc$function_exp)) + # note: important that there is *no* space between | for grepl function + # and important there IS a psace in str_detect..! + + # get the data type of the column + col_data_type <- self$get_variables_metadata(data_name = calc_from_data_name, column = col_name, property = "class") + # if it is a ordered factor... + if (any(stringr::str_detect("ordered", col_data_type))){ + # put in here the ones that DO work for ordered factor + if (any(grepl("summary_count_non_missing|summary_count_missing|summary_count|summary_min|summary_max|summary_range", formula_fn_exp))){ + curr_data_list[[c_data_label]] <- curr_data_list[[c_data_label]] %>% + dplyr::summarise_(.dots = setNames(list(as.formula(paste0("~", calc$function_exp))), calc$result_name)) + } else { + curr_data_list[[c_data_label]] <- curr_data_list[[c_data_label]] %>% + dplyr::summarise_(.dots = setNames(list(NA), calc$result_name)) + } + # if it is a factor or character, do not work for anything except... + } else if (any(stringr::str_detect("factor | character", col_data_type))){ + # put in here the ones that DO work for factor or character + if (any(grepl("summary_count_non_missing|summary_count_missing|summary_count", formula_fn_exp))){ + curr_data_list[[c_data_label]] <- curr_data_list[[c_data_label]] %>% + dplyr::summarise_(.dots = setNames(list(as.formula(paste0("~", calc$function_exp))), calc$result_name)) + } else { + curr_data_list[[c_data_label]] <- curr_data_list[[c_data_label]] %>% + dplyr::summarise_(.dots = setNames(list(NA), calc$result_name)) + } + } else if (any(stringr::str_detect("Date", col_data_type))){ + # put in here the ones that DO NOT work for date + if (any(grepl("summary_sum", formula_fn_exp))){ + curr_data_list[[c_data_label]] <- curr_data_list[[c_data_label]] %>% + dplyr::summarise_(.dots = setNames(list(NA), calc$result_name)) + } else { + curr_data_list[[c_data_label]] <- curr_data_list[[c_data_label]] %>% + dplyr::summarise_(.dots = setNames(list(as.formula(paste0("~", calc$function_exp))), calc$result_name)) + } + } else { + curr_data_list[[c_data_label]] <- curr_data_list[[c_data_label]] %>% dplyr::summarise_(.dots = setNames(list(as.formula(paste0("~", calc$function_exp))), calc$result_name)) + } curr_data_list[[c_has_summary_label]] <- TRUE } # This type is grouping the data @@ -584,7 +622,7 @@ DataBook$set("public", "get_link_columns_from_data_frames", function(first_data_ # Called from apply_instat_calculation if calc$save_calc == TRUE DataBook$set("public", "save_calc_output", function(calc, curr_data_list, previous_manipulations) { - + # Add previous manipulations to calc so that it can be rerun on its own (it may have been a sub calculation) calc$manipulations <- c(previous_manipulations, calc$manipulations) calc_dependencies <- calc$get_dependencies() @@ -727,10 +765,10 @@ DataBook$set("public", "save_calc_output", function(calc, curr_data_list, previo # Add metadata to calculated_from columns # for example, calculated_from may include sub_calculation columns which were not saved and so don't appear in the instat object data for(i in seq_along(calc_dependencies)) { - # This adds metadata: has_dependants = TRUE which indicates that the calculated_from columns have columns that depend on them - self$append_to_variables_metadata(names(calc_dependencies[i]), calc_dependencies[[i]], has_dependants_label, TRUE) - # This adds the output_column to the calculated_from columns' list of dependent columns - self$add_dependent_columns(names(calc_dependencies[i]), calc_dependencies[[i]], output_column) + # This adds metadata: has_dependants = TRUE which indicates that the calculated_from columns have columns that depend on them + self$append_to_variables_metadata(names(calc_dependencies[i]), calc_dependencies[[i]], has_dependants_label, TRUE) + # This adds the output_column to the calculated_from columns' list of dependent columns + self$add_dependent_columns(names(calc_dependencies[i]), calc_dependencies[[i]], output_column) } # This adds metadata: is_calculated = TRUE to the output column, which indicates that the column has been created by a calculation if(calc$result_name != "") { diff --git a/instat/static/InstatObject/R/Backend_Components/summary_functions.R b/instat/static/InstatObject/R/Backend_Components/summary_functions.R index 8d0b89f9a04..16094464bb8 100644 --- a/instat/static/InstatObject/R/Backend_Components/summary_functions.R +++ b/instat/static/InstatObject/R/Backend_Components/summary_functions.R @@ -249,7 +249,7 @@ DataBook$set("public", "summary", function(data_name, columns_to_summarise, summ summaries_max <- length(summaries) summary_names <- ifelse(startsWith(summaries, "summary_"), substr(summaries, 9, nchar(summaries)), summaries) - summary_names <- gsub("_", "-", summary_names) + summary_names <- gsub("_", "__", summary_names) summary_names <- make.unique(summary_names) summary_count_names <- summary_names[1:count_summaries_max] summary_other_names <- summary_names[(count_summaries_max + 1):summaries_max] @@ -1347,7 +1347,7 @@ DataBook$set("public", "summary_table", function(data_name, columns_to_summarise if (na_level_display == "") stop("na_level_display must be a non empty string") # removes "summary_" from beginning of summary function names so that display is nice summaries_display <- sapply(summaries, function(x) ifelse(startsWith(x, "summary_"), substring(x, 9), x)) - + # todo: add in code to store results if store_results = TRUE on the dialog # only give this option if there is 1 column factor. if (!store_results) { @@ -1355,21 +1355,20 @@ DataBook$set("public", "summary_table", function(data_name, columns_to_summarise } else { save <- 2 } - - cell_values <- self$calculate_summary(data_name = data_name, columns_to_summarise = columns_to_summarise, summaries = summaries, factors = factors, store_results = FALSE, drop = drop, na.rm = na.rm, return_output = TRUE, weights = weights, result_names = result_names, percentage_type = percentage_type, perc_total_columns = perc_total_columns, perc_total_factors = perc_total_factors, perc_total_filter = perc_total_filter, perc_decimal = perc_decimal, margin_name = margin_name, additional_filter = additional_filter, perc_return_all = FALSE, sep = "-", ...) + cell_values <- self$calculate_summary(data_name = data_name, columns_to_summarise = columns_to_summarise, summaries = summaries, factors = factors, store_results = FALSE, drop = drop, na.rm = na.rm, return_output = TRUE, weights = weights, result_names = result_names, percentage_type = percentage_type, perc_total_columns = perc_total_columns, perc_total_factors = perc_total_factors, perc_total_filter = perc_total_filter, perc_decimal = perc_decimal, margin_name = margin_name, additional_filter = additional_filter, perc_return_all = FALSE, sep = "__", ...) for (i in seq_along(factors)) { levels(cell_values[[i]]) <- c(levels(cell_values[[i]]), na_level_display) cell_values[[i]][is.na(cell_values[[i]])] <- na_level_display } grps <- nrow(cell_values) cell_values <- reshape2:::melt.data.frame(cell_values, id.vars = factors, variable.name = "summary-variable", value.name = "value") - if (treat_columns_as_factor) { + if (treat_columns_as_factor && !is.null(columns_to_summarise)) { cell_values[["variable"]] <- rep(columns_to_summarise, each = nrow(cell_values) / length(columns_to_summarise)) cell_values[["summary"]] <- rep(summaries_display, each = grps, length.out = nrow(cell_values)) cell_values[["summary-variable"]] <- NULL } shaped_cell_values <- cell_values %>% dplyr::relocate(value, .after = last_col()) - + for (i in seq_along(factors)) { levels(shaped_cell_values[[i]]) <- c(levels(shaped_cell_values[[i]]), margin_name) } @@ -1378,19 +1377,19 @@ DataBook$set("public", "summary_table", function(data_name, columns_to_summarise power_sets <- rje::powerSet(factors) # We could need last set if only have row or column factors power_sets_outer <- power_sets[-(c(length(power_sets)))] - if (treat_columns_as_factor) { - order_names <- unique(paste(shaped_cell_values$summary, shaped_cell_values$variable, sep = "-")) + if (treat_columns_as_factor && !is.null(columns_to_summarise)) { + order_names <- unique(paste(shaped_cell_values$summary, shaped_cell_values$variable, sep = "__")) } else { order_names <- unique(shaped_cell_values$summary) } for (facts in power_sets_outer) { if (length(facts) == 0) facts <- c() - margin_tables[[length(margin_tables) + 1]] <- self$calculate_summary(data_name = data_name, columns_to_summarise = columns_to_summarise, summaries = summaries, factors = facts, store_results = FALSE, drop = drop, na.rm = na.rm, return_output = TRUE, weights = weights, result_names = result_names, percentage_type = percentage_type, perc_total_columns = perc_total_columns, perc_total_factors = perc_total_factors, perc_total_filter = perc_total_filter, perc_decimal = perc_decimal, margin_name = margin_name, additional_filter = additional_filter, perc_return_all = FALSE, sep = "-", ...) + margin_tables[[length(margin_tables) + 1]] <- self$calculate_summary(data_name = data_name, columns_to_summarise = columns_to_summarise, summaries = summaries, factors = facts, store_results = FALSE, drop = drop, na.rm = na.rm, return_output = TRUE, weights = weights, result_names = result_names, percentage_type = percentage_type, perc_total_columns = perc_total_columns, perc_total_factors = perc_total_factors, perc_total_filter = perc_total_filter, perc_decimal = perc_decimal, margin_name = margin_name, additional_filter = additional_filter, perc_return_all = FALSE, sep = "__", ...) margin_tables[[length(margin_tables)]] <- margin_tables[[length(margin_tables)]] %>% dplyr::select(c(all_of(facts), order_names)) } # for outer margins margin_item <- length(summaries) * length(columns_to_summarise) - + if (("outer" %in% margins) && (length(factors) > 0)) { outer_margins <- plyr::ldply(margin_tables) # Change shape @@ -1401,32 +1400,49 @@ DataBook$set("public", "summary_table", function(data_name, columns_to_summarise outer_margins <- outer_margins %>% tidyr::pivot_longer(cols = 1:margin_item, values_to = "value", names_to = "summary-variable") } - if (treat_columns_as_factor) { + if (treat_columns_as_factor && !is.null(columns_to_summarise)) { outer_margins <- outer_margins %>% - tidyr::separate(col = "summary-variable", into = c("summary", "variable"), sep = "-") + tidyr::separate(col = "summary-variable", into = c("summary", "variable"), sep = "__") } } else { outer_margins <- NULL } if ("summary" %in% margins || ("outer" %in% margins && length(factors) == 0)) { summary_margins <- NULL - if ("outer" %in% margins) { - power_sets_summary <- power_sets - } else { - power_sets_summary <- power_sets[(c(length(power_sets)))] + if (is.null(columns_to_summarise)){ + power_sets_summary <- power_sets[-(length(power_sets))] + } + else { + if ("outer" %in% margins) { + power_sets_summary <- power_sets + } + else { + power_sets_summary <- power_sets[(c(length(power_sets)))] + } } - for (facts in power_sets_summary) { - if (length(facts) == 0) facts <- c() - summary_margins_df <- data_book$get_data_frame(data_name = data_name) %>% - dplyr::select(c(factors, columns_to_summarise)) %>% - tidyr::pivot_longer(cols = columns_to_summarise) - data_book$import_data(data_tables = list(summary_margins_df = summary_margins_df)) - summary_margins[[length(summary_margins) + 1]] <- data_book$calculate_summary(data_name = "summary_margins_df", columns_to_summarise = "value", summaries = summaries, factors = facts, store_results = FALSE, drop = drop, na.rm = na.rm, return_output = TRUE, weights = weights, result_names = result_names, percentage_type = percentage_type, perc_total_columns = perc_total_columns, perc_total_factors = perc_total_factors, perc_total_filter = perc_total_filter, perc_decimal = perc_decimal, margin_name = margin_name, additional_filter = additional_filter, perc_return_all = FALSE, ...) - data_book$delete_dataframes(data_names = "summary_margins_df") + + if (is.null(columns_to_summarise)){ + for (facts in power_sets_summary) { + if (length(facts) == 0) facts <- c() + summary_margins_df <- data_book$get_data_frame(data_name = data_name) %>% + dplyr::select(c(factors)) + data_book$import_data(data_tables = list(summary_margins_df = summary_margins_df)) + summary_margins[[length(summary_margins) + 1]] <- data_book$calculate_summary(data_name = "summary_margins_df", columns_to_summarise = NULL, summaries = summaries, factors = facts, store_results = FALSE, drop = drop, na.rm = na.rm, return_output = TRUE, weights = weights, result_names = result_names, percentage_type = percentage_type, perc_total_columns = perc_total_columns, perc_total_factors = perc_total_factors, perc_total_filter = perc_total_filter, perc_decimal = perc_decimal, margin_name = margin_name, additional_filter = additional_filter, perc_return_all = FALSE, ...) + data_book$delete_dataframes(data_names = "summary_margins_df") + } + } else { + for (facts in power_sets_summary) { + if (length(facts) == 0) facts <- c() + summary_margins_df <- data_book$get_data_frame(data_name = data_name) %>% + dplyr::select(c(factors, columns_to_summarise)) %>% + tidyr::pivot_longer(cols = columns_to_summarise) + data_book$import_data(data_tables = list(summary_margins_df = summary_margins_df)) + summary_margins[[length(summary_margins) + 1]] <- data_book$calculate_summary(data_name = "summary_margins_df", columns_to_summarise = "value", summaries = summaries, factors = facts, store_results = FALSE, drop = drop, na.rm = na.rm, return_output = TRUE, weights = weights, result_names = result_names, percentage_type = percentage_type, perc_total_columns = perc_total_columns, perc_total_factors = perc_total_factors, perc_total_filter = perc_total_filter, perc_decimal = perc_decimal, margin_name = margin_name, additional_filter = additional_filter, perc_return_all = FALSE, ...) + data_book$delete_dataframes(data_names = "summary_margins_df") + } } summary_margins <- plyr::ldply(summary_margins) - - if (treat_columns_as_factor) { + if (treat_columns_as_factor && !is.null(columns_to_summarise)) { # remove "_value" in them for (col in 1:ncol(summary_margins)) { colnames(summary_margins)[col] <- sub("_value", "", colnames(summary_margins)[col]) @@ -1434,34 +1450,40 @@ DataBook$set("public", "summary_table", function(data_name, columns_to_summarise summary_margins <- summary_margins %>% tidyr::pivot_longer(cols = !factors, names_to = "summary", values_to = "value") } else { - for (col in 1:ncol(summary_margins)) { - # TODO: if the colname is the same as a factor, then do nothing - colnames(summary_margins)[col] <- sub("_value", "_all", colnames(summary_margins)[col]) - } - summary_margins <- summary_margins %>% + if (length(summary_margins) == 1) { + summary_margins <- data.frame(summary_margins, `summary-variable` = "count", factors = NA) + names(summary_margins) <- c("value", "summary-variable", factors) + }else { + for (col in 1:ncol(summary_margins)) { + # TODO: if the colname is the same as a factor, then do nothing + colnames(summary_margins)[col] <- sub("_value", "_all", colnames(summary_margins)[col]) + } + summary_margins <- summary_margins %>% tidyr::pivot_longer(cols = !factors, names_to = "summary-variable", values_to = "value") + } } } else { summary_margins <- NULL } if (!is.null(summary_margins) || !is.null(outer_margins)) { margin_tables_all <- (dplyr::bind_rows(summary_margins, outer_margins)) - + margin_tables_all <- margin_tables_all %>% dplyr::mutate_at(vars(-value), ~ replace(., is.na(.), margin_name)) - + shaped_cell_values <- dplyr::bind_rows(shaped_cell_values, margin_tables_all) %>% dplyr::mutate_at(vars(-value), ~ replace(., is.na(.), margin_name)) %>% dplyr::mutate_at(vars(-value), ~ forcats::as_factor(forcats::fct_relevel(., margin_name, after = Inf))) } } - shaped_cell_values <- shaped_cell_values %>% dplyr::mutate(value = round(value, signif_fig)) -if (treat_columns_as_factor){ - shaped_cell_values <- shaped_cell_values %>% + shaped_cell_values <- shaped_cell_values %>% dplyr::mutate(value = as.numeric(as.character(value)), + value = round(value, signif_fig)) + if (treat_columns_as_factor && !is.null(columns_to_summarise)){ + shaped_cell_values <- shaped_cell_values %>% dplyr::mutate(summary = as.factor(summary)) %>% dplyr::mutate(summary = forcats::fct_relevel(summary, summaries_display)) %>% dplyr::mutate(variable = as.factor(variable)) %>% dplyr::mutate(variable= forcats::fct_relevel(variable, columns_to_summarise)) -} -if (store_table) { + } + if (store_table) { data_book$import_data(data_tables = list(shaped_cell_values = shaped_cell_values)) } return(shaped_cell_values) diff --git a/instat/static/InstatObject/R/Rsetup.R b/instat/static/InstatObject/R/Rsetup.R index 0d7aa91f633..44bad71c992 100644 --- a/instat/static/InstatObject/R/Rsetup.R +++ b/instat/static/InstatObject/R/Rsetup.R @@ -1,206 +1,209 @@ # Packages including dependencies # Generated from install_packages.R, do not edit manually! -packs <- c("abind", "agricolae", "agridat", - "AlgDesign", "animation", "arrangements", "ash", - "askpass", "assertthat", "automap", "backports", - "base64enc", "bayestestR", "BH", "bit", - "bit64", "bitops", "boot", "brew", "brio", - "broom", "bslib", "cachem", "callr", - "candisc", "car", "carData", "caret", - "cellranger", "changepoint", "checkmate", "chillR", - "chron", "circlize", "CircStats", "circular", - "class", "classInt", "cli", "clifro", - "climdex.pcic", "clipr", "cluster", "cmsaf", - "cmsafops", "cmsafvis", "codetools", "colorRamps", - "colorspace", "colourpicker", "combinat", "commonmark", - "conquer", "corrplot", "countrycode", "cowplot", - "cpp11", "crayon", "credentials", "crosstalk", - "curl", "DAAG", "dae", "data.table", - "datawizard", "date", "DBI", "dendextend", - "DEoptimR", "desc", "DescTools", "devtools", - "diffobj", "digest", "distillery", "dotCall64", - "dplyr", "DT", "dummies", "e1071", "ecmwfr", - "effectsize", "ellipse", "ellipsis", "emmeans", - "EnvStats", "estimability", "evaluate", "Evapotranspiration", - "Exact", "expm", "extraDistr", "extrafont", - "extrafontdb", "extRemes", "factoextra", "FactoMineR", - "fansi", "faraway", "farver", "fastmap", - "fields", "filelock", "fitdistrplus", "flashClust", - "FNN", "fontawesome", "forcats", "foreach", - "forecast", "foreign", "formula.tools", "Formula", - "fracdiff", "fs", "future.apply", "future", - "gapminder", "gcookbook", "generics", "GenSA", - "geosphere", "gert", "getPass", "GGally", - "ggalt", "ggdendro", "ggeffects", "ggfittext", - "ggforce", "ggformula", "ggfortify", "ggmosaic", - "ggplot2", "ggplotify", "ggpmisc", "ggpp", - "ggpubr", "ggrepel", "ggridges", "ggsci", - "ggsignif", "ggstance", "ggtext", "ggthemes", - "ggwordcloud", "gh", "gitcreds", "gld", - "GlobalOptions", "globals", "glue", "gmp", - "goftest", "gower", "gridExtra", "gridGraphics", - "gridtext", "gstat", "gtable", "haven", - "heplots", "hexbin", "highr", "HistData", - "Hmisc", "hms", "htmlTable", "htmltools", - "htmlwidgets", "httpuv", "httr", "hunspell", - "hydroGOF", "hydroTSM", "imputeTS", "ini", - "insight", "intervals", "ipred", "isoband", - "iterators", "janeaustenr", "janitor", "jpeg", - "jquerylib", "jsonlite", "Kendall", "KernSmooth", - "keyring", "klaR", "knitr", "labeling", - "labelled", "Lahman", "later", "lattice", - "latticeExtra", "lava", "lazyeval", "leaflet.providers", - "leaflet", "leaps", "lemon", "lifecycle", - "listenv", "lme4", "lmodel2", "lmom", - "lmomco", "Lmoments", "lmtest", "lubridate", - "magick", "magrittr", "mapdata", "mapproj", - "maps", "maptools", "markdown", "MASS", - "Matrix", "MatrixModels", "matrixStats", "memoise", - "metR", "mgcv", "mime", "miniUI", "minqa", - "MKdescr", "MKinfer", "ModelMetrics", "modelr", - "mosaic", "mosaicCore", "mosaicData", "munsell", - "mvtnorm", "ncdf4.helpers", "ncdf4", "nlme", - "nloptr", "nnet", "nortest", "numDeriv", - "nycflights13", "openair", "openssl", "openxlsx", - "operator.tools", "parallelly", "parameters", - "patchwork", "pbkrtest", "pbs", "PCICt", - "performance", "pillar", "pkgbuild", "pkgconfig", - "pkgload", "plotly", "plotrix", "pls", - "plyr", "png", "polyclip", "polynom", - "praise", "prettyunits", "pROC", "processx", - "prodlim", "productplots", "progress", "progressr", - "proj4", "promises", "proxy", "ps", "purrr", - "quadprog", "quantmod", "quantreg", "questionr", - "R.cache", "R.methodsS3", "R.oo", "R.utils", - "R6", "rainfarmr", "rappdirs", "raster", - "rasterVis", "rcmdcheck", "RColorBrewer", - "Rcpp", "RcppArmadillo", "RcppEigen", "RcppRoll", - "RCurl", "readODS", "readr", "readxl", - "recipes", "rematch", "rematch2", "remotes", - "reshape", "reshape2", "rgdal", "rio", - "rje", "rlang", "RMAWGEN", "RMySQL", - "robustbase", "rootSolve", "roxygen2", "rpart", - "rpivotTable", "rprojroot", "rrefine", "rstatix", - "rstudioapi", "rtf", "Rttf2pt1", "rversions", - "rvest", "rworldmap", "rworldxtra", "s2", - "sandwich", "sass", "scales", "scatterplot3d", - "SearchTrees", "selectr", "sessioninfo", "sf", - "shades", "shape", "shiny", "shinyFiles", - "shinyjs", "shinythemes", "signmedian.test", - "sjlabelled", "sjmisc", "sjPlot", "sjstats", - "snakecase", "SnowballC", "sodium", "sourcetools", - "sp", "spacetime", "spam", "SparseM", - "SPEI", "splines2", "splus2R", "SQUAREM", - "stinepack", "stringdist", "stringi", "stringr", - "strucchange", "styler", "survival", "svglite", - "sys", "systemfonts", "terra", "testthat", - "texmex", "tibble", "tidyr", "tidyselect", - "tidytext", "timeDate", "tokenizers", "treemapify", - "trend", "tseries", "TTR", "tweenr", - "tzdb", "units", "urca", "usethis", "utf8", - "vars", "vctrs", "viridis", "viridisLite", - "visdat", "visreg", "vroom", "wakefield", - "waldo", "weathermetrics", "whisker", "withr", - "wk", "xfun", "XML", "xml2", "xopen", - "xtable", "xts", "yaml", "yulab.utils", +packs <- c("abind", "agricolae", "agridat", + "AlgDesign", "animation", "arrangements", "ash", + "askpass", "assertthat", "automap", "backports", + "base64enc", "bayestestR", "BH", "bit", + "bit64", "bitops", "boot", "brew", "brio", + "broom", "bslib", "cachem", "callr", + "candisc", "car", "carData", "caret", + "cellranger", "changepoint", "checkmate", "chillR", + "chron", "circlize", "CircStats", "circular", + "class", "classInt", "cli", "clifro", + "climdex.pcic", "clipr", "clue", "cluster", + "cmsaf", "cmsafops", "cmsafvis", "codetools", + "colorRamps", "colorspace", "colourpicker", + "combinat", "commonmark", "corrplot", "countrycode", + "cowplot", "cpp11", "crayon", "credentials", + "crosstalk", "curl", "DAAG", "dae", "data.table", + "datawizard", "date", "DBI", "dendextend", + "DEoptimR", "desc", "DescTools", "devtools", + "diffobj", "digest", "distillery", "dotCall64", + "dplyr", "DT", "e1071", "ecmwfr", "effectsize", + "ellipse", "ellipsis", "emmeans", "EnvStats", + "estimability", "evaluate", "Evapotranspiration", + "Exact", "expm", "extraDistr", "extrafont", + "extrafontdb", "extRemes", "factoextra", "FactoMineR", + "fansi", "faraway", "farver", "fastDummies", + "fastmap", "fields", "filelock", "fitdistrplus", + "flashClust", "FNN", "fontawesome", "forcats", + "foreach", "forecast", "foreign", "formula.tools", + "Formula", "fracdiff", "fs", "future.apply", + "future", "gapminder", "gcookbook", "generics", + "GenSA", "geosphere", "gert", "getPass", + "GGally", "ggalt", "ggdendro", "ggeffects", + "ggfittext", "ggforce", "ggformula", "ggfortify", + "ggmosaic", "ggplot2", "ggplotify", "ggpmisc", + "ggpp", "ggpubr", "ggrepel", "ggridges", + "ggsci", "ggsignif", "ggstance", "ggtext", + "ggthemes", "ggwordcloud", "gh", "gitcreds", + "gld", "GlobalOptions", "globals", "glue", + "gmp", "goftest", "gower", "gridExtra", + "gridGraphics", "gridtext", "gstat", "gtable", + "hardhat", "haven", "heplots", "hexbin", + "highr", "HistData", "Hmisc", "hms", + "htmlTable", "htmltools", "htmlwidgets", "httpuv", + "httr", "hunspell", "hydroGOF", "hydroTSM", + "imputeTS", "ini", "insight", "intervals", + "ipred", "isoband", "iterators", "janeaustenr", + "janitor", "jpeg", "jquerylib", "jsonlite", + "Kendall", "KernSmooth", "keyring", "klaR", + "knitr", "labeling", "labelled", "Lahman", + "later", "lattice", "latticeExtra", "lava", + "lazyeval", "leaflet.providers", "leaflet", + "leaps", "lemon", "lifecycle", "listenv", + "lme4", "lmodel2", "lmom", "lmomco", + "Lmoments", "lmtest", "lubridate", "magick", + "magrittr", "mapdata", "mapproj", "maps", + "maptools", "markdown", "MASS", "Matrix", + "MatrixModels", "mc2d", "memoise", "metR", + "mgcv", "mime", "miniUI", "minqa", "MKdescr", + "MKinfer", "mlbench", "ModelMetrics", "modelr", + "mosaic", "mosaicCore", "mosaicData", "munsell", + "mvtnorm", "ncdf4.helpers", "ncdf4", "nlme", + "nloptr", "nnet", "nortest", "numDeriv", + "nycflights13", "openair", "openssl", "openxlsx", + "operator.tools", "parallelly", "parameters", + "patchwork", "pbkrtest", "pbs", "PCICt", + "performance", "pillar", "pkgbuild", "pkgconfig", + "pkgload", "plotly", "plotrix", "pls", + "plyr", "png", "polyclip", "polynom", + "praise", "prettyunits", "pROC", "processx", + "prodlim", "productplots", "progress", "progressr", + "proj4", "promises", "proxy", "ps", "purrr", + "quadprog", "quantmod", "quantreg", "questionr", + "R.cache", "R.methodsS3", "R.oo", "R.utils", + "R6", "rainfarmr", "rappdirs", "raster", + "rasterVis", "rcmdcheck", "RColorBrewer", "rcorpora", + "Rcpp", "RcppArmadillo", "RcppEigen", "RcppRoll", + "RCurl", "readODS", "readr", "readxl", + "recipes", "rematch", "rematch2", "remotes", + "repr", "reshape", "reshape2", "rgdal", + "rio", "rje", "rlang", "RMAWGEN", "RMySQL", + "robustbase", "rootSolve", "roxygen2", "rpart", + "rpivotTable", "rprojroot", "rrefine", "rstatix", + "rstudioapi", "rtf", "Rttf2pt1", "rversions", + "rvest", "rworldmap", "rworldxtra", "s2", + "sandwich", "sass", "scales", "scatterplot3d", + "SearchTrees", "selectr", "sessioninfo", "sf", + "shades", "shape", "shiny", "shinyFiles", + "shinyjs", "shinythemes", "shinyWidgets", "signmedian.test", + "sjlabelled", "sjmisc", "sjPlot", "sjstats", + "skimr", "snakecase", "SnowballC", "sodium", + "sourcetools", "sp", "spacetime", "spam", + "SparseM", "SPEI", "splines2", "splus2R", + "SQUAREM", "statip", "stinepack", "stringdist", + "stringi", "stringr", "strucchange", "styler", + "survival", "svglite", "sys", "systemfonts", + "terra", "testthat", "texmex", "tibble", + "tidyr", "tidyselect", "tidytext", "timeDate", + "tokenizers", "treemapify", "trend", "tseries", + "TTR", "tweenr", "tzdb", "units", "urca", + "usethis", "utf8", "vars", "vctrs", "viridis", + "viridisLite", "visdat", "visreg", "vroom", + "wakefield", "waldo", "weathermetrics", "whisker", + "withr", "wk", "xfun", "XML", "xml2", + "xopen", "xtable", "xts", "yaml", "yulab.utils", "zip", "zoo", "zyp", # mmtable2 package from GitHub added manually to list # install with devtools::install_github("ianmoran11/mmtable2") "mmtable2") -versions <- c("1.4-5", "1.3-5", "1.20", "1.2.0", - "2.7", "1.1.9", "1.0-15", "1.1", "0.2.1", - "1.0-14", "1.4.1", "0.1-3", "0.11.5", - "1.78.0-0", "4.0.4", "4.0.5", "1.0-7", - "1.3-28", "1.0-6", "1.1.3", "0.7.11", - "0.3.1", "1.0.6", "3.7.0", "0.8-6", "3.0-12", - "3.0-5", "6.0-90", "1.1.0", "2.2.2", - "2.0.0", "0.72.7", "2.3-56", "0.4.13", - "0.2-6", "0.4-93", "7.3-20", "0.4-3", - "3.1.1", "3.2-5", "1.1-11", "0.7.1", - "2.1.2", "3.4.0", "1.2.3", "1.1.10", - "0.2-18", "2.3", "2.0-2", "1.1.1", "0.0-8", - "1.7", "1.2.1", "0.92", "1.3.0", "1.1.1", - "0.4.2", "1.4.2", "1.3.2", "1.2.0", "4.3.2", - "1.24", "3.2-13", "1.14.2", "0.2.2", - "1.2-39", "1.1.2", "1.15.2", "1.0-10", - "1.4.0", "0.99.44", "2.4.3", "0.3.5", - "0.6.29", "1.2-1", "1.0-1", "1.0.7", - "0.20", "1.5.6", "1.7-9", "1.3.0", "0.6.0", - "0.4.2", "0.3.2", "1.7.2", "2.4.0", "1.3", - "0.14", "1.16", "3.1", "0.999-6", "1.9.1", - "0.17", "1.0", "2.1-1", "1.0.7", "2.4", - "1.0.2", "1.0.7", "2.1.0", "1.1.0", "13.3", - "1.0.2", "1.1-6", "1.01-2", "1.1.3", - "0.2.2", "0.5.1", "1.5.1", "8.16", "0.8-82", - "1.7.1", "1.2-4", "1.5-1", "1.5.2", "1.8.1", - "1.23.0", "0.3.0", "2.0", "0.1.1", "1.1.7", - "1.5-14", "1.5.0", "0.2-2", "2.1.2", - "0.4.0", "0.1.22", "1.1.1", "0.9.1", - "0.3.3", "0.10.1", "0.4.14", "0.3.3", - "3.3.5", "0.1.0", "0.4.5", "0.4.3", "0.4.0", - "0.9.1", "0.5.3", "2.9", "0.6.3", "0.3.5", - "0.1.1", "4.2.4", "0.5.0", "1.3.0", "0.1.1", - "2.6.4", "0.1.2", "0.14.0", "1.6.0", - "0.6-2.1", "1.2-3", "0.2.2", "2.3", "0.5-1", - "0.1.4", "2.0-8", "0.3.0", "2.4.3", "1.3-9", - "1.28.2", "0.9", "0.8-7", "4.6-0", "1.1.1", - "2.4.0", "0.5.2", "1.5.4", "1.6.5", "1.4.2", - "3.0.1", "0.4-0", "0.6-0", "3.2", "0.3.1", - "0.15.0", "0.15.2", "0.9-12", "0.2.5", - "1.0.13", "0.1.5", "2.1.0", "0.1-9", - "0.1.4", "1.7.3", "2.2", "2.23-20", "1.3.0", - "0.6-15", "1.37", "0.4.2", "2.9.0", "9.0-0", - "1.3.0", "0.20-45", "0.6-29", "1.6.10", - "0.2.2", "1.9.0", "2.0.4.1", "3.1", "0.4.5", - "1.0.1", "0.8.0", "1.1-27.1", "1.7-3", - "2.8", "2.3.7", "1.3-1", "0.9-39", "1.8.0", - "2.7.3", "2.0.1", "2.3.0", "1.2.8", "3.4.0", - "1.1-2", "1.1", "7.3-55", "1.4-0", "0.5-0", - "0.61.0", "2.0.1", "0.11.0", "1.8-38", - "0.12", "0.1.1.1", "1.2.4", "0.7", "0.6", - "1.2.2.2", "0.1.8", "1.8.3", "0.9.0", - "0.20.2", "0.5.0", "1.1-3", "0.3-6", - "1.19", "3.1-155", "1.2.2.3", "7.3-17", - "1.0-4", "2016.8-1.1", "1.0.2", "2.8-6", - "1.4.6", "4.2.5", "1.6.3", "1.30.0", - "0.16.0", "1.1.1", "0.5.1", "1.1", "0.5-4.1", - "0.8.0", "1.6.4", "1.3.1", "2.0.3", "1.2.4", - "4.10.0", "3.8-2", "2.8-0", "1.8.6", - "0.1-7", "1.10-0", "1.4-0", "1.0.0", - "1.1.1", "1.18.0", "3.5.2", "2019.11.13", - "0.1.1", "1.2.2", "0.10.0", "1.0-10.1", - "1.2.0.1", "0.4-26", "1.6.0", "0.3.4", - "1.5-8", "0.4.18", "5.86", "0.7.6", "0.15.0", - "1.8.1", "1.24.0", "2.11.0", "2.5.1", - "0.1", "0.3.3", "3.5-11", "0.51.0", "1.4.0", - "1.1-2", "1.0.8", "0.10.7.5.0", - "0.3.3.9.1", "0.3.0", "1.98-1.5", "1.7.0", - "2.1.1", "1.3.1", "0.1.17", "1.0.1", - "2.1.2", "2.4.2", "0.8.8", "1.4.4", "1.5-28", - "0.5.29", "1.10.16", "0.4.12", "1.3.7", - "0.10.23", "0.93-9", "1.8.2.3", "7.1.2", - "4.1-15", "0.3.0", "2.0.2", "2.0.0", - "0.7.0", "0.13", "0.4-14.1", "1.3.9", - "2.1.1", "1.0.2", "1.3-6", "1.01", "1.0.7", - "3.0-1", "0.4.0", "1.1.1", "0.3-41", - "0.5.2", "0.4-2", "1.2.2", "1.0-5", "1.4.0", - "1.4.6", "1.7.1", "0.9.1", "2.1.0", "1.2.0", - "1.5.1", "1.1.8", "2.8.9", "2.8.10", - "0.18.1", "0.11.0", "0.7.0", "1.2.0", - "0.1.7", "1.4-6", "1.2-5", "2.8-0", "1.81", - "1.7", "0.4.5", "1.3-3", "2021.1", "1.4", - "0.9.8", "1.7.6", "1.4.0", "1.5-2", "1.6.2", - "3.2-13", "2.0.0", "3.4", "1.0.3", "1.4-22", - "3.1.2", "2.4.8", "3.1.6", "1.1.4", "1.1.1", - "0.3.2", "3043.102", "0.2.1", "2.5.5", - "1.1.4", "0.10-49", "0.24.3", "1.0.2", - "0.2.0", "0.7-2", "1.3-0", "2.1.5", "1.2.2", - "1.5-6", "0.3.8", "0.6.2", "0.4.0", "0.5.3", - "2.7.0", "1.5.7", "0.3.6", "0.3.1", "1.2.2", - "0.4", "2.4.3", "0.6.0", "0.29", "3.99-0.8", - "1.3.3", "1.0.0", "1.8-4", "0.12.1", - "2.2.1", "0.0.4", "2.2.0", "1.8-9", "0.10-1.1", +versions <- c("1.4-5", "1.3-5", "1.20", "1.2.0", + "2.7", "1.1.9", "1.0-15", "1.1", "0.2.1", + "1.0-16", "1.4.1", "0.1-3", "0.12.1", + "1.78.0-0", "4.0.4", "4.0.5", "1.0-7", + "1.3-28", "1.0-7", "1.1.3", "0.8.0", + "0.3.1", "1.0.6", "3.7.0", "0.8-6", "3.0-12", + "3.0-5", "6.0-92", "1.1.0", "2.2.3", + "2.1.0", "0.72.7", "2.3-56", "0.4.14", + "0.2-6", "0.4-95", "7.3-20", "0.4-3", + "3.3.0", "3.2-5", "1.1-11", "0.8.0", + "0.3-60", "2.1.3", "3.4.2", "1.2.4", + "1.1.11", "0.2-18", "2.3", "2.0-3", "1.1.1", + "0.0-8", "1.8.0", "0.92", "1.3.1", "1.1.1", + "0.4.2", "1.5.1", "1.3.2", "1.2.0", "4.3.2", + "1.24", "3.2-13", "1.14.2", "0.4.0", + "1.2-39", "1.1.2", "1.15.2", "1.0-11", + "1.4.1", "0.99.44", "2.4.3", "0.3.5", + "0.6.29", "1.2-1", "1.0-1", "1.0.9", + "0.22", "1.7-9", "1.3.0", "0.6.0.1", + "0.4.2", "0.3.2", "1.7.3", "2.7.0", "1.3", + "0.15", "1.16", "3.1", "0.999-6", "1.9.1", + "0.18", "1.0", "2.1-1", "1.0.7", "2.4", + "1.0.3", "1.0.7", "2.1.0", "1.6.3", "1.1.0", + "13.3", "1.0.2", "1.1-8", "1.01-2", "1.1.3", + "0.2.2", "0.5.1", "1.5.2", "8.16", "0.8-82", + "1.7.1", "1.2-4", "1.5-1", "1.5.2", "1.9.0", + "1.25.0", "0.3.0", "2.0", "0.1.2", "1.1.7", + "1.5-14", "1.6.0", "0.2-2", "2.1.2", + "0.4.0", "0.1.23", "1.1.2", "0.9.1", + "0.3.3", "0.10.1", "0.4.14", "0.3.3", + "3.3.5", "0.1.0", "0.4.6", "0.4.4", "0.4.0", + "0.9.1", "0.5.3", "2.9", "0.6.3", "0.3.5", + "0.1.1", "4.2.4", "0.5.0", "1.3.0", "0.1.1", + "2.6.4", "0.1.2", "0.14.0", "1.6.2", + "0.6-5", "1.2-3", "1.0.0", "2.3", "0.5-1", + "0.1.4", "2.0-9", "0.3.0", "0.2.0", "2.5.0", + "1.3-9", "1.28.2", "0.9", "0.8-7", "4.7-0", + "1.1.1", "2.4.0", "0.5.2", "1.5.4", "1.6.5", + "1.4.2", "3.0.1", "0.4-0", "0.6-0", "3.2", + "0.3.1", "0.17.0", "0.15.2", "0.9-12", + "0.2.5", "1.0.14", "0.1.5", "2.1.0", + "0.1-9", "0.1.4", "1.8.0", "2.2.1", "2.23-20", + "1.3.0", "1.7-0", "1.39", "0.4.2", "2.9.0", + "10.0-1", "1.3.0", "0.20-45", "0.6-29", + "1.6.10", "0.2.2", "1.9.0", "2.1.1", + "3.1", "0.4.5", "1.0.1", "0.8.0", "1.1-29", + "1.7-3", "2.8", "2.3.7", "1.3-1", "0.9-40", + "1.8.0", "2.7.3", "2.0.3", "2.3.0", "1.2.8", + "3.4.0", "1.1-4", "1.1", "7.3-57", "1.4-1", + "0.5-0", "0.1-21", "2.0.1", "0.12.0", + "1.8-40", "0.12", "0.1.1.1", "1.2.4", + "0.7", "0.6", "2.1-3", "1.2.2.2", "0.1.8", + "1.8.3", "0.9.0", "0.20.2", "0.5.0", + "1.1-3", "0.3-6", "1.19", "3.1-157", + "2.0.0", "7.3-17", "1.0-4", "2016.8-1.1", + "1.0.2", "2.9-1", "2.0.0", "4.2.5", "1.6.3", + "1.31.1", "0.17.0", "1.1.1", "0.5.1", + "1.1", "0.5-4.1", "0.9.0", "1.7.0", "1.3.1", + "2.0.3", "1.2.4", "4.10.0", "3.8-2", + "2.8-0", "1.8.7", "0.1-7", "1.10-0", + "1.4-1", "1.0.0", "1.1.1", "1.18.0", + "3.5.3", "2019.11.13", "0.1.1", "1.2.2", + "0.10.0", "1.0-11", "1.2.0.1", "0.4-26", + "1.7.0", "0.3.4", "1.5-8", "0.4.20", + "5.88", "0.7.7", "0.15.0", "1.8.1", "1.24.0", + "2.11.0", "2.5.1", "0.1", "0.3.3", "3.5-15", + "0.51.2", "1.4.0", "1.1-3", "2.0.0", + "1.0.8.3", "0.11.0.0.0", "0.3.3.9.2", "0.3.0", + "1.98-1.6", "1.7.0", "2.1.2", "1.4.0", + "0.2.0", "1.0.1", "2.1.2", "2.4.2", "1.1.4", + "0.8.9", "1.4.4", "1.5-31", "0.5.29", + "1.10.16", "1.0.2", "1.3.7", "0.10.23", + "0.95-0", "1.8.2.3", "7.1.2", "4.1.16", + "0.3.0", "2.0.3", "2.0.0", "0.7.0", "0.13", + "0.4-14.1", "1.3.10", "2.1.1", "1.0.2", + "1.3-6", "1.01", "1.0.7", "3.0-1", "0.4.1", + "1.2.0", "0.3-41", "0.5.2", "0.4-2", + "1.2.2", "1.0-7", "1.4.0", "1.4.6", "1.7.1", + "0.9.1", "2.1.0", "1.2.0", "0.6.4", "1.5.1", + "1.2.0", "2.8.9", "2.8.10", "0.18.1", + "2.1.4", "0.11.0", "0.7.0", "1.2.0", + "0.1.7", "1.4-7", "1.2-6", "2.8-0", "1.81", + "1.7", "0.4.5", "1.3-3", "2021.1", "0.2.3", + "1.4", "0.9.8", "1.7.6", "1.4.0", "1.5-2", + "1.7.0", "3.3-1", "2.1.0", "3.4", "1.0.4", + "1.5-21", "3.1.4", "2.4.8", "3.1.6", + "1.2.0", "1.1.2", "0.3.2", "3043.102", + "0.2.1", "2.5.5", "1.1.4", "0.10-51", + "0.24.3", "1.0.2", "0.3.0", "0.8-0", + "1.3-0", "2.1.5", "1.2.2", "1.5-6", "0.4.1", + "0.6.2", "0.4.0", "0.5.3", "2.7.0", "1.5.7", + "0.3.6", "0.4.0", "1.2.2", "0.4", "2.5.0", + "0.6.0", "0.30", "3.99-0.9", "1.3.3", + "1.0.0", "1.8-4", "0.12.1", "2.3.5", + "0.0.4", "2.2.0", "1.8-10", "0.10-1.1", # mmtable2 package from GitHub added manually to list "0.1.3" ) diff --git a/instat/static/InstatObject/R/data_object_R6.R b/instat/static/InstatObject/R/data_object_R6.R index f851b64b654..6c687878d85 100644 --- a/instat/static/InstatObject/R/data_object_R6.R +++ b/instat/static/InstatObject/R/data_object_R6.R @@ -145,9 +145,9 @@ DataSheet$set("public", "set_data", function(new_data, messages=TRUE, check_name if(check_names) { # "T" should be avoided as a column name but is not checked by make.names() if("T" %in% names(new_data)) names(new_data)[names(new_data) == "T"] <- ".T" - valid_names <- make.names(iconv(names(new_data), to = "ASCII//TRANSLIT", sub = ".")) + valid_names <- make.names(iconv(names(new_data), to = "ASCII//TRANSLIT", sub = "."), unique = TRUE) if(!all(names(new_data) == valid_names)) { - warning("Not all column names are syntactically valid. make.names() and iconv() will be used to force them to be valid.") + warning("Not all column names are syntactically valid or unique. make.names() and iconv() will be used to force them to be valid and unique.") names(new_data) <- valid_names } } @@ -278,7 +278,7 @@ DataSheet$set("public", "set_metadata_changed", function(new_val) { } ) -DataSheet$set("public", "get_data_frame", function(convert_to_character = FALSE, include_hidden_columns = TRUE, use_current_filter = TRUE, use_column_selection = TRUE, filter_name = "", stack_data = FALSE, remove_attr = FALSE, retain_attr = FALSE, max_cols, max_rows, drop_unused_filter_levels = FALSE, start_row, start_col, ...) { +DataSheet$set("public", "get_data_frame", function(convert_to_character = FALSE, include_hidden_columns = TRUE, use_current_filter = TRUE, use_column_selection = TRUE, filter_name = "", column_selection_name = "", stack_data = FALSE, remove_attr = FALSE, retain_attr = FALSE, max_cols, max_rows, drop_unused_filter_levels = FALSE, start_row, start_col, ...) { if(!stack_data) { if(!include_hidden_columns && self$is_variables_metadata(is_hidden_label)) { hidden <- self$get_variables_metadata(property = is_hidden_label) @@ -302,6 +302,10 @@ DataSheet$set("public", "get_data_frame", function(convert_to_character = FALSE, out <- out[self$get_filter_as_logical(filter_name = filter_name), ] } } + if(column_selection_name != "") { + selected_columns <- self$get_column_selection_column_names(column_selection_name) + out <- out[ ,selected_columns, drop = FALSE] + } #TODO: consider removing include_hidden_columns argument from this function if(use_column_selection && self$column_selection_applied()) { old_metadata <- attributes(private$data) @@ -531,6 +535,11 @@ DataSheet$set("public", "get_column_labels", function(columns) { } ) +DataSheet$set("public", "get_data_frame_label", function(use_current_filter = FALSE) { + return(attr(self$get_data_frame(use_current_filter = use_current_filter), "label")) +} +) + DataSheet$set("public", "clear_variables_metadata", function() { for(column in self$get_data_frame(use_current_filter = FALSE)) { for(name in names(attributes(column))) { @@ -741,7 +750,7 @@ DataSheet$set("public", "cor", function(x_col_names, y_col_name, use = "everythi } ) -DataSheet$set("public", "rename_column_in_data", function(curr_col_name = "", new_col_name = "", label = "", type = "single", .fn, .cols = everything(), ...) { +DataSheet$set("public", "rename_column_in_data", function(curr_col_name = "", new_col_name = "", label = "", type = "single", .fn, .cols = everything(), new_column_names_df, new_labels_df, ...) { curr_data <- self$get_data_frame(use_current_filter = FALSE) # Column name must be character if (type == "single") { @@ -751,17 +760,11 @@ DataSheet$set("public", "rename_column_in_data", function(curr_col_name = "", ne } if (!is.character(curr_col_name)) { stop("Current column name must be of type: character") - } - - else if (!(curr_col_name %in% names(curr_data))) { + } else if (!(curr_col_name %in% names(curr_data))) { stop(paste0("Cannot rename column: ", curr_col_name, ". Column was not found in the data.")) - } - - else if (!is.character(new_col_name)) { + } else if (!is.character(new_col_name)) { stop("New column name must be of type: character") - } - - else { + } else { if (sum(names(curr_data) == curr_col_name) > 1) { # Should never happen since column names must be unique warning("Multiple columns have name: '", curr_col_name, "'. All such columns will be renamed.") @@ -779,14 +782,47 @@ DataSheet$set("public", "rename_column_in_data", function(curr_col_name = "", ne self$append_to_variables_metadata(col_name = new_col_name, property = "label", new_val = label) self$variables_metadata_changed <- TRUE } - } else { - private$data <- curr_data |> - dplyr::rename_with( - .fn = .fn, - .cols = {{ .cols }}, ... - ) + } else if (type == "multiple") { + if (!missing(new_column_names_df)) { + new_col_names <- new_column_names_df[, 1] + cols_changed_index <- new_column_names_df[, 2] + curr_col_names <- names(private$data) + curr_col_names[cols_changed_index] <- new_col_names + if(any(duplicated(curr_col_names))) stop("Cannot rename columns. Column names must be unique.") + names(private$data)[cols_changed_index] <- new_col_names + for (i in seq_along(cols_changed_index)) { + self$append_to_variables_metadata(new_col_names[i], name_label, new_col_names[i]) + } + } + if (!missing(new_labels_df)) { + new_labels <- new_labels_df[, 1] + new_labels_index <- new_labels_df[, 2] + for (i in seq_along(new_labels)) { + if (isTRUE(new_labels[i] != "")) { + self$append_to_variables_metadata(col_name = names(private$data)[new_labels_index[i]], property = "label", new_val = new_labels[i]) + } + } + } self$data_changed <- TRUE self$variables_metadata_changed <- TRUE + } else if (type == "rename_with") { + if (missing(.fn)) stop(.fn, "is missing with no default.") + curr_col_names <- names(curr_data) + private$data <- curr_data |> + + dplyr::rename_with( + .fn = .fn, + .cols = {{ .cols }}, ... + ) + new_col_names <- names(private$data) + if (!all(new_col_names %in% curr_col_names)) { + new_col_names <- new_col_names[!(new_col_names %in% curr_col_names)] + for (i in seq_along(new_col_names)) { + self$append_to_variables_metadata(new_col_names[i], name_label, new_col_names[i]) + } + self$data_changed <- TRUE + self$variables_metadata_changed <- TRUE + } } }) @@ -1028,26 +1064,38 @@ DataSheet$set("public", "append_to_metadata", function(property, new_value = "") ) DataSheet$set("public", "append_to_variables_metadata", function(col_names, property, new_val = "") { - if(missing(property)) stop("property must be specified.") - if(!is.character(property)) stop("property must be a character") - if(!missing(col_names)) { - #if(!all(col_names %in% self$get_column_names())) stop("Not all of ", paste(col_names, collapse = ","), " found in data.") - if(!all(col_names %in% names(private$data))) stop("Not all of ", paste(col_names, collapse = ","), " found in data.") - for(curr_col in col_names) { - attr(private$data[[curr_col]], property) <- new_val + if (missing(property)) stop("property must be specified.") + if (!is.character(property)) stop("property must be a character") + if (!missing(col_names)) { + # if(!all(col_names %in% self$get_column_names())) stop("Not all of ", paste(col_names, collapse = ","), " found in data.") + if (!all(col_names %in% names(private$data))) stop("Not all of ", paste(col_names, collapse = ","), " found in data.") + for (curr_col in col_names) { + #see comments in PR #7247 to understand why ' property == labels_label && new_val == "" ' check was added + #see comments in issue #7337 to understand why the !is.null(new_val) check was added. + if (((property == labels_label && new_val == "") || (property == colour_label && new_val == -1)) && !is.null(new_val)) { + #reset the column labels or colour property + attr(private$data[[curr_col]], property) <- NULL + } else { + attr(private$data[[curr_col]], property) <- new_val + } self$append_to_changes(list(Added_variables_metadata, curr_col, property)) } - } - else { - for(col_name in self$get_column_names()) { - attr(private$data[[col_name]], property) <- new_val + } else { + for (col_name in self$get_column_names()) { + #see comments in PR #7247 to understand why ' property == labels_label && new_val == "" ' check was added + #see comments in issue #7337 to understand why the !is.null(new_val) check was added. + if (((property == labels_label && new_val == "") || (property == colour_label && new_val == -1)) && !is.null(new_val)) { + #reset the column labels or colour property + attr(private$data[[col_name]], property) <- NULL + } else { + attr(private$data[[col_name]], property) <- new_val + } } self$append_to_changes(list(Added_variables_metadata, property, new_val)) } self$variables_metadata_changed <- TRUE self$data_changed <- TRUE -} -) +}) DataSheet$set("public", "append_to_changes", function(value) { @@ -1353,7 +1401,7 @@ DataSheet$set("public", "convert_column_to_type", function(col_names = c(), to_t else if(to_type == "numeric") { if(ignore_labels) { if (is.factor(curr_col)) new_col <- as.numeric(levels(curr_col))[curr_col] - else new_col <- as.numeric(curr_col) + else new_col <- as.numeric(curr_col) } else { if(self$is_variables_metadata(labels_label, col_name) && !is.numeric(curr_col)) { @@ -2180,7 +2228,7 @@ DataSheet$set("public", "add_key", function(col_names, key_name) { self$append_to_variables_metadata(col_names, is_key_label, TRUE) if(length(private$keys) == 1) self$append_to_variables_metadata(setdiff(self$get_column_names(), col_names), is_key_label, FALSE) self$append_to_metadata(is_linkable, TRUE) - self$append_to_metadata(next_default_item(key_label, names(self$get_metadata())), paste(col_names, collapse = ",")) + self$append_to_metadata(key_label, paste(private$keys[[key_name]], collapse = ",")) cat(paste("Key name:", key_name), paste("Key columns:", paste(private$keys[[key_name]], collapse = ", ")), sep = "\n") @@ -2211,7 +2259,9 @@ DataSheet$set("public", "get_keys", function(key_name) { DataSheet$set("public", "remove_key", function(key_name) { if(!key_name %in% names(private$keys)) stop(key_name, " not found.") + self$append_to_variables_metadata(private$keys[[key_name]], is_key_label, FALSE) private$keys[[key_name]] <- NULL + self$append_to_metadata(key_label, NULL) cat("Key removed:", key_name) } ) @@ -2281,7 +2331,8 @@ DataSheet$set("public", "has_colours", function(columns) { } ) -DataSheet$set("public", "set_column_colours_by_metadata", function(columns, property) { +DataSheet$set("public", "set_column_colours_by_metadata", function(data_name, columns, property) { +if(!missing(data_name) && missing(columns)) columns <- names(self$get_data_frame(data_name = data_name)) if(missing(columns)) property_values <- self$get_variables_metadata(property = property) else property_values <- self$get_variables_metadata(property = property, column = columns) @@ -2503,6 +2554,7 @@ DataSheet$set("public","set_contrasts_of_factor", function(col_name, new_contras factor_col <- self$get_columns_from_data(col_name) contr_col <- nlevels(factor_col) - 1 contr_row <- nlevels(factor_col) + cat("Factor",col_name,"has",new_contrasts,"contrasts") if(new_contrasts == "user_defined") { if(any(is.na(defined_contr_matrix)) ||!is.numeric(defined_contr_matrix) ||nrow(defined_contr_matrix) != contr_row || ncol(defined_contr_matrix) != contr_col) stop("The contrast matrix should have ", contr_col, " column(s) and ", contr_row, " row(s) ") } @@ -4312,3 +4364,9 @@ DataSheet$set("public", "replace_values_with_NA", function(row_index, column_ind self$set_data(curr_data) } ) + +DataSheet$set("public", "has_labels", function(col_names) { + if(missing(col_names)) stop("Column name must be specified.") + return(!is.null(attr(col_names, "labels"))) +} +) diff --git a/instat/static/InstatObject/R/install_packages.R b/instat/static/InstatObject/R/install_packages.R index dd215285200..0d10037aa59 100644 --- a/instat/static/InstatObject/R/install_packages.R +++ b/instat/static/InstatObject/R/install_packages.R @@ -123,9 +123,13 @@ pkgs <- # For density, distribution function and random generation for triangular and continuous empirical distributions # Model > Probability Distributions > Show Model # Model > Probability Distributions > Random Samples - "mc2d" + "mc2d", + # For creating extra summary statistics in Describe > Two/Three Variables > Summarise + "skimr", # For fast creation of dummy (binary) variables from categories variables in Prepare > Column:Factor > Dummy Variables - "fastDummies" + "fastDummies", + # For most frequent values in Prepare > Column:Numeric > Row Summaries + "statip" # also install mmtable2 from GitHub devtools::install_github("ianmoran11/mmtable2") ) pkgList <- pkgDep(pkgs, type="win.binary", repos = "https://cran.rstudio.com/", suggests = FALSE, includeBasePkgs = FALSE, Rversion = r_version) diff --git a/instat/static/InstatObject/R/instat_object_R6.R b/instat/static/InstatObject/R/instat_object_R6.R index 3e1b8b07376..5c71fb13656 100644 --- a/instat/static/InstatObject/R/instat_object_R6.R +++ b/instat/static/InstatObject/R/instat_object_R6.R @@ -132,7 +132,7 @@ DataBook$set("public", "set_data_objects", function(new_data_objects) { } ) -DataBook$set("public", "copy_data_object", function(data_name, new_name, filter_name = "", reset_row_names = TRUE) { +DataBook$set("public", "copy_data_object", function(data_name, new_name, filter_name = "", column_selection_name = "", reset_row_names = TRUE) { new_obj <- self$get_data_objects(data_name)$data_clone() if(filter_name != "") { subset_data <- self$get_data_objects(data_name)$get_data_frame(use_current_filter = FALSE, filter_name = filter_name, retain_attr = TRUE) @@ -140,6 +140,11 @@ DataBook$set("public", "copy_data_object", function(data_name, new_name, filter_ new_obj$remove_current_filter() new_obj$set_data(subset_data) } + if(column_selection_name != "") { + subset_data <- self$get_data_objects(data_name)$get_data_frame(use_current_filter = FALSE, filter_name = filter_name, column_selection_name = column_selection_name, use_column_selection = FALSE, retain_attr = TRUE) + new_obj$remove_current_column_selection() + new_obj$set_data(subset_data) + } self$append_data_object(new_name, new_obj) } ) @@ -165,8 +170,9 @@ DataBook$set("public", "import_RDS", function(data_RDS, keep_existing = TRUE, ov new_links_list <- data_RDS$get_links() for(data_obj_name in data_RDS$get_data_names()) { data_obj_clone <- self$clone_data_object(data_RDS$get_data_objects(data_obj_name), include_objects = include_objects, include_metadata = include_metadata, include_logs = include_logs, include_filters = include_filters, include_column_selections = include_column_selections, include_calculations = include_calculations, include_comments = include_comments) - if(data_obj_name %in% self$get_data_names() && !overwrite_existing) { - new_name <- next_default_item(data_obj_name, self$get_data_names()) + if(tolower(data_obj_name) %in% tolower(self$get_data_names()) && !overwrite_existing) { + warning("Cannot have data frames with the same name only differing by case. Data frame will be renamed.") + new_name <- next_default_item(tolower(data_obj_name), tolower(self$get_data_names())) data_obj_clone$append_to_metadata(data_name_label, new_name) if(new_name != data_obj_name) { for(i in seq_along(new_links_list)) { @@ -328,17 +334,17 @@ DataBook$set("public", "get_data_objects", function(data_name, as_list = FALSE, } ) -DataBook$set("public", "get_data_frame", function(data_name, convert_to_character = FALSE, stack_data = FALSE, include_hidden_columns = TRUE, use_current_filter = TRUE, use_column_selection = TRUE, filter_name = "", remove_attr = FALSE, retain_attr = FALSE, max_cols, max_rows, drop_unused_filter_levels = FALSE, start_row, start_col, ...) { +DataBook$set("public", "get_data_frame", function(data_name, convert_to_character = FALSE, stack_data = FALSE, include_hidden_columns = TRUE, use_current_filter = TRUE, filter_name = "", use_column_selection = TRUE, column_selection_name = "", remove_attr = FALSE, retain_attr = FALSE, max_cols, max_rows, drop_unused_filter_levels = FALSE, start_row, start_col, ...) { if(!stack_data) { if(missing(data_name)) data_name <- self$get_data_names() if(length(data_name) > 1) { retlist <- list() for (curr_name in data_name) { - retlist[[curr_name]] = self$get_data_objects(curr_name)$get_data_frame(convert_to_character = convert_to_character, include_hidden_columns = include_hidden_columns, use_current_filter = use_current_filter, use_column_selection = use_column_selection, filter_name = filter_name, remove_attr = remove_attr, retain_attr = retain_attr, max_cols = max_cols, max_rows = max_rows, drop_unused_filter_levels = drop_unused_filter_levels, start_row = start_row, start_col = start_col) + retlist[[curr_name]] = self$get_data_objects(curr_name)$get_data_frame(convert_to_character = convert_to_character, include_hidden_columns = include_hidden_columns, use_current_filter = use_current_filter, use_column_selection = use_column_selection, filter_name = filter_name, column_selection_name = column_selection_name, remove_attr = remove_attr, retain_attr = retain_attr, max_cols = max_cols, max_rows = max_rows, drop_unused_filter_levels = drop_unused_filter_levels, start_row = start_row, start_col = start_col) } return(retlist) } - else return(self$get_data_objects(data_name)$get_data_frame(convert_to_character = convert_to_character, include_hidden_columns = include_hidden_columns, use_current_filter = use_current_filter, use_column_selection = use_column_selection, filter_name = filter_name, remove_attr = remove_attr, retain_attr = retain_attr, max_cols = max_cols, max_rows = max_rows, drop_unused_filter_levels = drop_unused_filter_levels, start_row = start_row, start_col = start_col)) + else return(self$get_data_objects(data_name)$get_data_frame(convert_to_character = convert_to_character, include_hidden_columns = include_hidden_columns, use_current_filter = use_current_filter, use_column_selection = use_column_selection, filter_name = filter_name, column_selection_name = column_selection_name, remove_attr = remove_attr, retain_attr = retain_attr, max_cols = max_cols, max_rows = max_rows, drop_unused_filter_levels = drop_unused_filter_levels, start_row = start_row, start_col = start_col)) } else { if(missing(data_name)) stop("data to be stacked is missing") @@ -370,6 +376,11 @@ DataBook$set("public", "get_column_labels", function(data_name, columns) { } ) +DataBook$set("public", "get_data_frame_label", function(data_name, use_current_filter = FALSE) { + self$get_data_objects(data_name)$get_data_frame_label(use_current_filter) +} +) + DataBook$set("public", "get_data_frame_metadata", function(data_name, label, include_calculated = TRUE, excluded_not_for_display = TRUE) { return(self$get_data_objects(data_name)$get_metadata(label = label, include_calculated = include_calculated, excluded_not_for_display = excluded_not_for_display)) } @@ -384,7 +395,13 @@ DataBook$set("public", "get_combined_metadata", function(convert_to_character = if(length(templist[[j]]) > 1 || is.list(templist[[j]])) templist[[j]] <- paste(as.character(templist[[j]]), collapse = ",") retlist[i, names(templist[j])] = templist[[j]] } - if(all(c(data_name_label, label_label) %in% names(retlist))) retlist <- retlist[ ,c(c(data_name_label, label_label), sort(setdiff(names(retlist), c(data_name_label, label_label))))] + if(all(c(data_name_label, label_label, row_count_label, column_count_label, + data_type_label, is_calculated_label, is_hidden_label, is_linkable, key_label) %in% names(retlist))){ + retlist <- retlist[ ,c(c(data_name_label, label_label, row_count_label, column_count_label, data_type_label, + is_calculated_label, is_hidden_label, is_linkable, key_label), + sort(setdiff(names(retlist), c(data_name_label,label_label, row_count_label, column_count_label, + data_type_label, is_calculated_label,is_hidden_label,is_linkable, key_label))))] + } else if(data_name_label %in% names(retlist)) retlist <- retlist[ ,c(data_name_label, sort(setdiff(names(retlist), data_name_label)))] i = i + 1 } @@ -906,8 +923,8 @@ DataBook$set("public", "paste_from_clipboard", function(data_name, col_names, st } ) -DataBook$set("public", "rename_column_in_data", function(data_name, column_name = NULL, new_val = NULL, label = "", type = "single", .fn, .cols = everything(), ...) { - self$get_data_objects(data_name)$rename_column_in_data(column_name, new_val, label, type, .fn, .cols, ...) +DataBook$set("public", "rename_column_in_data", function(data_name, column_name = NULL, new_val = NULL, label = "", type = "single", .fn, .cols = everything(), new_column_names_df, new_labels_df, ...) { + self$get_data_objects(data_name)$rename_column_in_data(column_name, new_val, label, type, .fn, .cols, new_column_names_df, new_labels_df, ...) self$update_links_rename_column(data_name = data_name, old_column_name = column_name, new_column_name = new_val) }) @@ -1373,7 +1390,7 @@ DataBook$set("public", "remove_column_colours", function(data_name) { ) DataBook$set("public","set_column_colours_by_metadata", function(data_name, columns, property) { - self$get_data_objects(data_name)$set_column_colours_by_metadata(columns, property) + self$get_data_objects(data_name)$set_column_colours_by_metadata(data_name, columns, property) } ) @@ -1397,11 +1414,10 @@ DataBook$set("public","set_contrasts_of_factor", function(data_name, col_name, n } ) -DataBook$set("public","create_factor_data_frame", function(data_name, factor, factor_data_frame_name, include_contrasts = TRUE, replace = FALSE) { +DataBook$set("public","create_factor_data_frame", function(data_name, factor, factor_data_frame_name, include_contrasts = FALSE, replace = FALSE, summary_count = TRUE) { curr_data_obj <- self$get_data_objects(data_name) if(!factor %in% names(curr_data_obj$get_data_frame())) stop(factor, " not found in the data") if(!is.factor(curr_data_obj$get_columns_from_data(factor))) stop(factor, " is not a factor column.") - create <- TRUE if(self$link_exists_from(data_name, factor)) { message("Factor data frame already exists.") if(replace) { @@ -1410,14 +1426,13 @@ DataBook$set("public","create_factor_data_frame", function(data_name, factor, fa names(factor_named) <- factor curr_factor_df_name <- self$get_linked_to_data_name(data_name, factor_named) # TODO what if there is more than 1? - if(length(curr_factor_df_name) > 0) self$delete_dataframe(curr_factor_df_name[1]) + if(length(curr_factor_df_name) > 0) self$delete_dataframes(curr_factor_df_name[1]) } else { warning("replace = FALSE so no action will be taken.") - create <- FALSE } } - if(create) { + data_frame_list <- list() if(missing(factor_data_frame_name)) factor_data_frame_name <- paste0(data_name, "_", factor) factor_data_frame_name <- make.names(factor_data_frame_name) @@ -1426,11 +1441,12 @@ DataBook$set("public","create_factor_data_frame", function(data_name, factor, fa factor_column <- curr_data_obj$get_columns_from_data(factor) factor_data_frame <- data.frame(levels(factor_column)) names(factor_data_frame) <- factor - if(include_contrasts) { - factor_data_frame <- cbind(factor_data_frame, contrasts(factor_column)) - } + if(include_contrasts) factor_data_frame <- cbind(factor_data_frame, contrasts(factor_column)) + if(summary_count) factor_data_frame <- cbind(factor_data_frame, summary(factor_column)) + row.names(factor_data_frame) <- 1:nrow(factor_data_frame) names(factor_data_frame)[2:ncol(factor_data_frame)] <- paste0("C", 1:(ncol(factor_data_frame)-1)) + if(summary_count) colnames(factor_data_frame)[ncol(factor_data_frame)] <- "Frequencies" data_frame_list[[factor_data_frame_name]] <- factor_data_frame self$import_data(data_frame_list) factor_data_obj <- self$get_data_objects(factor_data_frame_name) @@ -1439,7 +1455,6 @@ DataBook$set("public","create_factor_data_frame", function(data_name, factor, fa names(factor) <- factor self$add_link(from_data_frame = data_name, to_data_frame = factor_data_frame_name, link_pairs = factor, type = keyed_link_label) } -} ) DataBook$set("public","split_date", function(data_name, col_name = "", year_val = FALSE, year_name = FALSE, leap_year = FALSE, month_val = FALSE, month_abbr = FALSE, month_name = FALSE, week_val = FALSE, week_abbr = FALSE, week_name = FALSE, weekday_val = FALSE, weekday_abbr = FALSE, weekday_name = FALSE, day = FALSE, day_in_month = FALSE, day_in_year = FALSE, day_in_year_366 = FALSE, pentad_val = FALSE, pentad_abbr = FALSE, dekad_val = FALSE, dekad_abbr = FALSE, quarter_val = FALSE, quarter_abbr = FALSE, with_year = FALSE, s_start_month = 1, s_start_day_in_month = 1, days_in_month = FALSE) { @@ -1550,7 +1565,7 @@ DataBook$set("public", "get_key_names", function(data_name, include_overall = TR ) DataBook$set("public", "remove_key", function(data_name, key_name) { - self$get_data_objects(data_name)$remove_key(key_name) + self$get_data_objects(data_name)$remove_key(key_name = key_name) } ) @@ -2722,3 +2737,8 @@ DataBook$set("public", "remove_empty", function(data_name, which = c("rows","co 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) }) + +DataBook$set("public","has_labels", function(data_name, col_names) { + self$get_data_objects(data_name)$has_labels(col_names) +} +) diff --git a/instat/static/InstatObject/R/labels_and_defaults.R b/instat/static/InstatObject/R/labels_and_defaults.R index ed6338aac03..e0b7e357d63 100644 --- a/instat/static/InstatObject/R/labels_and_defaults.R +++ b/instat/static/InstatObject/R/labels_and_defaults.R @@ -26,8 +26,8 @@ decimal_places_label="Decimal_Places" columns_label="columns" summarised_from_label="summarised_from" key_label="key" -row_count_label="Row_Count" -column_count_label="Column_Count" +row_count_label="Rows" +column_count_label="Columns" is_linkable="Is_Linkable" #variables_metadata labels diff --git a/instat/static/InstatObject/R/stand_alone_functions.R b/instat/static/InstatObject/R/stand_alone_functions.R index a49ee46a453..d9131063505 100644 --- a/instat/static/InstatObject/R/stand_alone_functions.R +++ b/instat/static/InstatObject/R/stand_alone_functions.R @@ -1235,6 +1235,11 @@ convert_to_dec_deg <- function (dd, mm = 0 , ss = 0, dir) { return(decdeg) } +convert_yy_to_yyyy <- function (x, base) { + if(missing(base)) stop("base year must be supplied") + dplyr::if_else(x+2000 <= base, x+2000, x+1900) +} + create_av_packs <- function() { av_packs <<- available.packages(repos = "https://cran.rstudio.com/") av_packs <<- data.frame(av_packs) @@ -2519,7 +2524,7 @@ get_quarter_label <- function(quarter, start_month){ return(factor(x = qtr, levels = unique(qtr))) } -is.containlabel <- function(x){ +is.containVariableLabel <- function(x){ return(isTRUE(sjlabelled::get_label(x) != "")) } @@ -2534,3 +2539,7 @@ is.NAvariable <- function(x){ is.levelscount <- function(x, n){ return(isTRUE(sum(levels(x)) == n)) } + +is.containValueLabel <- function(x){ + return(labels_label %in% names(attributes(x))) +} diff --git a/instat/translations/rInstatTranslations.db b/instat/translations/rInstatTranslations.db index a6c12710d0a..84f91bb5b6a 100644 Binary files a/instat/translations/rInstatTranslations.db and b/instat/translations/rInstatTranslations.db differ diff --git a/instat/ucrButtons.Designer.vb b/instat/ucrButtons.Designer.vb index e7af43eb5f7..d6c0aeca156 100644 --- a/instat/ucrButtons.Designer.vb +++ b/instat/ucrButtons.Designer.vb @@ -38,26 +38,25 @@ Partial Class ucrButtons 'Do not modify it using the code editor. Private Sub InitializeComponent() - Me.cmdOk = New System.Windows.Forms.Button() + Me.components = New System.ComponentModel.Container() Me.cmdCancel = New System.Windows.Forms.Button() Me.cmdReset = New System.Windows.Forms.Button() Me.cmdHelp = New System.Windows.Forms.Button() - Me.cmdPaste = New System.Windows.Forms.Button() Me.chkComment = New System.Windows.Forms.CheckBox() Me.txtComment = New System.Windows.Forms.TextBox() Me.cmdLanguage = New System.Windows.Forms.Button() + Me.cmdOk = New instat.ucrSplitButton() + Me.contextMenuStripOk = New System.Windows.Forms.ContextMenuStrip(Me.components) + Me.toolStripMenuItemOkClose = New System.Windows.Forms.ToolStripMenuItem() + Me.cmdPaste = New instat.ucrSplitButton() + Me.contextMenuStripToScript = New System.Windows.Forms.ContextMenuStrip(Me.components) + Me.toolStripMenuItemToScriptClose = New System.Windows.Forms.ToolStripMenuItem() + Me.toolStripMenuItemToScriptKeep = New System.Windows.Forms.ToolStripMenuItem() + Me.toolStripMenuItemOkKeep = New System.Windows.Forms.ToolStripMenuItem() + Me.contextMenuStripOk.SuspendLayout() + Me.contextMenuStripToScript.SuspendLayout() Me.SuspendLayout() ' - 'cmdOk - ' - Me.cmdOk.Location = New System.Drawing.Point(0, 26) - Me.cmdOk.Name = "cmdOk" - Me.cmdOk.Size = New System.Drawing.Size(75, 23) - Me.cmdOk.TabIndex = 2 - Me.cmdOk.Tag = "Ok " - Me.cmdOk.Text = "Ok" - Me.cmdOk.UseVisualStyleBackColor = True - ' 'cmdCancel ' Me.cmdCancel.Location = New System.Drawing.Point(158, 26) @@ -89,16 +88,6 @@ Partial Class ucrButtons Me.cmdHelp.Text = "Help " Me.cmdHelp.UseVisualStyleBackColor = True ' - 'cmdPaste - ' - Me.cmdPaste.Location = New System.Drawing.Point(327, 26) - Me.cmdPaste.Name = "cmdPaste" - Me.cmdPaste.Size = New System.Drawing.Size(75, 23) - Me.cmdPaste.TabIndex = 6 - Me.cmdPaste.Tag = "To_Script" - Me.cmdPaste.Text = "To Script" - Me.cmdPaste.UseVisualStyleBackColor = True - ' 'chkComment ' Me.chkComment.AutoSize = True @@ -128,32 +117,101 @@ Partial Class ucrButtons Me.cmdLanguage.Text = "Lang" Me.cmdLanguage.UseVisualStyleBackColor = True ' + 'cmdOk + ' + Me.cmdOk.AutoSize = True + Me.cmdOk.ContextMenuStrip = Me.contextMenuStripOk + Me.cmdOk.Location = New System.Drawing.Point(0, 26) + Me.cmdOk.Name = "cmdOk" + Me.cmdOk.Size = New System.Drawing.Size(75, 23) + Me.cmdOk.SplitMenuStrip = Me.contextMenuStripOk + Me.cmdOk.TabIndex = 8 + Me.cmdOk.Tag = "Ok" + Me.cmdOk.Text = "Ok" + Me.cmdOk.UseVisualStyleBackColor = True + ' + 'contextMenuStripOk + ' + Me.contextMenuStripOk.Items.AddRange(New System.Windows.Forms.ToolStripItem() {Me.toolStripMenuItemOkClose, Me.toolStripMenuItemOkKeep}) + Me.contextMenuStripOk.Name = "contextMenuStripOk" + Me.contextMenuStripOk.Size = New System.Drawing.Size(135, 48) + ' + 'toolStripMenuItemOkClose + ' + Me.toolStripMenuItemOkClose.Name = "toolStripMenuItemOkClose" + Me.toolStripMenuItemOkClose.Size = New System.Drawing.Size(134, 22) + Me.toolStripMenuItemOkClose.Text = "Ok && Close" + ' + 'cmdPaste + ' + Me.cmdPaste.AutoSize = True + Me.cmdPaste.ContextMenuStrip = Me.contextMenuStripToScript + Me.cmdPaste.Location = New System.Drawing.Point(327, 26) + Me.cmdPaste.Name = "cmdPaste" + Me.cmdPaste.Size = New System.Drawing.Size(78, 23) + Me.cmdPaste.SplitMenuStrip = Me.contextMenuStripToScript + Me.cmdPaste.TabIndex = 10 + Me.cmdPaste.Tag = "To_Script" + Me.cmdPaste.Text = "To Script" + Me.cmdPaste.UseVisualStyleBackColor = True + ' + 'contextMenuStripToScript + ' + Me.contextMenuStripToScript.Items.AddRange(New System.Windows.Forms.ToolStripItem() {Me.toolStripMenuItemToScriptClose, Me.toolStripMenuItemToScriptKeep}) + Me.contextMenuStripToScript.Name = "contextMenuStripToScript" + Me.contextMenuStripToScript.Size = New System.Drawing.Size(181, 70) + ' + 'toolStripMenuItemToScriptClose + ' + Me.toolStripMenuItemToScriptClose.Name = "toolStripMenuItemToScriptClose" + Me.toolStripMenuItemToScriptClose.Size = New System.Drawing.Size(180, 22) + Me.toolStripMenuItemToScriptClose.Text = "To Script && Close" + ' + 'toolStripMenuItemToScriptKeep + ' + Me.toolStripMenuItemToScriptKeep.Name = "toolStripMenuItemToScriptKeep" + Me.toolStripMenuItemToScriptKeep.Size = New System.Drawing.Size(180, 22) + Me.toolStripMenuItemToScriptKeep.Text = "To Script && Keep" + ' + 'toolStripMenuItemOkKeep + ' + Me.toolStripMenuItemOkKeep.Name = "toolStripMenuItemOkKeep" + Me.toolStripMenuItemOkKeep.Size = New System.Drawing.Size(134, 22) + Me.toolStripMenuItemOkKeep.Text = "Ok && Keep" + ' 'ucrButtons ' Me.AutoScaleDimensions = New System.Drawing.SizeF(96.0!, 96.0!) Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi Me.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink + Me.Controls.Add(Me.cmdPaste) + Me.Controls.Add(Me.cmdOk) Me.Controls.Add(Me.cmdLanguage) Me.Controls.Add(Me.txtComment) Me.Controls.Add(Me.chkComment) - Me.Controls.Add(Me.cmdPaste) - Me.Controls.Add(Me.cmdOk) Me.Controls.Add(Me.cmdCancel) Me.Controls.Add(Me.cmdReset) Me.Controls.Add(Me.cmdHelp) Me.Name = "ucrButtons" Me.Size = New System.Drawing.Size(410, 52) + Me.contextMenuStripOk.ResumeLayout(False) + Me.contextMenuStripToScript.ResumeLayout(False) Me.ResumeLayout(False) Me.PerformLayout() End Sub - - Friend WithEvents cmdOk As Button Friend WithEvents cmdCancel As Button Friend WithEvents cmdReset As Button Friend WithEvents cmdHelp As Button - Friend WithEvents cmdPaste As Button Friend WithEvents chkComment As CheckBox Friend WithEvents txtComment As TextBox Friend WithEvents cmdLanguage As Button + Friend WithEvents cmdOk As ucrSplitButton + Friend WithEvents contextMenuStripOk As ContextMenuStrip + Friend WithEvents toolStripMenuItemOkClose As ToolStripMenuItem + Friend WithEvents toolStripMenuItemOkKeep As ToolStripMenuItem + Friend WithEvents cmdPaste As ucrSplitButton + Friend WithEvents contextMenuStripToScript As ContextMenuStrip + Friend WithEvents toolStripMenuItemToScriptClose As ToolStripMenuItem + Friend WithEvents toolStripMenuItemToScriptKeep As ToolStripMenuItem End Class diff --git a/instat/ucrButtons.resx b/instat/ucrButtons.resx index 29dcb1b3a35..b22b0165111 100644 --- a/instat/ucrButtons.resx +++ b/instat/ucrButtons.resx @@ -117,4 +117,10 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + 17, 17 + + + 174, 17 + \ No newline at end of file diff --git a/instat/ucrButtons.vb b/instat/ucrButtons.vb index 537e7febb3e..fc1e00ee1f7 100644 --- a/instat/ucrButtons.vb +++ b/instat/ucrButtons.vb @@ -49,12 +49,37 @@ Public Class ucrButtons End Sub Private Sub cmdOk_Click(sender As Object, e As EventArgs) Handles cmdOk.Click + RunFormScripts(sender, e, True) + End Sub + + Private Sub cmdPaste_Click(sender As Object, e As EventArgs) Handles cmdPaste.Click + Scripts(bRun:=False) + ParentForm.Close() + End Sub + + Private Sub toolStripMenuItemOkClose_Click(sender As Object, e As EventArgs) Handles toolStripMenuItemOkClose.Click + RunFormScripts(sender, e, True) + End Sub + + Private Sub toolStripMenuItemOkKeep_Click(sender As Object, e As EventArgs) Handles toolStripMenuItemOkKeep.Click + RunFormScripts(sender, e, False) + End Sub + + Private Sub toolStripMenuItemToScriptClose_Click(sender As Object, e As EventArgs) Handles toolStripMenuItemToScriptClose.Click + Scripts(bRun:=False) + ParentForm.Close() + End Sub + + Private Sub toolStripMenuItemToScriptKeep_Click(sender As Object, e As EventArgs) Handles toolStripMenuItemToScriptKeep.Click + Scripts(bRun:=False) + End Sub + + Private Sub RunFormScripts(sender As Object, e As EventArgs, bCloseForm As Boolean) Dim lstCurrentEnabled As New List(Of Boolean) Dim ctrTempControl As Control Dim j As Integer 'this is getting the current controls on the form and disables then to prevent user to interract with form when its running - For Each ctrTempControl In ParentForm.Controls lstCurrentEnabled.Add(ctrTempControl.Enabled) ctrTempControl.Enabled = False @@ -72,7 +97,11 @@ Public Class ucrButtons 'Indeed, the events BeforeClickOk and ClickOk enables for the moment to insert R-commands before and after the Base R-command handle. 'In the process, we want the RSyntax parameters to be set as at the end of GetScript. Hence the reset needs to come after. 'Eventually, all this should be more neatly incorporated in the RSyntax machinery... - ParentForm.Close() + + If bCloseForm Then + ParentForm.Close() + End If + j = 0 For Each ctrTempControl In ParentForm.Controls ctrTempControl.Enabled = lstCurrentEnabled(j) @@ -234,10 +263,6 @@ Public Class ucrButtons End If End Sub - Private Sub cmdPaste_Click(sender As Object, e As EventArgs) Handles cmdPaste.Click - Scripts(bRun:=False) - End Sub - Private Sub chkComment_CheckedChanged(sender As Object, e As EventArgs) Handles chkComment.CheckedChanged SetCommentEditable() End Sub diff --git a/instat/ucrColumnMetadata.Designer.vb b/instat/ucrColumnMetadata.Designer.vb index 9cda5c05b9c..7ff00d14517 100644 --- a/instat/ucrColumnMetadata.Designer.vb +++ b/instat/ucrColumnMetadata.Designer.vb @@ -50,6 +50,8 @@ Partial Class ucrColumnMetadata Me.copySheet = New System.Windows.Forms.ToolStripMenuItem() Me.reorderSheet = New System.Windows.Forms.ToolStripMenuItem() Me.viewSheet = New System.Windows.Forms.ToolStripMenuItem() + Me.ToolStripSeparator4 = New System.Windows.Forms.ToolStripSeparator() + Me.mnuHelp2 = New System.Windows.Forms.ToolStripMenuItem() Me.propertiesContextMenuStrip = New System.Windows.Forms.ContextMenuStrip(Me.components) Me.mnuDeleteLabels = New System.Windows.Forms.ToolStripMenuItem() Me.lblHeaderColumnMetadata = New System.Windows.Forms.Label() @@ -73,11 +75,13 @@ Partial Class ucrColumnMetadata Me.ToolStripSeparator1 = New System.Windows.Forms.ToolStripSeparator() Me.mnuSort = New System.Windows.Forms.ToolStripMenuItem() Me.mnuAddComment = New System.Windows.Forms.ToolStripMenuItem() - Me.mnuColumnFilter = New System.Windows.Forms.ToolStripMenuItem() - Me.mnuColumnContextColumnSelection = New System.Windows.Forms.ToolStripMenuItem() + Me.mnuColumnFilterRows = New System.Windows.Forms.ToolStripMenuItem() + Me.mnuColumnContextSelectColumns = New System.Windows.Forms.ToolStripMenuItem() Me.mnuColumnContextRemoveCurrentColumnSelection = New System.Windows.Forms.ToolStripMenuItem() Me.mnuClearColumnFilter = New System.Windows.Forms.ToolStripMenuItem() Me.columnContextMenuStrip = New System.Windows.Forms.ContextMenuStrip(Me.components) + Me.ToolStripSeparator3 = New System.Windows.Forms.ToolStripSeparator() + Me.mnuHelp1 = New System.Windows.Forms.ToolStripMenuItem() Me.cellContextMenuStrip.SuspendLayout() Me.statusColumnMenu.SuspendLayout() Me.propertiesContextMenuStrip.SuspendLayout() @@ -101,9 +105,9 @@ Partial Class ucrColumnMetadata 'statusColumnMenu ' Me.statusColumnMenu.ImageScalingSize = New System.Drawing.Size(20, 20) - Me.statusColumnMenu.Items.AddRange(New System.Windows.Forms.ToolStripItem() {Me.deleteDataFrame, Me.renameSheet, Me.mnuBottomAddComment, Me.hideSheet, Me.unhideSheet, Me.copySheet, Me.reorderSheet, Me.viewSheet}) + Me.statusColumnMenu.Items.AddRange(New System.Windows.Forms.ToolStripItem() {Me.deleteDataFrame, Me.renameSheet, Me.mnuBottomAddComment, Me.hideSheet, Me.unhideSheet, Me.copySheet, Me.reorderSheet, Me.viewSheet, Me.ToolStripSeparator4, Me.mnuHelp2}) Me.statusColumnMenu.Name = "statusColumnMenu" - Me.statusColumnMenu.Size = New System.Drawing.Size(163, 180) + Me.statusColumnMenu.Size = New System.Drawing.Size(163, 208) ' 'deleteDataFrame ' @@ -154,6 +158,17 @@ Partial Class ucrColumnMetadata Me.viewSheet.Size = New System.Drawing.Size(162, 22) Me.viewSheet.Text = "View Data Frame" ' + 'ToolStripSeparator4 + ' + Me.ToolStripSeparator4.Name = "ToolStripSeparator4" + Me.ToolStripSeparator4.Size = New System.Drawing.Size(159, 6) + ' + 'mnuHelp2 + ' + Me.mnuHelp2.Name = "mnuHelp2" + Me.mnuHelp2.Size = New System.Drawing.Size(162, 22) + Me.mnuHelp2.Text = "Help" + ' 'propertiesContextMenuStrip ' Me.propertiesContextMenuStrip.ImageScalingSize = New System.Drawing.Size(24, 24) @@ -317,17 +332,17 @@ Partial Class ucrColumnMetadata Me.mnuAddComment.Size = New System.Drawing.Size(214, 22) Me.mnuAddComment.Text = "Add Comment..." ' - 'mnuColumnFilter + 'mnuColumnFilterRows ' - Me.mnuColumnFilter.Name = "mnuColumnFilter" - Me.mnuColumnFilter.Size = New System.Drawing.Size(214, 22) - Me.mnuColumnFilter.Text = "Filter..." + Me.mnuColumnFilterRows.Name = "mnuColumnFilterRows" + Me.mnuColumnFilterRows.Size = New System.Drawing.Size(214, 22) + Me.mnuColumnFilterRows.Text = "Filter Rows..." ' - 'mnuColumnContextColumnSelection + 'mnuColumnContextSelectColumns ' - Me.mnuColumnContextColumnSelection.Name = "mnuColumnContextColumnSelection" - Me.mnuColumnContextColumnSelection.Size = New System.Drawing.Size(214, 22) - Me.mnuColumnContextColumnSelection.Text = "Column Selection..." + Me.mnuColumnContextSelectColumns.Name = "mnuColumnContextSelectColumns" + Me.mnuColumnContextSelectColumns.Size = New System.Drawing.Size(214, 22) + Me.mnuColumnContextSelectColumns.Text = "Select Columns..." ' 'mnuColumnContextRemoveCurrentColumnSelection ' @@ -344,9 +359,20 @@ Partial Class ucrColumnMetadata 'columnContextMenuStrip ' Me.columnContextMenuStrip.ImageScalingSize = New System.Drawing.Size(24, 24) - Me.columnContextMenuStrip.Items.AddRange(New System.Windows.Forms.ToolStripItem() {Me.mnuColumnRename, Me.mnuDuplicateColumn, Me.mnuReorderColumns, Me.mnuInsertColsBefore, Me.mnuInsertColsAfter, Me.mnuDeleteCol, Me.toolStripMenuItem2, Me.mnuConvertToFactor, Me.mnuCovertToOrderedFactors, Me.mnuConvertText, Me.mnuConvertToLogical, Me.mnuConvertVariate, Me.ToolStripSeparator2, Me.mnuLevelsLabels, Me.ToolStripSeparator1, Me.mnuSort, Me.mnuAddComment, Me.mnuColumnFilter, Me.mnuColumnContextColumnSelection, Me.mnuColumnContextRemoveCurrentColumnSelection, Me.mnuClearColumnFilter}) + Me.columnContextMenuStrip.Items.AddRange(New System.Windows.Forms.ToolStripItem() {Me.mnuColumnRename, Me.mnuDuplicateColumn, Me.mnuReorderColumns, Me.mnuInsertColsBefore, Me.mnuInsertColsAfter, Me.mnuDeleteCol, Me.toolStripMenuItem2, Me.mnuConvertToFactor, Me.mnuCovertToOrderedFactors, Me.mnuConvertText, Me.mnuConvertToLogical, Me.mnuConvertVariate, Me.ToolStripSeparator2, Me.mnuLevelsLabels, Me.ToolStripSeparator1, Me.mnuSort, Me.mnuAddComment, Me.mnuColumnFilterRows, Me.mnuColumnContextSelectColumns, Me.mnuColumnContextRemoveCurrentColumnSelection, Me.mnuClearColumnFilter, Me.ToolStripSeparator3, Me.mnuHelp1}) Me.columnContextMenuStrip.Name = "columnContextMenuStrip" - Me.columnContextMenuStrip.Size = New System.Drawing.Size(215, 440) + Me.columnContextMenuStrip.Size = New System.Drawing.Size(215, 468) + ' + 'ToolStripSeparator3 + ' + Me.ToolStripSeparator3.Name = "ToolStripSeparator3" + Me.ToolStripSeparator3.Size = New System.Drawing.Size(211, 6) + ' + 'mnuHelp1 + ' + Me.mnuHelp1.Name = "mnuHelp1" + Me.mnuHelp1.Size = New System.Drawing.Size(214, 22) + Me.mnuHelp1.Text = "Help" ' 'ucrColumnMetadata ' @@ -399,9 +425,13 @@ Partial Class ucrColumnMetadata Friend WithEvents ToolStripSeparator1 As ToolStripSeparator Friend WithEvents mnuSort As ToolStripMenuItem Friend WithEvents mnuAddComment As ToolStripMenuItem - Private WithEvents mnuColumnFilter As ToolStripMenuItem - Friend WithEvents mnuColumnContextColumnSelection As ToolStripMenuItem + Private WithEvents mnuColumnFilterRows As ToolStripMenuItem + Friend WithEvents mnuColumnContextSelectColumns As ToolStripMenuItem Friend WithEvents mnuColumnContextRemoveCurrentColumnSelection As ToolStripMenuItem Private WithEvents mnuClearColumnFilter As ToolStripMenuItem Friend WithEvents columnContextMenuStrip As ContextMenuStrip + Friend WithEvents ToolStripSeparator3 As ToolStripSeparator + Friend WithEvents mnuHelp1 As ToolStripMenuItem + Friend WithEvents ToolStripSeparator4 As ToolStripSeparator + Friend WithEvents mnuHelp2 As ToolStripMenuItem End Class diff --git a/instat/ucrColumnMetadata.vb b/instat/ucrColumnMetadata.vb index 77f18c86993..c7514f40ea5 100644 --- a/instat/ucrColumnMetadata.vb +++ b/instat/ucrColumnMetadata.vb @@ -91,7 +91,7 @@ Public Class ucrColumnMetadata End Sub Private Sub loadForm() - lstNonEditableColumns.AddRange({"class", "Is_Hidden", "Is_Key", "Is_Calculated", "Has_Dependants", "Dependent_Columns", "Calculated_By", "Dependencies", "Colour"}) + lstNonEditableColumns.AddRange({"class", "labels", "Is_Hidden", "Is_Key", "Is_Calculated", "Has_Dependants", "Dependent_Columns", "Calculated_By", "Dependencies", "Colour"}) 'DEBUG ' If True Then @@ -111,6 +111,7 @@ Public Class ucrColumnMetadata _grid.SetNonEditableColumns(lstNonEditableColumns) _grid.SetContextmenuStrips(Nothing, cellContextMenuStrip, columnContextMenuStrip, statusColumnMenu) AddHandler _grid.EditValue, AddressOf EditValue + AddHandler _grid.DeleteLabels, AddressOf DeleteLables autoTranslate(Me) End Sub @@ -122,6 +123,27 @@ Public Class ucrColumnMetadata _grid.SetCurrentDataFrame(iIndex) End Sub + Private Sub DeleteLables(strColumnName As String) + Dim clsDeleteLabelsFunction As New RFunction + + If strColumnName = strLabelsLabel Then + If MsgBox("This will delete the selected label(s) and replace with (NA)." & + Environment.NewLine & "Continue?", + MessageBoxButtons.YesNo, "Delete Labels") = DialogResult.Yes Then + + clsDeleteLabelsFunction.SetRCommand(frmMain.clsRLink.strInstatDataObject & "$append_to_variables_metadata") + clsDeleteLabelsFunction.AddParameter("data_name", Chr(34) & _grid.CurrentWorksheet.Name & Chr(34), iPosition:=0) + clsDeleteLabelsFunction.AddParameter("col_names", frmMain.clsRLink.GetListAsRString(_grid.GetSelectedColumns), iPosition:=1) + clsDeleteLabelsFunction.AddParameter("property", Chr(34) & "labels" & Chr(34), iPosition:=2) + clsDeleteLabelsFunction.AddParameter("new_val", Chr(34) & Chr(34), iPosition:=3) + frmMain.clsRLink.RunScript(clsDeleteLabelsFunction.ToScript()) + End If + Else + MsgBox("Deleting cells is currently disabled. This feature will be included in future versions." & Environment.NewLine & + "To remove a cell's value, replace the value with NA.", MsgBoxStyle.Information, "Cannot delete cells.") + End If + End Sub + Private Sub EditValue(iRow As Integer, strColumnName As String, strPreviousValue As String, newValue As Object) Dim strScript As String Dim strComment As String @@ -298,7 +320,7 @@ Public Class ucrColumnMetadata dlgDuplicateColumns.ShowDialog() End Sub - Private Sub mnuColumnFilter_Click(sender As Object, e As EventArgs) Handles mnuColumnFilter.Click + Private Sub mnuColumnFilter_Click(sender As Object, e As EventArgs) Handles mnuColumnFilterRows.Click dlgRestrict.bIsSubsetDialog = False dlgRestrict.strDefaultDataframe = _grid.CurrentWorksheet.Name dlgRestrict.ShowDialog() @@ -425,7 +447,7 @@ Public Class ucrColumnMetadata dlgAddComment.ShowDialog() End Sub - Private Sub mnuColumnContextColumnSelection_Click(sender As Object, e As EventArgs) Handles mnuColumnContextColumnSelection.Click + Private Sub mnuColumnContextColumnSelection_Click(sender As Object, e As EventArgs) Handles mnuColumnContextSelectColumns.Click dlgSelect.SetDefaultDataFrame(_grid.CurrentWorksheet.Name) dlgSelect.ShowDialog() End Sub @@ -435,4 +457,8 @@ Public Class ucrColumnMetadata GetCurrentDataFrameFocus().clsPrepareFunctions.RemoveCurrentColumnSelection() EndWait() End Sub + + Private Sub mnuHelp1_Click(sender As Object, e As EventArgs) Handles mnuHelp1.Click, mnuHelp2.Click + Help.ShowHelp(Me, frmMain.strStaticPath & "\" & frmMain.strHelpFilePath, HelpNavigator.TopicId, "543") + End Sub End Class \ No newline at end of file diff --git a/instat/ucrDataFrame.Designer.vb b/instat/ucrDataFrame.Designer.vb index df5c66b84f0..22e7d29fb0e 100644 --- a/instat/ucrDataFrame.Designer.vb +++ b/instat/ucrDataFrame.Designer.vb @@ -19,7 +19,7 @@ Partial Class ucrDataFrame Inherits instat.ucrCore 'UserControl 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 ucrDataFrame '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.cboAvailableDataFrames = New System.Windows.Forms.ComboBox() @@ -50,6 +50,8 @@ Partial Class ucrDataFrame 'cboAvailableDataFrames ' Me.cboAvailableDataFrames.ContextMenuStrip = Me.mnuRightClick + Me.cboAvailableDataFrames.DrawMode = System.Windows.Forms.DrawMode.OwnerDrawFixed + Me.cboAvailableDataFrames.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList Me.cboAvailableDataFrames.FormattingEnabled = True Me.cboAvailableDataFrames.Location = New System.Drawing.Point(0, 19) Me.cboAvailableDataFrames.Name = "cboAvailableDataFrames" diff --git a/instat/ucrDataFrame.vb b/instat/ucrDataFrame.vb index 5bb82394507..bcd7667db84 100644 --- a/instat/ucrDataFrame.vb +++ b/instat/ucrDataFrame.vb @@ -15,22 +15,28 @@ ' along with this program. If not, see . Imports instat -Imports instat.Translations - -Public Class ucrDataFrame - Public iDataFrameLength As Integer - Public iColumnCount As Integer - Public clsCurrDataFrame As New RFunction - Public bFirstLoad As Boolean = True - Private bIncludeOverall As Boolean = False - Private bPvtUseFilteredData As Boolean - Private bPvtDropUnusedFilterLevels As Boolean = False - Public strCurrDataFrame As String = "" - Public bDataFrameFixed As Boolean = False - Private strFixedDataFrame As String - 'If the control is used to set a parameter that is a string i.e. data_name = "survey" - Private bParameterIsString As Boolean = False - 'If the control is used to set a parameter that is an RFunction i.e. x = InstatDataObject$get_data_frame(data_name = "survey") +Imports instat.Translations + +Public Class ucrDataFrame + Public clsCurrDataFrame As New RFunction + Public bFirstLoad As Boolean = True + Private bPvtUseFilteredData As Boolean + Private bPvtDropUnusedFilterLevels As Boolean = False + + Private strCachedDataFrameName As String = "" + + 'todo. rename this property to SelectedDataFrameName. + Public ReadOnly Property strCurrDataFrame As String + Get + 'return cboAvailableDataFrames.Text because cboAvailableDataFrames.SelectedItem + 'could be Nothing + Return cboAvailableDataFrames.Text + End Get + End Property + + 'If the control is used to set a parameter that is a string i.e. data_name = "survey" + Private bParameterIsString As Boolean = False + 'If the control is used to set a parameter that is an RFunction i.e. x = InstatDataObject$get_data_frame(data_name = "survey") Private bParameterIsRFunction As Boolean = False 'The name of the data parameter in the get data frame instat object method (should always be the same) Private strDataParameterNameInRFunction As String = "data_name" @@ -41,75 +47,156 @@ Public Class ucrDataFrame Private bOnlyLinkedToPrimaryDataFrames As Boolean = False 'If bOnlyLinkedToPrimaryDataFrames then should the primary data frame itself be displayed Private bIncludePrimaryDataFrameAsLinked As Boolean = True - ' To prevent circular refreshing of data frame list + ''' + ''' Used as a flag to prevent circular refreshing of data frame list + ''' Private bSuppressRefresh As Boolean = False + Public ReadOnly Property iDataFrameLength As Integer + Get + Return If(cboAvailableDataFrames.Text = "", 0, frmMain.DataBook.GetDataFrame(cboAvailableDataFrames.Text).iTotalRowCount) + End Get + End Property + + Public ReadOnly Property iColumnCount As Integer + Get + Return If(cboAvailableDataFrames.Text = "", 0, frmMain.DataBook.GetDataFrame(cboAvailableDataFrames.Text).iTotalColumnCount) + End Get + End Property + Private Sub ucrDataFrame_Load(sender As Object, e As EventArgs) Handles MyBase.Load - FillComboBox() - If bFirstLoad Then - InitialiseControl() - bFirstLoad = False - End If - SetDataFrameProperties() - End Sub - + If bFirstLoad Then + InitialiseControl() + bFirstLoad = False + End If + 'always load data frame names on load event because a data frame may have been deleted + 'and the control needs to refresh the data frame names. + LoadDataFrameNamesAndFillComboBox() + End Sub + Private Sub InitialiseControl() bUseCurrentFilter = True lblDataFrame.AutoSize = True bUpdateRCodeFromControl = True - 'TODO remove this once control updated - cboAvailableDataFrames.DropDownStyle = ComboBoxStyle.DropDownList - cboAvailableDataFrames.AutoCompleteMode = AutoCompleteMode.None - cboAvailableDataFrames.AutoCompleteSource = AutoCompleteSource.None - End Sub - + End Sub + Public Sub Reset() - FillComboBox() - If frmMain.strDefaultDataFrame <> "" Then - cboAvailableDataFrames.SelectedIndex = cboAvailableDataFrames.Items.IndexOf(frmMain.strDefaultDataFrame) - ElseIf frmMain.strCurrentDataFrame <> "" Then - cboAvailableDataFrames.SelectedIndex = cboAvailableDataFrames.Items.IndexOf(frmMain.strCurrentDataFrame) - End If - SetDataFrameProperties() - End Sub - - Private Sub FillComboBox(Optional bSetFixed As Boolean = True) - Dim iOldText As String - 'TODO DO change DataFrameChanged event to not need these - Dim sender As New Object - Dim e As New EventArgs - - iOldText = cboAvailableDataFrames.Text cboAvailableDataFrames.Items.Clear() - cboAvailableDataFrames.Text = "" - frmMain.clsRLink.FillComboDataFrames(cboAvailableDataFrames, bFirstLoad, strCurrentDataFrame:=iOldText, bOnlyLinkedToPrimaryDataFrames:=bOnlyLinkedToPrimaryDataFrames, strPrimaryDataFrame:=strPrimaryDataFrame, bIncludePrimaryDataFrameAsLinked:=bIncludePrimaryDataFrameAsLinked) - If bSetFixed AndAlso bDataFrameFixed AndAlso strFixedDataFrame <> "" Then - SetDataframe(strFixedDataFrame, False) + LoadDataFrameNamesAndFillComboBox() + 'if there is a default data frame name then just select it, if it exists + If Not String.IsNullOrEmpty(frmMain.strDefaultDataFrame) AndAlso cboAvailableDataFrames.Items.Contains(frmMain.strDefaultDataFrame) Then + cboAvailableDataFrames.SelectedItem = frmMain.strDefaultDataFrame + End If + + 'todo. temporary and can be changed once some dialogs are correctly set up. + 'Note. This is necessary because of the way some dialogs are set up + 'for instance, dialogs that manually add parameters to their R Functions + 'need these events raised even though the data frame has not changed. + OnControlValueChanged() + End Sub + + ''' + ''' loads data frame names and fills the combobox used for selection + ''' Updates the necessary values too + ''' + Private Sub LoadDataFrameNamesAndFillComboBox() + bSuppressRefresh = True + + 'get current selected data frame name first before deleting + Dim strSelectedDataFrameName As String = cboAvailableDataFrames.Text + 'then clear items + cboAvailableDataFrames.Items.Clear() + 'add new items + If bOnlyLinkedToPrimaryDataFrames Then + 'todo. GetLinkedToDataFrameNames should also be done through the data book + 'As of 22/04/022 the data book did not have this feature + cboAvailableDataFrames.Items.AddRange(frmMain.clsRLink.GetLinkedToDataFrameNames(strPrimaryDataFrame, bIncludePrimaryDataFrameAsLinked).ToArray) + Else + For Each dataFrame As clsDataFrame In frmMain.DataBook.DataFrames + cboAvailableDataFrames.Items.Add(dataFrame.strName) + Next + End If + + If cboAvailableDataFrames.Items.Count > 0 Then + If cboAvailableDataFrames.Items.Contains(strSelectedDataFrameName) Then + 'try to restore the data frame name that was previously selected + cboAvailableDataFrames.SelectedItem = strSelectedDataFrameName + Else + 'if this control did not have any any data frame previously selected + 'then set one from data viewer focused data frame + 'get data viewer selected data frame + cboAvailableDataFrames.SelectedItem = frmMain.ucrDataViewer.GetCurrentDataFrameNameFocus() + End If + + End If + + bSuppressRefresh = False + + UpdateValuesAndRaiseEvents() + End Sub + + ''' + ''' updates necessary values if the cached data frame is not equal to selected data frame + ''' + Private Sub UpdateValuesAndRaiseEvents() + + 'only set the other values and raise events if the data frame truly changed + If strCachedDataFrameName = cboAvailableDataFrames.Text Then + Exit Sub End If - If cboAvailableDataFrames.Text <> iOldText Then - SelectedDataFrameChanged(sender, e) + + 'set parameter properties. Note we are updating this R Function at this level because + 'of how it's being used by other dialogs + clsCurrDataFrame.SetRCommand(frmMain.clsRLink.strInstatDataObject & "$get_data_frame") + clsCurrDataFrame.AddParameter(strParameterName:="data_name", + strParameterValue:=Chr(34) & cboAvailableDataFrames.Text & Chr(34), iPosition:=0) + clsCurrDataFrame.SetAssignTo(cboAvailableDataFrames.Text) + + 'set cached data frame name + strCachedDataFrameName = cboAvailableDataFrames.Text + + 'raise event + OnControlValueChanged() + + 'if dialogs are set to change 'overall' selected data frame + 'then pass the selected data frame to frmMain as the selected current 'overall' data frame + If frmMain.clsInstatOptions.bChangeDataFrame Then + frmMain.SetCurrentDataFrame(cboAvailableDataFrames.Text) End If - End Sub - - Public Event DataFrameChanged(sender As Object, e As EventArgs, strPrevDataFrame As String) - + End Sub + Private Sub cboAvailableDataFrames_SelectedIndexChanged(sender As Object, e As EventArgs) Handles cboAvailableDataFrames.SelectedIndexChanged If Not bSuppressRefresh Then - If cboAvailableDataFrames.SelectedIndex = -1 Then - cboAvailableDataFrames.Text = "" - End If - If strCurrDataFrame <> cboAvailableDataFrames.Text Then - ' This prevents circular refreshing with receivers linked to primary data frame - bSuppressRefresh = True - RaiseEvent DataFrameChanged(sender, e, strCurrDataFrame) - bSuppressRefresh = False - strCurrDataFrame = cboAvailableDataFrames.Text - SetDataFrameProperties() - OnControlValueChanged() - End If + UpdateValuesAndRaiseEvents() + End If + End Sub + + 'displays the data frame name slected in red if it differs with the selected sheet in the data frame + Private Sub cboAvailableDataFrames_DrawItem(sender As Object, e As DrawItemEventArgs) Handles cboAvailableDataFrames.DrawItem + + If e.Index < 0 Then + Exit Sub End If - End Sub - + + e.DrawBackground() + + 'get the item text of the combobox item being draw + Dim strItemtext As String = cboAvailableDataFrames.Items(e.Index).ToString() + + 'determine the forecolor of the combo box item + 'display data frame name in red if it's different from the data viewer selected sheet name + Dim strSelectedSheetName As String = frmMain.ucrDataViewer.GetCurrentDataFrameNameFocus() + + Dim brush As Brush = If(Not cboAvailableDataFrames.DroppedDown AndAlso + strItemtext <> strSelectedSheetName AndAlso + strItemtext = cboAvailableDataFrames.Text, + Brushes.Red, + Brushes.Black) + + 'draw the item text + e.Graphics.DrawString(strItemtext, DirectCast(sender, ComboBox).Font, brush, e.Bounds.X, e.Bounds.Y) + End Sub + Public Overrides Sub UpdateParameter(clsTempParam As RParameter) If clsTempParam IsNot Nothing Then If bParameterIsString Then @@ -119,56 +206,32 @@ Public Class ucrDataFrame End If End If End Sub - - Private Sub SelectedDataFrameChanged(sender As Object, e As EventArgs) - End Sub - - Public Sub SetDataFrameProperties() - Dim clsParam As New RParameter - If cboAvailableDataFrames.Text <> "" AndAlso Not bIncludeOverall Then - If Not frmMain.clsRLink.DataFrameExists(cboAvailableDataFrames.Text) Then - Reset() - Exit Sub - End If - iDataFrameLength = frmMain.clsRLink.GetDataFrameLength(cboAvailableDataFrames.Text) - iColumnCount = frmMain.clsRLink.GetDataFrameColumnCount(cboAvailableDataFrames.Text) - clsCurrDataFrame.SetRCommand(frmMain.clsRLink.strInstatDataObject & "$get_data_frame") - clsParam.SetArgumentName("data_name") - clsParam.SetArgumentValue(Chr(34) & cboAvailableDataFrames.Text & Chr(34)) - clsCurrDataFrame.AddParameter(clsParam) - clsCurrDataFrame.SetAssignTo(cboAvailableDataFrames.Text) - End If - End Sub - Public Sub SetDataframe(strDataframe As String, Optional bEnableDataframe As Boolean = True) - Dim Index As Integer = -1 - FillComboBox(False) - If strDataframe IsNot Nothing Then - Index = cboAvailableDataFrames.Items.IndexOf(strDataframe) - End If - If Index >= 0 Then - cboAvailableDataFrames.SelectedIndex = Index - End If - If Not bEnableDataframe Then - strFixedDataFrame = strDataframe - Else - strFixedDataFrame = "" + ''' + ''' Sets the data frame name that will be selected by the control + ''' + ''' + ''' Data frame name to select. The data frame name will only be selected if it exists + ''' + ''' + ''' If true, data frame selection by user will be enabled, false otherwise. + ''' Default is True. + ''' + Public Sub SetDataframe(strDataFrameName As String, Optional bEnableUserSelection As Boolean = True) + 'set if data frame name should be selectable + cboAvailableDataFrames.Enabled = bEnableUserSelection + + 'load and fill all the data frame names + LoadDataFrameNamesAndFillComboBox() + + 'set the passed data frame name as the selected one + If cboAvailableDataFrames.Items.Contains(strDataFrameName) Then + cboAvailableDataFrames.SelectedItem = strDataFrameName End If - cboAvailableDataFrames.Enabled = bEnableDataframe - bDataFrameFixed = Not bEnableDataframe End Sub - - Public Sub SetIncludeOverall(bInclude As Boolean) - bIncludeOverall = bInclude - FillComboBox() - End Sub - - Public Function GetIncludeOverall() As Boolean - Return bIncludeOverall - End Function - - Public Property bUseCurrentFilter As Boolean + + Public Property bUseCurrentFilter As Boolean Get Return bPvtUseFilteredData End Get @@ -183,10 +246,10 @@ Public Class ucrDataFrame Else clsCurrDataFrame.AddParameter("use_current_filter", "FALSE") End If - End Set + End Set End Property - Public Property bDropUnusedFilterLevels As Boolean + Public Property bDropUnusedFilterLevels As Boolean Get Return bPvtDropUnusedFilterLevels End Get @@ -201,7 +264,7 @@ Public Class ucrDataFrame clsCurrDataFrame.RemoveParameterByName("drop_unused_filter_levels") End If End If - End Set + End Set End Property Private Sub mnuRightClickCopy_Click(sender As Object, e As EventArgs) Handles mnuRightClickCopy.Click @@ -251,15 +314,9 @@ Public Class ucrDataFrame End Sub Public Overrides Function IsRDefault() As Boolean - Return GetParameter() IsNot Nothing AndAlso objRDefault IsNot Nothing AndAlso objRDefault.Equals(cboAvailableDataFrames.Text) + Return GetParameter() IsNot Nothing AndAlso objRDefault IsNot Nothing AndAlso objRDefault.Equals(cboAvailableDataFrames.Text) End Function - Private Sub ucrDataFrame_DataFrameChanged(sender As Object, e As EventArgs, strPrevDataFrame As String) Handles Me.DataFrameChanged - If frmMain.clsInstatOptions.bChangeDataFrame Then - frmMain.SetCurrentDataFrame(cboAvailableDataFrames.Text) - End If - End Sub - '''-------------------------------------------------------------------------------------------- ''' ''' Translates to the current language and then sets @@ -287,9 +344,10 @@ Public Class ucrDataFrame End If strPrimaryDataFrame = strNewPrimaryDataFrame bOnlyLinkedToPrimaryDataFrames = bNewOnlyLinkedToPrimaryDataFrames - bNewIncludePrimaryDataFrameAsLinked = bIncludePrimaryDataFrameAsLinked + bIncludePrimaryDataFrameAsLinked = bNewIncludePrimaryDataFrameAsLinked If bUpdate Then - FillComboBox() + LoadDataFrameNamesAndFillComboBox() End If End Sub + End Class \ No newline at end of file diff --git a/instat/ucrDataFrameLength.Designer.vb b/instat/ucrDataFrameLength.Designer.vb index d32c2fb6934..705ae16f769 100644 --- a/instat/ucrDataFrameLength.Designer.vb +++ b/instat/ucrDataFrameLength.Designer.vb @@ -16,10 +16,10 @@ Partial Class ucrDataFrameLength - Inherits instat.ucrCore + Inherits instat.ucrInputTextBox 'UserControl 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,30 +36,19 @@ Partial Class ucrDataFrameLength '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.txtLength = New System.Windows.Forms.TextBox() Me.SuspendLayout() ' - 'txtLength - ' - Me.txtLength.Enabled = False - Me.txtLength.Location = New System.Drawing.Point(0, 0) - Me.txtLength.Name = "txtLength" - Me.txtLength.Size = New System.Drawing.Size(51, 20) - Me.txtLength.TabIndex = 0 - ' 'ucrDataFrameLength ' Me.AutoScaleDimensions = New System.Drawing.SizeF(96.0!, 96.0!) Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi - Me.Controls.Add(Me.txtLength) + Me.IsReadOnly = True Me.Name = "ucrDataFrameLength" Me.Size = New System.Drawing.Size(54, 23) Me.ResumeLayout(False) Me.PerformLayout() End Sub - - Friend WithEvents txtLength As TextBox End Class diff --git a/instat/ucrDataFrameLength.vb b/instat/ucrDataFrameLength.vb index 1f7c04528f5..d80d328e84c 100644 --- a/instat/ucrDataFrameLength.vb +++ b/instat/ucrDataFrameLength.vb @@ -15,24 +15,38 @@ ' along with this program. If not, see . Public Class ucrDataFrameLength - Public WithEvents ucrDataFrameSelector As ucrDataFrame - Public Sub SetDataFrameSelector(clsSelector As ucrDataFrame) - ucrDataFrameSelector = clsSelector - SetLength() + Public Overrides Sub SetDataFrameSelector(clsSelector As ucrDataFrame) + MyBase.SetDataFrameSelector(clsSelector) + SetDataFrameLength() End Sub - Public Sub SetLength() + ''' + ''' sets the textbox to show the length of the data frame set + ''' + Private Sub SetDataFrameLength() If ucrDataFrameSelector IsNot Nothing AndAlso ucrDataFrameSelector.cboAvailableDataFrames.Text <> "" Then - txtLength.Text = frmMain.clsRLink.GetDataFrameLength(ucrDataFrameSelector.cboAvailableDataFrames.Text) + 'txtInput.Text = frmMain.clsRLink.GetDataFrameLength(ucrDataFrameSelector.cboAvailableDataFrames.Text) + 'was not preferred. Setting txtInput.Text property raises TextChanged event of the ucrInputTextBox (this control's parent) + 'However that event doesn't raise ControlValueChanged which is required for the parameter values to be updated + 'see issue #7367 for more information + 'so use SetName(). Also raises ControlValueChanged needed to update the paramete values + SetName(frmMain.clsRLink.GetDataFrameLength(ucrDataFrameSelector.cboAvailableDataFrames.Text)) End If End Sub - Private Sub clsDataFrameSelector_DataFrameChanged(sender As Object, e As EventArgs, strPrevDataFrame As String) Handles ucrDataFrameSelector.DataFrameChanged - SetLength() - End Sub + ''' + ''' Gets the length(no. of rows) of the data frame, if data frame is not set, returns 0 + ''' + ''' length of the set data frame + Public Function GetDataFrameLength() As Integer + Dim iLength As Integer + Integer.TryParse(txtInput.Text, iLength) + Return iLength + End Function - Private Sub ucrDataFrameLength_Load(sender As Object, e As EventArgs) Handles Me.Load - SetLength() + Private Sub ucrDataFrameSelector_ControlValueChanged(sender As Object) Handles ucrDataFrameSelector.ControlValueChanged + SetDataFrameLength() End Sub + End Class diff --git a/instat/ucrDataView.Designer.vb b/instat/ucrDataView.Designer.vb index bbef3688b50..07d8153dead 100644 --- a/instat/ucrDataView.Designer.vb +++ b/instat/ucrDataView.Designer.vb @@ -58,16 +58,18 @@ Partial Class ucrDataView Me.toolStripMenuItem21 = New System.Windows.Forms.ToolStripSeparator() Me.mnuSort = New System.Windows.Forms.ToolStripMenuItem() Me.mnuColumnAddComment = New System.Windows.Forms.ToolStripMenuItem() - Me.mnuColumnFilter = New System.Windows.Forms.ToolStripMenuItem() + Me.mnuColumnFilterRows = New System.Windows.Forms.ToolStripMenuItem() Me.mnuColumnContextColumnSelection = New System.Windows.Forms.ToolStripMenuItem() Me.mnuColumnContextRemoveCurrentColumnSelection = New System.Windows.Forms.ToolStripMenuItem() Me.mnuClearColumnFilter = New System.Windows.Forms.ToolStripMenuItem() + Me.ToolStripSeparator8 = New System.Windows.Forms.ToolStripSeparator() + Me.mnuHelp = New System.Windows.Forms.ToolStripMenuItem() Me.cellContextMenuStrip = New System.Windows.Forms.ContextMenuStrip(Me.components) + Me.mnuDeleteCells = New System.Windows.Forms.ToolStripMenuItem() Me.ToolStripSeparator3 = New System.Windows.Forms.ToolStripSeparator() 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() @@ -80,10 +82,12 @@ Partial Class ucrDataView Me.ToolStripSeparator7 = New System.Windows.Forms.ToolStripSeparator() Me.mnuSorts = New System.Windows.Forms.ToolStripMenuItem() Me.mnuComment = New System.Windows.Forms.ToolStripMenuItem() - Me.mnuFilters = New System.Windows.Forms.ToolStripMenuItem() + Me.mnuFilterRows = New System.Windows.Forms.ToolStripMenuItem() Me.mnuCellContextColumnSelection = New System.Windows.Forms.ToolStripMenuItem() Me.mnuCellContextRemoveCurrentColumnSelection = New System.Windows.Forms.ToolStripMenuItem() Me.mnuRemoveCurrentFilters = New System.Windows.Forms.ToolStripMenuItem() + Me.ToolStripSeparator9 = New System.Windows.Forms.ToolStripSeparator() + Me.mnuHelp1 = New System.Windows.Forms.ToolStripMenuItem() Me.rowContextMenuStrip = New System.Windows.Forms.ContextMenuStrip(Me.components) Me.mnuInsertRowsBefore = New System.Windows.Forms.ToolStripMenuItem() Me.mnuInsertRowsAfter = New System.Windows.Forms.ToolStripMenuItem() @@ -95,6 +99,8 @@ Partial Class ucrDataView Me.mnuRowContextColumnSelection = New System.Windows.Forms.ToolStripMenuItem() Me.mnuRowContextRemoveCurrentColumnSelection = New System.Windows.Forms.ToolStripMenuItem() Me.mnuRemoveCurrentFilter = New System.Windows.Forms.ToolStripMenuItem() + Me.ToolStripSeparator10 = New System.Windows.Forms.ToolStripSeparator() + Me.mnuHelp2 = New System.Windows.Forms.ToolStripMenuItem() Me.statusColumnMenu = New System.Windows.Forms.ContextMenuStrip(Me.components) Me.deleteDataFrame = New System.Windows.Forms.ToolStripMenuItem() Me.renameSheet = New System.Windows.Forms.ToolStripMenuItem() @@ -104,6 +110,8 @@ Partial Class ucrDataView Me.CopySheet = New System.Windows.Forms.ToolStripMenuItem() Me.reorderSheet = New System.Windows.Forms.ToolStripMenuItem() Me.ViewSheet = New System.Windows.Forms.ToolStripMenuItem() + Me.ToolStripSeparator11 = New System.Windows.Forms.ToolStripSeparator() + Me.mnuHelp3 = New System.Windows.Forms.ToolStripMenuItem() Me.lblHeaderDataView = New System.Windows.Forms.Label() Me.tlpTableContainer = New System.Windows.Forms.TableLayoutPanel() Me.panelSectionsAll = New System.Windows.Forms.Panel() @@ -149,9 +157,9 @@ Partial Class ucrDataView 'columnContextMenuStrip ' Me.columnContextMenuStrip.ImageScalingSize = New System.Drawing.Size(20, 20) - Me.columnContextMenuStrip.Items.AddRange(New System.Windows.Forms.ToolStripItem() {Me.mnuColumnRename, Me.mnuDuplicateColumn, Me.mnuReorderColumns, Me.mnuInsertColsBefore, Me.mnuInsertColsAfter, Me.mnuDeleteCol, Me.mnuPaste, Me.toolStripMenuItem2, Me.mnuConvertToFactor, Me.mnuCovertToOrderedFactors, Me.mnuConvertText, Me.mnuConvertToLogical, Me.mnuConvertVariate, Me.ToolStripSeparator1, Me.mnuLevelsLabels, Me.toolStripMenuItem21, Me.mnuSort, Me.mnuColumnAddComment, Me.mnuColumnFilter, Me.mnuColumnContextColumnSelection, Me.mnuColumnContextRemoveCurrentColumnSelection, Me.mnuClearColumnFilter}) + Me.columnContextMenuStrip.Items.AddRange(New System.Windows.Forms.ToolStripItem() {Me.mnuColumnRename, Me.mnuDuplicateColumn, Me.mnuReorderColumns, Me.mnuInsertColsBefore, Me.mnuInsertColsAfter, Me.mnuDeleteCol, Me.mnuPaste, Me.toolStripMenuItem2, Me.mnuConvertToFactor, Me.mnuCovertToOrderedFactors, Me.mnuConvertText, Me.mnuConvertToLogical, Me.mnuConvertVariate, Me.ToolStripSeparator1, Me.mnuLevelsLabels, Me.toolStripMenuItem21, Me.mnuSort, Me.mnuColumnAddComment, Me.mnuColumnFilterRows, Me.mnuColumnContextColumnSelection, Me.mnuColumnContextRemoveCurrentColumnSelection, Me.mnuClearColumnFilter, Me.ToolStripSeparator8, Me.mnuHelp}) Me.columnContextMenuStrip.Name = "columnContextMenuStrip" - Me.columnContextMenuStrip.Size = New System.Drawing.Size(215, 440) + Me.columnContextMenuStrip.Size = New System.Drawing.Size(215, 468) ' 'mnuColumnRename ' @@ -258,17 +266,17 @@ Partial Class ucrDataView Me.mnuColumnAddComment.Size = New System.Drawing.Size(214, 22) Me.mnuColumnAddComment.Text = "Add Comment..." ' - 'mnuColumnFilter + 'mnuColumnFilterRows ' - Me.mnuColumnFilter.Name = "mnuColumnFilter" - Me.mnuColumnFilter.Size = New System.Drawing.Size(214, 22) - Me.mnuColumnFilter.Text = "Filter..." + Me.mnuColumnFilterRows.Name = "mnuColumnFilterRows" + Me.mnuColumnFilterRows.Size = New System.Drawing.Size(214, 22) + Me.mnuColumnFilterRows.Text = "Filter Rows..." ' 'mnuColumnContextColumnSelection ' Me.mnuColumnContextColumnSelection.Name = "mnuColumnContextColumnSelection" Me.mnuColumnContextColumnSelection.Size = New System.Drawing.Size(214, 22) - Me.mnuColumnContextColumnSelection.Text = "Column Selection..." + Me.mnuColumnContextColumnSelection.Text = "Select Columns..." ' 'mnuColumnContextRemoveCurrentColumnSelection ' @@ -282,18 +290,29 @@ Partial Class ucrDataView Me.mnuClearColumnFilter.Size = New System.Drawing.Size(214, 22) Me.mnuClearColumnFilter.Text = "Remove Current Filter" ' + 'ToolStripSeparator8 + ' + Me.ToolStripSeparator8.Name = "ToolStripSeparator8" + Me.ToolStripSeparator8.Size = New System.Drawing.Size(211, 6) + ' + 'mnuHelp + ' + Me.mnuHelp.Name = "mnuHelp" + Me.mnuHelp.Size = New System.Drawing.Size(214, 22) + Me.mnuHelp.Text = "Help" + ' '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.Items.AddRange(New System.Windows.Forms.ToolStripItem() {Me.mnuDeleteCells, 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.mnuFilterRows, Me.mnuCellContextColumnSelection, Me.mnuCellContextRemoveCurrentColumnSelection, Me.mnuRemoveCurrentFilters, Me.ToolStripSeparator9, Me.mnuHelp1}) Me.cellContextMenuStrip.Name = "cellContextMenuStrip" - Me.cellContextMenuStrip.Size = New System.Drawing.Size(215, 380) - + Me.cellContextMenuStrip.Size = New System.Drawing.Size(215, 430) + ' + 'mnuDeleteCells + ' + Me.mnuDeleteCells.Name = "mnuDeleteCells" + Me.mnuDeleteCells.Size = New System.Drawing.Size(214, 22) + Me.mnuDeleteCells.Text = "Delete Cell(s)" ' 'ToolStripSeparator3 ' @@ -318,12 +337,6 @@ 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" @@ -393,17 +406,17 @@ Partial Class ucrDataView Me.mnuComment.Size = New System.Drawing.Size(214, 22) Me.mnuComment.Text = "Add Comment..." ' - 'mnuFilters + 'mnuFilterRows ' - Me.mnuFilters.Name = "mnuFilters" - Me.mnuFilters.Size = New System.Drawing.Size(214, 22) - Me.mnuFilters.Text = "Filter..." + Me.mnuFilterRows.Name = "mnuFilterRows" + Me.mnuFilterRows.Size = New System.Drawing.Size(214, 22) + Me.mnuFilterRows.Text = "Filter Rows..." ' 'mnuCellContextColumnSelection ' Me.mnuCellContextColumnSelection.Name = "mnuCellContextColumnSelection" Me.mnuCellContextColumnSelection.Size = New System.Drawing.Size(214, 22) - Me.mnuCellContextColumnSelection.Text = "Column Selection..." + Me.mnuCellContextColumnSelection.Text = "Select Columns..." ' 'mnuCellContextRemoveCurrentColumnSelection ' @@ -417,12 +430,23 @@ Partial Class ucrDataView Me.mnuRemoveCurrentFilters.Size = New System.Drawing.Size(214, 22) Me.mnuRemoveCurrentFilters.Text = "Remove Current Filter" ' + 'ToolStripSeparator9 + ' + Me.ToolStripSeparator9.Name = "ToolStripSeparator9" + Me.ToolStripSeparator9.Size = New System.Drawing.Size(211, 6) + ' + 'mnuHelp1 + ' + Me.mnuHelp1.Name = "mnuHelp1" + Me.mnuHelp1.Size = New System.Drawing.Size(214, 22) + Me.mnuHelp1.Text = "Help" + ' 'rowContextMenuStrip ' Me.rowContextMenuStrip.ImageScalingSize = New System.Drawing.Size(20, 20) - Me.rowContextMenuStrip.Items.AddRange(New System.Windows.Forms.ToolStripItem() {Me.mnuInsertRowsBefore, Me.mnuInsertRowsAfter, Me.mnuDeleteRows, Me.ToolStripSeparator2, Me.mnuAddComment, Me.ToolStripSeparator4, Me.mnuFilter, Me.mnuRowContextColumnSelection, Me.mnuRowContextRemoveCurrentColumnSelection, Me.mnuRemoveCurrentFilter}) + Me.rowContextMenuStrip.Items.AddRange(New System.Windows.Forms.ToolStripItem() {Me.mnuInsertRowsBefore, Me.mnuInsertRowsAfter, Me.mnuDeleteRows, Me.ToolStripSeparator2, Me.mnuAddComment, Me.ToolStripSeparator4, Me.mnuFilter, Me.mnuRowContextColumnSelection, Me.mnuRowContextRemoveCurrentColumnSelection, Me.mnuRemoveCurrentFilter, Me.ToolStripSeparator10, Me.mnuHelp2}) Me.rowContextMenuStrip.Name = "columnContextMenuStrip" - Me.rowContextMenuStrip.Size = New System.Drawing.Size(215, 214) + Me.rowContextMenuStrip.Size = New System.Drawing.Size(215, 242) ' 'mnuInsertRowsBefore ' @@ -463,13 +487,13 @@ Partial Class ucrDataView Me.mnuFilter.Name = "mnuFilter" Me.mnuFilter.Size = New System.Drawing.Size(214, 22) Me.mnuFilter.Tag = "Filter..." - Me.mnuFilter.Text = "Filter..." + Me.mnuFilter.Text = "Filter Rows..." ' 'mnuRowContextColumnSelection ' Me.mnuRowContextColumnSelection.Name = "mnuRowContextColumnSelection" Me.mnuRowContextColumnSelection.Size = New System.Drawing.Size(214, 22) - Me.mnuRowContextColumnSelection.Text = "Column Selection..." + Me.mnuRowContextColumnSelection.Text = "Select Columns..." ' 'mnuRowContextRemoveCurrentColumnSelection ' @@ -484,12 +508,23 @@ Partial Class ucrDataView Me.mnuRemoveCurrentFilter.Tag = "Remove_Current_Filter" Me.mnuRemoveCurrentFilter.Text = "Remove Current Filter" ' + 'ToolStripSeparator10 + ' + Me.ToolStripSeparator10.Name = "ToolStripSeparator10" + Me.ToolStripSeparator10.Size = New System.Drawing.Size(211, 6) + ' + 'mnuHelp2 + ' + Me.mnuHelp2.Name = "mnuHelp2" + Me.mnuHelp2.Size = New System.Drawing.Size(214, 22) + Me.mnuHelp2.Text = "Help" + ' 'statusColumnMenu ' Me.statusColumnMenu.ImageScalingSize = New System.Drawing.Size(20, 20) - Me.statusColumnMenu.Items.AddRange(New System.Windows.Forms.ToolStripItem() {Me.deleteDataFrame, Me.renameSheet, Me.mnuBottomAddComment, Me.HideSheet, Me.unhideSheet, Me.CopySheet, Me.reorderSheet, Me.ViewSheet}) + Me.statusColumnMenu.Items.AddRange(New System.Windows.Forms.ToolStripItem() {Me.deleteDataFrame, Me.renameSheet, Me.mnuBottomAddComment, Me.HideSheet, Me.unhideSheet, Me.CopySheet, Me.reorderSheet, Me.ViewSheet, Me.ToolStripSeparator11, Me.mnuHelp3}) Me.statusColumnMenu.Name = "statusColumnMenu" - Me.statusColumnMenu.Size = New System.Drawing.Size(163, 180) + Me.statusColumnMenu.Size = New System.Drawing.Size(163, 208) ' 'deleteDataFrame ' @@ -540,6 +575,17 @@ Partial Class ucrDataView Me.ViewSheet.Size = New System.Drawing.Size(162, 22) Me.ViewSheet.Text = "View Data Frame" ' + 'ToolStripSeparator11 + ' + Me.ToolStripSeparator11.Name = "ToolStripSeparator11" + Me.ToolStripSeparator11.Size = New System.Drawing.Size(159, 6) + ' + 'mnuHelp3 + ' + Me.mnuHelp3.Name = "mnuHelp3" + Me.mnuHelp3.Size = New System.Drawing.Size(162, 22) + Me.mnuHelp3.Text = "Help" + ' 'lblHeaderDataView ' Me.lblHeaderDataView.BackColor = System.Drawing.Color.FromArgb(CType(CType(35, Byte), Integer), CType(CType(105, Byte), Integer), CType(CType(190, Byte), Integer)) @@ -956,7 +1002,7 @@ Partial Class ucrDataView Private WithEvents mnuDeleteCol As ToolStripMenuItem Private WithEvents toolStripMenuItem2 As ToolStripSeparator Private WithEvents toolStripMenuItem21 As ToolStripSeparator - Private WithEvents mnuColumnFilter As ToolStripMenuItem + Private WithEvents mnuColumnFilterRows As ToolStripMenuItem Private WithEvents mnuClearColumnFilter As ToolStripMenuItem Private WithEvents cellContextMenuStrip As ContextMenuStrip Private WithEvents rowContextMenuStrip As ContextMenuStrip @@ -1004,7 +1050,7 @@ Partial Class ucrDataView Friend WithEvents mnuLabelsLevel As ToolStripMenuItem Friend WithEvents ToolStripSeparator7 As ToolStripSeparator Friend WithEvents mnuSorts As ToolStripMenuItem - Private WithEvents mnuFilters As ToolStripMenuItem + Private WithEvents mnuFilterRows As ToolStripMenuItem Private WithEvents mnuRemoveCurrentFilters As ToolStripMenuItem Friend WithEvents mnuComment As ToolStripMenuItem Friend WithEvents mnuColumnAddComment As ToolStripMenuItem @@ -1049,5 +1095,12 @@ Partial Class ucrDataView Friend WithEvents mnuCellContextRemoveCurrentColumnSelection As ToolStripMenuItem Friend WithEvents mnuRowContextColumnSelection As ToolStripMenuItem Friend WithEvents mnuRowContextRemoveCurrentColumnSelection As ToolStripMenuItem - + Friend WithEvents ToolStripSeparator8 As ToolStripSeparator + Friend WithEvents mnuHelp As ToolStripMenuItem + Friend WithEvents ToolStripSeparator9 As ToolStripSeparator + Friend WithEvents mnuHelp1 As ToolStripMenuItem + Friend WithEvents ToolStripSeparator10 As ToolStripSeparator + Friend WithEvents mnuHelp2 As ToolStripMenuItem + Friend WithEvents ToolStripSeparator11 As ToolStripSeparator + Friend WithEvents mnuHelp3 As ToolStripMenuItem End Class diff --git a/instat/ucrDataView.vb b/instat/ucrDataView.vb index 441c37035d3..9027645f001 100644 --- a/instat/ucrDataView.vb +++ b/instat/ucrDataView.vb @@ -18,18 +18,13 @@ Imports System.ComponentModel Imports System.IO Imports System.Runtime.InteropServices Imports instat.Translations -Imports unvell.ReoGrid -Imports unvell.ReoGrid.Events Public Class ucrDataView Private _clsDataBook As clsDataBook Private _grid As IDataViewGrid - - Public WithEvents grdCurrSheet As unvell.ReoGrid.Worksheet - Public WriteOnly Property DataBook() As clsDataBook - Set(ByVal value As clsDataBook) + Set(value As clsDataBook) _clsDataBook = value _grid.DataBook = value End Set @@ -94,14 +89,14 @@ Public Class ucrDataView End Sub Private Sub RefreshWorksheet(fillWorkSheet As clsWorksheetAdapter, dataFrame As clsDataFrame) - If Not dataFrame.clsVisiblePage.HasChanged Then + If Not dataFrame.clsVisibleDataFramePage.HasChanged Then Exit Sub End If _grid.CurrentWorksheet = fillWorkSheet - _grid.AddColumns(dataFrame.clsVisiblePage) + _grid.AddColumns(dataFrame.clsVisibleDataFramePage) _grid.AddRowData(dataFrame) _grid.UpdateWorksheetStyle(fillWorkSheet) - dataFrame.clsVisiblePage.HasChanged = False + dataFrame.clsVisibleDataFramePage.HasChanged = False RefreshDisplayInformation() End Sub @@ -110,13 +105,13 @@ Public Class ucrDataView End Sub Private Sub UpdateNavigationButtons() - lblColBack.Enabled = If(GetCurrentDataFrameFocus()?.clsVisiblePage?.CanLoadPreviousColumnPage(), False) - lblColNext.Enabled = If(GetCurrentDataFrameFocus()?.clsVisiblePage?.CanLoadNextColumnPage(), False) + lblColBack.Enabled = If(GetCurrentDataFrameFocus()?.clsVisibleDataFramePage?.CanLoadPreviousColumnPage(), False) + lblColNext.Enabled = If(GetCurrentDataFrameFocus()?.clsVisibleDataFramePage?.CanLoadNextColumnPage(), False) lblColFirst.Enabled = lblColBack.Enabled lblColLast.Enabled = lblColNext.Enabled - lblRowBack.Enabled = If(GetCurrentDataFrameFocus()?.clsVisiblePage?.CanLoadPreviousRowPage(), False) - lblRowNext.Enabled = If(GetCurrentDataFrameFocus()?.clsVisiblePage?.CanLoadNextRowPage(), False) + lblRowBack.Enabled = If(GetCurrentDataFrameFocus()?.clsVisibleDataFramePage?.CanLoadPreviousRowPage(), False) + lblRowNext.Enabled = If(GetCurrentDataFrameFocus()?.clsVisibleDataFramePage?.CanLoadNextRowPage(), False) lblRowFirst.Enabled = lblRowBack.Enabled lblRowLast.Enabled = lblRowNext.Enabled End Sub @@ -150,8 +145,28 @@ Public Class ucrDataView End If End Sub - Private Function GetCurrentDataFrameFocus() As clsDataFrame - Return _clsDataBook.GetDataFrame(_grid.CurrentWorksheet.Name) + ''' + ''' Gets current selected data frame + ''' todo. rename this to GetSelectedDataFrame? + ''' + ''' + ''' Nothing if no data frame is currently focused. + ''' This can happen when all data frames have been deleted + ''' + Public Function GetCurrentDataFrameFocus() As clsDataFrame + Return If(_grid.CurrentWorksheet Is Nothing, Nothing, _clsDataBook.GetDataFrame(_grid.CurrentWorksheet.Name)) + End Function + + ''' + ''' Gets current selected data frame name + ''' todo. rename this to GetSelectedDataFrameName? + ''' + ''' + ''' Nothing if no data frame is currently focused. + ''' This can happen when all data frames have been deleted + ''' + Public Function GetCurrentDataFrameNameFocus() As String + Return If(_grid.CurrentWorksheet Is Nothing, Nothing, _grid.CurrentWorksheet.Name) End Function Private Sub mnuDeleteCol_Click(sender As Object, e As EventArgs) Handles mnuDeleteCol.Click @@ -224,7 +239,6 @@ Public Class ucrDataView Private Sub RefreshDisplayInformation() If GetWorkSheetCount() <> 0 AndAlso _clsDataBook IsNot Nothing AndAlso GetCurrentDataFrameFocus() IsNot Nothing Then - frmMain.strCurrentDataFrame = _grid.CurrentWorksheet.Name frmMain.tstatus.Text = _grid.CurrentWorksheet.Name SetDisplayLabels() UpdateNavigationButtons() @@ -236,7 +250,7 @@ Public Class ucrDataView End Sub Private Sub ResizeLabels() - Const iMinSize As Single = 5 + Const iMinSize As Single = 4.5 TblPanPageDisplay.Font = New Font(TblPanPageDisplay.Font.FontFamily, 12, TblPanPageDisplay.Font.Style) While lblRowDisplay.Width + lblColDisplay.Width + 50 + @@ -282,16 +296,24 @@ Public Class ucrDataView End Sub Private Sub SetDisplayLabels() - lblRowDisplay.Text = "Showing rows " & GetCurrentDataFrameFocus().clsVisiblePage.intStartRow & " to " & - GetCurrentDataFrameFocus().clsVisiblePage.intEndRow & " of " + Dim strRowLabel As String = GetCurrentDataFrameFocus().clsVisibleDataFramePage.intStartRow & " to " & + GetCurrentDataFrameFocus().clsVisibleDataFramePage.intEndRow & " of " + Dim strColLabel As String = GetCurrentDataFrameFocus().clsVisibleDataFramePage.intStartColumn & " to " & + GetCurrentDataFrameFocus().clsVisibleDataFramePage.intEndColumn & " of " + If GetCurrentDataFrameFocus().clsFilterOrColumnSelection.bFilterApplied Then - lblRowDisplay.Text &= GetCurrentDataFrameFocus().clsFilterOrColumnSelection.iFilteredRowCount & - " (" & GetCurrentDataFrameFocus().iTotalRowCount & ")" & " | Active filter: " & GetCurrentDataFrameFocus().clsFilterOrColumnSelection.strName + lblRowDisplay.Text = "Rows " & strRowLabel & GetCurrentDataFrameFocus().clsFilterOrColumnSelection.iFilteredRowCount & + " (" & GetCurrentDataFrameFocus().iTotalRowCount & ")" & " | Filter: " & GetCurrentDataFrameFocus().clsFilterOrColumnSelection.strName Else - lblRowDisplay.Text &= GetCurrentDataFrameFocus().iTotalRowCount + lblRowDisplay.Text = "Showing rows " & strRowLabel & GetCurrentDataFrameFocus().iTotalRowCount + End If + + If GetCurrentDataFrameFocus().clsFilterOrColumnSelection.bColumnSelectionApplied Then + lblColDisplay.Text = "Columns " & strColLabel & GetCurrentDataFrameFocus().clsVisibleDataFramePage.intEndColumn & + " (" & GetCurrentDataFrameFocus().iTotalColumnCount & ")" & " | Selection: " & GetCurrentDataFrameFocus().clsFilterOrColumnSelection.strSelectionName + Else + lblColDisplay.Text = "Showing columns " & strColLabel & GetCurrentDataFrameFocus().iTotalColumnCount End If - lblColDisplay.Text = "columns " & GetCurrentDataFrameFocus().clsVisiblePage.intStartColumn & " to " & GetCurrentDataFrameFocus().clsVisiblePage.intEndColumn & - " of " & GetCurrentDataFrameFocus().iTotalColumnCount ResizeLabels() End Sub @@ -423,7 +445,7 @@ Public Class ucrDataView EndWait() End Sub - Private Sub mnuColumnFilter_Click(sender As Object, e As EventArgs) Handles mnuColumnFilter.Click + Private Sub mnuColumnFilter_Click(sender As Object, e As EventArgs) Handles mnuColumnFilterRows.Click dlgRestrict.bIsSubsetDialog = False dlgRestrict.strDefaultDataframe = _grid.CurrentWorksheet.Name dlgRestrict.ShowDialog() @@ -580,14 +602,14 @@ Public Class ucrDataView Dim iNonNumericValues As Integer = GetCurrentDataFrameFocus().clsPrepareFunctions.GetAmountOfNonNumericValuesInColumn(strColumn) If iNonNumericValues = 0 Then GetCurrentDataFrameFocus().clsPrepareFunctions.ConvertToNumeric(strColumn, True) - ElseIf iNonNumericValues = GetCurrentDataFrameFocus().iTotalRowCount Then - GetCurrentDataFrameFocus().clsPrepareFunctions.ConvertToNumeric(strColumn, False) Else + Dim bCheckLabels As Boolean = GetCurrentDataFrameFocus().clsPrepareFunctions.CheckHasLabels(strColumn) frmConvertToNumeric.SetDataFrameName(GetCurrentDataFrameFocus().strName) frmConvertToNumeric.SetColumnName(strColumn) + frmConvertToNumeric.CheckLabels(bCheckLabels) frmConvertToNumeric.SetNonNumeric(iNonNumericValues) frmConvertToNumeric.ShowDialog() - ' Yes for "normal" convert and No for "labelled" convert + ' Yes for "normal" convert and No for "ordinal" convert If frmConvertToNumeric.DialogResult = DialogResult.Yes Then GetCurrentDataFrameFocus().clsPrepareFunctions.ConvertToNumeric(strColumn, True) ElseIf frmConvertToNumeric.DialogResult = DialogResult.No Then @@ -612,7 +634,7 @@ Public Class ucrDataView dlgSort.ShowDialog() End Sub - Private Sub mnuFilters_Click(sender As Object, e As EventArgs) Handles mnuFilters.Click + Private Sub mnuFilters_Click(sender As Object, e As EventArgs) Handles mnuFilterRows.Click dlgRestrict.bIsSubsetDialog = False dlgRestrict.strDefaultDataframe = _grid.CurrentWorksheet.Name dlgRestrict.ShowDialog() @@ -717,7 +739,7 @@ Public Class ucrDataView End Sub Private Sub cellContextMenuStrip_Opening(sender As Object, e As CancelEventArgs) Handles cellContextMenuStrip.Opening - mnuLabelsLevel.Enabled = IsOnlyOneColumnSelected() AndAlso IsOnlyOneColumnSelected() + mnuLabelsLevel.Enabled = IsOnlyOneColumnSelected() AndAlso IsOnlyOneColumnSelected() AndAlso IsFirstSelectedColumnAFactor() mnuRemoveCurrentFilters.Enabled = GetCurrentDataFrameFocus().clsFilterOrColumnSelection.bFilterApplied mnuCellContextRemoveCurrentColumnSelection.Enabled = GetCurrentDataFrameFocus().clsFilterOrColumnSelection.bColumnSelectionApplied End Sub @@ -766,42 +788,42 @@ Public Class ucrDataView End Sub Private Sub lblRowFirst_Click(sender As Object, e As EventArgs) Handles lblRowFirst.Click - GetCurrentDataFrameFocus().clsVisiblePage.LoadFirstRowPage() + GetCurrentDataFrameFocus().clsVisibleDataFramePage.LoadFirstRowPage() RefreshWorksheet(_grid.CurrentWorksheet, GetCurrentDataFrameFocus()) End Sub Private Sub lblRowBack_Click(sender As Object, e As EventArgs) Handles lblRowBack.Click - GetCurrentDataFrameFocus().clsVisiblePage.LoadPreviousRowPage() + GetCurrentDataFrameFocus().clsVisibleDataFramePage.LoadPreviousRowPage() RefreshWorksheet(_grid.CurrentWorksheet, GetCurrentDataFrameFocus()) End Sub Private Sub lblRowNext_Click(sender As Object, e As EventArgs) Handles lblRowNext.Click - GetCurrentDataFrameFocus().clsVisiblePage.LoadNextRowPage() + GetCurrentDataFrameFocus().clsVisibleDataFramePage.LoadNextRowPage() RefreshWorksheet(_grid.CurrentWorksheet, GetCurrentDataFrameFocus()) End Sub Private Sub lblRowLast_Click(sender As Object, e As EventArgs) Handles lblRowLast.Click - GetCurrentDataFrameFocus().clsVisiblePage.LoadLastRowPage() + GetCurrentDataFrameFocus().clsVisibleDataFramePage.LoadLastRowPage() RefreshWorksheet(_grid.CurrentWorksheet, GetCurrentDataFrameFocus()) End Sub Private Sub lblColFirst_Click(sender As Object, e As EventArgs) Handles lblColFirst.Click - GetCurrentDataFrameFocus().clsVisiblePage.LoadFirstColumnPage() + GetCurrentDataFrameFocus().clsVisibleDataFramePage.LoadFirstColumnPage() RefreshWorksheet(_grid.CurrentWorksheet, GetCurrentDataFrameFocus()) End Sub Private Sub lblColBack_Click(sender As Object, e As EventArgs) Handles lblColBack.Click - GetCurrentDataFrameFocus().clsVisiblePage.LoadPreviousColumnPage() + GetCurrentDataFrameFocus().clsVisibleDataFramePage.LoadPreviousColumnPage() RefreshWorksheet(_grid.CurrentWorksheet, GetCurrentDataFrameFocus()) End Sub Private Sub lblColNext_Click(sender As Object, e As EventArgs) Handles lblColNext.Click - GetCurrentDataFrameFocus().clsVisiblePage.LoadNextColumnPage() + GetCurrentDataFrameFocus().clsVisibleDataFramePage.LoadNextColumnPage() RefreshWorksheet(_grid.CurrentWorksheet, GetCurrentDataFrameFocus()) End Sub Private Sub lblColLast_Click(sender As Object, e As EventArgs) Handles lblColLast.Click - GetCurrentDataFrameFocus().clsVisiblePage.LoadLastColumnPage() + GetCurrentDataFrameFocus().clsVisibleDataFramePage.LoadLastColumnPage() RefreshWorksheet(_grid.CurrentWorksheet, GetCurrentDataFrameFocus()) End Sub @@ -858,4 +880,8 @@ Public Class ucrDataView Private Sub mnuDeleteCells_Click(sender As Object, e As EventArgs) Handles mnuDeleteCells.Click DeleteCell_Click() End Sub + + Private Sub mnuHelp_Click(sender As Object, e As EventArgs) Handles mnuHelp.Click, mnuHelp1.Click, mnuHelp2.Click, mnuHelp3.Click + Help.ShowHelp(frmMain, frmMain.strStaticPath & "/" & frmMain.strHelpFilePath, HelpNavigator.TopicId, "146") + End Sub End Class \ No newline at end of file diff --git a/instat/ucrDistributionsWithParameters.vb b/instat/ucrDistributionsWithParameters.vb index 78897d48862..35025ad3da6 100644 --- a/instat/ucrDistributionsWithParameters.vb +++ b/instat/ucrDistributionsWithParameters.vb @@ -14,66 +14,66 @@ ' You should have received a copy of the GNU General Public License ' along with this program. If not, see . -Imports instat.Translations - -Public Class ucrDistributionsWithParameters - Public lstParameterLabels As New List(Of Label) - Public lstParameterInputTextBoxes As New List(Of ucrInputTextBox) - Public lstCurrArguments As New List(Of String) +Imports instat.Translations + +Public Class ucrDistributionsWithParameters + Public lstParameterLabels As New List(Of Label) + Public lstParameterInputTextBoxes As New List(Of ucrInputTextBox) + Public lstCurrArguments As New List(Of String) Public bParametersFilled As Boolean = False Private Sub ucrDistributionsWithParameters_Load(sender As Object, e As EventArgs) Handles MyBase.Load 'temp disabled - ucrInputParameter4.Visible = False + ucrInputParameter4.Visible = False lblParameter4.Visible = False - End Sub - - Public Sub SetParameters() - Dim i As Integer = 0 - Dim strParamName As String - - If lstParameterLabels.Count = 0 Then - lstParameterLabels.AddRange({lblParameter1, lblParameter2, lblParameter3}) - End If - If lstParameterInputTextBoxes.Count = 0 Then - lstParameterInputTextBoxes.AddRange({ucrInputParameter1, ucrInputParameter2, ucrInputParameter3}) - End If - - If clsCurrDistribution.clsParameters.Count < 3 Then - lblParameter3.Visible = False - ucrInputParameter3.Visible = False - Else - lblParameter3.Visible = True - ucrInputParameter3.Visible = True - End If - If clsCurrDistribution.clsParameters.Count < 2 Then - lblParameter2.Visible = False - ucrInputParameter2.Visible = False - Else - lblParameter2.Visible = True - ucrInputParameter2.Visible = True - End If - If clsCurrDistribution.clsParameters.Count < 1 Then - lblParameter1.Visible = False - ucrInputParameter1.Visible = False - Else - lblParameter1.Visible = True - ucrInputParameter1.Visible = True - End If - - If clsCurrDistribution IsNot Nothing Then - For Each strParamName In lstCurrArguments - clsCurrRFunction.RemoveParameterByName(strParamName) - Next - 'Removes transformed parameters - 'which are not in lstCurrArguments - clsCurrRFunction.RemoveParameterByName("rate") - clsCurrRFunction.RemoveParameterByName("scale") - clsCurrRFunction.RemoveParameterByName("size") - lstCurrArguments.Clear() - For i = 0 To clsCurrDistribution.clsParameters.Count - 1 - lstParameterLabels(i).Text = GetTranslation(clsCurrDistribution.clsParameters(i).strNameTag) - lstCurrArguments.Add(clsCurrDistribution.clsParameters(i).strArgumentName) + End Sub + + Public Sub SetParameters() + Dim i As Integer = 0 + Dim strParamName As String + + If lstParameterLabels.Count = 0 Then + lstParameterLabels.AddRange({lblParameter1, lblParameter2, lblParameter3}) + End If + If lstParameterInputTextBoxes.Count = 0 Then + lstParameterInputTextBoxes.AddRange({ucrInputParameter1, ucrInputParameter2, ucrInputParameter3}) + End If + + If clsCurrDistribution.clsParameters.Count < 3 Then + lblParameter3.Visible = False + ucrInputParameter3.Visible = False + Else + lblParameter3.Visible = True + ucrInputParameter3.Visible = True + End If + If clsCurrDistribution.clsParameters.Count < 2 Then + lblParameter2.Visible = False + ucrInputParameter2.Visible = False + Else + lblParameter2.Visible = True + ucrInputParameter2.Visible = True + End If + If clsCurrDistribution.clsParameters.Count < 1 Then + lblParameter1.Visible = False + ucrInputParameter1.Visible = False + Else + lblParameter1.Visible = True + ucrInputParameter1.Visible = True + End If + + If clsCurrDistribution IsNot Nothing Then + For Each strParamName In lstCurrArguments + clsCurrRFunction.RemoveParameterByName(strParamName) + Next + 'Removes transformed parameters + 'which are not in lstCurrArguments + clsCurrRFunction.RemoveParameterByName("rate") + clsCurrRFunction.RemoveParameterByName("scale") + clsCurrRFunction.RemoveParameterByName("size") + lstCurrArguments.Clear() + 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) If clsCurrDistribution.strNameTag = "Discrete_Empirical" Then @@ -81,64 +81,67 @@ Public Class ucrDistributionsWithParameters 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 + End If Else lstParameterInputTextBoxes(i).Reset() End If - OnControlValueChanged() - Next - If clsCurrDistribution.strNameTag = "Bernoulli" Then - AddParameter("size", 1) - End If - bParametersFilled = False - End If - CheckParametersFilled() - End Sub - - Public Sub CheckParametersFilled() - If (Not ucrInputParameter1.Visible OrElse Not ucrInputParameter1.IsEmpty) AndAlso (Not ucrInputParameter2.Visible OrElse Not ucrInputParameter2.IsEmpty) AndAlso (Not ucrInputParameter3.Visible OrElse Not ucrInputParameter3.IsEmpty) Then - bParametersFilled = True - Else - bParametersFilled = False - End If - End Sub - + OnControlValueChanged() + Next + If clsCurrDistribution.strNameTag = "Bernoulli" Then + AddParameter("size", 1) + End If + bParametersFilled = False + End If + CheckParametersFilled() + End Sub + + Public Sub CheckParametersFilled() + If (Not ucrInputParameter1.Visible OrElse Not ucrInputParameter1.IsEmpty) AndAlso (Not ucrInputParameter2.Visible OrElse Not ucrInputParameter2.IsEmpty) AndAlso (Not ucrInputParameter3.Visible OrElse Not ucrInputParameter3.IsEmpty) Then + bParametersFilled = True + Else + bParametersFilled = False + End If + End Sub + Private Sub ucrDistributionsWithParameters_ucrInputDistributionsIndexChanged() Handles Me.DistributionsIndexChanged - SetParameters() - End Sub - + SetParameters() + End Sub + Private Sub ucrInputParameter1_ControlValueChanged() Handles ucrInputParameter1.ControlValueChanged If lstCurrArguments IsNot Nothing AndAlso lstCurrArguments.Count > 0 Then AddParameter(lstCurrArguments(0), ucrInputParameter1.GetText) - CheckParametersFilled() + If clsCurrDistribution.strNameTag = "Discrete_Empirical" Then + ucrInputParameter1.IsReadOnly = True + CheckParametersFilled() + Else + ucrInputParameter1.IsReadOnly = False + End If End If OnControlValueChanged() End Sub - Private Sub ucrInputParameter2_ContentsChanged() Handles ucrInputParameter2.ContentsChanged + Private Sub ucrInputParameter2_ControlContentsChanged(ucrChangedControl As ucrCore) Handles ucrInputParameter2.ControlContentsChanged If lstCurrArguments IsNot Nothing AndAlso lstCurrArguments.Count > 1 Then 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 OnControlContentsChanged() - End Sub - + End Sub + Private Sub ucrInputParameter3_ControlValueChanged() Handles ucrInputParameter3.ControlValueChanged If lstCurrArguments IsNot Nothing AndAlso lstCurrArguments.Count > 2 Then AddParameter(lstCurrArguments(2), ucrInputParameter3.GetText) CheckParametersFilled() End If - OnControlValueChanged() - End Sub - - Private Sub ucrDistributionsWithParameters_ParameterChanged() Handles Me.ControlValueChanged - CheckParametersFilled() + OnControlValueChanged() + End Sub + + Private Sub ucrDistributionsWithParameters_ParameterChanged() Handles Me.ControlValueChanged + CheckParametersFilled() End Sub End Class \ No newline at end of file diff --git a/instat/ucrFactor.vb b/instat/ucrFactor.vb index ea25837a1b2..7b432cb07f0 100644 --- a/instat/ucrFactor.vb +++ b/instat/ucrFactor.vb @@ -14,648 +14,874 @@ ' You should have received a copy of the GNU General Public License ' along with this program. If not, see . -Imports instat Imports RDotNet +Imports unvell.ReoGrid Imports unvell.ReoGrid.CellTypes Imports unvell.ReoGrid.Events -Imports unvell.ReoGrid +''' +''' This control only accepts string parameter types +''' It does not yet support entry of comma separated values +''' It can only be used in either of the following states; NormalGrid, SingleSelectorGrid, MultipleSelectorGrid +''' In NormalGrid normal state, if set to internally write to parameters, +''' the parameters will have a list of the entire values of the column regardless of whether +''' the values were edit or not. +''' Reading R parameters will fail if any new levels created were not submitted to R +''' In Selector state mode, if set to internally write to parameters, +''' the parameters will have a list of the selected values +''' Public Class ucrFactor - Public Event SelectedLevelChanged() - Public Event GridContentChanged() - Public Event GridVisibleChanged() - Public WithEvents clsReceiver As ucrReceiverSingle - Public WithEvents shtCurrSheet As unvell.ReoGrid.Worksheet - Public bIsSelector As Boolean - Public bIsMultipleSelector As Boolean - Public bIsGridColumn As Boolean - Public strColumnToGet As String - Public iSelectorColumnIndex As Integer - Public strSelectorColumnName As String - Private bIsEditable As Boolean - Private lstEditableColumns As List(Of String) - Public bIncludeCopyOfLevels As Boolean - Public strExtraColumn As String = "" - Public strSelectedLevels As String() - Public WithEvents ucrChkLevels As ucrCheck - Public bForceShowLevels As Boolean - Public bIncludeLevels As Boolean - Public bIncludeNA As Boolean - Public strLevelsName As String - Public strLabelsName As String - Public strFreqName As String - Private bDoNotUpdateCells As Boolean = False - - Public Sub New() - - ' This call is required by the designer. - InitializeComponent() - - ' Add any initialization after the InitializeComponent() call. - bIsSelector = False - bIsMultipleSelector = False - bIsGridColumn = False - strColumnToGet = "" - iSelectorColumnIndex = -1 - strSelectorColumnName = "Select Level" - bIsEditable = False - lstEditableColumns = New List(Of String) - bIncludeCopyOfLevels = False - bForceShowLevels = False - bIncludeLevels = True - bIncludeNA = False - strLevelsName = "Level" - strLabelsName = "Label" - strFreqName = "Freq" - End Sub - Private Sub ucrFactor_Load(sender As Object, e As EventArgs) Handles MyBase.Load + 'this reogrid worksheet will eventually be replaced with the custom grid sheet + Private WithEvents _grdSheet As unvell.ReoGrid.Worksheet + + ''' + ''' raised when the grid content has been refilled from R. + ''' For instance when a factor variable is changed, it's default metadata is refilled from R + ''' + Public Event GridContentReFilledFromR() + + ''' + ''' the receiver linked to this control. + ''' will be used to display the factor metadata of the variable contained in it + ''' The receiver should contain a factor variable + ''' + Private WithEvents _ucrLinkedReceiver As ucrReceiverSingle + + 'Note. This will be initialised once in this object scope. + + ''' + ''' used as a cache of the receiver's contents + ''' + Private strCurrFactorVariableName As String = "" + + ''' + ''' used to determine whether to include NA factor level, if available, + ''' as part of the metadata filled in the grid sheet + ''' + Private _bIncludeNALevel As Boolean = False + + ''' + ''' holds all column names to be set as editable in the grid sheet after filling the metadata + ''' + Private _editableColNames As New HashSet(Of String) + + ''' + ''' holds column names to be hidden in the grid sheet after filling the metadata + ''' + Private _hiddenColNames As New HashSet(Of String) + + ''' + ''' holds extra column names that will be added to the sheet after filling the metadata + ''' + Private _extraColNames As New HashSet(Of String) + + ''' + ''' holds parameter names and column names associated with them + ''' used in writing the contents of the columns in to the parameters + ''' + Private _dctParamAndColNames As New Dictionary(Of String, String) + + ''' + ''' holds the state of the control + ''' + Private _enumControlState As ControlStates = ControlStates.NormalGrid + + ''' + ''' the control's valid states + ''' + Private Enum ControlStates + 'can contain editable columns. no row selection is internally supported + NormalGrid + 'cannot contain editable columns and also single selection of grid rows + SingleSelectorGrid + 'cannot contain editable columns and also allows multiple selection of grid rows + MultipleSelectorGrid + End Enum + + ''' + ''' represents column names internally supported by this control + ''' + Public Structure DefaultColumnNames + '------------------- + 'note an Enum would have been ideal, but VB.Net does not support String Enums + '------------------ + + ''' + ''' Used to represent the ordinal column name from R. + ''' It's always added in the grid + ''' + Public Const Ordinal As String = "Ord." + ''' + ''' used to represent "Level" column name from R + ''' It's always added in the grid + ''' + Public Const Level As String = "Level" + ''' + ''' used to represent "Label" column name from R + ''' It's always added in the grid + ''' + Public Const Label As String = "Label" + ''' + ''' used to represent "Freq" column name from R + ''' It's always added in the grid + ''' + Public Const Freq As String = "Freq" + + ''' + ''' used to represent "Selector" column name + ''' this column is added internally when the control is used as a 'selector' + ''' it does not come from R. + ''' It's added in the grid if the control is used as a selector + ''' + Public Const SelectorColumn As String = "Select" + End Structure + + + Private Sub ucrFactor_Load(sender As Object, e As EventArgs) Handles Me.Load + 'the grid will always have 1 sheet. So no need to display the sheet tab control grdFactorData.SetSettings(unvell.ReoGrid.WorkbookSettings.View_ShowSheetTabControl, False) - 'TODO possibly don't need to do this now as linking will fill the grid (but counts etc. need to be updated) - RefreshFactorData() End Sub - Public Sub SetReceiver(clsNewReceiver As ucrReceiverSingle) - clsReceiver = clsNewReceiver - If ucrChkLevels IsNot Nothing Then - ucrChkLevels.Enabled = Not clsReceiver.IsEmpty - End If - RefreshFactorData() - End Sub + Private Sub _ucrLinkedReceiver_ControlValueChanged(ucrChangedControl As ucrCore) Handles _ucrLinkedReceiver.ControlValueChanged + 'Calling this subroutine here is necessary. + 'However when reloading a dialog, the receiver always clears it's contents first before + 'restoring the previous selected variable. + 'This forces this control to never retain what was previously selected despite it's inbuilt ability to do so + 'todo Once the receiver is refactored this comment can be removed. - Public Sub AddEditableColumns(strColumns As String()) - lstEditableColumns.AddRange(strColumns) - ApplyColumnSettings() + FillGridWithNewDataSheet() End Sub - Public Sub SetAsSingleSelector() - bIsSelector = True - bIsMultipleSelector = False - bIsGridColumn = False - RefreshFactorData() + Private Sub _grdSheet_BeforeCut(sender As Object, e As BeforeRangeOperationEventArgs) Handles _grdSheet.BeforeCut + MsgBox("Cutting is currently disabled. This feature will be included in future versions." & + Environment.NewLine & "Try copying and deleting from one column cells at a time.", + MsgBoxStyle.Information, "Cannot cut from cells") + e.IsCancelled = True End Sub - Public Sub SetAsMultipleSelector() - bIsSelector = True - bIsMultipleSelector = True - bIsGridColumn = False - RefreshFactorData() + Private Sub _grdSheet_BeforeCellKeyDown(sender As Object, e As BeforeCellKeyDownEventArgs) Handles _grdSheet.BeforeCellKeyDown + If e.KeyCode = unvell.ReoGrid.Interaction.KeyCode.Delete OrElse e.KeyCode = unvell.ReoGrid.Interaction.KeyCode.Back Then + MsgBox("Deleting cells is currently disabled. " & + "This feature will be included in future versions." & + Environment.NewLine & "To remove a cell's value, replace the value with NA.", + MsgBoxStyle.Information, "Cannot delete cells.") + e.IsCancelled = True + End If End Sub - Public Sub SetIsGridColumn(strColumnName As String) - bIsSelector = False - bIsMultipleSelector = False - bIsGridColumn = True - strColumnToGet = strColumnName - RefreshFactorData() - End Sub + ''' + ''' raised when user types in the cell. + ''' does not apply to checkbox and radiobutton cells + ''' + ''' + ''' + Private Sub _grdSheet_AfterCellEdit(sender As Object, e As CellAfterEditEventArgs) Handles _grdSheet.AfterCellEdit - Public Sub SetAsViewerOnly() - bIsSelector = False - bIsMultipleSelector = False - RefreshFactorData() - End Sub + Dim bValid As Boolean = True + 'do levels entry validation + If _grdSheet.ColumnHeaders(e.Cell.Column).Text = DefaultColumnNames.Level Then + If Not IsNumeric(e.NewData) Then + MsgBox("Levels must be numeric values", MsgBoxStyle.Information, "Invalid Value") + bValid = False + ElseIf e.NewData.Contains(".") Then + MsgBox("Levels must not be decimal", MsgBoxStyle.Information, "Invalid Value") - Public Sub SetEditableStatus(bEditable As Boolean) - bIsEditable = bEditable - If shtCurrSheet IsNot Nothing Then - shtCurrSheet.SetSettings(unvell.ReoGrid.WorksheetSettings.Edit_Readonly, Not bEditable) + bValid = False + End If End If - End Sub - Public Sub SetSelectorColumnName(strNewColumnName As String) - strSelectorColumnName = strNewColumnName - If iSelectorColumnIndex <> -1 Then - shtCurrSheet.ColumnHeaders(iSelectorColumnIndex).Text = strSelectorColumnName + If bValid Then + 'set the new data before calling OnControlValueChanged + 'very important especially when writing to the parameter value + _grdSheet(e.Cell.Row, e.Cell.Column) = e.NewData + 'this will raise ControlContentsChanged event + 'and also update parameter and R code with the values + OnControlValueChanged() + e.Cell.Style.BackColor = Color.Gold Else - RefreshFactorData() + e.EndReason = EndEditReason.Cancel End If + End Sub - Private Sub RefreshFactorData() - Dim dfTemp As DataFrame - Dim bShowGrid As Boolean = False - Dim clsGetFactorData As New RFunction - Dim clsConvertToCharacter As New RFunction - Dim bHasLevels As Boolean - Dim iLevelsCol As Integer - Dim iLabelsCol As Integer - Dim iFreqCol As Integer - Dim strColType As String - Dim expDataFrame As SymbolicExpression - grdFactorData.Worksheets.Clear() - ' Contains allows ordered factors to be included - If clsReceiver IsNot Nothing AndAlso Not clsReceiver.IsEmpty() Then - strColType = frmMain.clsRLink.GetColumnType(clsReceiver.GetDataName(), clsReceiver.GetVariableNames(False)) - If strColType = "" Then - clsReceiver.Clear() - ElseIf strColType.Contains("factor") Then - clsGetFactorData.SetRCommand(frmMain.clsRLink.strInstatDataObject & "$get_factor_data_frame") - clsGetFactorData.AddParameter("data_name", Chr(34) & clsReceiver.GetDataName() & Chr(34)) - clsGetFactorData.AddParameter("col_name", clsReceiver.GetVariableNames()) - If bIncludeLevels Then - clsGetFactorData.AddParameter("include_levels", "TRUE") - Else - clsGetFactorData.AddParameter("include_levels", "FALSE") - End If - If bIncludeNA Then - clsGetFactorData.AddParameter("include_NA_level", "TRUE") - Else - clsGetFactorData.AddParameter("include_NA_level", "FALSE") - End If - clsConvertToCharacter.SetRCommand("convert_to_character_matrix") - clsConvertToCharacter.AddParameter("data", clsRFunctionParameter:=clsGetFactorData) - expDataFrame = frmMain.clsRLink.RunInternalScriptGetValue(clsConvertToCharacter.ToScript(), bSilent:=True) - If expDataFrame IsNot Nothing AndAlso expDataFrame.Type <> Internals.SymbolicExpressionType.Null Then - dfTemp = expDataFrame.AsDataFrame - frmMain.clsGrids.FillSheet(dfTemp, "Factor Data", grdFactorData) - shtCurrSheet = grdFactorData.CurrentWorksheet - shtCurrSheet.SetSettings(unvell.ReoGrid.WorksheetSettings.Edit_DragSelectionToMoveCells, False) - bShowGrid = True - shtCurrSheet.SelectionForwardDirection = unvell.ReoGrid.SelectionForwardDirection.Down - iLevelsCol = GetColumnIndex(strLevelsName) - iLabelsCol = GetColumnIndex(strLabelsName) - iFreqCol = GetColumnIndex(strFreqName) - If bIncludeCopyOfLevels Then - shtCurrSheet.AppendColumns(1) - shtCurrSheet.ColumnHeaders(shtCurrSheet.ColumnCount - 1).Text = "New Label" - For i = 0 To shtCurrSheet.RowCount - 1 - shtCurrSheet(i, shtCurrSheet.ColumnCount - 1) = shtCurrSheet(i, iLabelsCol) - Next - End If - If strExtraColumn <> "" Then - shtCurrSheet.AppendColumns(1) - shtCurrSheet.ColumnHeaders(shtCurrSheet.ColumnCount - 1).Text = strExtraColumn - End If - If bIsSelector Then - iSelectorColumnIndex = shtCurrSheet.ColumnCount - shtCurrSheet.AppendColumns(1) - If bIsMultipleSelector Then - shtCurrSheet.ColumnHeaders(iSelectorColumnIndex).DefaultCellBody = GetType(CheckBoxCell) - shtCurrSheet.ColumnHeaders(iSelectorColumnIndex).Text = strSelectorColumnName - InitialiseSelected() - Else - shtCurrSheet.ColumnHeaders(iSelectorColumnIndex).Text = strSelectorColumnName - shtCurrSheet.ColumnHeaders(iSelectorColumnIndex).DefaultCellBody = GetType(RadioButtonCell) - InitialiseSelected() - Dim rgpselectcolumn As New RadioButtonGroup - For i = 0 To shtCurrSheet.RowCount - 1 - Dim rdotemp As New RadioButtonCell - rdotemp.RadioGroup = rgpselectcolumn - shtCurrSheet(i, iSelectorColumnIndex) = rdotemp - Next - End If - End If - End If - End If - Else - shtCurrSheet = Nothing - iSelectorColumnIndex = -1 - End If - grdFactorData.Visible = bShowGrid - If shtCurrSheet IsNot Nothing Then - shtCurrSheet.SetSettings(unvell.ReoGrid.WorksheetSettings.Edit_Readonly, Not bIsEditable) - shtCurrSheet.SetSettings(unvell.ReoGrid.WorksheetSettings.Edit_DragSelectionToMoveCells, False) - shtCurrSheet.SetSettings(unvell.ReoGrid.WorksheetSettings.View_ShowRowHeader, False) - shtCurrSheet.SetSettings(unvell.ReoGrid.WorksheetSettings.Edit_DragSelectionToFillSerial, False) - shtCurrSheet.SelectionForwardDirection = unvell.ReoGrid.SelectionForwardDirection.Down - shtCurrSheet.ColumnHeaders(0).Width = 30 - If iLevelsCol <> -1 Then - shtCurrSheet.ColumnHeaders(iLevelsCol).Width = 40 - End If - If iFreqCol <> -1 Then - shtCurrSheet.ColumnHeaders(iFreqCol).Width = 40 - End If - ApplyColumnSettings() - RaiseEvent GridContentChanged() - If ucrChkLevels IsNot Nothing Then - ucrChkLevels.Enabled = True - ucrChkLevels.Checked = False - End If - If Not bForceShowLevels Then - If iLevelsCol <> -1 Then - bHasLevels = frmMain.clsRLink.IsVariablesMetadata(clsReceiver.GetDataName(), "labels", clsReceiver.GetVariableNames(False)) - If bHasLevels Then - If ucrChkLevels IsNot Nothing Then - ucrChkLevels.Enabled = False - ucrChkLevels.Checked = True - End If - Else - shtCurrSheet.HideColumns(iLevelsCol, 1) - End If - End If - End If + ''' + ''' sets the state of the control, linked receiver and grid properties + ''' + ''' + ''' + ''' + ''' + ''' + ''' + ''' + Private Sub SetupControl(enumControlState As ControlStates, + ucrLinkedReceiver As ucrReceiverSingle, + Optional dctParamAndColNames As Dictionary(Of String, String) = Nothing, + Optional hiddenColNames As IEnumerable(Of String) = Nothing, + Optional extraColNames As IEnumerable(Of String) = Nothing, + Optional editableColNames As IEnumerable(Of String) = Nothing, + Optional bIncludeNALevel As Boolean = False) + + _enumControlState = enumControlState + _ucrLinkedReceiver = ucrLinkedReceiver + + 'if nothing then just initialise with empty collections + _dctParamAndColNames = If(dctParamAndColNames, New Dictionary(Of String, String)) + _hiddenColNames = New HashSet(Of String)(If(hiddenColNames, {})) + _extraColNames = New HashSet(Of String)(If(extraColNames, {})) + _editableColNames = New HashSet(Of String)(If(editableColNames, {})) + _bIncludeNALevel = bIncludeNALevel + FillGridWithNewDataSheet() + End Sub + + Public Sub SetAsNormalGridColumn(ucrLinkedReceiver As ucrReceiverSingle, + Optional dctParamAndColNames As Dictionary(Of String, String) = Nothing, + Optional hiddenColNames As IEnumerable(Of String) = Nothing, + Optional extraColNames As IEnumerable(Of String) = Nothing, + Optional editableColNames As IEnumerable(Of String) = Nothing) + + SetupControl(ControlStates.NormalGrid, ucrLinkedReceiver, dctParamAndColNames, + hiddenColNames, extraColNames, editableColNames, bIncludeNALevel:=False) + + End Sub + + Public Sub SetAsSingleSelectorGrid(ucrLinkedReceiver As ucrReceiverSingle, + Optional dctParamAndColNames As Dictionary(Of String, String) = Nothing, + Optional hiddenColNames As IEnumerable(Of String) = Nothing, + Optional bIncludeNALevel As Boolean = False) + SetupControl(ControlStates.SingleSelectorGrid, ucrLinkedReceiver, dctParamAndColNames, + hiddenColNames:=hiddenColNames, bIncludeNALevel:=bIncludeNALevel) + End Sub + + Public Sub SetAsMultipleSelectorGrid(ucrLinkedReceiver As ucrReceiverSingle, + Optional dctParamAndColNames As Dictionary(Of String, String) = Nothing, + Optional hiddenColNames As IEnumerable(Of String) = Nothing, + Optional bIncludeNALevel As Boolean = False) + SetupControl(ControlStates.MultipleSelectorGrid, ucrLinkedReceiver, dctParamAndColNames, + hiddenColNames:=hiddenColNames, bIncludeNALevel:=bIncludeNALevel) + End Sub + + ''' + ''' hides the columns + ''' + ''' + Public Sub HideColumns(hiddenColNames As IEnumerable(Of String)) + If _grdSheet Is Nothing Then + Exit Sub End If + + Dim lstHiddenColumnsNames As List(Of String) = _hiddenColNames.ToList + lstHiddenColumnsNames.AddRange(hiddenColNames) + _hiddenColNames = New HashSet(Of String)(lstHiddenColumnsNames) + + For Each strColName As String In _hiddenColNames + _grdSheet.HideColumns(GetColumnIndex(_grdSheet, strColName), 1) + Next End Sub - Private Sub ApplyColumnSettings() - Dim lstColNumber As New List(Of Integer) - Dim bIsReadOnly As Boolean + ''' + ''' shows the columns if they exist + ''' + ''' + Public Sub ShowColumns(showColNames As IEnumerable(Of String)) - If shtCurrSheet IsNot Nothing AndAlso lstEditableColumns IsNot Nothing AndAlso lstEditableColumns.Count > 0 Then - shtCurrSheet.SetSettings(unvell.ReoGrid.WorksheetSettings.Edit_Readonly, False) - For i = 0 To shtCurrSheet.ColumnCount - 1 - bIsReadOnly = Not lstEditableColumns.Contains(shtCurrSheet.ColumnHeaders(i).Text) - For j = 0 To shtCurrSheet.RowCount - 1 - shtCurrSheet.Cells(j, i).IsReadOnly = bIsReadOnly - Next - Next + If _grdSheet Is Nothing Then + Exit Sub End If - End Sub - Private Sub clsReceiver_SelectionChanged(sender As Object, e As EventArgs) Handles clsReceiver.SelectionChanged - RefreshFactorData() + 'update the list of hidden column names first + Dim lstHiddenColumnsNames As List(Of String) = _hiddenColNames.ToList + lstHiddenColumnsNames.RemoveAll(Function(i) showColNames.Contains(i)) + _hiddenColNames = New HashSet(Of String)(lstHiddenColumnsNames) + + 'then show the column names + For Each strColName As String In showColNames + _grdSheet.ShowColumns(GetColumnIndex(_grdSheet, strColName), 1) + Next End Sub - Private Sub InitialiseSelected() - 'sets the default as the reference level (always first level) - 'TODO are there other initial selections needed? - Dim i As Integer - Dim bSelect As Boolean - - If iSelectorColumnIndex <> -1 Then - For i = 0 To shtCurrSheet.RowCount - 1 - If strSelectedLevels IsNot Nothing AndAlso strSelectedLevels.Count > 0 Then - bSelect = strSelectedLevels.Contains(shtCurrSheet(i, 0)) - Else - bSelect = False - End If - shtCurrSheet(i, iSelectorColumnIndex) = bSelect - Next + Private Sub FillGridWithNewDataSheet() + 'check for linked receiver and empty receiver contents + 'also check column type of the receiver if it is a factor. + 'the alternative way of getting the column type is by calling (todo left here for later reference) + 'frmMain.clsRLink.GetColumnType(_ucrLinkedReceiver.GetDataName(), _ucrLinkedReceiver.GetVariableNames(bWithQuotes:=False)) + 'Note contains() check allows ordered factors to be included + If _ucrLinkedReceiver Is Nothing OrElse _ucrLinkedReceiver.IsEmpty() OrElse + String.IsNullOrEmpty(_ucrLinkedReceiver.strCurrDataType) OrElse + Not _ucrLinkedReceiver.strCurrDataType.ToLower.Contains("factor") Then + ClearWorkSheetAndVariableName() + OnControlValueChanged() + Exit Sub End If - strSelectedLevels = Nothing - End Sub - Public Sub AddLevel() - Dim i As Integer - Dim iNewRow As Integer - - If grdFactorData.CurrentWorksheet IsNot Nothing AndAlso shtCurrSheet IsNot Nothing Then - shtCurrSheet.AppendRows(1) - iNewRow = shtCurrSheet.RowCount - 1 - For i = 0 To shtCurrSheet.ColumnCount - 1 - If shtCurrSheet.ColumnHeaders(i).Text = "Ord." Then - shtCurrSheet(iNewRow, i) = shtCurrSheet.RowCount - shtCurrSheet.SetRangeDataFormat(iNewRow, i, 1, 1, unvell.ReoGrid.DataFormat.CellDataFormatFlag.Text) - ElseIf shtCurrSheet.ColumnHeaders(i).Text = strLabelsName Then - shtCurrSheet(iNewRow, i) = "" - shtCurrSheet.SetRangeDataFormat(iNewRow, i, 1, 1, unvell.ReoGrid.DataFormat.CellDataFormatFlag.Text) - ElseIf shtCurrSheet.ColumnHeaders(i).Text = strLevelsName Then - shtCurrSheet(iNewRow, i) = "" - shtCurrSheet.SetRangeDataFormat(iNewRow, i, 1, 1, unvell.ReoGrid.DataFormat.CellDataFormatFlag.Text) - ElseIf shtCurrSheet.ColumnHeaders(i).Text = strFreqName Then - 'TODO Fix this formatting issue with a grid user control - shtCurrSheet.SetRangeDataFormat(iNewRow, i, 1, 1, unvell.ReoGrid.DataFormat.CellDataFormatFlag.Text) - shtCurrSheet(iNewRow, i) = 0 - End If - Next + + 'Get the R factor variable name + Dim strNewFactorVariableName As String = _ucrLinkedReceiver.GetVariableNames(bWithQuotes:=True) + + 'check if the receiver contents really changed. + 'Some dialogs and controls implementations + 'may indirectly call this function multiple times unnecessary. + 'adding this checks helps with performance efficiency. + If strCurrFactorVariableName = strNewFactorVariableName Then + Exit Sub + End If + 'set the new factor varible as the current cached variable + strCurrFactorVariableName = strNewFactorVariableName + If CreateAndFillNewDataSheet(grdFactorData, + Chr(34) & _ucrLinkedReceiver.GetDataName() & Chr(34), + strNewFactorVariableName, + _enumControlState, _bIncludeNALevel, + _hiddenColNames, _extraColNames, + _editableColNames) Then + _grdSheet = grdFactorData.CurrentWorksheet + 'show the reogrid + grdFactorData.Visible = True + RaiseEvent GridContentReFilledFromR() + OnControlValueChanged() End If - ApplyColumnSettings() End Sub - Public Function GetSelectedLevels() As String - Dim strTemp As String = "" - Dim i As Integer - Dim checked As Boolean - Dim iCount As Integer = 0 - Dim iLabelsCol As Integer - - If grdFactorData.CurrentWorksheet IsNot Nothing Then - iLabelsCol = GetColumnIndex(strLabelsName) - For i = 0 To grdFactorData.CurrentWorksheet.RowCount - 1 - If shtCurrSheet(i, iSelectorColumnIndex) IsNot Nothing Then - checked = DirectCast(shtCurrSheet(i, iSelectorColumnIndex), Boolean) - If checked Then - If iCount = 1 Then - strTemp = "c(" & strTemp & "," - ElseIf iCount > 1 Then - strTemp = strTemp & "," - End If - 'This checks if the value in the ordinal column is "-" which means it's the NA row - 'so no quotes should be added. - 'There could be a real factor level with the same label as (NA) so safer to check - 'the Ordinal column which will only have "-" for the (NA) row. - If shtCurrSheet(i, 0) = "-" Then - strTemp = strTemp & shtCurrSheet(i, iLabelsCol) - Else - strTemp = strTemp & Chr(34) & shtCurrSheet(i, iLabelsCol) & Chr(34) - End If - iCount = iCount + 1 - End If - End If + ''' + ''' clears all grid worksheets and resets the cached factor variable name + ''' also hides the grid + ''' + Private Sub ClearWorkSheetAndVariableName() + 'clear any worksheets from the grid + _grdSheet = Nothing + grdFactorData.Worksheets.Clear() + 'clear the cached varible name too. + 'An important step to do incase variable data type has been changed + strCurrFactorVariableName = "" + + + 'important + 'ucrFilter control implementation forced this line addition + 'for some reason when ucrFactor.Visible = True is called when + '_grdSheet = Nothing, then the reogrid throws a visbility error. + 'todo removal of this Visibility setting can removed once ucrFilter has been fully refactored + 'see issue #7408 comments + grdFactorData.Visible = False + End Sub + + ''' + ''' Creates a new worksheet add adds it to the grid control + ''' Fills the new worksheet with the factor variable metadata + ''' Applies the appropriate settings to the worksheet + ''' + ''' + ''' + ''' + ''' + ''' + ''' + ''' + ''' + ''' + Private Function CreateAndFillNewDataSheet(grdControl As unvell.ReoGrid.ReoGridControl, + strDataFrameName As String, + strFactorVariableName As String, + enumControlState As ControlStates, + bIncludeNALevel As Boolean, + hiddenColumnNames As IEnumerable(Of String), + extraColumnNames As IEnumerable(Of String), + editableColumnNames As IEnumerable(Of String)) As Boolean + + + 'get the factor metadata from R + Dim expDataFrame As SymbolicExpression + Dim clsConvertToCharFunction As New RFunction + Dim clsGetFactorDataFunction As New RFunction + + clsGetFactorDataFunction.SetRCommand(frmMain.clsRLink.strInstatDataObject & "$get_factor_data_frame") + clsGetFactorDataFunction.AddParameter("data_name", strDataFrameName) + clsGetFactorDataFunction.AddParameter("col_name", strFactorVariableName) + clsGetFactorDataFunction.AddParameter("include_NA_level", If(bIncludeNALevel, "TRUE", "FALSE")) + clsConvertToCharFunction.SetRCommand("convert_to_character_matrix") + clsConvertToCharFunction.AddParameter("data", clsRFunctionParameter:=clsGetFactorDataFunction) + expDataFrame = frmMain.clsRLink.RunInternalScriptGetValue(clsConvertToCharFunction.ToScript(), bSilent:=True) + + If expDataFrame Is Nothing OrElse expDataFrame.Type = Internals.SymbolicExpressionType.Null Then + Return False + End If + 'Below function will create a new worksheet and fill it with factor metadata from the data frame + frmMain.clsGrids.FillSheet(expDataFrame.AsDataFrame, "Factor Data", grdControl) + + grdControl.CurrentWorksheet.SetSettings(unvell.ReoGrid.WorksheetSettings.Edit_DragSelectionToMoveCells, False) + grdControl.CurrentWorksheet.SelectionForwardDirection = unvell.ReoGrid.SelectionForwardDirection.Down + grdControl.CurrentWorksheet.SetSettings(unvell.ReoGrid.WorksheetSettings.View_ShowRowHeader, False) + grdControl.CurrentWorksheet.SetSettings(unvell.ReoGrid.WorksheetSettings.Edit_DragSelectionToFillSerial, False) + 'set the ordinal column width size + grdControl.CurrentWorksheet.ColumnHeaders(0).Width = 30 + + 'create the extra columns and their default cell values + For Each strExtraColName As String In extraColumnNames + grdControl.CurrentWorksheet.AppendColumns(1) + grdControl.CurrentWorksheet.ColumnHeaders(grdControl.CurrentWorksheet.Columns - 1).Text = strExtraColName + 'create the cells by setting its value. + 'very important, without setting the value GetCell and cell value will be nothing + For iRowIndex As Integer = 0 To grdControl.CurrentWorksheet.Rows - 1 + grdControl.CurrentWorksheet(iRowIndex, grdControl.CurrentWorksheet.Columns - 1) = "" Next - If iCount > 1 Then - strTemp = strTemp & ")" + Next + + Select Case enumControlState + Case ControlStates.SingleSelectorGrid + 'add select level column with radiobutton as the cell body values + grdControl.CurrentWorksheet.AppendColumns(1) + grdControl.CurrentWorksheet.ColumnHeaders(grdControl.CurrentWorksheet.Columns - 1).Text = DefaultColumnNames.SelectorColumn + grdControl.CurrentWorksheet.ColumnHeaders(grdControl.CurrentWorksheet.Columns - 1).DefaultCellBody = GetType(unvell.ReoGrid.CellTypes.RadioButtonCell) + AddSelectorButtonCells(grdControl.CurrentWorksheet, grdControl.CurrentWorksheet.Columns - 1, True) + Case ControlStates.MultipleSelectorGrid + 'add select level column with checkbox as the cell body values + grdControl.CurrentWorksheet.AppendColumns(1) + grdControl.CurrentWorksheet.ColumnHeaders(grdControl.CurrentWorksheet.Columns - 1).Text = DefaultColumnNames.SelectorColumn + grdControl.CurrentWorksheet.ColumnHeaders(grdControl.CurrentWorksheet.Columns - 1).DefaultCellBody = GetType(unvell.ReoGrid.CellTypes.CheckBoxCell) + AddSelectorButtonCells(grdControl.CurrentWorksheet, grdControl.CurrentWorksheet.Columns - 1, False) + Case ControlStates.NormalGrid + 'do nothing + End Select + + 'hide columns not needed. The data frame had all default factor metadata columns + For iColIndex As Integer = 0 To grdControl.CurrentWorksheet.ColumnCount - 1 + If hiddenColumnNames.Contains(grdControl.CurrentWorksheet.ColumnHeaders(iColIndex).Text) Then + grdControl.CurrentWorksheet.HideColumns(iColIndex, 1) End If - End If - Return strTemp + Next + + ApplyUneditibleCellSettings(grdControl.CurrentWorksheet, editableColumnNames) + Return True End Function - Public Function IsAllSelected() As Boolean - If grdFactorData.CurrentWorksheet IsNot Nothing Then - For i = 0 To grdFactorData.CurrentWorksheet.RowCount - 1 - If shtCurrSheet(i, iSelectorColumnIndex) IsNot Nothing Then - If Not DirectCast(shtCurrSheet(i, iSelectorColumnIndex), Boolean) Then - Return False - End If - Else - Return False - End If - Next - Return True - Else - Return False + ''' + ''' used to add a new row in the grid + ''' note. calling this method when the control is in 'Selector' state will not add a new row + ''' + Public Sub AddNewRowInGrid() + 'if no sheet is set or control is used as a selector then adding new rows is not allowed + If _grdSheet Is Nothing OrElse Not _enumControlState = ControlStates.NormalGrid Then + Exit Sub End If - End Function - Private Sub shtcurrsheet_celldatachanged(sender As Object, e As CellEventArgs) Handles shtCurrSheet.CellDataChanged - Dim i As Integer - Dim iChecked As Boolean + 'add new row and set it's cells data format to text + _grdSheet.AppendRows(1) + _grdSheet.SetRangeDataFormat(_grdSheet.Rows - 1, 0, 1, _grdSheet.Columns, unvell.ReoGrid.DataFormat.CellDataFormatFlag.Text) + For iColIndex As Integer = 0 To _grdSheet.Columns - 1 + Select Case _grdSheet.ColumnHeaders(iColIndex).Text + Case DefaultColumnNames.Ordinal + _grdSheet(_grdSheet.Rows - 1, iColIndex) = _grdSheet.Rows + Case DefaultColumnNames.Freq + _grdSheet(_grdSheet.Rows - 1, iColIndex) = 0 + Case Else + _grdSheet(_grdSheet.Rows - 1, iColIndex) = "" + End Select + Next + + ApplyUneditibleCellSettings(_grdSheet, _editableColNames) + 'to update parameters and call parent dialog validations + OnControlValueChanged() + End Sub - If Not bDoNotUpdateCells Then - If e.Cell.Column = iSelectorColumnIndex AndAlso grdFactorData.Worksheets(0).SelectionRange.ContainsColumn(iSelectorColumnIndex) AndAlso grdFactorData.Worksheets(0).SelectionRange.Rows > 1 Then - iChecked = DirectCast(e.Cell.Data, Boolean) - bDoNotUpdateCells = True - For i = grdFactorData.Worksheets(0).SelectionRange.Row To grdFactorData.Worksheets(0).SelectionRange.Row + grdFactorData.Worksheets(0).SelectionRange.Rows - 1 - shtCurrSheet(i, iSelectorColumnIndex) = iChecked + Private Sub ApplyUneditibleCellSettings(grdSheet As unvell.ReoGrid.Worksheet, + editableColumnNames As IEnumerable(Of String)) + If editableColumnNames.Count = 0 Then + 'just set whole sheet as none editable. + 'note. the grid in 'selector' state will always be read only + grdSheet.SetSettings(unvell.ReoGrid.WorksheetSettings.Edit_Readonly, True) + Else + 'unfortunately we don't have a way of setting a whole column as read only. + 'so set the cells of the uneditable columns as read only + Dim bIsNotEditable As Boolean + grdSheet.SetSettings(unvell.ReoGrid.WorksheetSettings.Edit_Readonly, False) + For iColIndex As Integer = 0 To grdSheet.Columns - 1 + bIsNotEditable = Not editableColumnNames.Contains(grdSheet.ColumnHeaders(iColIndex).Text) + For iRowIndex As Integer = 0 To grdSheet.Rows - 1 + grdSheet.GetCell(iRowIndex, iColIndex).IsReadOnly = bIsNotEditable Next - bDoNotUpdateCells = False - End If - UpdateCells(e.Cell.Column) + Next End If End Sub - Private Sub UpdateCells(Optional iColumn As Integer = -2) - Dim i As Integer - Dim iSelected As Boolean - If iColumn = iSelectorColumnIndex Then - For i = 0 To grdFactorData.CurrentWorksheet.RowCount - 1 - If shtCurrSheet(i, iSelectorColumnIndex) IsNot Nothing Then - iSelected = DirectCast(shtCurrSheet(i, iSelectorColumnIndex), Boolean) - If iSelected Then - shtCurrSheet.RowHeaders(i).Style.BackColor = Color.Gold - Else - shtCurrSheet.RowHeaders(i).Style.BackColor = Color.White - End If - End If + Private Sub AddSelectorButtonCells(grdSheet As unvell.ReoGrid.Worksheet, + iSelectorColIndex As Integer, + bSingleSelection As Boolean) + + If bSingleSelection Then + Dim radioButtonGroup As New unvell.ReoGrid.CellTypes.RadioButtonGroup + For iRowIndex As Integer = 0 To grdSheet.Rows - 1 + 'create the cell first by setting its value + grdSheet(iRowIndex, iSelectorColIndex) = False + 'then set the body to be a radio button + Dim radioButtonCell As New unvell.ReoGrid.CellTypes.RadioButtonCell + 'setting radio button group ensures that only 1 radio button is selectable + radioButtonCell.RadioGroup = radioButtonGroup + grdSheet.GetCell(iRowIndex, iSelectorColIndex).Body = radioButtonCell + 'attach the event handler to the cell body + AddHandler radioButtonCell.Click, Sub() + 'this will raise ControlContentsChanged event + 'and also update parameter and R code with the values + OnControlValueChanged() + End Sub + Next - RaiseEvent SelectedLevelChanged() Else - RaiseEvent GridContentChanged() + For iRowIndex As Integer = 0 To grdSheet.Rows - 1 + 'create the cell first by setting its value + grdSheet(iRowIndex, iSelectorColIndex) = False + 'then cet the body to be a check box + Dim checkBoxCell As New unvell.ReoGrid.CellTypes.CheckBoxCell + grdSheet.GetCell(iRowIndex, iSelectorColIndex).Body = checkBoxCell + 'attach the event handler to the cell body + AddHandler checkBoxCell.Click, Sub() + 'this will raise ControlContentsChanged event + 'and also update parameter and R code with the values + OnControlValueChanged() + End Sub + Next End If End Sub - Public Function GetColumnInFactorSheet(iColumn As Integer, Optional bWithQuotes As Boolean = True) As String - Dim strTemp As String = "" - If shtCurrSheet IsNot Nothing Then - If shtCurrSheet.RowCount = 1 Then - If bWithQuotes Then - strTemp = Chr(34) & shtCurrSheet(0, iColumn).ToString & Chr(34) - Else - strTemp = shtCurrSheet(0, iColumn).ToString - End If - ElseIf shtCurrSheet.RowCount > 1 Then - strTemp = "c(" - For i = 0 To shtCurrSheet.RowCount - 1 - If i > 0 Then - strTemp = strTemp & "," - End If - If shtCurrSheet(i, iColumn) IsNot Nothing Then - If bWithQuotes Then - strTemp = strTemp & Chr(34) & shtCurrSheet(i, iColumn).ToString & Chr(34) - Else - strTemp = strTemp & shtCurrSheet(i, iColumn).ToString - End If - End If - Next - strTemp = strTemp & ")" - End If - End If + ''' + ''' checks if all values in the list of columns are not empty. + ''' column names must exist in the grid + ''' + ''' + ''' true if all values are not empty and false otherwise + Public Function IsColumnComplete(colNames As IEnumerable(Of String)) As Boolean - Return strTemp - End Function - - Public Function GetColumnInFactorSheet(strColumn As String, Optional bWithQuotes As Boolean = True) As String - Dim i As Integer - Dim iCol As Integer = -1 - Dim strTemp As String = "" + If _grdSheet Is Nothing Then + Return False + End If - If shtCurrSheet IsNot Nothing Then - For i = 0 To shtCurrSheet.ColumnCount - 1 - If shtCurrSheet.ColumnHeaders(i).Text = strColumn Then - iCol = i - Exit For + For Each strColName As String In colNames + Dim iColIndex As Integer = GetColumnIndex(_grdSheet, strColName) + For iRowIndex As Integer = 0 To _grdSheet.Rows - 1 + If _grdSheet(iRowIndex, iColIndex).ToString() = "" Then + Return False End If Next - If iCol <> -1 Then strTemp = GetColumnInFactorSheet(iCol, bWithQuotes) - End If - Return strTemp + Next + Return True End Function - Public Function GetColumnAsList(iColumn As Integer, Optional bWithQuotes As Boolean = True) As List(Of String) - Dim strTemp As New List(Of String) + ''' + ''' gets the row count of the grid. + ''' + ''' row count of the grid. If the grid sheet has not been set, returns 0 + Public ReadOnly Property RowCount() As Integer + Get + Return If(_grdSheet Is Nothing, 0, _grdSheet.Rows) + End Get + End Property + + ''' + ''' gets the grid sheet + ''' + ''' + Public ReadOnly Property GridSheet() As unvell.ReoGrid.Worksheet + Get + Return _grdSheet + End Get + End Property + + ''' + ''' returns the column index of the column name passed from the grid sheet + ''' + ''' + ''' return -1 if column index not found + Public Function GetColumnIndex(strColName As String) As Integer + Return If(_grdSheet Is Nothing, -1, GetColumnIndex(_grdSheet, strColName)) + End Function - If shtCurrSheet IsNot Nothing Then - If iColumn >= shtCurrSheet.ColumnCount OrElse iColumn < 0 Then - MsgBox("Developer error: Cannot get column at index: " & iColumn & " index out of bounds") - Else - For i = 0 To shtCurrSheet.RowCount - 1 - If shtCurrSheet(i, iColumn) IsNot Nothing Then - If bWithQuotes Then - strTemp.Add(Chr(34) & shtCurrSheet(i, iColumn).ToString & Chr(34)) - Else - strTemp.Add(shtCurrSheet(i, iColumn).ToString) - End If - Else - strTemp.Add(Nothing) - End If - Next + Private Function GetColumnIndex(grdSheet As unvell.ReoGrid.Worksheet, strColName As String) As Integer + For i As Integer = 0 To grdSheet.Columns - 1 + If grdSheet.ColumnHeaders(i).Text = strColName Then + Return i End If - End If - Return strTemp + Next + Return -1 End Function - Public Function GetColumnAsList(strColumn As String, Optional bWithQuotes As Boolean = True) As List(Of String) - Dim iColumn As Integer + ''' + ''' gets cell values of the requested column from the selected or checked rows + ''' the column name must exist in the grid + ''' + ''' column name of the cell values + ''' Add double quotes for R or not + ''' cell values from selected rows of the column requested. + ''' If no rows selected an empty list is returned + Public Function GetSelectedCellValues(strValueColName As String, + bWithQuotes As Boolean) As List(Of String) + + If _grdSheet Is Nothing Then + Return New List(Of String) + End If - iColumn = GetColumnIndex(strColumn) - Return GetColumnAsList(iColumn, bWithQuotes) + Return GetSelectedCellValues(_grdSheet, + GetColumnIndex(_grdSheet, DefaultColumnNames.Ordinal), + GetColumnIndex(_grdSheet, DefaultColumnNames.SelectorColumn), + GetColumnIndex(_grdSheet, strValueColName), + bWithQuotes) End Function - Public Sub SetSelectionAllLevels(bSelect As Boolean) - Dim i As Integer - If iSelectorColumnIndex <> -1 AndAlso bIsMultipleSelector = True Then - For i = 0 To shtCurrSheet.RowCount - 1 - shtCurrSheet(i, iSelectorColumnIndex) = bSelect - Next - End If - End Sub + 'used internally + Private Function GetSelectedCellValues(grdSheet As unvell.ReoGrid.Worksheet, + iOrdinalColIndex As Integer, + iSelectedColIndex As Integer, + iValueColIndex As Integer, + bWithQuotes As Boolean) As List(Of String) - Public Sub SetColumn(strValues As String(), iColumnIndex As Integer, Optional bSilent As Boolean = True) - Dim i As Integer - If shtCurrSheet IsNot Nothing Then - If strValues.Count <> shtCurrSheet.RowCount Then - If Not bSilent Then - MsgBox("Developer error: Cannot set value of control " & Name & " because the list of values does not match the number of levels.") - End If - ElseIf iColumnIndex < 0 OrElse iColumnIndex >= shtCurrSheet.ColumnCount Then - If Not bSilent Then - MsgBox("Developer error: Cannot set value of control " & Name & " because there is no column at index " & iColumnIndex & " in the grid.") - End If + Dim lstCellValues As New List(Of String) + + For iRowIndex As Integer = 0 To grdSheet.Rows - 1 + If Not DirectCast(grdSheet(iRowIndex, iSelectedColIndex), Boolean) Then + Continue For + End If + + + 'This checks if the value in the ordinal column is "-" which means it's the NA row + 'so no quotes should be added. + 'There could be a real factor level with the same label as (NA) so safer to check + 'the ordinal column which will only have "-" for the (NA) row. + If grdSheet(iRowIndex, iOrdinalColIndex) = "-" Then + lstCellValues.Add(grdSheet(iRowIndex, iValueColIndex)) + ElseIf bWithQuotes Then + lstCellValues.Add(Chr(34) & grdSheet(iRowIndex, iValueColIndex) & Chr(34)) Else - For i = 0 To shtCurrSheet.RowCount - 1 - shtCurrSheet(i, iColumnIndex) = strValues(i) - Next + lstCellValues.Add(grdSheet(iRowIndex, iValueColIndex)) End If - End If - End Sub - Private Sub grdFactorData_VisibleChanged(sender As Object, e As EventArgs) Handles grdFactorData.VisibleChanged - RaiseEvent GridVisibleChanged() - End Sub + Next + + Return lstCellValues + End Function - Private Sub grdFactorData_Leave(sender As Object, e As EventArgs) Handles grdFactorData.Leave - If shtCurrSheet IsNot Nothing AndAlso shtCurrSheet.IsEditing Then - shtCurrSheet.EndEdit(unvell.ReoGrid.EndEditReason.NormalFinish) + + ''' + ''' gets cell values of the requested column from the grid rows + ''' the column name must exist in the grid. + ''' + ''' column name of the cell values + ''' Add double quotes for R or not + ''' cell values from selected rows of the column requested. + ''' If no rows selected an empty list is returned + Public Function GetCellValues(strValueColName As String, bWithQuotes As Boolean) As List(Of String) + 'todo. validation of grid and columns. used externally + If _grdSheet Is Nothing Then + Return New List(Of String) End If - End Sub - Public Function IsColumnComplete(strColumn As String) As Boolean - Dim iColumn As Integer = -1 + Return GetCellValues(_grdSheet, GetColumnIndex(_grdSheet, strValueColName), bWithQuotes) + End Function - If shtCurrSheet IsNot Nothing Then - iColumn = GetColumnIndex(strColumn) - If iColumn = -1 Then - MsgBox("No column called " & strColumn & " to select in grid.", MsgBoxStyle.Critical, "Cannot select column.") - Return False + Private Function GetCellValues(grdSheet As unvell.ReoGrid.Worksheet, + iValueColIndex As Integer, bWithQuotes As Boolean) As List(Of String) + Dim lstCellValues As New List(Of String) + For i = 0 To grdSheet.RowCount - 1 + If bWithQuotes Then + lstCellValues.Add(Chr(34) & grdSheet(i, iValueColIndex) & Chr(34)) Else - For i As Integer = 0 To shtCurrSheet.RowCount - 1 - If shtCurrSheet(i, iColumn) Is Nothing OrElse shtCurrSheet(i, iColumn).ToString() = "" Then - Return False - End If - Next - Return True + lstCellValues.Add(grdSheet(i, iValueColIndex)) End If - Else + Next + Return lstCellValues + End Function + + ''' + ''' Checks if all rows are 'selected or checked' + ''' Note. Should be used in 'MultipleSelector or SingleSelector' state only + ''' + ''' true if any row is 'selected', false otherwise + Public Function IsAnyGridRowSelected() As Boolean + 'only multiple select state supports this + If _grdSheet Is Nothing OrElse _enumControlState = ControlStates.NormalGrid Then Return False End If - End Function - Private Sub shtCurrSheet_RangeDataChanged(sender As Object, e As RangeEventArgs) Handles shtCurrSheet.RangeDataChanged - UpdateCells(e.Range.Col) - End Sub + Dim iSelectorColumnIndex As Integer = GetColumnIndex(_grdSheet, DefaultColumnNames.SelectorColumn) + For i = 0 To _grdSheet.Rows - 1 + If DirectCast(_grdSheet(i, iSelectorColumnIndex), Boolean) Then + Return True + End If + Next + Return False + End Function - Private Sub shtCurrSheet_BeforeCellKeyDown(sender As Object, e As BeforeCellKeyDownEventArgs) Handles shtCurrSheet.BeforeCellKeyDown - If e.KeyCode = unvell.ReoGrid.Interaction.KeyCode.Delete OrElse e.KeyCode = unvell.ReoGrid.Interaction.KeyCode.Back Then - MsgBox("Deleting cells is currently disabled. This feature will be included in future versions." & Environment.NewLine & "To remove a cell's value, replace the value with NA.", MsgBoxStyle.Information, "Cannot delete cells.") - e.IsCancelled = True + ''' + ''' Checks if all rows are 'selected or checked' + ''' Note. Should be used in 'MultipleSelector' state only + ''' + ''' true if all rows are 'selected', false otherwise + Public Function IsAllGridRowsSelected() As Boolean + 'only multiple select state supports this + If _grdSheet Is Nothing OrElse Not _enumControlState = ControlStates.MultipleSelectorGrid Then + Return False End If - End Sub - - Private Sub shtCurrSheet_BeforeCut(sender As Object, e As BeforeRangeOperationEventArgs) Handles shtCurrSheet.BeforeCut - e.IsCancelled = True - End Sub - Public Overrides Sub UpdateParameter(clsTempParam As RParameter) - If clsTempParam IsNot Nothing Then - If bIsSelector Then - clsTempParam.SetArgumentValue(GetSelectedLevels()) - ElseIf bIsGridColumn Then - If IsColumnComplete(strColumnToGet) Then - clsTempParam.SetArgumentValue(GetColumnInFactorSheet(strColumn:=strColumnToGet)) - End If + Dim iSelectorColumnIndex As Integer = GetColumnIndex(_grdSheet, DefaultColumnNames.SelectorColumn) + For iRowIndex = 0 To _grdSheet.Rows - 1 + If Not DirectCast(_grdSheet(iRowIndex, iSelectorColumnIndex), Boolean) Then + Return False End If + Next + Return True + End Function + + ''' + ''' Checks or unchecks all rows in the grid + ''' Note. Should be used in 'MultipleSelector' or 'SingleSelctor' state only + ''' + ''' + ''' if set to true, will raise ConroValueChanged of this control + Public Sub SelectAllGridRows(bChecked As Boolean, Optional bRaisedControlValueChangedEvent As Boolean = True) + 'only multiple select state supports this + If _grdSheet Is Nothing OrElse Not _enumControlState = ControlStates.MultipleSelectorGrid Then + Exit Sub End If - End Sub - Protected Overrides Sub SetControlValue() - Dim lstCurrentValues As String() = Nothing - Dim clsTempParameter As RParameter - - clsTempParameter = GetParameter() - If clsTempParameter IsNot Nothing AndAlso clsTempParameter.bIsString Then - lstCurrentValues = ExtractItemsFromRList(clsTempParameter.strArgumentValue) - If bIsSelector Then - strSelectedLevels = lstCurrentValues - RefreshFactorData() - ElseIf bIsGridColumn Then - RefreshFactorData() - SetColumn(lstCurrentValues, GetColumnIndex(strColumnToGet)) + Dim iCheckedColIndex As Integer = GetColumnIndex(_grdSheet, DefaultColumnNames.SelectorColumn) + Dim bChangeDetected As Boolean = False + For iRowIndex As Integer = 0 To _grdSheet.Rows - 1 + If _grdSheet(iRowIndex, iCheckedColIndex) <> bChecked Then + bChangeDetected = True + Else + _grdSheet(iRowIndex, iCheckedColIndex) = bChecked End If + Next + 'only raise control value changed if a change was detected + If bChangeDetected AndAlso bRaisedControlValueChangedEvent Then + OnControlValueChanged() End If End Sub - Private Sub ucrFactor_GridContentChanged() Handles Me.GridContentChanged, Me.SelectedLevelChanged - OnControlValueChanged() - End Sub - Private Sub shtCurrSheet_AfterCellEdit(sender As Object, e As CellAfterEditEventArgs) Handles shtCurrSheet.AfterCellEdit - If shtCurrSheet.ColumnHeaders(e.Cell.Column).Text = strLevelsName AndAlso e.NewData.ToString() <> "" Then - If Not IsNumeric(e.NewData) Then - MsgBox("Invalid value: " & e.NewData.ToString() & Environment.NewLine & "Levels must be numeric values.", MsgBoxStyle.Exclamation, "Invalid Value") - e.EndReason = EndEditReason.Cancel - End If - End If - End Sub + 'used internally when reading data from parameter + Private Sub SetSelectedRows(grdSheet As unvell.ReoGrid.Worksheet, + iSelectedColIndex As Integer, + iValueColIndex As Integer, + cellValues As IEnumerable(Of String), + bRaisedControlValueChangedEvent As Boolean) - Public Function GetColumnIndex(strColumn As String) As Integer - If shtCurrSheet IsNot Nothing Then - For i As Integer = 0 To shtCurrSheet.ColumnCount - 1 - If shtCurrSheet.ColumnHeaders(i).Text = strColumn Then - Return i + 'reset all selection + For iRowIndex As Integer = 0 To grdSheet.Rows - 1 + grdSheet(iRowIndex, iSelectedColIndex) = False + Next + + 'then set the selected rows + For iValueIndex As Integer = 0 To cellValues.Count - 1 + For iRowIndex As Integer = 0 To grdSheet.Rows - 1 + If cellValues(iValueIndex) = grdSheet(iRowIndex, iValueColIndex) Then + grdSheet(iRowIndex, iSelectedColIndex) = True End If Next + Next + + If bRaisedControlValueChangedEvent Then + OnControlValueChanged() + End If + End Sub + + ''' + ''' sets all the cell values of the column name passed + ''' the column must exist and the cell values count = grid row count + ''' + ''' column name + ''' cell values to be set + ''' if set to true, will raise ConroValueChanged of this control + ''' if true, a developer message box will be displayed, false otherwise + Public Sub SetCellValues(strValueColName As String, cellValues As IEnumerable(Of String), + Optional bRaisedControlValueChangedEvent As Boolean = True, + Optional bSilent As Boolean = False) + + If _grdSheet Is Nothing Then + Exit Sub End If - Return -1 - End Function - 'These checks should be done by reogrid control: https://reogrid.net/document/cell-edit/ - '"paste operation will also be aborted if target range including any read-only cells" - Private Sub shtCurrSheet_BeforePaste(sender As Object, e As BeforeRangeOperationEventArgs) Handles shtCurrSheet.BeforePaste - For i As Integer = e.Range.Col To e.Range.EndCol - If shtCurrSheet.Cells(0, i).IsReadOnly Then - e.IsCancelled = True + Dim iValueColIndex As Integer = GetColumnIndex(_grdSheet, strValueColName) + 'to enforce developers use this control correctly do the following checks + If iValueColIndex < 0 Then + If Not bSilent Then + MsgBox("Developer error: Cannot set value of control " & Name & " because there is no column at index " & iValueColIndex & " in the grid.") End If - Next - End Sub + Exit Sub + End If - Private Sub shtCurrSheet_AfterPaste(sender As Object, e As RangeEventArgs) Handles shtCurrSheet.AfterPaste - 'This is needed because pasting carries cell properties e.g. overrides readonly properties - ApplyColumnSettings() + If cellValues.Count <> _grdSheet.Rows Then + If Not bSilent Then + MsgBox("Developer error: Cannot set value of control " & Name & " because the list of values does not match the number of rows in the grid.") + End If + Exit Sub + End If + + SetCellValues(_grdSheet, iValueColIndex, cellValues, bRaisedControlValueChangedEvent) End Sub - Public Sub SetLevelsCheckbox(ucrChkAddLevels As ucrCheck) - ucrChkLevels = ucrChkAddLevels - If clsReceiver IsNot Nothing Then - ucrChkLevels.Enabled = Not clsReceiver.IsEmpty + 'used internally + Private Sub SetCellValues(grdSheet As unvell.ReoGrid.Worksheet, iValueColIndex As Integer, cellValues As IEnumerable(Of String), bRaisedControlValueChangedEvent As Boolean) + For iRowIndex As Integer = 0 To grdSheet.RowCount - 1 + grdSheet(iRowIndex, iValueColIndex) = cellValues(iRowIndex) + Next + If bRaisedControlValueChangedEvent Then + OnControlValueChanged() End If End Sub - Private Sub ucrChkLevels_ControlValueChanged(ucrChangedControl As ucrCore) Handles ucrChkLevels.ControlValueChanged - Dim iLevelsCol As Integer + ''' + ''' by default this is always called when subroutine OnControlValueChanged + ''' of this control is called + ''' + ''' + Public Overrides Sub UpdateParameter(clsTempParam As RParameter) - If shtCurrSheet IsNot Nothing Then - iLevelsCol = GetColumnIndex(strLevelsName) - If iLevelsCol <> -1 Then - If ucrChkLevels.Checked Then - shtCurrSheet.ShowColumns(iLevelsCol, 1) - Else - shtCurrSheet.HideColumns(iLevelsCol, 1) - End If - End If + If clsTempParam Is Nothing OrElse _grdSheet Is Nothing Then + Exit Sub End If + + Dim strColName As String = _dctParamAndColNames.Item(clsTempParam.strArgumentName) + Dim iValueColIndex As Integer = GetColumnIndex(_grdSheet, strColName) + Dim strRValue As String = "" + Select Case _enumControlState + Case ControlStates.SingleSelectorGrid, ControlStates.MultipleSelectorGrid + Dim iOrdinalColIndex As Integer = GetColumnIndex(_grdSheet, DefaultColumnNames.Ordinal) + Dim iSelectorColIndex As Integer = GetColumnIndex(_grdSheet, DefaultColumnNames.SelectorColumn) + strRValue = mdlCoreControl.GetRVector(GetSelectedCellValues(_grdSheet, + iOrdinalColIndex, iSelectorColIndex, iValueColIndex, True), + bOnlyIfMultipleElement:=(_enumControlState = ControlStates.SingleSelectorGrid)) + + Case ControlStates.NormalGrid + strRValue = mdlCoreControl.GetRVector(GetCellValues(_grdSheet, iValueColIndex, True)) + End Select + + clsTempParam.SetArgumentValue(strRValue) End Sub - Private Sub clsReceiver_ControlValueChanged(ucrChangedControl As ucrCore) Handles clsReceiver.ControlValueChanged - If ucrChkLevels IsNot Nothing AndAlso clsReceiver.IsEmpty Then - ucrChkLevels.Enabled = False + ''' + ''' called at ucrCore level when a dialog calls SetRCode for this control. + ''' this sets the control values from it's parameter objects + ''' + Protected Overrides Sub SetControlValue() + Dim clsTempParam As RParameter = GetParameter() + If clsTempParam Is Nothing OrElse Not clsTempParam.bIsString OrElse _grdSheet Is Nothing Then + Exit Sub End If - End Sub - Public Sub SetIncludeLevels(bInclude As Boolean) - bIncludeLevels = bInclude - RefreshFactorData() + Dim arrCellValues As String() = mdlCoreControl.ExtractItemsFromRList(clsTempParam.strArgumentValue) + Dim strColName As String = _dctParamAndColNames.Item(clsTempParam.strArgumentName) + Dim iValueColIndex As Integer = GetColumnIndex(_grdSheet, strColName) + + Select Case _enumControlState + Case ControlStates.SingleSelectorGrid, ControlStates.MultipleSelectorGrid + Dim iSelectorColIndex As Integer = GetColumnIndex(_grdSheet, DefaultColumnNames.SelectorColumn) + SetSelectedRows(_grdSheet, iSelectorColIndex, iValueColIndex, arrCellValues, False) + Case ControlStates.NormalGrid + If arrCellValues.Count <> _grdSheet.Rows Then + MsgBox("Developer error: Cannot set value of control " & Name & " because the list of values does not match the number of rows in the grid. check SetControl()") + Exit Sub + End If + SetCellValues(_grdSheet, iValueColIndex, arrCellValues, False) + End Select End Sub + End Class \ No newline at end of file diff --git a/instat/ucrFilePath.vb b/instat/ucrFilePath.vb index f666d0e9ac4..366b837e042 100644 --- a/instat/ucrFilePath.vb +++ b/instat/ucrFilePath.vb @@ -14,6 +14,7 @@ ' You should have received a copy of the GNU General Public License ' along with this program. If not, see . +Imports System.ComponentModel Imports System.IO Imports instat.Translations @@ -53,8 +54,8 @@ Public Class ucrFilePath Get Return btnBrowse.Text End Get - Set(ByVal value As String) - btnBrowse.Text = GetTranslation(value) + Set(value As String) + btnBrowse.Text = If(DesignMode, value, GetTranslation(value)) End Set End Property @@ -71,8 +72,8 @@ Public Class ucrFilePath Get Return lblName.Text End Get - Set(ByVal value As String) - lblName.Text = GetTranslation(value) + Set(value As String) + lblName.Text = If(DesignMode, value, GetTranslation(value)) End Set End Property @@ -82,17 +83,36 @@ Public Class ucrFilePath Public Property FilePathDialogTitle As String = "Save As" ''' - ''' used to set the allowed file filters or file extensions + ''' Used to set the allowed file filters or file extensions + ''' Format example; Excel files|*.xls;*.xlsx|R Data Structure files|*.RDS + ''' Note. this should be set before setting FilePath property. + ''' the first file filter or extension set here overwrites the set FilePath extension ''' Public Property FilePathDialogFilter As String Get Return strFilePathDialogFilter End Get - Set(ByVal value As String) + Set(value As String) strFilePathDialogFilter = value - 'reset the filter index(start index is 1). + 'reset the filter index(start index is based on 1). 'its safer To, just incase number of filters set are different from previously set SelectedFileFilterIndex = 1 + + If String.IsNullOrEmpty(strFilePathDialogFilter) OrElse FolderBrowse OrElse String.IsNullOrEmpty(FilePath) Then + Exit Property + End If + + 'for file browse, if file path name was already set, + 'change the extension set to use the new one. + 'get the new file extension from the list of filter names in strFilePathDialogFilter + 'for instance if strFilePathDialogFilter is + 'Excel files|*.xls;*.xlsx|R Data Structure files|*.RDS + 'the new file path will have .xls as its extension + Dim arrStr() As String = strFilePathDialogFilter.Split({"|"}, StringSplitOptions.RemoveEmptyEntries) + arrStr = arrStr(1).Split({";"}, StringSplitOptions.RemoveEmptyEntries) + FilePath = Path.GetDirectoryName(FilePath) & "\" & + Path.GetFileNameWithoutExtension(FilePath) & arrStr(0).Substring(1) + End Set End Property @@ -104,11 +124,21 @@ Public Class ucrFilePath Public Property SelectedFileFilterIndex As Integer ''' - ''' used to set the suggested name if no file name was set before + ''' used to set the suggested name if no file name was set before by the user + ''' Note. The name should not have a file extension ''' ''' Public Property DefaultFileSuggestionName As String = "" + ''' + ''' holds last user set file name, without the path and extension + ''' value is set when the user browses the file system + ''' + ''' + + Private Property UserSetFilePathName As String = "" + + ''' ''' gets or sets the input file path used by the FolderBrowseDialog or SaveFileDialog prompt ''' also sets PreviousSelectedWindowsFilePath to 'remember' the last selected file name and directory @@ -117,28 +147,54 @@ Public Class ucrFilePath Get Return PathControl().GetText() End Get - Set(ByVal value As String) + Set(value As String) 'first replace backward slashed with forward slashes cause of R path formats PathControl().SetName(value.Replace("\", "/")) - If value <> "" Then - 'to be safe, always replace the forward slashes with back slashes. values will be used by vb.net sialog prompts - PreviousSelectedWindowsFilePath = value.Replace("/", "\") - End If RaiseEvent FilePathChanged() End Set End Property ''' - ''' gets or sets the previously set path. This is never cleared when sub clear() is called. - ''' its used internally to set initial directories of the folder or save dialogs prompts even when path was extenally cleared - ''' the path will always be in windows backslash convention format i.e uses "\" instead of "/" - ''' - Private Property PreviousSelectedWindowsFilePath As String = "" + ''' gets the file path directory. if file path is directory, + ''' then the last directory will also be included + ''' + ''' + + Public ReadOnly Property FilePathDirectory() As String + Get + If IsEmpty() Then + Return "" + Else + 'check for extension to determine if its a directory + 'GetDirectoryName omits the last directory + 'yet here we need it as path of the directory path + If String.IsNullOrEmpty(Path.GetExtension(FilePath)) Then + Return FilePath + Else + Return Path.GetDirectoryName(FilePath) + End If + End If + End Get + End Property + + + Public ReadOnly Property SuggestionNameWithoutExtension() As String + Get + If Not String.IsNullOrEmpty(UserSetFilePathName) Then + Return Path.GetFileNameWithoutExtension(UserSetFilePathName) + ElseIf Not String.IsNullOrEmpty(DefaultFileSuggestionName) Then + Return DefaultFileSuggestionName + Else + Return "" + End If + End Get + End Property ''' ''' gets the control that contains the input file path and name ''' - ''' ucrInputTextBox + ''' ucrInputTextBox + Public ReadOnly Property PathControl() As ucrInputTextBox Get Return ucrInputFilePath @@ -194,11 +250,10 @@ Public Class ucrFilePath Private Sub btnBrowse_Click(sender As Object, e As EventArgs) Handles btnBrowse.Click If FolderBrowse Then Using dlgFolderBrowse As New FolderBrowserDialog - If String.IsNullOrEmpty(PreviousSelectedWindowsFilePath) Then + If IsEmpty() Then dlgFolderBrowse.SelectedPath = frmMain.clsInstatOptions.strWorkingDirectory Else - 'use the file path in windows backslash convention format - dlgFolderBrowse.SelectedPath = Path.GetDirectoryName(PreviousSelectedWindowsFilePath) + dlgFolderBrowse.SelectedPath = FilePathDirectory 'Path.GetDirectoryName(FilePath) End If If DialogResult.OK = dlgFolderBrowse.ShowDialog() Then FilePath = dlgFolderBrowse.SelectedPath @@ -210,31 +265,31 @@ Public Class ucrFilePath Using dlgSaveFile As New SaveFileDialog dlgSaveFile.Title = FilePathDialogTitle dlgSaveFile.Filter = FilePathDialogFilter - If String.IsNullOrEmpty(PreviousSelectedWindowsFilePath) Then - dlgSaveFile.FileName = DefaultFileSuggestionName + If IsEmpty() Then + dlgSaveFile.FileName = SuggestionNameWithoutExtension() dlgSaveFile.InitialDirectory = frmMain.clsInstatOptions.strWorkingDirectory Else 'if there is no current file path and there is a default suggested name, then use the default suggestion 'else check if previous selected path has an extension to determine if the previous path included a file name and use it 'else leave the FileName as empty(it's the default) - If IsEmpty() AndAlso Not String.IsNullOrEmpty(DefaultFileSuggestionName) Then - dlgSaveFile.FileName = DefaultFileSuggestionName - ElseIf Not String.IsNullOrEmpty(Path.GetExtension(PreviousSelectedWindowsFilePath)) Then - dlgSaveFile.FileName = Path.GetFileNameWithoutExtension(PreviousSelectedWindowsFilePath) + If Not String.IsNullOrEmpty(Path.GetExtension(FilePath)) Then + dlgSaveFile.FileName = Path.GetFileNameWithoutExtension(FilePath) + ElseIf Not String.IsNullOrEmpty(SuggestionNameWithoutExtension()) Then + dlgSaveFile.FileName = SuggestionNameWithoutExtension() End If - - dlgSaveFile.InitialDirectory = Path.GetDirectoryName(PreviousSelectedWindowsFilePath) + dlgSaveFile.InitialDirectory = Path.GetDirectoryName(FilePath) dlgSaveFile.FilterIndex = SelectedFileFilterIndex - End If If DialogResult.OK = dlgSaveFile.ShowDialog() Then FilePath = dlgSaveFile.FileName SelectedFileFilterIndex = dlgSaveFile.FilterIndex + UserSetFilePathName = dlgSaveFile.FileName End If End Using End If End Sub + Private Sub ucrInputFilePath_Click(sender As Object, e As EventArgs) Handles ucrInputFilePath.Click btnBrowse.PerformClick() End Sub diff --git a/instat/ucrFilter.Designer.vb b/instat/ucrFilter.Designer.vb index 59f51eea331..98438d08284 100644 --- a/instat/ucrFilter.Designer.vb +++ b/instat/ucrFilter.Designer.vb @@ -70,13 +70,13 @@ Partial Class ucrFilter Me.cmd1 = New System.Windows.Forms.Button() Me.cmdCombineWithAndOr = New System.Windows.Forms.Button() Me.ttpCombineWithAndOr = New System.Windows.Forms.ToolTip(Me.components) + Me.ucrFactorLevels = New instat.ucrFactor() Me.ucrReceiverExpression = New instat.ucrReceiverExpression() Me.ucrLogicalCombobox = New instat.ucrInputComboBox() Me.ucrDatePicker = New instat.ucrDateTimePicker() Me.ucrInputFilterName = New instat.ucrInputComboBox() Me.ucrFilterPreview = New instat.ucrInputTextBox() Me.ucrFilterOperation = New instat.ucrInputComboBox() - Me.ucrFactorLevels = New instat.ucrFactor() Me.ucrFilterByReceiver = New instat.ucrReceiverSingle() Me.ucrSelectorForFitler = New instat.ucrSelectorByDataFrameAddRemove() Me.ucrChkNotForAllConditions = New instat.ucrCheck() @@ -513,14 +513,11 @@ Partial Class ucrFilter ' Me.ucrFactorLevels.AutoSize = True Me.ucrFactorLevels.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle - Me.ucrFactorLevels.clsReceiver = Nothing Me.ucrFactorLevels.Location = New System.Drawing.Point(398, 65) Me.ucrFactorLevels.Margin = New System.Windows.Forms.Padding(5) Me.ucrFactorLevels.Name = "ucrFactorLevels" - Me.ucrFactorLevels.shtCurrSheet = Nothing Me.ucrFactorLevels.Size = New System.Drawing.Size(354, 262) Me.ucrFactorLevels.TabIndex = 2 - Me.ucrFactorLevels.ucrChkLevels = Nothing ' 'ucrFilterByReceiver ' @@ -571,6 +568,7 @@ Partial Class ucrFilter Me.AutoScaleDimensions = New System.Drawing.SizeF(96.0!, 96.0!) Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi Me.AutoSize = True + Me.Controls.Add(Me.ucrFactorLevels) Me.Controls.Add(Me.cmdCombineWithAndOr) Me.Controls.Add(Me.grpNumeric) Me.Controls.Add(Me.ucrLogicalCombobox) @@ -587,7 +585,6 @@ Partial Class ucrFilter Me.Controls.Add(Me.ucrFilterOperation) Me.Controls.Add(Me.cmdAddCondition) Me.Controls.Add(Me.lblSelectLevels) - Me.Controls.Add(Me.ucrFactorLevels) Me.Controls.Add(Me.ucrFilterByReceiver) Me.Controls.Add(Me.ucrSelectorForFitler) Me.Controls.Add(Me.ucrChkNotForAllConditions) diff --git a/instat/ucrFilter.vb b/instat/ucrFilter.vb index 489aa594e17..7525433c7dc 100644 --- a/instat/ucrFilter.vb +++ b/instat/ucrFilter.vb @@ -64,10 +64,11 @@ Public Class ucrFilter ucrFilterByReceiver.Selector = ucrSelectorForFitler ucrFilterOperation.SetItems({"==", "<", "<=", ">", ">=", "!=", "is.na", "! is.na"}) ucrFilterOperation.SetDropDownStyleAsNonEditable() - ucrFactorLevels.SetAsMultipleSelector() - ucrFactorLevels.SetReceiver(ucrFilterByReceiver) - ucrFactorLevels.SetIncludeLevels(False) - ucrFactorLevels.bIncludeNA = True + + ucrFactorLevels.SetAsMultipleSelectorGrid(ucrFilterByReceiver, + hiddenColNames:={ucrFactor.DefaultColumnNames.Level}, + bIncludeNALevel:=True) + clsFilterOperator.bForceIncludeOperation = False lstFilters.Columns.Add("Variable") lstFilters.Columns.Add("Condition") @@ -90,6 +91,13 @@ Public Class ucrFilter VariableTypeProperties() End Sub + 'todo. currently, this subroutine is called even before load event of this control is called + 'the visibility setting it's toggling affects how load events of controls it contains are called + 'this may cause unintended 'load' bugs to some controls like reogrids + 'when refactoring the sequence of events that call this, + 'making sure that this is only called during this control's loading event should be prioritised + 'See issue #7408 comments + Private Sub VariableTypeProperties() ucrReceiverExpression.Visible = False lblSelectLevels.Visible = False @@ -128,7 +136,7 @@ Public Class ucrFilter cmdAddCondition.Enabled = False Else If ucrFilterByReceiver.strCurrDataType.ToLower.Contains("factor") Then - cmdAddCondition.Enabled = Not String.IsNullOrEmpty(ucrFactorLevels.GetSelectedLevels()) + cmdAddCondition.Enabled = ucrFactorLevels.IsAnyGridRowSelected Else Select Case ucrFilterOperation.GetText() Case "is.na", "! is.na" @@ -148,7 +156,7 @@ Public Class ucrFilter End Sub Private Sub SetToggleButtonSettings() - If ucrFactorLevels.IsAllSelected() Then + If ucrFactorLevels.IsAllGridRowsSelected Then cmdToggleSelectAll.Text = "Deselect All Levels" cmdToggleSelectAll.FlatStyle = FlatStyle.Flat Else @@ -196,7 +204,7 @@ Public Class ucrFilter If ucrFilterByReceiver.strCurrDataType.Contains("factor") Then clsCurrentOperator.SetOperation("%in%") clsCurrentConditionListFunction.AddParameter("operation", Chr(34) & "%in%" & Chr(34)) - strCondition = ucrFactorLevels.GetSelectedLevels() + strCondition = mdlCoreControl.GetRVector(ucrFactorLevels.GetSelectedCellValues(ucrFactor.DefaultColumnNames.Label, True), bOnlyIfMultipleElement:=True) Else clsCurrentOperator.SetOperation(ucrFilterOperation.GetText()) clsCurrentConditionListFunction.AddParameter("operation", Chr(34) & ucrFilterOperation.GetText() & Chr(34)) @@ -236,10 +244,10 @@ Public Class ucrFilter End Sub Private Sub cmdToggleSelectAll_Click(sender As Object, e As EventArgs) Handles cmdToggleSelectAll.Click - ucrFactorLevels.SetSelectionAllLevels(Not ucrFactorLevels.IsAllSelected()) + ucrFactorLevels.SelectAllGridRows(Not ucrFactorLevels.IsAllGridRowsSelected()) End Sub - Private Sub ucrFactorLevels_SelectedLevelChanged() Handles ucrFactorLevels.SelectedLevelChanged + Private Sub ucrFactorLevels_ControlValueChanged(ucrChangedControl As ucrCore) Handles ucrFactorLevels.ControlValueChanged SetToggleButtonSettings() CheckAddEnabled() End Sub @@ -426,4 +434,6 @@ Public Class ucrFilter End If ucrFilterPreview.SetName(strFilter) End Sub + + End Class diff --git a/instat/ucrInput.vb b/instat/ucrInput.vb index 8b994422dcc..36337b2c97d 100644 --- a/instat/ucrInput.vb +++ b/instat/ucrInput.vb @@ -20,9 +20,8 @@ Imports RDotNet Public Class ucrInput Public bUserTyped As Boolean = False Public Event NameChanged() - Public Event ContentsChanged() Protected strValidationType As String = "None" - Dim strReservedWords() As String = ({"if", "else", "repeat", "while", "function", "for", "in", "next", "break", "TRUE", "FALSE", "NULL", "Inf", "NaN", "NA", "NA_integer_", "NA_real_", "NA_complex_", "NA_character_"}) + Protected ReadOnly strReservedWords() As String = ({"if", "else", "repeat", "while", "function", "for", "in", "next", "break", "TRUE", "FALSE", "NULL", "Inf", "NaN", "NA", "NA_integer_", "NA_real_", "NA_complex_", "NA_character_"}) Public clsRList As New RFunction Protected dcmMinimum As Decimal = Decimal.MinValue Protected dcmMaximum As Decimal = Decimal.MaxValue @@ -86,11 +85,6 @@ Public Class ucrInput End If End Sub - Public Sub OnContentsChanged() - RaiseEvent ContentsChanged() - OnControlContentsChanged() - End Sub - Public Function UserTyped() As Boolean Return bUserTyped End Function @@ -488,7 +482,7 @@ Public Class ucrInput Return 0 End Function - Private Sub ucrDataFrameSelector_DataFrameChanged(sender As Object, e As EventArgs, strPrevDataFrame As String) Handles ucrDataFrameSelector.DataFrameChanged + Private Sub ucrDataFrameSelector_ControlValueChanged(sender As Object) Handles ucrDataFrameSelector.ControlValueChanged If Not bUserTyped Then SetDefaultName() End If diff --git a/instat/ucrInputComboBox.vb b/instat/ucrInputComboBox.vb index 3cdd7568e41..e565d0c2e50 100644 --- a/instat/ucrInputComboBox.vb +++ b/instat/ucrInputComboBox.vb @@ -151,7 +151,7 @@ Public Class ucrInputComboBox End Select End Sub - Public Sub ucrDataFrameSelector_DataFrameChanged() Handles ucrDataFrameSelector.DataFrameChanged + Public Sub ucrDataFrameSelector_ControlValueChanged() Handles ucrDataFrameSelector.ControlValueChanged FillItemTypes() End Sub @@ -290,7 +290,8 @@ Public Class ucrInputComboBox End Sub Private Sub cboInput_TextChanged(sender As Object, e As EventArgs) Handles cboInput.TextChanged - OnContentsChanged() + 'shouldn't we be raising OnControlValueChanged instead? see issue #7367 + OnControlContentsChanged() End Sub Private Sub cboInput_Click(sender As Object, e As EventArgs) Handles cboInput.Click OnControlClicked() diff --git a/instat/ucrInputFactorLevels.Designer.vb b/instat/ucrInputFactorLevels.Designer.vb index 776d9ce529c..b4978231ca6 100644 --- a/instat/ucrInputFactorLevels.Designer.vb +++ b/instat/ucrInputFactorLevels.Designer.vb @@ -28,9 +28,8 @@ Partial Class ucrInputFactorLevels ' Me.AutoScaleDimensions = New System.Drawing.SizeF(96.0!, 96.0!) Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi - Me.AutoSize = True Me.Name = "ucrInputFactorLevels" - Me.Size = New System.Drawing.Size(0, 0) + Me.Size = New System.Drawing.Size(164, 21) Me.ResumeLayout(False) End Sub diff --git a/instat/ucrInputTextBox.vb b/instat/ucrInputTextBox.vb index 2c59a0a6bc3..f911cce9ee3 100644 --- a/instat/ucrInputTextBox.vb +++ b/instat/ucrInputTextBox.vb @@ -54,7 +54,11 @@ Public Class ucrInputTextBox Else e.Cancel = Not ValidateText(strCurrent) End If - If Not e.Cancel Then OnNameChanged() + If Not e.Cancel Then + 'Note. calling this subroutine internally raises + 'ControlContentsChanged and ControlValueChanged events + OnNameChanged() + End If End Sub Public Overrides Function GetText() As String @@ -74,7 +78,8 @@ Public Class ucrInputTextBox End Function Private Sub txtInput_TextChanged(sender As Object, e As EventArgs) Handles txtInput.TextChanged - OnContentsChanged() + 'shouldn't we be raising OnControlValueChanged instead? see issue #7367 + OnControlContentsChanged() End Sub Private Sub txtInput_Click(sender As Object, e As EventArgs) Handles txtInput.Click diff --git a/instat/ucrLayerParameters.Designer.vb b/instat/ucrLayerParameters.Designer.vb index 0b995dff681..6191adca6b0 100644 --- a/instat/ucrLayerParameters.Designer.vb +++ b/instat/ucrLayerParameters.Designer.vb @@ -56,63 +56,55 @@ Partial Class ucrLayerParameters ' 'UcrLayerParamsControls1 ' - Me.UcrLayerParamsControls1.AutoSize = True Me.UcrLayerParamsControls1.Location = New System.Drawing.Point(6, 49) Me.UcrLayerParamsControls1.Name = "UcrLayerParamsControls1" - Me.UcrLayerParamsControls1.Size = New System.Drawing.Size(338, 28) + Me.UcrLayerParamsControls1.Size = New System.Drawing.Size(290, 28) Me.UcrLayerParamsControls1.TabIndex = 2 ' 'UcrLayerParamsControls2 ' - Me.UcrLayerParamsControls2.AutoSize = True - Me.UcrLayerParamsControls2.Location = New System.Drawing.Point(6, 75) + Me.UcrLayerParamsControls2.Location = New System.Drawing.Point(6, 73) Me.UcrLayerParamsControls2.Name = "UcrLayerParamsControls2" Me.UcrLayerParamsControls2.Size = New System.Drawing.Size(290, 28) Me.UcrLayerParamsControls2.TabIndex = 3 ' 'UcrLayerParamsControls3 ' - Me.UcrLayerParamsControls3.AutoSize = True - Me.UcrLayerParamsControls3.Location = New System.Drawing.Point(6, 100) + Me.UcrLayerParamsControls3.Location = New System.Drawing.Point(6, 97) Me.UcrLayerParamsControls3.Name = "UcrLayerParamsControls3" Me.UcrLayerParamsControls3.Size = New System.Drawing.Size(290, 28) Me.UcrLayerParamsControls3.TabIndex = 4 ' 'UcrLayerParamsControls4 ' - Me.UcrLayerParamsControls4.AutoSize = True - Me.UcrLayerParamsControls4.Location = New System.Drawing.Point(6, 125) + Me.UcrLayerParamsControls4.Location = New System.Drawing.Point(6, 121) Me.UcrLayerParamsControls4.Name = "UcrLayerParamsControls4" Me.UcrLayerParamsControls4.Size = New System.Drawing.Size(290, 28) Me.UcrLayerParamsControls4.TabIndex = 5 ' 'UcrLayerParamsControls5 ' - Me.UcrLayerParamsControls5.AutoSize = True - Me.UcrLayerParamsControls5.Location = New System.Drawing.Point(6, 150) + Me.UcrLayerParamsControls5.Location = New System.Drawing.Point(6, 145) Me.UcrLayerParamsControls5.Name = "UcrLayerParamsControls5" Me.UcrLayerParamsControls5.Size = New System.Drawing.Size(290, 28) Me.UcrLayerParamsControls5.TabIndex = 6 ' 'UcrLayerParamsControls6 ' - Me.UcrLayerParamsControls6.AutoSize = True - Me.UcrLayerParamsControls6.Location = New System.Drawing.Point(6, 175) + Me.UcrLayerParamsControls6.Location = New System.Drawing.Point(6, 171) Me.UcrLayerParamsControls6.Name = "UcrLayerParamsControls6" Me.UcrLayerParamsControls6.Size = New System.Drawing.Size(290, 28) Me.UcrLayerParamsControls6.TabIndex = 7 ' 'UcrLayerParamsControls7 ' - Me.UcrLayerParamsControls7.AutoSize = True - Me.UcrLayerParamsControls7.Location = New System.Drawing.Point(6, 200) + Me.UcrLayerParamsControls7.Location = New System.Drawing.Point(6, 197) Me.UcrLayerParamsControls7.Name = "UcrLayerParamsControls7" Me.UcrLayerParamsControls7.Size = New System.Drawing.Size(290, 28) Me.UcrLayerParamsControls7.TabIndex = 8 ' 'UcrLayerParamsControls8 ' - Me.UcrLayerParamsControls8.AutoSize = True Me.UcrLayerParamsControls8.Location = New System.Drawing.Point(6, 225) Me.UcrLayerParamsControls8.Name = "UcrLayerParamsControls8" Me.UcrLayerParamsControls8.Size = New System.Drawing.Size(290, 28) @@ -120,72 +112,63 @@ Partial Class ucrLayerParameters ' 'UcrLayerParamsControls9 ' - Me.UcrLayerParamsControls9.AutoSize = True - Me.UcrLayerParamsControls9.Location = New System.Drawing.Point(6, 250) + Me.UcrLayerParamsControls9.Location = New System.Drawing.Point(6, 253) Me.UcrLayerParamsControls9.Name = "UcrLayerParamsControls9" Me.UcrLayerParamsControls9.Size = New System.Drawing.Size(290, 28) Me.UcrLayerParamsControls9.TabIndex = 10 ' 'UcrLayerParamsControls10 ' - Me.UcrLayerParamsControls10.AutoSize = True - Me.UcrLayerParamsControls10.Location = New System.Drawing.Point(6, 275) + Me.UcrLayerParamsControls10.Location = New System.Drawing.Point(6, 279) Me.UcrLayerParamsControls10.Name = "UcrLayerParamsControls10" Me.UcrLayerParamsControls10.Size = New System.Drawing.Size(290, 28) Me.UcrLayerParamsControls10.TabIndex = 11 ' 'UcrLayerParamsControls11 ' - Me.UcrLayerParamsControls11.AutoSize = True - Me.UcrLayerParamsControls11.Location = New System.Drawing.Point(6, 300) + Me.UcrLayerParamsControls11.Location = New System.Drawing.Point(6, 305) Me.UcrLayerParamsControls11.Name = "UcrLayerParamsControls11" Me.UcrLayerParamsControls11.Size = New System.Drawing.Size(290, 28) Me.UcrLayerParamsControls11.TabIndex = 12 ' 'UcrLayerParamsControls12 ' - Me.UcrLayerParamsControls12.AutoSize = True - Me.UcrLayerParamsControls12.Location = New System.Drawing.Point(6, 325) + Me.UcrLayerParamsControls12.Location = New System.Drawing.Point(6, 329) Me.UcrLayerParamsControls12.Name = "UcrLayerParamsControls12" Me.UcrLayerParamsControls12.Size = New System.Drawing.Size(290, 28) Me.UcrLayerParamsControls12.TabIndex = 13 ' 'UcrLayerParamsControls13 ' - Me.UcrLayerParamsControls13.AutoSize = True - Me.UcrLayerParamsControls13.Location = New System.Drawing.Point(6, 350) + Me.UcrLayerParamsControls13.Location = New System.Drawing.Point(6, 353) Me.UcrLayerParamsControls13.Name = "UcrLayerParamsControls13" Me.UcrLayerParamsControls13.Size = New System.Drawing.Size(290, 28) Me.UcrLayerParamsControls13.TabIndex = 14 ' 'UcrLayerParamsControls17 ' - Me.UcrLayerParamsControls17.AutoSize = True - Me.UcrLayerParamsControls17.Location = New System.Drawing.Point(6, 450) + Me.UcrLayerParamsControls17.Location = New System.Drawing.Point(6, 455) Me.UcrLayerParamsControls17.Name = "UcrLayerParamsControls17" Me.UcrLayerParamsControls17.Size = New System.Drawing.Size(290, 28) Me.UcrLayerParamsControls17.TabIndex = 18 ' 'UcrLayerParamsControls16 ' - Me.UcrLayerParamsControls16.AutoSize = True - Me.UcrLayerParamsControls16.Location = New System.Drawing.Point(6, 425) + Me.UcrLayerParamsControls16.Location = New System.Drawing.Point(6, 429) Me.UcrLayerParamsControls16.Name = "UcrLayerParamsControls16" Me.UcrLayerParamsControls16.Size = New System.Drawing.Size(290, 28) Me.UcrLayerParamsControls16.TabIndex = 17 ' 'UcrLayerParamsControls15 ' - Me.UcrLayerParamsControls15.AutoSize = True - Me.UcrLayerParamsControls15.Location = New System.Drawing.Point(6, 400) + Me.UcrLayerParamsControls15.Location = New System.Drawing.Point(6, 403) Me.UcrLayerParamsControls15.Name = "UcrLayerParamsControls15" Me.UcrLayerParamsControls15.Size = New System.Drawing.Size(290, 28) Me.UcrLayerParamsControls15.TabIndex = 16 ' 'UcrLayerParamsControls14 ' - Me.UcrLayerParamsControls14.AutoSize = True - Me.UcrLayerParamsControls14.Location = New System.Drawing.Point(6, 375) + Me.UcrLayerParamsControls14.Location = New System.Drawing.Point(6, 377) Me.UcrLayerParamsControls14.Name = "UcrLayerParamsControls14" Me.UcrLayerParamsControls14.Size = New System.Drawing.Size(290, 28) Me.UcrLayerParamsControls14.TabIndex = 15 @@ -212,7 +195,7 @@ Partial Class ucrLayerParameters Me.Controls.Add(Me.UcrLayerParamsControls2) Me.Controls.Add(Me.UcrLayerParamsControls1) Me.Name = "ucrLayerParameters" - Me.Size = New System.Drawing.Size(347, 481) + Me.Size = New System.Drawing.Size(347, 528) Me.Controls.SetChildIndex(Me.UcrLayerParamsControls1, 0) Me.Controls.SetChildIndex(Me.UcrLayerParamsControls2, 0) Me.Controls.SetChildIndex(Me.UcrLayerParamsControls3, 0) diff --git a/instat/ucrLayerParamsControls.Designer.vb b/instat/ucrLayerParamsControls.Designer.vb index 02a9928aea7..8d44944c194 100644 --- a/instat/ucrLayerParamsControls.Designer.vb +++ b/instat/ucrLayerParamsControls.Designer.vb @@ -44,7 +44,6 @@ Partial Class ucrLayerParamsControls ' 'ucrReceiverMetadataProperty ' - Me.ucrReceiverMetadataProperty.AutoSize = True Me.ucrReceiverMetadataProperty.Location = New System.Drawing.Point(101, 2) Me.ucrReceiverMetadataProperty.Name = "ucrReceiverMetadataProperty" Me.ucrReceiverMetadataProperty.Size = New System.Drawing.Size(161, 23) @@ -52,7 +51,6 @@ Partial Class ucrLayerParamsControls ' 'ucrChkParamName ' - Me.ucrChkParamName.AutoSize = True Me.ucrChkParamName.Checked = False Me.ucrChkParamName.Dock = System.Windows.Forms.DockStyle.Left Me.ucrChkParamName.Location = New System.Drawing.Point(0, 0) @@ -69,7 +67,6 @@ Partial Class ucrLayerParamsControls Me.Name = "ucrLayerParamsControls" Me.Size = New System.Drawing.Size(265, 28) Me.ResumeLayout(False) - Me.PerformLayout() End Sub Friend WithEvents ucrReceiverMetadataProperty As ucrReceiverMetadataProperty diff --git a/instat/ucrNewColumnName.vb b/instat/ucrNewColumnName.vb index 39bab08bcfd..f012e6bc157 100644 --- a/instat/ucrNewColumnName.vb +++ b/instat/ucrNewColumnName.vb @@ -65,7 +65,7 @@ Public Class ucrNewColumnName End If End Sub - Private Sub ucrDataFrameSelector_DataFrameChanged(sender As Object, e As EventArgs, strPreviousDataFrame As String) Handles ucrDataFrameSelector.DataFrameChanged + Private Sub ucrDataFrameSelector_ControlValueChanged(sender As Object) Handles ucrDataFrameSelector.ControlValueChanged frmMain.clsRLink.FillColumnNames(ucrDataFrameSelector.cboAvailableDataFrames.Text, cboColumns:=cboColumnName) SetDefaultName() End Sub diff --git a/instat/ucrReceiverMetadataProperty.Designer.vb b/instat/ucrReceiverMetadataProperty.Designer.vb index e9d34601e4d..f4a98e957a4 100644 --- a/instat/ucrReceiverMetadataProperty.Designer.vb +++ b/instat/ucrReceiverMetadataProperty.Designer.vb @@ -47,7 +47,6 @@ Partial Class ucrReceiverMetadataProperty 'ucrInputTextValue ' Me.ucrInputTextValue.AddQuotesIfUnrecognised = True - Me.ucrInputTextValue.AutoSize = True Me.ucrInputTextValue.Dock = System.Windows.Forms.DockStyle.Fill Me.ucrInputTextValue.IsMultiline = False Me.ucrInputTextValue.IsReadOnly = False @@ -82,15 +81,14 @@ Partial Class ucrReceiverMetadataProperty ' 'ucrNudParamValue ' - Me.ucrNudParamValue.AutoSize = True Me.ucrNudParamValue.DecimalPlaces = New Decimal(New Integer() {0, 0, 0, 0}) - Me.ucrNudParamValue.Dock = System.Windows.Forms.DockStyle.Left + Me.ucrNudParamValue.Dock = System.Windows.Forms.DockStyle.Fill Me.ucrNudParamValue.Increment = New Decimal(New Integer() {1, 0, 0, 0}) Me.ucrNudParamValue.Location = New System.Drawing.Point(0, 0) Me.ucrNudParamValue.Maximum = New Decimal(New Integer() {100, 0, 0, 0}) Me.ucrNudParamValue.Minimum = New Decimal(New Integer() {0, 0, 0, 0}) Me.ucrNudParamValue.Name = "ucrNudParamValue" - Me.ucrNudParamValue.Size = New System.Drawing.Size(0, 22) + Me.ucrNudParamValue.Size = New System.Drawing.Size(140, 22) Me.ucrNudParamValue.TabIndex = 12 Me.ucrNudParamValue.Value = New Decimal(New Integer() {0, 0, 0, 0}) ' @@ -105,7 +103,6 @@ Partial Class ucrReceiverMetadataProperty Me.Name = "ucrReceiverMetadataProperty" Me.Size = New System.Drawing.Size(140, 22) Me.ResumeLayout(False) - Me.PerformLayout() End Sub Friend WithEvents ucrColor As ucrColors diff --git a/instat/ucrReorder.vb b/instat/ucrReorder.vb index 78a63bc4ae2..f93eb68d936 100644 --- a/instat/ucrReorder.vb +++ b/instat/ucrReorder.vb @@ -14,11 +14,11 @@ ' You should have received a copy of the GNU General Public License ' along with this program. If not, see . -Imports RDotNet -Public Class ucrReorder +Imports RDotNet +Public Class ucrReorder Public Event OrderChanged() - Public WithEvents ucrDataFrameList As ucrDataFrame - Public WithEvents ucrReceiver As ucrReceiverSingle + Public WithEvents ucrDataFrameList As ucrDataFrame + Public WithEvents ucrReceiver As ucrReceiverSingle Private strDataType As String = "" Public bWithQuotes As Boolean = True Public bIsDataType As Boolean = True @@ -36,7 +36,7 @@ Public Class ucrReorder Bottom End Enum - Public Sub setDataType(strType As String) + Public Sub setDataType(strType As String) strDataType = strType lstAvailableData.Clear() Select Case strDataType @@ -52,23 +52,23 @@ Public Class ucrReorder lstAvailableData.Columns.Add("Objects") End Select lstAvailableData.Columns(0).Width = -2 - LoadList() - End Sub - + LoadList() + End Sub + Private Sub cmdUp_Click(sender As Object, e As EventArgs) Handles cmdUp.Click ReorderListViewItems(Direction.Up) - End Sub - + End Sub + Private Sub cmdDown_click(sender As Object, e As EventArgs) Handles cmdDown.Click - ReorderListViewItems(Direction.Down) + ReorderListViewItems(Direction.Down) End Sub Private Sub cmdBottom_Click(sender As Object, e As EventArgs) Handles cmdBottom.Click - ReorderListViewItems(Direction.Bottom) - End Sub - - Private Sub cmdTop_Click(sender As Object, e As EventArgs) Handles cmdTop.Click - ReorderListViewItems(Direction.Top) + ReorderListViewItems(Direction.Bottom) + End Sub + + Private Sub cmdTop_Click(sender As Object, e As EventArgs) Handles cmdTop.Click + ReorderListViewItems(Direction.Top) End Sub ''' @@ -122,47 +122,47 @@ Public Class ucrReorder dctSelectedItems.Values.LastOrDefault().EnsureVisible() 'notify order changed RaiseEvent OrderChanged() - End Sub - - Public Function GetVariableNames(Optional bWithQuotes As Boolean = True) As String - Dim strTemp As String = "" - Dim i As Integer - If lstAvailableData.Items.Count = 1 Then - If bWithQuotes Then - strTemp = Chr(34) & lstAvailableData.Items(0).Text & Chr(34) - Else - strTemp = lstAvailableData.Items(0).Text - End If - ElseIf lstAvailableData.Items.Count > 1 Then - strTemp = "c" & "(" - For i = 0 To lstAvailableData.Items.Count - 1 - If i > 0 Then - strTemp = strTemp & "," + End Sub + + Public Function GetVariableNames(Optional bWithQuotes As Boolean = True) As String + Dim strTemp As String = "" + Dim i As Integer + If lstAvailableData.Items.Count = 1 Then + If bWithQuotes Then + strTemp = Chr(34) & lstAvailableData.Items(0).Text & Chr(34) + Else + strTemp = lstAvailableData.Items(0).Text + End If + ElseIf lstAvailableData.Items.Count > 1 Then + strTemp = "c" & "(" + For i = 0 To lstAvailableData.Items.Count - 1 + If i > 0 Then + strTemp = strTemp & "," End If If bWithQuotes Then strTemp = strTemp & Chr(34) & lstAvailableData.Items(i).Text & Chr(34) Else strTemp = strTemp & lstAvailableData.Items(i).Text - End If - Next - strTemp = strTemp & ")" - End If - - Return strTemp - End Function - - Public Sub setDataframes(dfDataframes As ucrDataFrame) - ucrDataFrameList = dfDataframes - LoadList() - End Sub - - Public Sub setReceiver(dfSingle As ucrReceiverSingle) - ucrReceiver = dfSingle - LoadList() - End Sub - - Public Sub LoadList() - Dim vecNames As CharacterVector = Nothing + End If + Next + strTemp = strTemp & ")" + End If + + Return strTemp + End Function + + Public Sub setDataframes(dfDataframes As ucrDataFrame) + ucrDataFrameList = dfDataframes + LoadList() + End Sub + + Public Sub setReceiver(dfSingle As ucrReceiverSingle) + ucrReceiver = dfSingle + LoadList() + End Sub + + Public Sub LoadList() + Dim vecNames As CharacterVector = Nothing If bIsDataType Then Select Case strDataType Case "column" @@ -188,50 +188,50 @@ Public Class ucrReorder vecNames = Nothing End Select FillListView(vecNames) - End If - End Sub - - Private Sub FillListView(vecNames As CharacterVector) - If vecNames IsNot Nothing Then - lstAvailableData.Items.Clear() - For i = 0 To vecNames.Count - 1 - lstAvailableData.Items.Add(vecNames(i)) - Next + End If + End Sub + + Private Sub FillListView(vecNames As CharacterVector) + If vecNames IsNot Nothing Then + lstAvailableData.Items.Clear() + For i = 0 To vecNames.Count - 1 + lstAvailableData.Items.Add(vecNames(i)) + Next RaiseEvent OrderChanged() - ElseIf Not bDataIsSummaries Then - lstAvailableData.Items.Clear() - End If - End Sub - - Private Sub FillListView(strItems As String()) - If strItems IsNot Nothing Then - lstAvailableData.Items.Clear() - For i = 0 To strItems.Count - 1 - lstAvailableData.Items.Add(strItems(i)) - Next + ElseIf Not bDataIsSummaries Then + lstAvailableData.Items.Clear() + End If + End Sub + + Private Sub FillListView(strItems As String()) + If strItems IsNot Nothing Then + lstAvailableData.Items.Clear() + For i = 0 To strItems.Count - 1 + lstAvailableData.Items.Add(strItems(i)) + Next RaiseEvent OrderChanged() - Else - lstAvailableData.Items.Clear() - End If - End Sub - - Private Sub ucrDataFrameList_DataFrameChanged(sender As Object, e As EventArgs, strPrevDataFrame As String) Handles ucrDataFrameList.DataFrameChanged - LoadList() - End Sub - - Private Sub ucrReceiver_SelectionChanged(sender As Object, e As EventArgs) Handles ucrReceiver.SelectionChanged - LoadList() - End Sub - - 'to update this to check if the order has changed - Public Function IsEmpty() As Boolean - If lstAvailableData.Items.Count > 0 Then - Return False - Else - Return True - End If - End Function - + Else + lstAvailableData.Items.Clear() + End If + End Sub + + Private Sub ucrDataFrameList_ControlValueChanged(sender As Object) Handles ucrDataFrameList.ControlValueChanged + LoadList() + End Sub + + Private Sub ucrReceiver_SelectionChanged(sender As Object, e As EventArgs) Handles ucrReceiver.SelectionChanged + LoadList() + End Sub + + 'to update this to check if the order has changed + Public Function IsEmpty() As Boolean + If lstAvailableData.Items.Count > 0 Then + Return False + Else + Return True + End If + End Function + Public Sub Reset() lstAvailableData.Items.Clear() End Sub @@ -284,4 +284,4 @@ Public Class ucrReorder Private Sub lstAvailableData_SelectedIndexChanged(sender As Object, e As EventArgs) Handles lstAvailableData.SelectedIndexChanged RaiseEvent SelectedIndexChanged(sender, e) End Sub -End Class +End Class diff --git a/instat/ucrSaveGraph.Designer.vb b/instat/ucrSaveGraph.Designer.vb deleted file mode 100644 index f4bc0b3b0c9..00000000000 --- a/instat/ucrSaveGraph.Designer.vb +++ /dev/null @@ -1,83 +0,0 @@ -' R- Instat -' Copyright (C) 2015-2017 -' -' This program is free software: you can redistribute it and/or modify -' it under the terms of the GNU General Public License as published by -' the Free Software Foundation, either version 3 of the License, or -' (at your option) any later version. -' -' This program is distributed in the hope that it will be useful, -' but WITHOUT ANY WARRANTY; without even the implied warranty of -' MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -' GNU General Public License for more details. -' -' You should have received a copy of the GNU General Public License -' along with this program. If not, see . - - -Partial Class ucrSaveGraph - Inherits System.Windows.Forms.UserControl - - 'UserControl overrides dispose to clean up the component list. - _ - Protected Overrides Sub Dispose(ByVal disposing As Boolean) - Try - If disposing AndAlso components IsNot Nothing Then - components.Dispose() - End If - Finally - MyBase.Dispose(disposing) - End Try - End Sub - - 'Required by the Windows Form Designer - Private components As System.ComponentModel.IContainer - - '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.ucrInputGraphName = New instat.ucrInputComboBox() - Me.chkSaveGraph = New System.Windows.Forms.CheckBox() - Me.SuspendLayout() - ' - 'ucrInputGraphName - ' - Me.ucrInputGraphName.AddQuotesIfUnrecognised = True - Me.ucrInputGraphName.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink - Me.ucrInputGraphName.GetSetSelectedIndex = -1 - Me.ucrInputGraphName.IsReadOnly = False - Me.ucrInputGraphName.Location = New System.Drawing.Point(146, 3) - Me.ucrInputGraphName.Name = "ucrInputGraphName" - Me.ucrInputGraphName.Size = New System.Drawing.Size(151, 29) - Me.ucrInputGraphName.TabIndex = 0 - ' - 'chkSaveGraph - ' - Me.chkSaveGraph.AutoSize = True - Me.chkSaveGraph.Location = New System.Drawing.Point(0, 3) - Me.chkSaveGraph.Name = "chkSaveGraph" - Me.chkSaveGraph.Size = New System.Drawing.Size(83, 17) - Me.chkSaveGraph.TabIndex = 1 - Me.chkSaveGraph.Tag = "Save_Graph" - Me.chkSaveGraph.Text = "Save Graph" - Me.chkSaveGraph.UseVisualStyleBackColor = True - ' - 'ucrSaveGraph - ' - Me.AutoScaleDimensions = New System.Drawing.SizeF(96.0!, 96.0!) - Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi - Me.AutoSize = True - Me.Controls.Add(Me.chkSaveGraph) - Me.Controls.Add(Me.ucrInputGraphName) - Me.Name = "ucrSaveGraph" - Me.Size = New System.Drawing.Size(313, 35) - Me.ResumeLayout(False) - Me.PerformLayout() - - End Sub - - Friend WithEvents ucrInputGraphName As ucrInputComboBox - Friend WithEvents chkSaveGraph As CheckBox -End Class diff --git a/instat/ucrSaveGraph.resx b/instat/ucrSaveGraph.resx deleted file mode 100644 index 1af7de150c9..00000000000 --- a/instat/ucrSaveGraph.resx +++ /dev/null @@ -1,120 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - \ No newline at end of file diff --git a/instat/ucrSaveGraph.sw-KE.resx b/instat/ucrSaveGraph.sw-KE.resx deleted file mode 100644 index 0e517ba7e70..00000000000 --- a/instat/ucrSaveGraph.sw-KE.resx +++ /dev/null @@ -1,45 +0,0 @@ - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - 86, 0 - - - 180, 20 - - - 0 - - - True - - - 0, 3 - - - 83, 17 - - - 1 - - - 6, 13 - - - 265, 20 - - - True - - \ No newline at end of file diff --git a/instat/ucrSaveGraph.vb b/instat/ucrSaveGraph.vb deleted file mode 100644 index 134c669fd1d..00000000000 --- a/instat/ucrSaveGraph.vb +++ /dev/null @@ -1,132 +0,0 @@ -' R- Instat -' Copyright (C) 2015-2017 -' -' This program is free software: you can redistribute it and/or modify -' it under the terms of the GNU General Public License as published by -' the Free Software Foundation, either version 3 of the License, or -' (at your option) any later version. -' -' This program is distributed in the hope that it will be useful, -' but WITHOUT ANY WARRANTY; without even the implied warranty of -' MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -' GNU General Public License for more details. -' -' You should have received a copy of the GNU General Public License -' along with this program. If not, see . - - - -''' This control allows the user to specify how an object should be saved. -''' -''' This control can save the object of type 'graph'. -''' The user can enter/update the name of the saved object via a text box or combo box. -''' A combo box may be used to display a list of possible save names (e.g. the existing -''' graph names). -''' An optional check box allows the text/combo box to be made visible or not visible. -''' -''' -Public Class ucrSaveGraph - Public Event SaveGraphCheckedChanged() - Public Event GraphNameChanged() - Public Event ContentsChanged() - Public bFirstLoad As Boolean - - '''-------------------------------------------------------------------------------------------- - ''' Constructs and initializes this component. - '''-------------------------------------------------------------------------------------------- - Public Sub New() - ' This call is required by the designer. - InitializeComponent() - - ' Add any initialization after the InitializeComponent() call. - ucrInputGraphName.SetDefaultTypeAsGraph() - ucrInputGraphName.SetItemsTypeAsGraphs() - ucrInputGraphName.SetValidationTypeAsRVariable() - bFirstLoad = True - End Sub - '''-------------------------------------------------------------------------------------------- - ''' Executes whenever this control loads. - ''' If this is the first time that the control has loaded then sets the control to - ''' the default state. - ''' If the control has already been loaded then this function does nothing. - ''' - ''' Source of the event. - ''' Event information. - '''-------------------------------------------------------------------------------------------- - Private Sub ucrSaveGraph_Load(sender As Object, e As EventArgs) Handles MyBase.Load - If bFirstLoad Then - SetDefaults() - bFirstLoad = False - End If - End Sub - '''-------------------------------------------------------------- - ''' Sets the control to its default state. - '''-------------------------------------------------------------- - Private Sub SetDefaults() - chkSaveGraph.Checked = False - ucrInputGraphName.Visible = False - End Sub - '''------------------------------------------------------------------ - ''' Resets the control to its default state. - '''------------------------------------------------------------------ - Public Sub Reset() - SetDefaults() - End Sub - '''------------------------------------------------------------------------------------------------- - ''' Sets the new data frame selector and links the selector to the combo box. - ''' The new data frame selector. - '''------------------------------------------------------------------------------------------------- - Public Sub SetDataFrameSelector(ucrNewDataFrameSelector As ucrDataFrame) - ucrInputGraphName.SetDataFrameSelector(ucrNewDataFrameSelector) - End Sub - '''---------------------------------------------------------------------------------------- - ''' Handles event triggered when the state of the check box changes. - ''' Source of the event. - ''' Event information. - '''---------------------------------------------------------------------------------------- - Private Sub chkSaveGraph_CheckedChanged(sender As Object, e As EventArgs) Handles chkSaveGraph.CheckedChanged - ucrInputGraphName.Enabled = chkSaveGraph.Checked - ucrInputGraphName.Visible = chkSaveGraph.Checked - RaiseEvent SaveGraphCheckedChanged() - End Sub - '''-------------------------------------------------------------------------------- - ''' Handles event triggered when the combo box name changes. - '''-------------------------------------------------------------------------------- - Private Sub ucrInputGraphName_NameChanged() Handles ucrInputGraphName.NameChanged - If chkSaveGraph.Checked Then - RaiseEvent GraphNameChanged() - End If - End Sub - '''----------------------------------------------------------------------------------- - ''' Handles event triggered when the combo box contents changes. - '''----------------------------------------------------------------------------------- - Private Sub ucrInputGraphName_ContentsChanged() Handles ucrInputGraphName.ContentsChanged - RaiseEvent ContentsChanged() - End Sub - '''---------------------------------------------------------------------- - ''' Returns the state of the save graph check box. - ''' True if the check box is checked. - '''---------------------------------------------------------------------- - Public ReadOnly Property bSaveGraph() As Boolean - Get - Return chkSaveGraph.Checked - End Get - End Property - '''--------------------------------------------------------------------- - ''' Sets the name of the graph in the combo box. - ''' Return the name graph. - '''--------------------------------------------------------------------- - Public ReadOnly Property strGraphName() As String - Get - Return ucrInputGraphName.GetText() - End Get - End Property - '''--------------------------------------------------------------------------------- - ''' Sets the prefix for the combo box value to the new prefix. - '''--------------------------------------------------------------------------------- - Public WriteOnly Property strPrefix() As String - Set(strNewPrefix As String) - ucrInputGraphName.SetPrefix(strNewPrefix) - End Set - End Property -End Class diff --git a/instat/ucrScript.Designer.vb b/instat/ucrScript.Designer.vb index 10a81f95766..e8109b432bc 100644 --- a/instat/ucrScript.Designer.vb +++ b/instat/ucrScript.Designer.vb @@ -63,6 +63,7 @@ Partial Class ucrScript Me.cmdRunAll = New System.Windows.Forms.Button() Me.cmdRunLineSelection = New System.Windows.Forms.Button() Me.tooltiptScriptWindow = New System.Windows.Forms.ToolTip(Me.components) + Me.cmdHelp = New System.Windows.Forms.Button() Me.mnuContextScript.SuspendLayout() Me.tlpTableContainer.SuspendLayout() Me.Panel2.SuspendLayout() @@ -221,6 +222,7 @@ Partial Class ucrScript ' 'Panel2 ' + Me.Panel2.Controls.Add(Me.cmdHelp) Me.Panel2.Controls.Add(Me.cmdClear) Me.Panel2.Controls.Add(Me.cmdRunAll) Me.Panel2.Controls.Add(Me.cmdRunLineSelection) @@ -260,6 +262,15 @@ Partial Class ucrScript Me.tooltiptScriptWindow.SetToolTip(Me.cmdRunLineSelection, "Run the current line or selection." & Global.Microsoft.VisualBasic.ChrW(13) & Global.Microsoft.VisualBasic.ChrW(10) & "(Ctrl + Enter)") Me.cmdRunLineSelection.UseVisualStyleBackColor = True ' + 'cmdHelp + ' + Me.cmdHelp.Location = New System.Drawing.Point(165, 1) + Me.cmdHelp.Name = "cmdHelp" + Me.cmdHelp.Size = New System.Drawing.Size(51, 23) + Me.cmdHelp.TabIndex = 5 + Me.cmdHelp.Text = "Help" + Me.cmdHelp.UseVisualStyleBackColor = True + ' 'ucrScript ' Me.AutoScaleDimensions = New System.Drawing.SizeF(96.0!, 96.0!) @@ -301,4 +312,5 @@ Partial Class ucrScript Friend WithEvents cmdRunLineSelection As Button Friend WithEvents tooltiptScriptWindow As ToolTip Friend WithEvents cmdClear As Button + Friend WithEvents cmdHelp As Button End Class \ No newline at end of file diff --git a/instat/ucrScript.vb b/instat/ucrScript.vb index 3011fe9e12e..6bf4d7f1f8f 100644 --- a/instat/ucrScript.vb +++ b/instat/ucrScript.vb @@ -271,8 +271,7 @@ Public Class ucrScript bUserTextChanged = False 'reset flag End Sub - Private Sub mnuHelp_Click(sender As Object, e As EventArgs) Handles mnuHelp.Click + Private Sub mnuHelp_Click(sender As Object, e As EventArgs) Handles mnuHelp.Click, cmdHelp.Click Help.ShowHelp(Me, frmMain.strStaticPath & "\" & frmMain.strHelpFilePath, HelpNavigator.TopicId, "542") End Sub - End Class diff --git a/instat/ucrSelector.designer.vb b/instat/ucrSelector.designer.vb index 23b94ac041d..379b3b7c545 100644 --- a/instat/ucrSelector.designer.vb +++ b/instat/ucrSelector.designer.vb @@ -45,6 +45,8 @@ Partial Class ucrSelector Me.SelectAllToolStripMenuItem = New System.Windows.Forms.ToolStripMenuItem() Me.ClearSelectionToolStripMenuItem = New System.Windows.Forms.ToolStripMenuItem() Me.AddAllToolStripMenuItem = New System.Windows.Forms.ToolStripMenuItem() + Me.ToolStripSeparator1 = New System.Windows.Forms.ToolStripSeparator() + Me.mnuHelp = New System.Windows.Forms.ToolStripMenuItem() Me.SelectionMenuStrip.SuspendLayout() Me.SuspendLayout() ' @@ -67,37 +69,48 @@ Partial Class ucrSelector ' 'SelectionMenuStrip ' - Me.SelectionMenuStrip.Items.AddRange(New System.Windows.Forms.ToolStripItem() {Me.AddSelectedToolStripMenuItem, Me.SelectAllToolStripMenuItem, Me.ClearSelectionToolStripMenuItem, Me.AddAllToolStripMenuItem}) + Me.SelectionMenuStrip.Items.AddRange(New System.Windows.Forms.ToolStripItem() {Me.AddSelectedToolStripMenuItem, Me.SelectAllToolStripMenuItem, Me.ClearSelectionToolStripMenuItem, Me.AddAllToolStripMenuItem, Me.ToolStripSeparator1, Me.mnuHelp}) Me.SelectionMenuStrip.Name = "SelectionMenuStrip" - Me.SelectionMenuStrip.Size = New System.Drawing.Size(153, 92) + Me.SelectionMenuStrip.Size = New System.Drawing.Size(181, 142) ' 'AddSelectedToolStripMenuItem ' Me.AddSelectedToolStripMenuItem.Name = "AddSelectedToolStripMenuItem" - Me.AddSelectedToolStripMenuItem.Size = New System.Drawing.Size(152, 22) + Me.AddSelectedToolStripMenuItem.Size = New System.Drawing.Size(180, 22) Me.AddSelectedToolStripMenuItem.Tag = "Add_selected" Me.AddSelectedToolStripMenuItem.Text = "Add Selected" ' 'SelectAllToolStripMenuItem ' Me.SelectAllToolStripMenuItem.Name = "SelectAllToolStripMenuItem" - Me.SelectAllToolStripMenuItem.Size = New System.Drawing.Size(152, 22) + Me.SelectAllToolStripMenuItem.Size = New System.Drawing.Size(180, 22) Me.SelectAllToolStripMenuItem.Tag = "Select_All" Me.SelectAllToolStripMenuItem.Text = "Select All" ' 'ClearSelectionToolStripMenuItem ' Me.ClearSelectionToolStripMenuItem.Name = "ClearSelectionToolStripMenuItem" - Me.ClearSelectionToolStripMenuItem.Size = New System.Drawing.Size(152, 22) + Me.ClearSelectionToolStripMenuItem.Size = New System.Drawing.Size(180, 22) Me.ClearSelectionToolStripMenuItem.Tag = "Clear_Selection" Me.ClearSelectionToolStripMenuItem.Text = "Clear Selection" ' 'AddAllToolStripMenuItem ' Me.AddAllToolStripMenuItem.Name = "AddAllToolStripMenuItem" - Me.AddAllToolStripMenuItem.Size = New System.Drawing.Size(152, 22) + Me.AddAllToolStripMenuItem.Size = New System.Drawing.Size(180, 22) Me.AddAllToolStripMenuItem.Text = "Add All" ' + 'ToolStripSeparator1 + ' + Me.ToolStripSeparator1.Name = "ToolStripSeparator1" + Me.ToolStripSeparator1.Size = New System.Drawing.Size(177, 6) + ' + 'mnuHelp + ' + Me.mnuHelp.Name = "mnuHelp" + Me.mnuHelp.Size = New System.Drawing.Size(180, 22) + Me.mnuHelp.Text = "Help" + ' 'ucrSelector ' Me.AutoScaleDimensions = New System.Drawing.SizeF(96.0!, 96.0!) @@ -116,4 +129,6 @@ Partial Class ucrSelector Friend WithEvents SelectAllToolStripMenuItem As ToolStripMenuItem Friend WithEvents ClearSelectionToolStripMenuItem As ToolStripMenuItem Friend WithEvents AddAllToolStripMenuItem As ToolStripMenuItem + Friend WithEvents ToolStripSeparator1 As ToolStripSeparator + Friend WithEvents mnuHelp As ToolStripMenuItem End Class diff --git a/instat/ucrSelector.vb b/instat/ucrSelector.vb index c499658aed2..d8627ddca6a 100644 --- a/instat/ucrSelector.vb +++ b/instat/ucrSelector.vb @@ -13,9 +13,6 @@ ' ' You should have received a copy of the GNU General Public License ' along with this program. If not, see . - -Imports RDotNet -Imports instat.Translations Public Class ucrSelector Public CurrentReceiver As ucrReceiver Public Event ResetAll() @@ -24,8 +21,7 @@ Public Class ucrSelector Public Event DataFrameChanged() Public lstVariablesInReceivers As List(Of Tuple(Of String, String)) Public bFirstLoad As Boolean - Public bIncludeOverall As Boolean - Public strCurrentDataFrame As String + Public strCurrentDataFrame As String = "" ' If a dialog has receivers which can have columns from multiple data frames ' there may be a primary data frame which some receivers must be from. ' Other receivers may only allow columns from data frames linked to the primary data frame @@ -56,8 +52,7 @@ Public Class ucrSelector ' Add any initialization after the InitializeComponent() call. lstVariablesInReceivers = New List(Of Tuple(Of String, String)) bFirstLoad = True - bIncludeOverall = False - strCurrentDataFrame = "" + 'bIncludeOverall = False lstIncludedMetadataProperties = New List(Of KeyValuePair(Of String, String())) lstExcludedMetadataProperties = New List(Of KeyValuePair(Of String, String())) strType = "column" @@ -67,7 +62,6 @@ Public Class ucrSelector If bFirstLoad Then bFirstLoad = False End If - LoadList() End Sub Protected Sub OnResetAll() @@ -107,27 +101,99 @@ Public Class ucrSelector Public Overridable Sub LoadList() Dim lstCombinedMetadataLists As List(Of List(Of KeyValuePair(Of String, String()))) - Dim strExclud As String() = Nothing + Dim arrStrExclud As String() = Nothing Dim strCurrentType As String - If CurrentReceiver IsNot Nothing Then - lstCombinedMetadataLists = CombineMetadataLists(CurrentReceiver.lstIncludedMetadataProperties, CurrentReceiver.lstExcludedMetadataProperties) - If CurrentReceiver.bExcludeFromSelector Then - strExclud = GetVariablesInReceiver().ToArray - End If - If CurrentReceiver.bTypeSet Then - strCurrentType = CurrentReceiver.GetItemType() - frmMain.clsRLink.FillListView(lstAvailableVariable, strType:=CurrentReceiver.GetItemType(), lstIncludedDataTypes:=lstCombinedMetadataLists(0), lstExcludedDataTypes:=lstCombinedMetadataLists(1), strHeading:=CurrentReceiver.strSelectorHeading, strDataFrameName:=strCurrentDataFrame, strExcludedItems:=strExclud, strDatabaseQuery:=CurrentReceiver.strDatabaseQuery, strNcFilePath:=CurrentReceiver.strNcFilePath) - Else - strCurrentType = strType - frmMain.clsRLink.FillListView(lstAvailableVariable, strType:=strType, lstIncludedDataTypes:=lstCombinedMetadataLists(0), lstExcludedDataTypes:=lstCombinedMetadataLists(1), strHeading:=CurrentReceiver.strSelectorHeading, strDataFrameName:=strCurrentDataFrame, strExcludedItems:=strExclud, strDatabaseQuery:=CurrentReceiver.strDatabaseQuery, strNcFilePath:=CurrentReceiver.strNcFilePath) + Dim strNewSelectorFillCondition As String + + 'no need to load elements if receiver is nothing + If CurrentReceiver Is Nothing Then + Exit Sub + End If + + lstCombinedMetadataLists = CombineMetadataLists(CurrentReceiver.lstIncludedMetadataProperties, CurrentReceiver.lstExcludedMetadataProperties) + If CurrentReceiver.bExcludeFromSelector Then + arrStrExclud = GetVariablesInReceiver().ToArray + End If + + 'set the type of 'elements' to show. If current receiver is set to a particular 'element' type then use it + strCurrentType = If(CurrentReceiver.bTypeSet, CurrentReceiver.GetItemType(), strType) + + 'if selector contains columns check if fill conditions are just the same + If strCurrentType = "column" Then + + 'holds the selector's list view 'fill conditions' + 'used as a 'cache' to check if there is need to clear and refill list view based on supplied parameters + Static _strCurrentSelectorFillCondition As String = "" + + 'check if the fill condition is the same, if it is then no need to refill the listview with the same data. + 'LoadList is called several times by different events raised in different places(e.g by linked receivers clearing and setting their contents ). + 'this makes refilling of the listview unnecessarily slow, especially for wide data sets (see comments in issue #7162) + 'long term fix is to find out how the repeated calls to LoadList() can be omitted + strNewSelectorFillCondition = GetSelectorFillCondition(frmMain.DataBook.GetDataFrame(strCurrentDataFrame), + strElementType:=strCurrentType, + lstCombinedMetadataLists:=lstCombinedMetadataLists, + strHeading:=CurrentReceiver.strSelectorHeading, + arrStrExcludedItems:=arrStrExclud, + strDatabaseQuery:=CurrentReceiver.strDatabaseQuery, + strNcFilePath:=CurrentReceiver.strNcFilePath) + If strNewSelectorFillCondition = _strCurrentSelectorFillCondition Then + Exit Sub End If - EnableDataOptions(strCurrentType) - 'Removed as probably don't need to load when no current receiver - 'Else - 'frmMain.clsRLink.FillListView(lstAvailableVariable, strType:=strType, lstIncludedDataTypes:=lstIncludedMetadataProperties, lstExcludedDataTypes:=lstExcludedMetadataProperties, strDataFrameName:=strCurrentDataFrame) + + _strCurrentSelectorFillCondition = strNewSelectorFillCondition End If + + 'todo, for columns, the list view should be field with variables from the .Net metadata object + frmMain.clsRLink.FillListView(lstAvailableVariable, strType:=strCurrentType, lstIncludedDataTypes:=lstCombinedMetadataLists(0), lstExcludedDataTypes:=lstCombinedMetadataLists(1), strHeading:=CurrentReceiver.strSelectorHeading, strDataFrameName:=strCurrentDataFrame, strExcludedItems:=arrStrExclud, strDatabaseQuery:=CurrentReceiver.strDatabaseQuery, strNcFilePath:=CurrentReceiver.strNcFilePath) + EnableDataOptions(strCurrentType) + End Sub + Private Function GetSelectorFillCondition(dataFrame As clsDataFrame, strElementType As String, + lstCombinedMetadataLists As List(Of List(Of KeyValuePair(Of String, String()))), + strHeading As String, arrStrExcludedItems As String(), strDatabaseQuery As String, + strNcFilePath As String) + Dim strSelectorFillCondition As String = "" + + If dataFrame IsNot Nothing Then + strSelectorFillCondition &= dataFrame.strName + strSelectorFillCondition &= dataFrame.clsColumnMetaData.MetadataChangeAuditId + End If + + If Not String.IsNullOrEmpty(strElementType) Then + strSelectorFillCondition &= strElementType + End If + + If Not String.IsNullOrEmpty(strHeading) Then + strSelectorFillCondition &= strHeading + End If + + If Not String.IsNullOrEmpty(strDatabaseQuery) Then + strSelectorFillCondition &= strDatabaseQuery + End If + + If Not String.IsNullOrEmpty(strNcFilePath) Then + strSelectorFillCondition &= strNcFilePath + End If + + If arrStrExcludedItems IsNot Nothing Then + strSelectorFillCondition &= String.Join("", arrStrExcludedItems) + End If + + If lstCombinedMetadataLists IsNot Nothing Then + For iLstIndex As Integer = 0 To lstCombinedMetadataLists.Count - 1 + 'Note, in the dictionary + 'Key = Metadata property (e.g class) and Value = array of metadata values(e.g numeric, factor, character) + For iDctIndex As Integer = 0 To lstCombinedMetadataLists(iLstIndex).Count - 1 + strSelectorFillCondition &= lstCombinedMetadataLists.Item(iLstIndex).Item(iDctIndex).Key + strSelectorFillCondition &= String.Join("", lstCombinedMetadataLists.Item(iLstIndex).Item(iDctIndex).Value) + Next + Next + End If + + Return strSelectorFillCondition + End Function + Private Function GetVariablesInReceiver() As List(Of String) Dim lstVars As New List(Of String) @@ -144,11 +210,6 @@ Public Class ucrSelector 'lstItemsInReceivers.Clear() End Sub - Public Overridable Sub SetIncludeOverall(bInclude As Boolean) - bIncludeOverall = bInclude - LoadList() - End Sub - Public Sub SetCurrentReceiver(conReceiver As ucrReceiver) Dim lstReceiverDataFrames As List(Of String) @@ -508,4 +569,7 @@ Public Class ucrSelector Next End Sub + Private Sub mnuHelp_Click(sender As Object, e As EventArgs) Handles mnuHelp.Click + Help.ShowHelp(Me, frmMain.strStaticPath & "\" & frmMain.strHelpFilePath, HelpNavigator.TopicId, "334") + End Sub End Class diff --git a/instat/ucrSelectorByDataFrame.vb b/instat/ucrSelectorByDataFrame.vb index 57e42cbedb4..5153453009b 100644 --- a/instat/ucrSelectorByDataFrame.vb +++ b/instat/ucrSelectorByDataFrame.vb @@ -26,30 +26,18 @@ Public Class ucrSelectorByDataFrame End If End Sub - Private Sub ucrAvailableDataFrames_DataFrameChanged(sender As Object, e As EventArgs, strPrevDataFrame As String) Handles ucrAvailableDataFrames.DataFrameChanged + Private Sub ucrAvailableDataFrames_ControlValueChanged(sender As Object) Handles ucrAvailableDataFrames.ControlValueChanged strCurrentDataFrame = ucrAvailableDataFrames.cboAvailableDataFrames.Text If CurrentReceiver Is Nothing OrElse CurrentReceiver.bAttachedToPrimaryDataFrame Then strPrimaryDataFrame = strCurrentDataFrame End If LoadList() - If strPrevDataFrame <> ucrAvailableDataFrames.cboAvailableDataFrames.Text Then - OnDataFrameChanged() - End If + OnDataFrameChanged() End Sub Public Overrides Sub Reset() ucrAvailableDataFrames.Reset() MyBase.Reset() - End Sub - - Private Sub ucrSelectorByDataFrame_DataFrameChanged() Handles Me.DataFrameChanged - LoadList() - End Sub - - Public Overrides Sub SetIncludeOverall(bInclude As Boolean) - MyBase.SetIncludeOverall(bInclude) - ucrAvailableDataFrames.SetIncludeOverall(bIncludeOverall) - LoadList() End Sub Public Overrides Sub SetDataframe(strDataframe As String, Optional bEnableDataframe As Boolean = True, Optional bSilent As Boolean = False) diff --git a/instat/ucrSelectorByDataFrameAddRemove.vb b/instat/ucrSelectorByDataFrameAddRemove.vb index 4239422376b..bad842e04ba 100644 --- a/instat/ucrSelectorByDataFrameAddRemove.vb +++ b/instat/ucrSelectorByDataFrameAddRemove.vb @@ -56,8 +56,11 @@ Public Class ucrSelectorByDataFrameAddRemove End If End Sub - Public Sub HideShowAddOrDataOptionsButton(Optional bAddVisible As Boolean = True, Optional bDataOptionsVisible As Boolean = True) + Public Sub HideShowAddOrDataOptionsOrListView(Optional bAddVisible As Boolean = True, + Optional bDataOptionsVisible As Boolean = True, + Optional bListVariables As Boolean = True) btnDataOptions.Visible = bDataOptionsVisible btnAdd.Visible = bAddVisible + lstAvailableVariable.Visible = bListVariables End Sub End Class diff --git a/instat/ucrSplitButton.vb b/instat/ucrSplitButton.vb new file mode 100644 index 00000000000..de6826314e7 --- /dev/null +++ b/instat/ucrSplitButton.vb @@ -0,0 +1,619 @@ + +' R- Instat +' Copyright (C) 2015-2017 +' +' This program is free software: you can redistribute it and/or modify +' it under the terms of the GNU General Public License as published by +' the Free Software Foundation, either version 3 of the License, or +' (at your option) any later version. +' +' This program is distributed in the hope that it will be useful, +' but WITHOUT ANY WARRANTY; without even the implied warranty of +' MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +' GNU General Public License for more details. +' +' You should have received a copy of the GNU General Public License +' along with this program. If not, see . + +Imports System.ComponentModel +Imports System.Windows.Forms.VisualStyles +Imports System.Runtime.InteropServices + +''' +''' Modifies .Net Button to support split button that can popup a contex menu simlar to a drop down +''' +Public Class ucrSplitButton + Inherits Button + + Private _pushButtonState As PushButtonState + Private ReadOnly _iSplitSectionWidth As Integer = 18 + Private ReadOnly _iBorderSize As Integer = SystemInformation.Border3DSize.Width * 2 + Private _dropDownRectangle As Rectangle + Private _bSplitMenuVisible As Boolean + + ''' + ''' used to determine if the button will be displayed and function in 'split' or 'normal' mode + ''' + Private _bShowSplit As Boolean + + ''' + ''' used as the split menu strip + ''' + Private _contextSplitMenuStrip As ContextMenuStrip + Private _textFormatFlags As TextFormatFlags = TextFormatFlags.Default + Private _bSkipNextOpen As Boolean + Private _bMouseEntered As Boolean + + Public Sub New() + 'by default support the autosize. This control aligns it's elements in runtime + AutoSize = True + End Sub + + + Public Overrides Property ContextMenuStrip As ContextMenuStrip + Get + Return SplitMenuStrip + End Get + Set(value As ContextMenuStrip) + SplitMenuStrip = value + End Set + End Property + + ''' + ''' sets the context menu of the control + ''' the context menu will be used for the split menu items + ''' + ''' ContextMenuStrip used by the control as a Split Menu + + Public Property SplitMenuStrip As ContextMenuStrip + Get + Return _contextSplitMenuStrip + End Get + Set(value As ContextMenuStrip) + + If _contextSplitMenuStrip IsNot Nothing Then + RemoveHandler _contextSplitMenuStrip.Closing, AddressOf SplitMenuStrip_Closing + RemoveHandler _contextSplitMenuStrip.Opening, AddressOf SplitMenuStrip_Opening + End If + + _contextSplitMenuStrip = value + + If _contextSplitMenuStrip IsNot Nothing Then + ShowSplit = True + AddHandler _contextSplitMenuStrip.Closing, AddressOf SplitMenuStrip_Closing + AddHandler _contextSplitMenuStrip.Opening, AddressOf SplitMenuStrip_Opening + Else + ShowSplit = False + End If + End Set + End Property + + + Private WriteOnly Property ShowSplit As Boolean + Set(value As Boolean) + + If value <> _bShowSplit Then + _bShowSplit = value + Invalidate() + + If Parent IsNot Nothing Then + Parent.PerformLayout() + End If + End If + End Set + End Property + + ''' + ''' used to determine display state of the button in response to different user events + ''' + ''' + Private Property State As PushButtonState + Get + Return _pushButtonState + End Get + Set(value As PushButtonState) + + If Not _pushButtonState.Equals(value) Then + _pushButtonState = value + Invalidate() + End If + End Set + End Property + + Protected Overrides Function IsInputKey(keyData As Keys) As Boolean + If keyData.Equals(Keys.Down) AndAlso _bShowSplit Then + Return True + End If + Return MyBase.IsInputKey(keyData) + End Function + + Protected Overrides Sub OnGotFocus(e As EventArgs) + If Not _bShowSplit Then + MyBase.OnGotFocus(e) + Return + End If + + If Not State.Equals(PushButtonState.Pressed) AndAlso Not State.Equals(PushButtonState.Disabled) Then + State = PushButtonState.Default + End If + End Sub + + Protected Overrides Sub OnKeyDown(kevent As KeyEventArgs) + If _bShowSplit Then + If kevent.KeyCode.Equals(Keys.Down) AndAlso Not _bSplitMenuVisible Then + ShowContextMenuStrip() + ElseIf kevent.KeyCode.Equals(Keys.Space) AndAlso kevent.Modifiers = Keys.None Then + State = PushButtonState.Pressed + End If + End If + + MyBase.OnKeyDown(kevent) + End Sub + + Protected Overrides Sub OnKeyUp(kevent As KeyEventArgs) + If kevent.KeyCode.Equals(Keys.Space) Then + If MouseButtons = MouseButtons.None Then + State = PushButtonState.Normal + End If + ElseIf kevent.KeyCode.Equals(Keys.Apps) Then + If MouseButtons = MouseButtons.None AndAlso Not _bSplitMenuVisible Then + ShowContextMenuStrip() + End If + End If + + MyBase.OnKeyUp(kevent) + End Sub + + Protected Overrides Sub OnEnabledChanged(e As EventArgs) + State = If(Enabled, PushButtonState.Normal, PushButtonState.Disabled) + MyBase.OnEnabledChanged(e) + End Sub + + Protected Overrides Sub OnLostFocus(e As EventArgs) + If Not _bShowSplit Then + MyBase.OnLostFocus(e) + Return + End If + + If Not State.Equals(PushButtonState.Pressed) AndAlso Not State.Equals(PushButtonState.Disabled) Then + State = PushButtonState.Normal + End If + End Sub + + Protected Overrides Sub OnMouseEnter(e As EventArgs) + If Not _bShowSplit Then + MyBase.OnMouseEnter(e) + Return + End If + + _bMouseEntered = True + + If Not State.Equals(PushButtonState.Pressed) AndAlso Not State.Equals(PushButtonState.Disabled) Then + State = PushButtonState.Hot + End If + End Sub + + Protected Overrides Sub OnMouseLeave(e As EventArgs) + If Not _bShowSplit Then + MyBase.OnMouseLeave(e) + Return + End If + + _bMouseEntered = False + + If Not State.Equals(PushButtonState.Pressed) AndAlso Not State.Equals(PushButtonState.Disabled) Then + State = If(Focused, PushButtonState.Default, PushButtonState.Normal) + End If + End Sub + + Protected Overrides Sub OnMouseDown(e As MouseEventArgs) + If Not _bShowSplit Then + MyBase.OnMouseDown(e) + Return + End If + + If _contextSplitMenuStrip IsNot Nothing AndAlso e.Button = MouseButtons.Left AndAlso Not _bMouseEntered Then + _bSkipNextOpen = True + End If + + If _dropDownRectangle.Contains(e.Location) AndAlso Not _bSplitMenuVisible AndAlso e.Button = MouseButtons.Left Then + ShowContextMenuStrip() + Else + State = PushButtonState.Pressed + End If + End Sub + + Protected Overrides Sub OnMouseUp(mevent As MouseEventArgs) + If Not _bShowSplit Then + MyBase.OnMouseUp(mevent) + Return + End If + + If mevent.Button = MouseButtons.Right AndAlso ClientRectangle.Contains(mevent.Location) AndAlso Not _bSplitMenuVisible Then + ShowContextMenuStrip() + ElseIf _contextSplitMenuStrip Is Nothing OrElse Not _bSplitMenuVisible Then + SetButtonDrawState() + + If ClientRectangle.Contains(mevent.Location) AndAlso Not _dropDownRectangle.Contains(mevent.Location) Then + OnClick(New EventArgs()) + End If + End If + End Sub + + Protected Overrides Sub OnPaint(pevent As PaintEventArgs) + MyBase.OnPaint(pevent) + If Not _bShowSplit Then Exit Sub + + '----------------------------------------------- + 'below code draws the separator and drop down icon inside the control + + Dim g As Graphics = pevent.Graphics + Dim bounds As Rectangle = ClientRectangle + + If State <> PushButtonState.Pressed AndAlso IsDefault AndAlso Not Application.RenderWithVisualStyles Then + Dim backgroundBounds As Rectangle = bounds + backgroundBounds.Inflate(-1, -1) + ButtonRenderer.DrawButton(g, backgroundBounds, State) + g.DrawRectangle(SystemPens.WindowFrame, 0, 0, bounds.Width - 1, bounds.Height - 1) + Else + ButtonRenderer.DrawButton(g, bounds, State) + End If + + _dropDownRectangle = New Rectangle(bounds.Right - _iSplitSectionWidth, 0, _iSplitSectionWidth, bounds.Height) + Dim iInternalBorder As Integer = _iBorderSize + Dim focusRect As Rectangle = New Rectangle(iInternalBorder - 1, iInternalBorder - 1, bounds.Width - _dropDownRectangle.Width - iInternalBorder, bounds.Height - (iInternalBorder * 2) + 2) + Dim bDrawSplitLine As Boolean = (State = PushButtonState.Hot OrElse State = PushButtonState.Pressed OrElse Not Application.RenderWithVisualStyles) + + If bDrawSplitLine Then + g.DrawLine(SystemPens.ButtonShadow, bounds.Right - _iSplitSectionWidth, _iBorderSize, bounds.Right - _iSplitSectionWidth, bounds.Bottom - _iBorderSize) + g.DrawLine(SystemPens.ButtonFace, bounds.Right - _iSplitSectionWidth - 1, _iBorderSize, bounds.Right - _iSplitSectionWidth - 1, bounds.Bottom - _iBorderSize) + End If + + 'below commented code is meant to support Right To Left language locales, + 'it can be activated if that support is desired. + 'will draw the elements from R, that is, 'down icon', 'split icon' then the text + 'If RightToLeft = RightToLeft.Yes Then + ' _dropDownRectangle.X = bounds.Left + 1 + ' focusRect.X = _dropDownRectangle.Right + + ' If bDrawSplitLine Then + ' g.DrawLine(SystemPens.ButtonShadow, bounds.Left + _iSplitSectionWidth, _borderSize, bounds.Left + _iSplitSectionWidth, bounds.Bottom - _borderSize) + ' g.DrawLine(SystemPens.ButtonFace, bounds.Left + _iSplitSectionWidth + 1, _borderSize, bounds.Left + _iSplitSectionWidth + 1, bounds.Bottom - _borderSize) + ' End If + 'Else + ' If bDrawSplitLine Then + ' g.DrawLine(SystemPens.ButtonShadow, bounds.Right - _iSplitSectionWidth, _borderSize, bounds.Right - _iSplitSectionWidth, bounds.Bottom - _borderSize) + ' g.DrawLine(SystemPens.ButtonFace, bounds.Right - _iSplitSectionWidth - 1, _borderSize, bounds.Right - _iSplitSectionWidth - 1, bounds.Bottom - _borderSize) + ' End If + 'End If + + PaintArrow(g, _dropDownRectangle) + PaintTextandImage(g, New Rectangle(0, 0, ClientRectangle.Width - _iSplitSectionWidth, ClientRectangle.Height)) + + If State <> PushButtonState.Pressed AndAlso Focused AndAlso ShowFocusCues Then + ControlPaint.DrawFocusRectangle(g, focusRect) + End If + End Sub + + Private Sub PaintArrow(g As Graphics, dropDownRect As Rectangle) + Dim middle As Point = New Point(Convert.ToInt32(dropDownRect.Left + dropDownRect.Width / 2), Convert.ToInt32(dropDownRect.Top + dropDownRect.Height / 2)) + middle.X += (dropDownRect.Width Mod 2) + Dim arrow As Point() = {New Point(middle.X - 2, middle.Y - 1), New Point(middle.X + 3, middle.Y - 1), New Point(middle.X, middle.Y + 2)} + + If Enabled Then + g.FillPolygon(SystemBrushes.ControlText, arrow) + Else + g.FillPolygon(SystemBrushes.ButtonShadow, arrow) + End If + End Sub + + Private Sub PaintTextandImage(g As Graphics, bounds As Rectangle) + Dim textRectangle As Rectangle + Dim imageRectangle As Rectangle + CalculateAndSetButtonTextAndImageLayout(bounds, textRectangle, imageRectangle) + + If Image IsNot Nothing Then + + If Enabled Then + g.DrawImage(Image, imageRectangle.X, imageRectangle.Y, Image.Width, Image.Height) + Else + ControlPaint.DrawImageDisabled(g, Image, imageRectangle.X, imageRectangle.Y, BackColor) + End If + End If + + If Not UseMnemonic Then + _textFormatFlags = _textFormatFlags Or TextFormatFlags.NoPrefix + ElseIf Not ShowKeyboardCues Then + _textFormatFlags = _textFormatFlags Or TextFormatFlags.HidePrefix + End If + + If Not String.IsNullOrEmpty(Text) Then + + If Enabled Then + TextRenderer.DrawText(g, Text, Font, textRectangle, ForeColor, _textFormatFlags) + Else + ControlPaint.DrawStringDisabled(g, Text, Font, BackColor, textRectangle, _textFormatFlags) + End If + End If + End Sub + + + Public Overrides Function GetPreferredSize(proposedSize As Size) As Size + Dim preferredSize As Size = MyBase.GetPreferredSize(proposedSize) + + If _bShowSplit Then + If AutoSize Then + Return CalculateButtonAutoSize() + End If + If Not String.IsNullOrEmpty(Text) AndAlso TextRenderer.MeasureText(Text, Font).Width + _iSplitSectionWidth > preferredSize.Width Then + Return preferredSize + New Size(_iSplitSectionWidth + _iBorderSize * 2, 0) + End If + End If + + Return preferredSize + End Function + + Private Function CalculateButtonAutoSize() As Size + Dim rectSize As Size = Size.Empty + Dim textSize As Size = TextRenderer.MeasureText(Text, Font) + Dim imageSize As Size = If(Image Is Nothing, Size.Empty, Image.Size) + + If Text.Length <> 0 Then + textSize.Height += 4 + textSize.Width += 4 + End If + + Select Case TextImageRelation + Case TextImageRelation.Overlay + rectSize.Height = Math.Max(If(Text.Length = 0, 0, textSize.Height), imageSize.Height) + rectSize.Width = Math.Max(textSize.Width, imageSize.Width) + Case TextImageRelation.ImageAboveText, TextImageRelation.TextAboveImage + rectSize.Height = textSize.Height + imageSize.Height + rectSize.Width = Math.Max(textSize.Width, imageSize.Width) + Case TextImageRelation.ImageBeforeText, TextImageRelation.TextBeforeImage + rectSize.Height = Math.Max(textSize.Height, imageSize.Height) + rectSize.Width = textSize.Width + imageSize.Width + End Select + + rectSize.Height += Padding.Vertical + 6 + rectSize.Width += Padding.Horizontal + 6 + If _bShowSplit Then + rectSize.Width += _iSplitSectionWidth + End If + Return rectSize + End Function + + Private Sub CalculateAndSetButtonTextAndImageLayout(ByRef contentRect As Rectangle, ByRef textRectangle As Rectangle, ByRef imageRectangle As Rectangle) + Dim textSize As Size = TextRenderer.MeasureText(Text, Font, contentRect.Size, _textFormatFlags) + Dim imageSize As Size = If(Image Is Nothing, Size.Empty, Image.Size) + textRectangle = Rectangle.Empty + imageRectangle = Rectangle.Empty + + Select Case TextImageRelation + Case TextImageRelation.Overlay + textRectangle = OverlayObjectRect(contentRect, textSize, TextAlign) + If _pushButtonState = PushButtonState.Pressed AndAlso Not Application.RenderWithVisualStyles Then textRectangle.Offset(1, 1) + If Image IsNot Nothing Then imageRectangle = OverlayObjectRect(contentRect, imageSize, ImageAlign) + Case TextImageRelation.ImageAboveText + contentRect.Inflate(-4, -4) + SetLayoutTextAboveOrBelowImage(contentRect, False, textSize, imageSize, textRectangle, imageRectangle) + Case TextImageRelation.TextAboveImage + contentRect.Inflate(-4, -4) + SetLayoutTextAboveOrBelowImage(contentRect, True, textSize, imageSize, textRectangle, imageRectangle) + Case TextImageRelation.ImageBeforeText + contentRect.Inflate(-4, -4) + SetLayoutTextBeforeOrAfterImage(contentRect, False, textSize, imageSize, textRectangle, imageRectangle) + Case TextImageRelation.TextBeforeImage + contentRect.Inflate(-4, -4) + SetLayoutTextBeforeOrAfterImage(contentRect, True, textSize, imageSize, textRectangle, imageRectangle) + End Select + End Sub + + Private Function OverlayObjectRect(ByRef container As Rectangle, ByRef sizeOfObject As Size, alignment As System.Drawing.ContentAlignment) As Rectangle + Dim x, y As Integer + + Select Case alignment + Case System.Drawing.ContentAlignment.TopLeft + x = 4 + y = 4 + Case System.Drawing.ContentAlignment.TopCenter + x = (container.Width - sizeOfObject.Width) / 2 + y = 4 + Case System.Drawing.ContentAlignment.TopRight + x = container.Width - sizeOfObject.Width - 4 + y = 4 + Case System.Drawing.ContentAlignment.MiddleLeft + x = 4 + y = (container.Height - sizeOfObject.Height) / 2 + Case System.Drawing.ContentAlignment.MiddleCenter + x = (container.Width - sizeOfObject.Width) / 2 + y = (container.Height - sizeOfObject.Height) / 2 + Case System.Drawing.ContentAlignment.MiddleRight + x = container.Width - sizeOfObject.Width - 4 + y = (container.Height - sizeOfObject.Height) / 2 + Case System.Drawing.ContentAlignment.BottomLeft + x = 4 + y = container.Height - sizeOfObject.Height - 4 + Case System.Drawing.ContentAlignment.BottomCenter + x = (container.Width - sizeOfObject.Width) / 2 + y = container.Height - sizeOfObject.Height - 4 + Case System.Drawing.ContentAlignment.BottomRight + x = container.Width - sizeOfObject.Width - 4 + y = container.Height - sizeOfObject.Height - 4 + Case Else + x = 4 + y = 4 + End Select + + Return New Rectangle(x, y, sizeOfObject.Width, sizeOfObject.Height) + End Function + + Private Sub SetLayoutTextBeforeOrAfterImage(ByVal totalArea As Rectangle, ByVal textFirst As Boolean, ByVal textSize As Size, ByVal imageSize As Size, ByRef textRect As Rectangle, ByRef imageRect As Rectangle) + Dim iElementSpacing As Integer = 0 + Dim iTotalWidth As Integer = textSize.Width + iElementSpacing + imageSize.Width + If Not textFirst Then iElementSpacing += 2 + + If iTotalWidth > totalArea.Width Then + textSize.Width = totalArea.Width - iElementSpacing - imageSize.Width + iTotalWidth = totalArea.Width + End If + + Dim iExcessWidth As Integer = totalArea.Width - iTotalWidth + Dim iOffset As Integer = 0 + Dim finalTextRect As Rectangle + Dim finalImageRect As Rectangle + Dim hText As HorizontalAlignment = GetHorizontalAlignment(TextAlign) + Dim hImage As HorizontalAlignment = GetHorizontalAlignment(ImageAlign) + + If hImage = HorizontalAlignment.Left Then + iOffset = 0 + ElseIf hImage = HorizontalAlignment.Right AndAlso hText = HorizontalAlignment.Right Then + iOffset = iExcessWidth + ElseIf hImage = HorizontalAlignment.Center AndAlso (hText = HorizontalAlignment.Left OrElse hText = HorizontalAlignment.Center) Then + iOffset += iExcessWidth / 3 + Else + iOffset += 2 * (iExcessWidth / 3) + End If + + If textFirst Then + finalTextRect = New Rectangle(totalArea.Left + iOffset, GetAlignInRectangle(totalArea, textSize, TextAlign).Top, textSize.Width, textSize.Height) + finalImageRect = New Rectangle(finalTextRect.Right + iElementSpacing, GetAlignInRectangle(totalArea, imageSize, ImageAlign).Top, imageSize.Width, imageSize.Height) + Else + finalImageRect = New Rectangle(totalArea.Left + iOffset, GetAlignInRectangle(totalArea, imageSize, ImageAlign).Top, imageSize.Width, imageSize.Height) + finalTextRect = New Rectangle(finalImageRect.Right + iElementSpacing, GetAlignInRectangle(totalArea, textSize, TextAlign).Top, textSize.Width, textSize.Height) + End If + + textRect = finalTextRect + imageRect = finalImageRect + End Sub + + Private Sub SetLayoutTextAboveOrBelowImage(totalArea As Rectangle, bTextFirst As Boolean, textSize As Size, imageSize As Size, ByRef textRect As Rectangle, ByRef imageRect As Rectangle) + Dim iElementSpacing As Integer = 0 + Dim iTotalHeight As Integer = textSize.Height + iElementSpacing + imageSize.Height + If bTextFirst Then iElementSpacing += 2 + If textSize.Width > totalArea.Width Then textSize.Width = totalArea.Width + + If iTotalHeight > totalArea.Height AndAlso bTextFirst Then + imageSize = Size.Empty + iTotalHeight = totalArea.Height + End If + + Dim iExcessHeight As Integer = totalArea.Height - iTotalHeight + Dim iOffset As Integer = 0 + Dim finalTextRect As Rectangle + Dim finalImageRect As Rectangle + Dim verticalText As VerticalAlignment = GetVerticalAlignment(TextAlign) + Dim verticalImage As VerticalAlignment = GetVerticalAlignment(ImageAlign) + + If verticalImage = VerticalAlignment.Top Then + iOffset = 0 + ElseIf verticalImage = VerticalAlignment.Bottom AndAlso verticalText = VerticalAlignment.Bottom Then + iOffset = iExcessHeight + ElseIf verticalImage = VerticalAlignment.Center AndAlso (verticalText = VerticalAlignment.Top OrElse verticalText = VerticalAlignment.Center) Then + iOffset += iExcessHeight / 3 + Else + iOffset += 2 * (iExcessHeight / 3) + End If + + If bTextFirst Then + finalTextRect = New Rectangle(GetAlignInRectangle(totalArea, textSize, TextAlign).Left, totalArea.Top + iOffset, textSize.Width, textSize.Height) + finalImageRect = New Rectangle(GetAlignInRectangle(totalArea, imageSize, ImageAlign).Left, finalTextRect.Bottom + iElementSpacing, imageSize.Width, imageSize.Height) + Else + finalImageRect = New Rectangle(GetAlignInRectangle(totalArea, imageSize, ImageAlign).Left, totalArea.Top + iOffset, imageSize.Width, imageSize.Height) + finalTextRect = New Rectangle(GetAlignInRectangle(totalArea, textSize, TextAlign).Left, finalImageRect.Bottom + iElementSpacing, textSize.Width, textSize.Height) + If finalTextRect.Bottom > totalArea.Bottom Then finalTextRect.Y = totalArea.Top + End If + + textRect = finalTextRect + imageRect = finalImageRect + End Sub + + Private Function GetHorizontalAlignment(enumAlign As System.Drawing.ContentAlignment) As HorizontalAlignment + Select Case enumAlign + Case System.Drawing.ContentAlignment.BottomLeft, System.Drawing.ContentAlignment.MiddleLeft, System.Drawing.ContentAlignment.TopLeft + Return HorizontalAlignment.Left + Case System.Drawing.ContentAlignment.BottomCenter, System.Drawing.ContentAlignment.MiddleCenter, System.Drawing.ContentAlignment.TopCenter + Return HorizontalAlignment.Center + Case System.Drawing.ContentAlignment.BottomRight, System.Drawing.ContentAlignment.MiddleRight, System.Drawing.ContentAlignment.TopRight + Return HorizontalAlignment.Right + End Select + + Return HorizontalAlignment.Left + End Function + + Private Function GetVerticalAlignment(enumAlign As System.Drawing.ContentAlignment) As VerticalAlignment + Select Case enumAlign + Case System.Drawing.ContentAlignment.TopLeft, System.Drawing.ContentAlignment.TopCenter, System.Drawing.ContentAlignment.TopRight + Return VerticalAlignment.Top + Case System.Drawing.ContentAlignment.MiddleLeft, System.Drawing.ContentAlignment.MiddleCenter, System.Drawing.ContentAlignment.MiddleRight + Return VerticalAlignment.Center + Case System.Drawing.ContentAlignment.BottomLeft, System.Drawing.ContentAlignment.BottomCenter, System.Drawing.ContentAlignment.BottomRight + Return VerticalAlignment.Bottom + End Select + + Return VerticalAlignment.Top + End Function + + Private Function GetAlignInRectangle(outer As Rectangle, inner As Size, enumAlign As System.Drawing.ContentAlignment) As Rectangle + Dim x As Integer = 0 + Dim y As Integer = 0 + + If enumAlign = System.Drawing.ContentAlignment.BottomLeft OrElse enumAlign = System.Drawing.ContentAlignment.MiddleLeft OrElse enumAlign = System.Drawing.ContentAlignment.TopLeft Then + x = outer.X + ElseIf enumAlign = System.Drawing.ContentAlignment.BottomCenter OrElse enumAlign = System.Drawing.ContentAlignment.MiddleCenter OrElse enumAlign = System.Drawing.ContentAlignment.TopCenter Then + x = Math.Max(outer.X + ((outer.Width - inner.Width) / 2), outer.Left) + ElseIf enumAlign = System.Drawing.ContentAlignment.BottomRight OrElse enumAlign = System.Drawing.ContentAlignment.MiddleRight OrElse enumAlign = System.Drawing.ContentAlignment.TopRight Then + x = outer.Right - inner.Width + End If + + If enumAlign = System.Drawing.ContentAlignment.TopCenter OrElse enumAlign = System.Drawing.ContentAlignment.TopLeft OrElse enumAlign = System.Drawing.ContentAlignment.TopRight Then + y = outer.Y + ElseIf enumAlign = System.Drawing.ContentAlignment.MiddleCenter OrElse enumAlign = System.Drawing.ContentAlignment.MiddleLeft OrElse enumAlign = System.Drawing.ContentAlignment.MiddleRight Then + y = outer.Y + (outer.Height - inner.Height) / 2 + ElseIf enumAlign = System.Drawing.ContentAlignment.BottomCenter OrElse enumAlign = System.Drawing.ContentAlignment.BottomRight OrElse enumAlign = System.Drawing.ContentAlignment.BottomLeft Then + y = outer.Bottom - inner.Height + End If + + Return New Rectangle(x, y, Math.Min(inner.Width, outer.Width), Math.Min(inner.Height, outer.Height)) + End Function + + Private Sub ShowContextMenuStrip() + If _bSkipNextOpen Then + _bSkipNextOpen = False + Return + End If + + State = PushButtonState.Pressed + + If _contextSplitMenuStrip IsNot Nothing Then + _contextSplitMenuStrip.Show(Me, New Point(0, Height), ToolStripDropDownDirection.BelowRight) + End If + End Sub + + Private Sub SplitMenuStrip_Opening(sender As Object, e As CancelEventArgs) + _bSplitMenuVisible = True + End Sub + + Private Sub SplitMenuStrip_Closing(ByVal sender As Object, ByVal e As ToolStripDropDownClosingEventArgs) + _bSplitMenuVisible = False + SetButtonDrawState() + + If e.CloseReason = ToolStripDropDownCloseReason.AppClicked Then + _bSkipNextOpen = _dropDownRectangle.Contains(PointToClient(Cursor.Position)) AndAlso MouseButtons = MouseButtons.Left + End If + End Sub + + Private Sub SetButtonDrawState() + If Bounds.Contains(Parent.PointToClient(Cursor.Position)) Then + State = PushButtonState.Hot + ElseIf Focused Then + State = PushButtonState.Default + ElseIf Not Enabled Then + State = PushButtonState.Disabled + Else + State = PushButtonState.Normal + End If + End Sub +End Class + + diff --git a/packages/RScript.1.0.4/.signature.p7s b/packages/RScript.1.0.6/.signature.p7s similarity index 88% rename from packages/RScript.1.0.4/.signature.p7s rename to packages/RScript.1.0.6/.signature.p7s index b53c58be83d..6db6249328f 100644 Binary files a/packages/RScript.1.0.4/.signature.p7s and b/packages/RScript.1.0.6/.signature.p7s differ diff --git a/packages/RScript.1.0.4/lib/net461/RScript.dll b/packages/RScript.1.0.6/lib/net461/RScript.dll similarity index 50% rename from packages/RScript.1.0.4/lib/net461/RScript.dll rename to packages/RScript.1.0.6/lib/net461/RScript.dll index 90412a912bb..731e11dfaa6 100644 Binary files a/packages/RScript.1.0.4/lib/net461/RScript.dll and b/packages/RScript.1.0.6/lib/net461/RScript.dll differ diff --git a/packages/RScript.1.0.4/lib/net461/RScript.xml b/packages/RScript.1.0.6/lib/net461/RScript.xml similarity index 99% rename from packages/RScript.1.0.4/lib/net461/RScript.xml rename to packages/RScript.1.0.6/lib/net461/RScript.xml index 3d456d29a4a..683778596c6 100644 --- a/packages/RScript.1.0.4/lib/net461/RScript.xml +++ b/packages/RScript.1.0.6/lib/net461/RScript.xml @@ -538,7 +538,8 @@ RScript -------------------------------------------------------------------------------------------- - Returns true if is a valid lexeme, else returns false. + Returns true if is a valid lexeme (either partial or + complete), else returns false. A sequence of characters from a syntactically correct R script @@ -564,9 +565,10 @@ RScript -------------------------------------------------------------------------------------------- Returns true if is a complete or partial string constant, else returns false. - String constants are delimited by a pair of single (‘'’) or double (‘"’) quotes - and can contain all other printable characters. Quotes and other special - characters within strings are specified using escape sequences. + String constants are delimited by a pair of single (‘'’), double (‘"’) + or backtick ('`') quotes and can contain all other printable characters. + Quotes and other special characters within strings are specified using escape + sequences. The text to check.