After updating to the Rhino 6 SR 13 canidate release, my eto form component is throwing an error “1. Solution exception:Multiple targets could match: ShowModal(Control), ShowModal(Control)”
I’m still trying to get the hang of using these forms but I’m just following the template code for making forms using eto.
I have tested on a computer running SR12 and it still works fine.
Perhaps it is an issue only on the python side? Or it could be my machine.
Can you try this sample code in a python component in grasshopper? Sorry, I’m not very familer with how to paste code into the correct formating on the page. this is from The Eto framework
import scriptcontext
import System
import Rhino.UI
import Eto.Drawing as drawing
import Eto.Forms as forms
class SampleEtoRoomNumberDialog(forms.Dialog[bool]):
def __init__(self):
# Initialize dialog box
self.Title = 'Sample Eto: Room Number'
self.Padding = drawing.Padding(10)
self.Resizable = False
# Create controls for the dialog
self.m_label = forms.Label(Text = 'Enter the Room Number:')
self.m_textbox = forms.TextBox(Text = None)
# Create the default button
self.DefaultButton = forms.Button(Text = 'OK')
self.DefaultButton.Click += self.OnOKButtonClick
# Create the abort button
self.AbortButton = forms.Button(Text = 'Cancel')
self.AbortButton.Click += self.OnCloseButtonClick
# Create a table layout and add all the controls
layout = forms.DynamicLayout()
layout.Spacing = drawing.Size(5, 5)
layout.AddRow(self.m_label, self.m_textbox)
layout.AddRow(None) # spacer
layout.AddRow(self.DefaultButton, self.AbortButton)
# Set the dialog content
self.Content = layout
# Start of the class functions
# Get the value of the textbox
def GetText(self):
return self.m_textbox.Text
# Close button click handler
def OnCloseButtonClick(self, sender, e):
self.m_textbox.Text = ""
self.Close(False)
# OK button click handler
def OnOKButtonClick(self, sender, e):
if self.m_textbox.Text == "":
self.Close(False)
else:
self.Close(True)
## End of Dialog Class ##
def RequestRoomNumber():
dialog = SampleEtoRoomNumberDialog();
rc = dialog.ShowModal(Rhino.UI.RhinoEtoApp.MainWindow)
if (rc):
print dialog.GetText() #Print the Room Number from the dialog control
RequestRoomNumber()