How to minimize Eto SemiModalForm: Solved

@clement, @dale, @pascal, @brian, @nathanletwory, @Helvetosaur,

I create an Eto SemiModalForm using:

args = TrimMeshArgs()
dlg = TrimMeshDialog(args)
result = UI.EtoExtensions.ShowSemiModal(dlg, RhinoDoc.ActiveDoc, UI.RhinoEtoApp.MainWindow)
dlg.BringToFront()

Inside the TrimMeshDialog I make a call to an external procedure that trims a mesh:

# Trim button click handler.
def OnTrimButtonClick(self, sender, e):
    trim_mesh(simple_trim, make_hole, make_trench)

I would like to minimize the Eto form before calling the trim_mesh procedure so that the Rhino window is clear of obstructions for selecting the area to be trimmed. So I want something like this:

 # Trim button click handler.
def OnTrimButtonClick(self, sender, e):
    self.form.Window.Minimize()
    trim_mesh(simple_trim, make_hole, make_trench)
    self.form.Window.Maximize()

I have done this with .NET windows but I am failing here. The error I am getting is:

Message: 'TrimMeshDialog' object has no attribute 'form'

but I have not figured out what to use instead of self.form.

Any help on this would be greatly appreciated.

Regards,
Terry.

I found the answer by using the Python Debugger. Looking at dlg created from:

dlg = TrimMeshDialog(args)

I found that it has a WindowState set to Normal. So I added to my module declarations:

from Eto.Forms import WindowState

and then I can use:

# Trim button click handler.
def OnTrimButtonClick(self, sender, e):
    self.WindowState = WindowState.Minimized
    trim_mesh(simple_trim, make_hole, make_trench)
    self.WindowState = WindowState.Normal

Works perfectly. For those interested here are the details of the Eto Dialog shown in the Debugger:

Regards,
Terry.

3 Likes