From aa39b4c89d72c93773ef42a4921bed2b065a710d Mon Sep 17 00:00:00 2001 From: n-thony Date: Wed, 25 Oct 2023 18:59:27 +0300 Subject: [PATCH] added function option --- instat/dlgScript.Designer.vb | 85 ++++++++++++++++++++++++++++++------ instat/dlgScript.vb | 24 +++++++++- 2 files changed, 94 insertions(+), 15 deletions(-) diff --git a/instat/dlgScript.Designer.vb b/instat/dlgScript.Designer.vb index 10e39123513..c0bc462b253 100644 --- a/instat/dlgScript.Designer.vb +++ b/instat/dlgScript.Designer.vb @@ -49,9 +49,9 @@ Partial Class dlgScript Me.ucrSaveModel = New instat.ucrSave() Me.ucrSaveTable = New instat.ucrSave() Me.ucrSaveColumn = New instat.ucrSave() - Me.ucrDataFrameSave = New instat.ucrDataFrame() Me.ucrSaveGraph = New instat.ucrSave() Me.ucrPnlSaveData = New instat.UcrPanel() + Me.ucrDataFrameSave = New instat.ucrDataFrame() Me.TabPage4 = New System.Windows.Forms.TabPage() Me.Label2 = New System.Windows.Forms.Label() Me.ucrInputRemoveObject = New instat.ucrInputTextBox() @@ -64,6 +64,10 @@ Partial Class dlgScript Me.ucrBase = New instat.ucrButtons() Me.ucrChkEditLibrary = New instat.ucrCheck() Me.ucrInputPreviewLibrary = New instat.ucrInputTextBox() + Me.ucrPnlExample = New instat.UcrPanel() + Me.rdoData = New System.Windows.Forms.RadioButton() + Me.rdoFunction = New System.Windows.Forms.RadioButton() + Me.ucrInputFunction = New instat.ucrInputTextBox() Me.TabControl1.SuspendLayout() Me.TabPage1.SuspendLayout() Me.TabPage5.SuspendLayout() @@ -436,17 +440,6 @@ Partial Class dlgScript Me.ucrSaveColumn.Size = New System.Drawing.Size(411, 33) Me.ucrSaveColumn.TabIndex = 35 ' - 'ucrDataFrameSave - ' - Me.ucrDataFrameSave.AutoSize = True - Me.ucrDataFrameSave.bDropUnusedFilterLevels = False - Me.ucrDataFrameSave.bUseCurrentFilter = True - Me.ucrDataFrameSave.Location = New System.Drawing.Point(20, 74) - Me.ucrDataFrameSave.Margin = New System.Windows.Forms.Padding(0) - Me.ucrDataFrameSave.Name = "ucrDataFrameSave" - Me.ucrDataFrameSave.Size = New System.Drawing.Size(252, 59) - Me.ucrDataFrameSave.TabIndex = 29 - ' 'ucrSaveGraph ' Me.ucrSaveGraph.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink @@ -465,6 +458,17 @@ Partial Class dlgScript Me.ucrPnlSaveData.Size = New System.Drawing.Size(603, 54) Me.ucrPnlSaveData.TabIndex = 47 ' + 'ucrDataFrameSave + ' + Me.ucrDataFrameSave.AutoSize = True + Me.ucrDataFrameSave.bDropUnusedFilterLevels = False + Me.ucrDataFrameSave.bUseCurrentFilter = True + Me.ucrDataFrameSave.Location = New System.Drawing.Point(20, 74) + Me.ucrDataFrameSave.Margin = New System.Windows.Forms.Padding(0) + Me.ucrDataFrameSave.Name = "ucrDataFrameSave" + Me.ucrDataFrameSave.Size = New System.Drawing.Size(252, 59) + Me.ucrDataFrameSave.TabIndex = 29 + ' 'TabPage4 ' Me.TabPage4.Controls.Add(Me.Label2) @@ -500,6 +504,10 @@ Partial Class dlgScript ' 'TabPage6 ' + Me.TabPage6.Controls.Add(Me.ucrInputFunction) + Me.TabPage6.Controls.Add(Me.rdoFunction) + Me.TabPage6.Controls.Add(Me.rdoData) + Me.TabPage6.Controls.Add(Me.ucrPnlExample) Me.TabPage6.Controls.Add(Me.lstCollection) Me.TabPage6.Controls.Add(Me.Label3) Me.TabPage6.Controls.Add(Me.ucrComboGetPackages) @@ -553,7 +561,7 @@ Partial Class dlgScript Me.ucrComboGetPackages.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink Me.ucrComboGetPackages.GetSetSelectedIndex = -1 Me.ucrComboGetPackages.IsReadOnly = False - Me.ucrComboGetPackages.Location = New System.Drawing.Point(17, 53) + Me.ucrComboGetPackages.Location = New System.Drawing.Point(115, 17) Me.ucrComboGetPackages.Margin = New System.Windows.Forms.Padding(14) Me.ucrComboGetPackages.Name = "ucrComboGetPackages" Me.ucrComboGetPackages.Size = New System.Drawing.Size(206, 32) @@ -592,6 +600,53 @@ Partial Class dlgScript Me.ucrInputPreviewLibrary.Size = New System.Drawing.Size(548, 90) Me.ucrInputPreviewLibrary.TabIndex = 47 ' + 'ucrPnlExample + ' + Me.ucrPnlExample.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink + Me.ucrPnlExample.Location = New System.Drawing.Point(21, 52) + Me.ucrPnlExample.Margin = New System.Windows.Forms.Padding(9) + Me.ucrPnlExample.Name = "ucrPnlExample" + Me.ucrPnlExample.Size = New System.Drawing.Size(598, 30) + Me.ucrPnlExample.TabIndex = 48 + ' + 'rdoData + ' + Me.rdoData.AutoSize = True + Me.rdoData.ImeMode = System.Windows.Forms.ImeMode.NoControl + Me.rdoData.Location = New System.Drawing.Point(41, 55) + Me.rdoData.Margin = New System.Windows.Forms.Padding(4) + Me.rdoData.Name = "rdoData" + Me.rdoData.Size = New System.Drawing.Size(69, 24) + Me.rdoData.TabIndex = 49 + Me.rdoData.TabStop = True + Me.rdoData.Text = "Data" + Me.rdoData.UseVisualStyleBackColor = True + ' + 'rdoFunction + ' + Me.rdoFunction.AutoSize = True + Me.rdoFunction.ImeMode = System.Windows.Forms.ImeMode.NoControl + Me.rdoFunction.Location = New System.Drawing.Point(221, 55) + Me.rdoFunction.Margin = New System.Windows.Forms.Padding(4) + Me.rdoFunction.Name = "rdoFunction" + Me.rdoFunction.Size = New System.Drawing.Size(96, 24) + Me.rdoFunction.TabIndex = 50 + Me.rdoFunction.TabStop = True + Me.rdoFunction.Text = "Function" + Me.rdoFunction.UseVisualStyleBackColor = True + ' + 'ucrInputFunction + ' + Me.ucrInputFunction.AddQuotesIfUnrecognised = True + Me.ucrInputFunction.AutoSize = True + Me.ucrInputFunction.IsMultiline = False + Me.ucrInputFunction.IsReadOnly = False + Me.ucrInputFunction.Location = New System.Drawing.Point(342, 54) + Me.ucrInputFunction.Margin = New System.Windows.Forms.Padding(14) + Me.ucrInputFunction.Name = "ucrInputFunction" + Me.ucrInputFunction.Size = New System.Drawing.Size(234, 32) + Me.ucrInputFunction.TabIndex = 51 + ' 'dlgScript ' Me.AutoScaleDimensions = New System.Drawing.SizeF(144.0!, 144.0!) @@ -669,4 +724,8 @@ Partial Class dlgScript Friend WithEvents lstCollection As ListView Friend WithEvents clmDatasets As ColumnHeader Friend WithEvents clmDesc As ColumnHeader + Friend WithEvents ucrPnlExample As UcrPanel + Friend WithEvents ucrInputFunction As ucrInputTextBox + Friend WithEvents rdoFunction As RadioButton + Friend WithEvents rdoData As RadioButton End Class diff --git a/instat/dlgScript.vb b/instat/dlgScript.vb index 11c2091412d..85cd0a7cf6d 100644 --- a/instat/dlgScript.vb +++ b/instat/dlgScript.vb @@ -52,6 +52,11 @@ Public Class dlgScript ucrPnlGetData.AddRadioButton(rdoGetColumn) ucrPnlGetData.AddRadioButton(rdoGetObject) + ucrPnlExample.AddRadioButton(rdoData) + ucrPnlExample.AddRadioButton(rdoFunction) + + ucrPnlExample.AddToLinkedControls(ucrInputFunction, {rdoFunction}, bNewLinkedHideIfParameterMissing:=True) + 'todo. this combobox can be a custom package control in future. Its also needed in dlgHelpVignettes ucrComboGetPackage.SetParameter(New RParameter("package", 0)) ucrComboGetPackage.SetItems(GetPackages(), bAddConditions:=True) @@ -147,6 +152,7 @@ Public Class dlgScript 'get controls reset rdoGetDataFrame.Checked = True + rdoData.Checked = True ucrComboGetPackage.Reset() ucrComboGetPackages.Reset() ucrDataFrameGet.Reset() @@ -274,9 +280,13 @@ Public Class dlgScript End Function Private Sub lstCollection_SelectedIndexChanged(sender As Object, e As EventArgs) Handles lstCollection.SelectedIndexChanged + Dim strTopic = lstCollection.SelectedItems(0).SubItems(0).Text + GetExample(strTopic) + End Sub + + Private Sub GetExample(strTopic As String) Try - If lstCollection.SelectedItems.Count > 0 AndAlso TabControl1.SelectedTab Is TabPage6 Then - Dim strTopic = lstCollection.SelectedItems(0).SubItems(0).Text + If Not String.IsNullOrEmpty(strTopic) Then clsLibraryExpFunction.AddParameter("topic", Chr(34) & strTopic & Chr(34), iPosition:=0) If clsLibraryExpFunction IsNot Nothing Then Dim strExampe = frmMain.clsRLink.RunInternalScriptGetValue(clsLibraryExpFunction.ToScript(), bSilent:=True).AsCharacter(0) @@ -379,6 +389,16 @@ Public Class dlgScript SetPreviewScript(clsImportNewDataFrame, strData) End Sub + Private Sub ucrPnlExample_ControlValueChanged(ucrChangedControl As ucrCore) Handles ucrPnlExample.ControlContentsChanged, ucrInputFunction.ControlContentsChanged + If rdoData.Checked Then + lstCollection.Visible = True + Else + lstCollection.Visible = False + Dim strTopic = ucrInputFunction.GetText + GetExample(strTopic) + End If + End Sub + Private Sub ucrComboGetPackages_ControlValueChanged(ucrChangedControl As ucrCore) Handles ucrComboGetPackages.ControlValueChanged If strSelectedPackage <> ucrComboGetPackages.GetText() Then strSelectedPackage = ucrComboGetPackages.GetText()