The following code seems to work fine, except that it does not commit changes to the custom component when I click apply (dialogue.ok).
What is happening is, when I input data into the Windows Form, the data seems to be stored in the "Set Data" field of the component pull down menu. Data does not appear as a locally defined value until I select 'Commit Changes'.
Is it possible to eliminate this 'Commit Changes' step?
Public Sub ShowForm()
Dim param As Param_Number = DirectCast(Params.Input(1), Param_Number)
Dim value As Double = 0.0
If (param.PersistentDataCount > 0) Then
value = param.PersistentData.FirstItem(True).Value
End If
Dim myForm As New Form1
myForm.TextBox1.Text = value.ToString()
If (myForm.ShowDialog() = DialogResult.OK) Then
If (GH_Convert.ToDouble(myForm.TextBox1.Text, value, GH_Conversion.Both)) Then
RecordUndoEvent("Focal Point Horiz Dist")
param.PersistentData.Clear()
param.PersistentData.Append(New GH_Number(value))
ExpireSolution(True)
End If
End If
End Sub
Public Overrides Sub AppendAdditionalMenuItems(menu As Windows.Forms.ToolStripDropDown)
MyBase.AppendAdditionalMenuItems(menu)
Menu_AppendGenericMenuItem(menu, "Tiered Seating Settings", AddressOf Menu_MyCustomItemClicked)
End Sub
Private Sub Menu_MyCustomItemClicked(ByVal sender As Object, ByVal e As EventArgs)
ShowForm()
End Sub
Tags:
- Attachments:
-