[Mono-winforms-list] Application.Run() and ContextStripMenu

Jonathan Pobst monkey at jpobst.com
Mon Jan 21 21:40:55 EST 2008


Hey!

This has been fixed in SVN as of Dec 16th.  You can build from SVN, grab 
an updated System.Windows.Forms.dll out of the monocharge: 
http://mono.ximian.com/daily/, or wait for 1.2.7.

Thanks!
Jonathan


AutoLyrix (NoWayX) wrote:
> Hello everyone,
> 
> I have an application that does not contain a form. It has a notifyicon only.
> So, I have to run my app using Application.Run() and not Application.Run(FORM)
> 
> If my notifyIcon has a contextmenustrip I get an exception:
> Unhandled Exception: System.NullReferenceException: Object reference
> not set to an instance of an object at
> System.Windows.Forms.ToolStripDropDown.OnHandleCreated
> (System.EventArgs)
> 
> The line that raise the exception inside ToolStripDropDown.cs is (line 564)
>                XplatUI.SetOwner (this.Handle,
> Application.MWFThread.Current.Context.MainForm.Handle);
> 
> 
> I attached one example that generates the exception. Compile it with
> -res:test.ico,test.Resources.test.ico (copy the test.ico from
> somewhere), so it has an icon.
> If you change the class Controller to inherit from the class Form and
> call Application.Run(controller) it works just fine.... (but of
> course, it shows a form!)
> 
> But I dont want to create a form... does anyone know how to fix this?
> Does anyone have suggestions?
> 
> Thanks,
> Alex
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> Mono-winforms-list maillist  -  Mono-winforms-list at lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/mono-winforms-list



More information about the Mono-winforms-list mailing list