Can't use VistaMenu in Application Context

Hi there,I'm not being able to use your VistaMenu control in my application...

Basically I have a ContextMenu associated to a NotifyIcon. However, this NotifyIcon is not associated to a Form but to an ApplicationContext instead.

I tried to do:InstantUpdate.Controls.VistaMenu v = new InstantUpdate.Controls.VistaMenu(this);

But I get this error:Error 1 The best overloaded method match for 'InstantUpdate.Controls.VistaMenu.VistaMenu(System.Windows.Forms.ContainerControl)' has some invalid arguments C:\Users\Nazgulled\Documents\Visual Studio 2008\Projects\FireNotes\AppContext.cs 34 50 FireNotesError 2 Argument '1': cannot convert from 'FireNotes.AppContext' to 'System.Windows.Forms.ContainerControl' C:\Users\Nazgulled\Documents\Visual Studio 2008\Projects\FireNotes\AppContext.cs 34 87 FireNotes

AppContext is a class that inherits from ApplicationContext.

Any suggestions?

Is there any chance I could see your source code? I know where the bug is coming from, I just need some context to know how you're using the menu.

Could you upload (or [email=support@wyday.com]e-mail me[/email]) a zip/rar of your project (or perhaps a simplified version of what you're doing if you don't want me to see your full source).

Ok, I've uploaded a fixed version of VistaMenu. I've included a new demo project that uses NotifyIcon. This is all you need to do:

VistaMenu vistaMenu = new VistaMenu();


//Setup the VistaMenuvistaMenu.SetImage(mnuSettings, Properties.Resources.Settings);vistaMenu.SetImage(mnuAbout, Properties.Resources.About);


//EndInit() is called by the designer on forms, but since this//is an ApplicationContext you need to call it manually((System.ComponentModel.ISupportInitialize)(vistaMenu)).EndInit();

This was a good bug find, thanks.

-Wyatt

I don't know what does that EndInit do, but I don't like it lol...

Isn't there a way to avoid it, to code VistaMenu without needing to do that? Or at least, avoid using it explicitly/manually by our code (in this context) and instead, implement it inside the VistaMenu class somehow?

If not, it's ok...

Thanks for the update 😉

I don't know what does that EndInit do, but I don't like it lol...

Isn't there a way to avoid it, to code VistaMenu without needing to do that? Or at least, avoid using it explicitly/manually by our code (in this context) and instead, implement it inside the VistaMenu class somehow?

If not, it's ok...

Thanks for the update 😉

It's not a very pretty line of code, I agree, but it's necessary. I could remove the EndInit call, but in doing so I would increase the startup time for the VistaMenu along with making it unusable as a Form component. Two unfavorable side-effects I would think.

Ok then, if it's needed, it's needed...