Skip to content

Commit

Permalink
Merge pull request #100 from deaspo/dlgDialogs
Browse files Browse the repository at this point in the history
merged Polycarp's Name dialog
  • Loading branch information
dannyparsons committed Mar 11, 2016
2 parents 111ef4f + 94e8c50 commit d5c23b4
Show file tree
Hide file tree
Showing 4 changed files with 64 additions and 53 deletions.
34 changes: 17 additions & 17 deletions instat/dlgName.Designer.vb

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

76 changes: 42 additions & 34 deletions instat/dlgName.vb
Original file line number Diff line number Diff line change
Expand Up @@ -16,54 +16,62 @@

Imports instat.Translations
Public Class dlgName
Private bUseDefaultName As Boolean
Dim bFirstLoad As Boolean = True
Public bRightClick As Boolean = False
Public strCurrentWorksheetName As String
Public strSelectedColumn As String
Private Sub dlgName_Load(sender As Object, e As EventArgs) Handles Me.Load
ucrBase.iHelpTopicID = 33
ucrReceiverNames.Selector = ucrSelectorByDataFrameAddRemove
ucrReceiverNames.Selector = ucrSelectorByDataFrameAddRemove
defaultSettings()
autoTranslate(Me)
'set the function
ucrBase.clsRsyntax.SetFunction(frmMain.clsRLink.strInstatDataObject & "$rename_column_in_data")
ucrReceiverNames.txtReceiverSingle.Text = frmEditor.grdData.CurrentWorksheet.ColumnHeaders(frmEditor.grdData.CurrentWorksheet.SelectionRange.Col).[Text]
If bFirstLoad Then
SetDefaults()
bFirstLoad = False
End If
If bRightClick Then
ucrReceiverName.txtReceiverSingle.Text = strSelectedColumn
txtName.Text = strSelectedColumn
bRightClick = False
Else
ucrReceiverName.txtReceiverSingle.Text = ""
txtName.Text = ""
End If
TestOKEnabled()
End Sub

Private Sub defaultSettings()
autoTranslate(Me)
ucrReceiverNames.Clear()
ucrReceiverNames.Enabled = False
ucrReceiverNames.Visible = False
ucrReceiverNames.Clear()
ucrReceiverNames.SetMeAsReceiver()
ucrReceiverNames.Enabled = True
ucrReceiverNames.Visible = True
bUseDefaultName = True
'txtName.Text = ""
Private Sub SetDefaults()
ucrSelectVariables.Reset()
ucrReceiverName.Selector = ucrSelectVariables
ucrReceiverName.SetMeAsReceiver()
ucrSelectVariables.ucrAvailableDataFrames.cboAvailableDataFrames.SelectedItem = strCurrentWorksheetName
End Sub

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

Private Sub ucrSingle_ValueChanged(sender As Object, e As EventArgs) Handles ucrReceiverNames.ValueChanged
If bUseDefaultName Then
txtName.Text = ucrReceiverNames.txtReceiverSingle.Text
End If
Private Sub ucrReceiverName_SelectionChanged(sender As Object, e As EventArgs) Handles ucrReceiverName.SelectionChanged
ucrBase.clsRsyntax.AddParameter("column_name", ucrReceiverName.GetVariableNames)
txtName.Text = ucrReceiverName.GetVariableNames
TestOKEnabled()
End Sub

Private Sub txtName_KeyPress(sender As Object, e As KeyPressEventArgs) Handles txtName.KeyPress
bUseDefaultName = False
Private Sub txtName_Leave(sender As Object, e As EventArgs) Handles txtName.Leave
ucrBase.clsRsyntax.AddParameter("new_val", Chr(34) & txtName.Text & Chr(34))
TestOKEnabled()
End Sub

'Public Sub setWorksheet(strCurrentWorksheetName As String, strSelectedColumn As String)
' ucrAddRemove.AddVariable(strCurrentWorksheetName, strSelectedColumn)
'End Sub

Private Sub ucrSingle_Leave(sender As Object, e As EventArgs) Handles ucrReceiverNames.Leave
ucrBase.clsRsyntax.AddParameter("data_name", Chr(34) & frmEditor.grdData.CurrentWorksheet.Name & Chr(34))
ucrBase.clsRsyntax.AddParameter("column_name", Chr(34) & frmEditor.grdData.CurrentWorksheet.ColumnHeaders(frmEditor.grdData.CurrentWorksheet.SelectionRange.Col).[Text] & Chr(34))
Private Sub TestOKEnabled()
If Not ucrReceiverName.IsEmpty() And txtName.Text <> "" Then
ucrBase.OKEnabled(True)
Else
ucrBase.OKEnabled(False)
End If
End Sub

Private Sub txtName_Leave(sender As Object, e As EventArgs) Handles txtName.Leave
ucrBase.clsRsyntax.AddParameter("new_val", Chr(34) & txtName.Text & Chr(34))
Private Sub ucrSelectVariables_DataFrameChanged() Handles ucrSelectVariables.DataFrameChanged
ucrBase.clsRsyntax.AddParameter("data_name", ucrSelectVariables.ucrAvailableDataFrames.cboAvailableDataFrames.SelectedItem)
End Sub
End Class

End Class
4 changes: 3 additions & 1 deletion instat/frmEditor.vb
Original file line number Diff line number Diff line change
Expand Up @@ -220,13 +220,15 @@ Public Class frmEditor
End Sub

Private Sub mnuColumnRename_Click(sender As Object, e As EventArgs) Handles mnuColumnRename.Click
dlgName.bRightClick = True
dlgName.strCurrentWorksheetName = grdCurrSheet.Name
dlgName.strSelectedColumn = grdCurrSheet.ColumnHeaders(grdData.CurrentWorksheet.SelectionRange.Col).[Text]
dlgName.ShowDialog()
End Sub

Private Sub grdData_CurrentWorksheetChanged(sender As Object, e As EventArgs) Handles grdData.CurrentWorksheetChanged, Me.Load, grdData.WorksheetInserted
grdCurrSheet = grdData.CurrentWorksheet
frmMain.strCurrentDataFrame = grdCurrSheet.Name

frmMain.tstatus.Text = grdCurrSheet.Name
End Sub

Expand Down
3 changes: 2 additions & 1 deletion instat/frmMain.vb
Original file line number Diff line number Diff line change
Expand Up @@ -727,7 +727,7 @@ Public Class frmMain
End Sub

Private Sub mnuTbSave_Click(sender As Object, e As EventArgs) Handles mnuTbSave.Click
mnuFileSave_click(sender, e)
mnuFileSave_Click(sender, e)
End Sub

Private Sub mnuFileSave_Click(sender As Object, e As EventArgs) Handles mnuFileSave.Click
Expand Down Expand Up @@ -882,3 +882,4 @@ Public Class frmMain
dlgRandomSubset.ShowDialog()
End Sub
End Class

0 comments on commit d5c23b4

Please sign in to comment.